Hi,

I noticed that if I am solving a vector equation, running sweep() instead
of solve() raises an error from the pysparseMatrix class's multiplication
method. I looked deeper into the error and found that the problem was that
a square matrix and a vector, both with the same number of total elements,
were being multiplied together, but failing because their sizes were
mismatched. The patch contains 5 lines that add a simple conditional, to
check if the square matrix and the vector have the same number of elements,
in which case I use ravel() on the square matrix (which expands the matrix
into a vector).

Using the ravel() method requires assuming that matrix-vector conversions
using C (row-major) order are correct. I verified this was the case using a
very simple problem. Any thoughts on whether this is a safe assumption
generally?

I've attached a patch file, which can be applied from in the fipy/ source
directory:

cd fipy/
patch -p1 < pysparseMatrix.patch


Charles

Attachment: pysparseMatrix.patch
Description: Binary data

_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to