[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Memory allocation for large matrices
From: |
Helena |
Subject: |
[Help-gsl] Memory allocation for large matrices |
Date: |
Tue, 27 Nov 2007 15:28:22 -0500 |
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
- [Help-gsl] Memory allocation for large matrices,
Helena <=