Re: Creating a symmetric matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg46870] Re: Creating a symmetric matrix
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 12 Mar 2004 02:21:50 -0500 (EST)
- Organization: The University of Western Australia
- References: <c2p9ld$dns$1@smc.vnet.net> <c2rne4$p04$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <c2rne4$p04$1 at smc.vnet.net>, Jens-Peer Kuska <kuska at informatik.uni-leipzig.de> wrote: > ll = PadRight[#, 4, 0] & /@ Table[a[j, i], {j, 1, 4}, {i, 1, j}]; > ll = ll + MapIndexed[If[Equal @@ #2, 0, #1] & , Transpose[ll], {2}] How about ll = PadRight[#, 4, 0] & /@ Table[a[j, i], {j, 1, 4}, {i, 1, j}]; ll + Transpose[ll] - DiagonalMatrix[Tr[ll, List]] instead? Cheers, Paul > Regards > Jens > > Mark Coleman wrote: > > > > Greetings, > > > > How can I efficiently build a symmetric matrix from an upper triangular > > one, i.e., extract the upper triangular elements and insert them into > > the lower triangle in such a way as to make the resulting square matrix > > symmetric? > > > > Thanks, > > > > Mark > -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul