Numpy ‘smart’ symmetric matrix

Posted by Debilski on Stack Overflow See other posts from Stack Overflow or by Debilski
Published on 2010-04-03T22:39:56Z Indexed on 2010/04/03 22:43 UTC
Read the original article Hit count: 455

Filed under:
|
|

Is there a smart and space-efficient symmetric matrix in numpy which automatically fills [j][i] when [i][j] is written to?

a = numpy.symmetric((3, 3))
a[0][1] = 1
print a
# [[0 1 0], [1 0 0], [0 0 0]]

An automatic Hermitian would also be nice, although I won’t need that at the time of writing.

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy