2
$\begingroup$

I want to find the rank of a very sparse, quite rectangular matrix mat, but I'm running out of RAM (I have 16 GB) if I try to use MatrixRank or RowReduce. The particular matrix I am considering is 44216 by 5958 and its Tally is

Tally@Flatten@Normal@mat

{{1, 89348}, {0, 263290898}, {-1, 58682}}

I have also tried to produce the Gram matrix

gram = Transpose[mat].mat

since it has the same rank, but this matrix is obviously much less sparse. I also run out of RAM trying to do MatrixRank[gram].

Also, should one take different approaches if the rank can be assumed to be small, or on the other hand, large (almost full rank)?

$\endgroup$
9
  • $\begingroup$ Have you tried using SingularValueList[]? $\endgroup$ Commented Jul 7, 2015 at 14:09
  • $\begingroup$ The notes on internal implementations states that "PseudoInverse, NullSpace, and MatrixRank are based on SingularValueDecomposition." Doesn't that mean that I effectively have? :p I'll test it shortly. $\endgroup$ Commented Jul 7, 2015 at 14:14
  • $\begingroup$ Yes, but I wasn't asking you to compute the entire decomposition; just the singular values. :P $\endgroup$ Commented Jul 7, 2015 at 14:22
  • $\begingroup$ True ;) MemoryConstrained[si = SingularValueList[gram];, 10000000000] is running now (using mat didn't work as expected), and it doesn't seem to eat memory as quickly as MatrixRank. I'll post again when it completes/aborts. $\endgroup$ Commented Jul 7, 2015 at 14:27
  • 1
    $\begingroup$ Yes, something like that. What gets zeroed of course depends on the Tolerance setting. $\endgroup$ Commented Jul 8, 2015 at 5:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.