[Numpy-discussion] Large symmetrical matrix

Simon Palmer simon.palmer@gmail....
Tue Jun 10 18:53:54 CDT 2008


Hi I have a problem which involves the creation of a large square matrix
which is zero across its diagonal and symmetrical about the diagonal i.e.
m[i,j] = m[j,i] and m[i,i] = 0.  So, in fact, it is a large triangular
matrix.  I was wondering whether there is any way of easily handling a
matrix of this shape without either incurring a memory penalty or a whole
whack of proprietary code?

To get through this I have implemented a 1D array which has ((n-1)^2)/2
elements inside a wrapper class which manpulates the arguments of array
accessors with some arithmetic to return the approriate value.  To be honest
I'd love to throw this away, but I haven't yet come across a feasible
alternative.

Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080611/8d4b66ac/attachment.html 


More information about the Numpy-discussion mailing list