#13 update_add_mask transposes indices

v1.0 (example)
open
nobody
None
5
2014-03-14
2014-03-14
Tony McDaniel
No

I'm using spmatrix.ll_mat in a finite volume CFD code for assembly of the Jacobian matrix. As a test, I ran the following:
from pysparse import spmatrix
A = spmatrix.ll_mat(4,4)
B = np.array([[ 1.,2.],[3.,4.]])
A.update_add_mask(B,[0,1],[0,1],[1,1],[1,1])
print A
ll_mat(general, [4,4]):
1.000000 3.000000 -------- --------
2.000000 4.000000 -------- --------



However, if I loop over the arrays as described in the docs:
for i in range(2):
for j in range(2):
A[i,j] += B[i,j]
print A
ll_mat(general, [4,4]):
1.000000 2.000000 -------- --------
3.000000 4.000000 -------- --------



I have looked at the code in ll_mat.c, but the source of the problem isn't obvious to me.

Discussion