Re: [Numpy-discussion] Sparse matrices in NumPy?

But memory is so cheap these days! ;-) I am a grad student, and have no money. :(
-- That which does not kill you, didn't try hard enough.

Paul Gettings writes:
Still it's not so bad, you just need to break the 7731x220 matrix into 220 vectors of length 7731 and multiply each of them by the diagonal "matrix", one at a time, and glue the results back together. The 7731x220 matrix should weigh in at about 6MB, hopefully you have enough memory for this...

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:

Paul Gettings writes:
Still it's not so bad, you just need to break the 7731x220 matrix into 220 vectors of length 7731 and multiply each of them by the diagonal "matrix", one at a time, and glue the results back together. The 7731x220 matrix should weigh in at about 6MB, hopefully you have enough memory for this...

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:
participants (3)
-
Charles G Waldman
-
Jon Saenz
-
Paul Gettings