help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Memory allocation for large matrices


From: Tommy Nordgren
Subject: Re: [Help-gsl] Memory allocation for large matrices
Date: Tue, 27 Nov 2007 21:49:07 +0100


On 27 nov 2007, at 21.28, Helena wrote:

Hi There,



I am trying to load a large matrix (180000*40) to GSL from a matrix.



The data was first saved in Matrix "A" by first initiate "A" as



double *A[180000];

for (i=0;i<180000;i++)

A [i]=malloc(40*sizeof*A[i]);





After reading values in to "A", I wanted to pass the values from "A" to a
GSL matrix "B".



gsl_matrix *B=gsl_matrix_alloc(180000,40);



for (i=0;i<180000;i++)

for (j=0;j<40;j++)

gsl_matrix_set(B,i ,j,A[i][j]);


I got an error message below each time the code reaches the gsl_marix_alloc
line:


Gsl:init_source.c :46: ERROR:failed to allocate space for block data

Default GSL error handler invoked.



I saw similar question posted before, but no answer yet. Is there any way to solve this problem by first define B as a gsl vector, then assign space for each element of the vector, similar to what I can do for a C matrix? I was
not able to make it work so far. Any helps or suggestions are highly
appreciated!



Helena
Do you REALLY need the matrix A? Try reading data directly into B instead. This will decrease the memory requirements of your app.
-------------------------------------
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
address@hidden







reply via email to

[Prev in Thread] Current Thread [Next in Thread]