I have a sparse Matrix B and an array b (uploaded here), and am trying to do
import numpy as np
import config
from scipy.sparse.linalg import spsolve
from scipy.sparse import load_npz
from numpy.linalg import solve
B = load_npz('B.npz')
b = np.load('b.npy')
spsolve(B, b)
which leads to
corrupted size vs. prev_size
Process finished with exit code 134 (interrupted by signal 6:SIGABRT)
the same problem does not happen when I use numpy.linalg.solve:
B_dense = np.array(B.todense())
solve(B_dense, b)
Out[5]:
array([-299.77073372, -299.68350884, -299.59972996, ..., -286.52926438,
-286.50847706, -286.48927409])
So since numpy's version works, I suppose nothing is "wrong" with my matrices? Why does this occur? And since this crashes the code without a trace -- is there perhaps a way to "wrap" the error in an exception, to run solve whenever spsolve would lead to an issue?