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

OutOfMemoryException with Matrices

$
0
0

@maxmedv wrote:

Hello! I've this problem with initialisation huge matrices such as 10000x10000. Asking for help or may be you know how can i keep in memory two or three this matrices without the exception. My program is working on x86 OS, so i have near 3 Gb of memory.
This is my code:

        var abMatrix = aMatrix.TransposeAndMultiply(bMatrix);

        aMatrix.MapInplace(x => x * x);
        bMatrix=bMatrix.Transpose();
        bMatrix.MapInplace(x => x * x);

        var aParcel = aMatrix.RowSums();
        var bParcel = bMatrix.ColumnSums();

        GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
        GC.Collect();

        var rr1 = abMatrix.MapIndexed((i, j, x) => aParcel[i] + bParcel[j] - 2 * x);


        var v = rr1.EnumerateRows().Sum(x => x.Min()) / rr1.RowCount;
        var v1 = rr1.EnumerateColumns().Sum(x => x.Min()) / rr1.ColumnCount;

Thanks for help!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 224

Trending Articles