Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Unexpected linalg.matrix_rank behavior #2718

amueller opened this Issue Nov 9, 2012 · 3 comments


None yet
3 participants

amueller commented Nov 9, 2012

I had a couple of unexpected results using matrix_rank. I'm on 1.6.1.
One was that removing a row from a matrix increased the rank, another was that adding a row to a matrix increased the rank by 2.
Also, these are not really reproducible and seem to be related to slicing.
I get something like:


I'm not sure where to go from here.
The matrix in this case has shape (80, 92) and three non-zero entries per row.

Is / was that a known issue that has been fixed in later version? Should I try master?
Any help would be appreciated.


pv commented Nov 9, 2012

It counts singular values larger than cutoff eps*max(svals). This may be sensitive to rounding error, which can depend on data alignment, hence the dependence on .copy(). You can maybe check what SVD gives you and see if that helps to explain things.

OTOH, the behavior was slightly tweaked in 78b7693, but I don't think this matters here.

amueller commented Nov 9, 2012

I thought it might be a precision issue. I started playing with the SVD, maybe it'll help. I thought it may just be a numerical issue but the dependence on copying and slicing was a bit irritating.

Thanks :)


seberg commented Dec 5, 2013

As noted, a precision issue of matrix_rank and not really a bug. I don't think there is any action possible here, so closing.

@seberg seberg closed this Dec 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment