I have the following code in mathematica which runs perfectly for a small matrix of 21 x 12 matrix. But I really want to test it for a large system. My data is 35844 x 21000 elements, totaling 1.5 GB. And it fails to import it.


Matrix = Import["D:\\A.txt", "Data"];

MatrixTranspose = Transpose[Matrix];


Export["D:\\result.txt", %]

Is there any method to let it run?

Many thanks,


  • $\begingroup$ Computing the null space is expensive, are you sure your computer's specs are able to deal with your large matrix? $\endgroup$ Jan 31, 2021 at 4:17
  • $\begingroup$ Try monitoring the memory usage while importing the file. 1.5 GB on disk does not necessarily mean 1.5 GB in memory. See if the computer is running out of memory, that could be what's causing this. $\endgroup$
    – C. E.
    Jan 31, 2021 at 14:01
  • $\begingroup$ Depending on the specifics of the matrix, this prior MSE thread might be of use. $\endgroup$ Jan 31, 2021 at 16:16
  • 2
    $\begingroup$ Regarding import, check this old Q/A. In particular, if your matrix is sparse enough, the readSparseTable function from my answer there. It won't be very fast with such size of the matrix, but at least it may very considerably lower the memory usage and make the import feasible. $\endgroup$ Jan 31, 2021 at 16:48


Your Answer

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

Browse other questions tagged or ask your own question.