I am using parallel colt wherein I need to find the rank of a matrix. The API documentation says the following about the following about DoubleAlgebra#rank
:
rank(DoubleMatrix2D A)
Returns the effective numerical rank of matrix A, obtained from Singular Value Decomposition.
But when I use it in my code, I get an IllegalArgumentException at runtime:
Exception in thread "main" java.lang.IllegalArgumentException: Matrix must be dense
at cern.colt.matrix.tdouble.algo.DoubleProperty.checkDense(Unknown Source)
at cern.colt.matrix.tdouble.algo.decomposition.DenseDoubleSingularValueDecomposition.<init>(Unknown Source)
at cern.colt.matrix.tdouble.algo.DenseDoubleAlgebra.svd(Unknown Source)
at cern.colt.matrix.tdouble.algo.DenseDoubleAlgebra.rank(Unknown Source)
The API doesn't mention that a matrix needs to be dense. In my IDE (I use Intellij IDEA), when I ctrl+click the method name in my code, it goes to the source, which shows
public int rank(cern.colt.matrix.tdouble.DoubleMatrix2D doubleMatrix2D) { /* compiled code */ }
Bottomline, everywhere I see the requirement for a DoubleMatrix2D
object, not a DenseDoubleMatrix2D
object. Any idea why the runtime exception happens?