17
$\begingroup$

Bug introduced in 10.1.0 and fixed in 10.3.0


I came across some strange behaviour during a computation involving matrices with symbolic values. It is reproduced below.

Multiplying a random 30x30 array with symbolic values with the identity matrix takes 4 seconds! Converting to a SparseArray seems to work, but I don't understand why it should since the matrix size is so small.

Mathematica Version is 10.1

aa = Table[RandomInteger[10] + Sqrt[RandomInteger[10]]/(1 + 
   Sqrt[RandomInteger[10]]), {30}, {30}];

IdentityMatrix[30].aa; // Timing

{3.95225, Null}

SparseArray[IdentityMatrix[30]].aa; // Timing

{0., Null}

$\endgroup$
  • $\begingroup$ This has to be a bug ... In 10.0 it is not slow but in 10.1 it is. I can reproduce it on OS X. Can you report it to WRI? $\endgroup$ – Szabolcs Jul 9 '15 at 15:21
  • 10
    $\begingroup$ already paying attention to it. I've passed it along to the appropriate tester, etc. $\endgroup$ – rcollyer Jul 9 '15 at 15:26
  • 7
    $\begingroup$ Quite relevant is this prior MSE post. It seems someone here (and I mean right here) did not know to leave well enough alone (smack smack). $\endgroup$ – Daniel Lichtblau Jul 9 '15 at 15:56
  • $\begingroup$ Thank you for reporting it. Makes the 3+ hours to narrow it down, worthwhile. $\endgroup$ – A. Roy Jul 9 '15 at 17:24
  • $\begingroup$ Bug is still present in version 10.2, Linux $\endgroup$ – A. Roy Aug 3 '15 at 15:52
3
$\begingroup$

This bug has been fixed as of Mathematica 10.3.

$Version

(* "10.3.0 for Mac OS X x86 (64-bit) (October 9, 2015)" *)

aa = Table[RandomInteger[10] + 
       Sqrt[RandomInteger[10]]/(1 + Sqrt[RandomInteger[10]]), {30}, {30}];

IdentityMatrix[30].aa; // Timing

(* {0.028025, Null} *)
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.