MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Creating a symmetric matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46961] Re: Creating a symmetric matrix
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Thu, 18 Mar 2004 01:24:44 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <c2p9ld$dns$1@smc.vnet.net> <200403130440.XAA15145@smc.vnet.net> <A8166766-7689-11D8-A63D-0003938BF55C@jeol.com> <c36baq$s26$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <c36baq$s26$1 at smc.vnet.net>, DrBob <drbob at bigfoot.com> 
wrote:

> Building a matrix that large (2000x2000), when half the information is 
> redundant, is probably a bad idea in the first place; and that applies to 
> the upper-triangular matrix you're taking it from as well.
> 
> Instead, you should write code that uses the necessary information more 
> efficiently.
> 
> SparseArray also may be of help.

Perhaps something like

  Flatten[Table[{i,j} -> a[i,j],{j, 1, 4}, {i, 1, j}]];

  % /. ({i_, j_} -> a_) :> {j, i} -> a;

  Normal[SparseArray[Join[%, %%]]]

Cheers,
Paul

-- 
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


  • Prev by Date: Re: Exact real solutions of cubic equations
  • Next by Date: Antw: Binary File Read in Mathematica 5 for Mac OSX
  • Previous by thread: Re: Re: Creating a symmetric matrix
  • Next by thread: Re: Creating a symmetric matrix