Hi, On Mon, Feb 10, 2014 at 2:11 PM, Pauli Virtanen <p...@iki.fi> wrote: > 10.02.2014 23:40, Alan G Isaac kirjoitti: >> On 2/10/2014 4:28 PM, Pauli Virtanen wrote: >>> Starting with asarray won't work: sparse matrices are not >>> subclasses of ndarray. >> >> I was focused on the `matrix` object. For this object, an initial >> asarray is all it takes to use array code. (Or ... not?) And it is >> a view, not a copy. >> >> I don't have the background to know how scipy ended up with a >> sparse matrix object instead of a sparse array object. In any case, >> it seems like a different question. > > I think this is very relevant question, and I believe one of the main > motivations for the continuous reappearance of this discussion. > > The existence of np.matrix messes up the general agreement on ndarray > semantics in Python. The meaning of very basic code such as > > A * B > A.sum(0) > A[0] > > where A and B are NxN matrices of some sort now depends on the types > of A and B. This makes writing duck typed code impossible when both > semantics are in play.
That is a very convincing argument. What would be the problems (apart from code compatibility) in making scipy.sparse use the ndarray semantics? Thanks, Matthew _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion