Maximum matrix size


(Ducloyer) #1

Hello
I’m trying to use MathNet.Numerics.LinearAlgebra to post-treate results of big mechanical calculation model.
On small model it’s ok, but the last test I’ve done (more than 15400 elements =square matrix more then 15400x15400) didn’t work. The matrix size was too big.
Did someone know the exact maximum matrix size ?
Is it a limit on the number of column and row, or on the product “number of column” x “number of row” ?
Is it a fixed limit or does it depend of the available memory ?

Thanks for your help

Xavier


(Christoph Rüegg) #2

The matrix size is limited by the underlying arrays:

  • A dense matrix requires an array of the length T=m*n, a sparse matrix an array of the length T=m+1 (and two arrays with an entry for each non-zero value), and a diagonal matrix an array of lenght T=min(m,n).
  • We currently use 32bit integers for array indexing (for performance reasons), limiting us to T < 2147483647
  • Unless you are on .Net 4.5 or newer, on a 64bit operating system, in a 64bit process and have gcAllowVeryLargeObjects enabled, arrays are limited to 2GB. For double, 2GB would limit us to T < 268435456

For a dense double-precision square matrix there is therefore a hard limit at 16384x16384 (2GB) on x86 and 46340x46340 (16GB) on x64. The former seems to be close to the limit you’ve discovered.


(Christoph Rüegg) #3

For reference: Bahrudin Hrnjica: With .NET 4.5, 10 years memory limit of 2 GB is over