[Numpy-discussion] Sparse matrices in NumPy?
Jon Saenz
jsaenz at wm.lc.ehu.es
Mon Jun 5 12:22:52 CDT 2000
I don't know if I am missing something, but:
Let's suppose you have A so that A.shape is (7731,). It is diagonal, so,
obviously, you don't need to save it all. Just a vector.
You also have B, shaped like this: (7731,220)
And you want to multiply A*B (the matrix way).
I would dare to say that what you really need is
C=A[:,NewAxis]*B
C will be shaped as (7731,220), which is what you probably need.
Jon Saenz. | Tfno: +34 946012470
Depto. Fisica Aplicada II | Fax: +34 944648500
Facultad de Ciencias. \\ Universidad del Pais Vasco \\
Apdo. 644 \\ 48080 - Bilbao \\ SPAIN
On Mon, 5 Jun 2000, Paul Gettings wrote:
> > But memory is so cheap these days! ;-)
> I am a grad student, and have no money. :(
>
> > > However, the matrix is empty except for the main diagonal.
> > Multiplying by a diagonalized matrix is just vectorized multiplication:
> > a 0 0
> > 0 b 0 . <x, y, z> = <az, by, cz>
> > 0 0 c
> My mistake - I need to multiply the 7731x7731 by a 7731x220 element matrix -
> square matrix times rectangular matrix, not just 2 diagonal matrices.
> Otherwise, the problem wouldn't be so hard. :)
>
> --
> That which does not kill you, didn't try hard enough.
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> http://lists.sourceforge.net/mailman/listinfo/numpy-discussion
>
More information about the Numpy-discussion
mailing list