[Numpy-discussion] Large symmetrical matrix

Robert Kern robert.kern at gmail.com
Tue Jun 10 20:05:20 EDT 2008


On Tue, Jun 10, 2008 at 18:53, Simon Palmer <simon.palmer at gmail.com> wrote:
> 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?

What operations do you want to perform on this array?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list