3
$\begingroup$

Bug introduced in 7.0 or earlier and fixed in 9.0.1 or earlier


Why does the following simple code never come to an end (at least with version 8)

n = 5;
mat = SparseArray[{i_, i_} -> 1, {n, n}, -1/(n - 1)];
MatrixRank[mat]

when the following clearly doesn't cause any problem?

n = 5;
mat = Normal@SparseArray[{i_, i_} -> 1, {n, n}, -1/(n - 1)];
MatrixRank[mat]

The same issue appears to exist with Det instead of MatrixRank.

$\endgroup$
  • $\begingroup$ The problem does not seem to exist on newer versions, I'd suggest upgrading. $\endgroup$ – rcollyer Aug 5 '13 at 17:12
  • 1
    $\begingroup$ On V8.0.4 (Mac) it more or less immediately crashes the kernel. The problem seems to be mixing Integer and Rational -- obviously a bug. Here's a workaround: mat = SparseArray[{i_, i_} -> 1/2, {n, n}, -1/(2 (n - 1))]. Then MatrixRank[mat] and Det[mat] return values. You would have to multiply the determinant by 2^n, but it returns zero. $\endgroup$ – Michael E2 Aug 5 '13 at 18:20
  • $\begingroup$ The question code also crashes v7, and the workaround from @Michael works there too. $\endgroup$ – Mr.Wizard Aug 5 '13 at 20:04
  • $\begingroup$ @MichaelE2 Are you able to check this in version 9? $\endgroup$ – Mr.Wizard Jul 30 '15 at 0:07
  • $\begingroup$ @Mr.Wizard It's fixed in V9.0.1. I'll update the notice. Can't check 9.0.0. $\endgroup$ – Michael E2 Jul 30 '15 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.