1

I am trying to create a sparse matrix by the SparseArray command. For a set of index pairs $(i,j)$ I want to calculate the $A_{i,j}$ element and then use this table to create the rules for the sparse array. However, using the Table command to generate the elements crashes my kernel. For example, the code to randomly create 6969 elements of a 640x640 matrix:

rules = Table[{RandomInteger[{1, 640}], RandomInteger[{1, 640}]} -> 
    RandomReal[], {i, 1, 6969}];

causes my kernel to crash. If I generate 6960 such rules, it doesn't crash.

I have not yet evaluated these to create a matrix, so I must be doing something wrong in creating the list. How can I do so correctly?

Update: working on a Mac Pro (late 2013) 12-core Intel Xeon E5 with 64 GB of memory. Mac OS X 10.14.6. Running Mathematica 12.0.0.0.

Update 2: Executing the Table command above inside the SparseArray command does not cause a kernel crash. It's something wonky with how my machine and Mathematica handles Table.

Kieran Mullen
  • 243
  • 1
  • 7

1 Answers1

1

Error fixed in later version of Mathematica

Given that others could not reproduce the error, it made sense that the problem was either in the version of Mathematica I was using or some very odd bug in my own computer. (Thank you to all who tried to reproduce the error.)

Updating from 12.0 to 12.3 fixed the problem.

It took a while to track down because it seemed like I had done something wrong with the sparse matrix commands, but it was simply some weird bug in Table in my version of the application!

Kieran Mullen
  • 243
  • 1
  • 7