BLAS error using scipy.sparse.linalg.spsolve on csr-format matrix #3312

Open
jimgaffney opened this Issue Feb 11, 2014 · 7 comments

Projects

None yet

4 participants

@jimgaffney

In the following test code, which I am running with ipython version 2.7.5 (Anaconda 1.8.0 (x86_64)| (default, Oct 24 2013, 07:02:20))

import scipy.sparse as sparse
import scipy.sparse.linalg as spla
import numpy as np

N = 1000

A = sparse.rand(N,N,density=0.01)
A = A.tocsr()

b = np.random.sample(N)

%timeit spla.spsolve(A,b)

I get the following error:

BLAS error: Parameter m passed to cblas_dgemv was -1, which is invalid.

This error only occurs for A in csr format; csc format works fine, as does coo (with some warnings reporting conversion to csc format)

@pv pv added this to the 0.14.0 milestone Feb 11, 2014
Owner
pv commented Feb 11, 2014

Verified. This fails already in Scipy 0.11.0, so it's not a new issue.

Interestingly, it seems to work also for CSR if the matrix A is nonsingular (the random matrices here are singular).

A SuperLU bug is possible here (we are at SuperLU 4.3, which is the latest upstream version).

This should be fixed before 0.14.0, as UMFPACK was dropped.

Contributor

Not sure if this helps, but I get a bunch of

 .
 .
 .
 ** On entry to DTRSV  parameter number  6 had an illegal value
 ** On entry to DGEMV  parameter number  2 had an illegal value
 ** On entry to DTRSV  parameter number  6 had an illegal value
 ** On entry to DGEMV  parameter number  2 had an illegal value
 .
 .
 .
Owner
pv commented Feb 21, 2014

Occurs also for CSC (superlu actually just does (A.T.solve(b.T)).T for CSR):

import scipy.sparse as sparse
import scipy.sparse.linalg as spla
import numpy as np
N = 20
np.random.seed(51)
A = sparse.rand(N,N,density=0.01, format="lil")
A = A.tocsc()
b = np.random.rand(N)
spla.spsolve(A, b)
Owner
pv commented Feb 22, 2014

We can bail out with an error rather than crash. That's implemented in gh-3373.

This looks like a superlu bug, and does not seem to be very easy to fix properly without knowing in detail what the code is trying to do.

Owner

gh-3373 is merged. Does this need a real fix for 0.14.0, or can that come later?

Owner
pv commented Feb 25, 2014

It needs a real fix, but not necessarily for 0.14.0.
I think this failure in SuperLU is triggered only for singular matrices, which lowers the priority. (We can live with an exception raised for singular matrices.)

@pv pv removed this from the 0.14.0 milestone Feb 27, 2014
Owner
pv commented Feb 27, 2014

Removing 0.14.0 milestone.
Fix would be nice, but this is not a release blocker.

@pv pv removed the prio-high label May 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment