Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rank calculated incorrectly #34

Closed
nbeloglazov opened this issue Aug 6, 2013 · 0 comments
Closed

rank calculated incorrectly #34

nbeloglazov opened this issue Aug 6, 2013 · 0 comments

Comments

@nbeloglazov
Copy link
Contributor

Example:

(rank (matrix [[1 2 3] [1 2 3]])) 

Real rank is 1 (rows are linearly dependant). Function returns 2.
I think the problem with svd function. It's documentation says:

(svd A) computes the sparse singular value decomposition of A
  returning a map with keys {:values L :left U :right V} such that
  A = U (diag L) V. If (size A) is [n m] and the rank of A is
  k, we have the size of U as [n k], (diag L) as [k k],
  and (t V) as [k m].

But it's not true. In jblas size of L calculated as min(n, m), not as rank of a matrix. Check this: https://github.com/mikiobraun/jblas/blob/master/src/main/java/org/jblas/Singular.java#L26

I think correct solution is to calculate number of non zero elements of L.

Thanks to Kevin for bug: https://groups.google.com/forum/#!topic/incanter/eINeIuV2Ktw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant