[SciPy-Dev] Sparse Matrix Prototype

Daniel Smith smith.daniel.br at gmail.com
Tue Mar 5 08:57:01 EST 2013


Hi,

I've been working on adding fancy indexing to the LIL sparse matrix
class and have run into a problem. Judging from the tests, no decision
has been made as to what NumPy structure the class should replicate.
In particular, some of the tests assume ndarray behavior, and others
assume matrix behavior. The biggest difference is in row/column vector
behavior. Take for example:

A = np.zeros((5, 5))
B = np.matrix(A)

A[:, 1]
    array([0, 0, 0, 0, 0])
B[:, 1]
    matrix([ [0], [0], [0], [0], [0] ])

Since NumPy is encouraging people to use ndarrays over matrices, it
might make sense to reproduce the ndarray behavior. However, since the
class has other matrix-specific behavior, e.g. being only
two-dimensional, it might be confusing to have the class behave like
an ndarray in other ways. Until a decision is made, no version of the
class will pass all the tests as currently written. Any input would be
greatly appreciated.

Thanks,
Daniel



More information about the SciPy-Dev mailing list