Re: Re: Creating a symmetric matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg46920] Re: [mg46889] Re: Creating a symmetric matrix
- From: DrBob <drbob at bigfoot.com>
- Date: Tue, 16 Mar 2004 02:37:24 -0500 (EST)
- References: <c2p9ld$dns$1@smc.vnet.net> <200403130440.XAA15145@smc.vnet.net> <A8166766-7689-11D8-A63D-0003938BF55C@jeol.com>
- Sender: owner-wri-mathgroup at wolfram.com
I didn't expect it to be the fastest method... it may use a lot less memory, but that's a temporary advantage. 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. Bobby On Mon, 15 Mar 2004 09:04:21 -0500, Sseziwa Mukasa,,(978) 536-2359 <mukasa at jeol.com> wrote: > > On Mar 12, 2004, at 11:40 PM, Bobby R. Treat wrote: > >> How's this? >> >> symmetric[a_?MatrixQ] := >> Array[a[[Min[#1, #2], Max[#1, #2]]] &, {Length@a, Length@a}] >> > > It avoids forming the transpose, but it's no faster than those solutions > on my machine, 60 seconds to process a 2000x2000 array. > > Regards, > > Ssezi > -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
- References:
- Re: Creating a symmetric matrix
- From: drbob@bigfoot.com (Bobby R. Treat)
- Re: Creating a symmetric matrix