[Numpy-discussion] Special matrices with structure?
Thu Mar 1 04:23:13 CST 2012
On 02/23/2012 03:50 PM, Jaakko Luttinen wrote:
> I was wondering whether it would be easy/possible/reasonable to have
> classes for arrays that have special structure in order to use less
> memory and speed up some computations?
> For instance:
> - symmetric matrix could be stored in almost half the memory required by
> a non-symmetric matrix
> - diagonal matrix only needs to store the diagonal vector
> - Toeplitz matrix only needs to store one or two vectors
> - sparse matrix only needs to store non-zero elements (some
> implementations in scipy.sparse)
> - and so on
Note to self: BLAS has lots of functions for matrices having special
structure (symmetric, triangular, banded, ...), so I suppose it would
"only" require some Python class wrappers which are compatible with
ndarray/matrix. But I don't know how to make these classes compatible
with generic numpy functions such as numpy.multiply/numpy.dot/etc..
> If such classes were implemented, it would be nice if they worked with
> numpy functions (dot, diag, ...) and operations (+, *, +=, ...) easily.
> I believe this has been discussed before but google didn't help a lot..
> NumPy-Discussion mailing list
More information about the NumPy-Discussion