Re: Re: Creating a symmetric matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg46925] Re: [mg46889] Re: Creating a symmetric matrix
- From: "Sseziwa Mukasa,,(978) 536-2359" <mukasa at jeol.com>
- Date: Tue, 16 Mar 2004 02:37:31 -0500 (EST)
- References: <c2p9ld$dns$1@smc.vnet.net> <200403130440.XAA15145@smc.vnet.net> <A8166766-7689-11D8-A63D-0003938BF55C@jeol.com> <opr4w22tniiz9bcq@smtp.cox-internet.com>
- Sender: owner-wri-mathgroup at wolfram.com
On Mar 15, 2004, at 2:00 PM, DrBob wrote:
> I didn't expect it to be the fastest method... it may use a lot less
> memory, but that's a temporary advantage.
Sorry, I didn't mean to offend. Hopefully you ran across my previous
post comparing a variety of solutions, I merely wanted to report how
that approach compared to those tested earlier.
Since I've seen more than a few messages on this list about handling
large matrices I thought I'd compare solutions that ignored memory use
and those that tried to be efficient in space used. Since there are a
wide variety of approaches to this problem in Mathematica I thought it
would be useful to compare them on the basis of space and time
efficiency.
Incidentally, without access to the Mathematica internals, it's
impossible to know if the expression
a+Transpose[a]-DiagonalMatrix[Tr[a, List]] really takes three times as
much memory as Array[a[[Min[#1, #2], Max[#1, #2]]] &, {Length@a,
Length@a}]. It's entirely possible the interpreter is smart enough to
know the storage of the temporary values is equivalent to the storage
of the result and the result can be computed in place. So really it's
the difference between solutions that explicitly try to be space
efficient and those that don't.
> Building a matrix that large (2000x2000), when half the information is
> redundant, is probably a bad idea in the first place;
I won't argue with that.
> Instead, you should write code that uses the necessary information
> more efficiently.
>
> SparseArray also may be of help.
See my earlier post.
Ultimately the answer to the question of efficiency is, where did this
array come from and what was Marc going to do with it?
Regards,
Ssezi
- References:
- Re: Creating a symmetric matrix
- From: drbob@bigfoot.com (Bobby R. Treat)
- Re: Creating a symmetric matrix