yig / PySPQR

Python wrapper for the sparse QR decomposition in SuiteSparseQR.
Creative Commons Zero v1.0 Universal
34 stars 28 forks source link

usage example not working #4

Closed johann50 closed 7 years ago

johann50 commented 7 years ago

FIrst of all, thanks for your work. This code will be very useful to people doing sparse least squares. I installed the code fine but got the following fixes and problems for the 'Usage' code that is on the github webpage. I am running python3.4, scipy 0.19, numpy-1.13, cffi-1.10, linux-3.19

PROBLEM 1. Got the error message: result = scipy.sparse.linalg.spsolve(R, Qb) AttributeError: 'module' object has no attribute 'linalg'

This was fixed by adding the import: import scipy.sparse.linalg

PROBLEM 2 "CHOLMOD error: A and B must have the same # of rows" from the following line: x = spqr.qr_solve( A, b, tolerance = 0 ) I fixed this problem by changing the dimension of b from 10 to 20. Had to reset this to the original dimension of 10 afterwards in order to avoid another error message in the subsequent code.

PROBLEM 3 But now I get the error message: "MatrixRankWarning: Matrix is exactly singular" from the line: scipy.sparse.linalg.spsolve(R, Qb)

yig commented 7 years ago

Thank you for pointing this out. I fixed the usage examples.

johann50 commented 7 years ago

PROBLEM 3 is not resolved.

johann50 commented 7 years ago

Sorry. Its OK now. Thanks.