intArray to doubleArray, Out Of Memory Exception C #

Я пытаюсь преобразовать массив int 10 000 на 10 000 в двойной массив с помощью следующего метода (я нашел на этом веб-сайте)

public double[,] intarraytodoublearray( int[,] val){ 

        int rows= val.GetLength(0);
        int cols = val.GetLength(1);
        var ret = new double[rows,cols];
        for (int i = 0; i < rows; i++ )
        {

            for (int j = 0; j < cols; j++) 
            {
                ret[i,j] = (double)val[i,j];
            }
        }
        return ret;
}

и способ, которым я вызываю

 int bound0 = myIntArray.GetUpperBound(0);
 int bound1 = myIntArray.GetUpperBound(1);
 double[,] myDoubleArray = new double[bound0,bound1];  
 myDoubleArray = intarraytodoublearray(myIntArray)  ;

это дает мне эту ошибку,

Unhandled Exception: OutOfMemoryException
[ERROR] FATAL UNHANDLED EXCEPTION: System.OutOfMemoryException: Out of memory
at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_2 (intptr,intptr,intptr)

На машине 32 ГБ ОЗУ, ОС - MAC OS 10.6.8

5
задан Emmet B 23 January 2012 в 08:00
поделиться