
I have a problem where I need to do matrix multiplication of a 7731x7731 matrix; storing this thing would take over 250 MB of memory, which is more than my machine has. :( However, the matrix is empty except for the main diagonal. Ideally, all that needs to be stored is a single vector 7731 elements long, and then tweak matrix multiplication algorithms to account for this. Are there any facilities in NumPy to do this sort of thing, or do I have to roll my own? Is there a way to effeciently store a very sparse matrix and do standard matrix multiplies? Thanks. -Paul Gettings Dep't of Geology & Geophysics University of Utah -- But Your Honor, they needed killin'.

Unless I am misunderstanding something, you have a vector, which is the diagonal of a square matrix, and thus contains 7731 elements. You want to multiply it by another vector, which has 7731 columns. Element by element by element multiplication will, I think, give you the result that you want. In matlab you would use the diag command and then use the .* operator to get element by element multiplication. In NumPY you would simply use the * operator to multiply the two vectors. Travis Oliphant has sparse matrix classes that you might want to check out, but I don't see why you would need them for this task. HLR ----- Original Message ----- From: "Paul Gettings" <gettings@mines.utah.edu> To: <numpy-discussion@lists.sourceforge.net> Sent: Monday, June 05, 2000 6:49 AM Subject: [Numpy-discussion] Sparse matrices in NumPy?

Unless I am misunderstanding something, you have a vector, which is the diagonal of a square matrix, and thus contains 7731 elements. You want to multiply it by another vector, which has 7731 columns. Element by element by element multiplication will, I think, give you the result that you want. In matlab you would use the diag command and then use the .* operator to get element by element multiplication. In NumPY you would simply use the * operator to multiply the two vectors. Travis Oliphant has sparse matrix classes that you might want to check out, but I don't see why you would need them for this task. HLR ----- Original Message ----- From: "Paul Gettings" <gettings@mines.utah.edu> To: <numpy-discussion@lists.sourceforge.net> Sent: Monday, June 05, 2000 6:49 AM Subject: [Numpy-discussion] Sparse matrices in NumPy?
participants (2)
-
Herbert L. Roitblat
-
Paul Gettings