Quantcast
Channel: Math.NET Numerics
Viewing all articles
Browse latest Browse all 971

New Post: Densematrix overflow exception and outofmemory exception

$
0
0
Hi all,

I was trying to work with very large matrices in C# using Math.Net library when I met the following exceptions.
private static DenseMatrix OutOfMemoryTest()
        {
            var testMat = new DenseMatrix(1000000, 7500, 10.5);
            return testMat;
        }
If I tried to create a large matrix like above, a exception was thrown.
Arithmetic operation resulted in an overflow.
private static DenseMatrix OutOfMemoryTest()
        {
            var testMat = new DenseMatrix(100000, 7500, 10.5);
            return testMat;
        }
If I cut the row numbers to 100000, the library threw an OutOfMemory Exception.
Exception of type 'System.OutOfMemoryException' was thrown.
Finally, if I even cut the row number to 10000, but change the return value to double array.
private static double[,] OutOfMemoryTest()
        {
            var testMat = new DenseMatrix(10000, 7500, 10.5);
            return testMat.ToArray();
        }
It did allow me to successfully create the matrix but failed to return the array.
Exception of type 'System.OutOfMemoryException' was thrown.
I am wondering if I misused the library or is there anything about memory I mislook? Or is it simply the library's problem?

Am I missing anything here? Please help. Thanks all.

Ben

Viewing all articles
Browse latest Browse all 971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>