MathGroup Archive 2004

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

Search the Archive

Re: Re: Creating a symmetric matrix

  • To: mathgroup at
  • Subject: [mg46925] Re: [mg46889] Re: Creating a symmetric matrix
  • From: "Sseziwa Mukasa,,(978) 536-2359" <mukasa at>
  • Date: Tue, 16 Mar 2004 02:37:31 -0500 (EST)
  • References: <c2p9ld$dns$> <> <> <>
  • Sender: owner-wri-mathgroup at

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 

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?



  • Prev by Date: Re: solving for variable and then get these e's..?
  • Next by Date: Re: Re: Excessive Mathematica memory use, revisited.
  • Previous by thread: Re: Re: Creating a symmetric matrix
  • Next by thread: Re: Creating a symmetric matrix