[Numpy-discussion] Matrix Class [was numpy release]

Alan G Isaac aisaac at american.edu
Tue Apr 29 01:04:27 EDT 2008


On Mon, 28 Apr 2008, Bill Spotz apparently wrote:
> If matrix multiplication in my example is replaced with 
> np.dot() in yours, then when IS anything gained by using 
> matrices? 

When matrix algebra is clearer than array algebra.
But that is not the case for this algorithm.
(Just the opposite, I would say.)

Simple example: (X.T * X).I * (X.T * Y)
(Not that this is computationally nice ...)



> As for this example, my version should work with a properly 
> implemented sparse_matrix A, but the array approach precludes that. 
> That is to say, I could convert A to a matrix if it is provided as an 
> array, but you could not convert a sparse_matrix to an array. 

A.todense().A?
(I don't think you can save on memory use without
substantial changes...)

In an earlier discussion, I suggested that if iteration
over matrices were to yield 1d arrays, then iteration
over sparse matrices should yield 1d "sparse arrays".

Cheers,
Alan





More information about the NumPy-Discussion mailing list