This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Allocating Arrays of matrixes


Try:

gsl_matrix **m;
int N; /* number of matrices */

m = malloc(sizeof(gsl_matrix *) * N);

for ( i = 0 ; i < N; ++i )
    m[i] = gsl_matrix_calloc( row, col );

.....

free(m);


On 31 May 2002, Daniel Konkle wrote:

> 
> I would like to dynamically allocate an array of matrixes.
> 
> I currently have them statically defined 
> 
> gsl_matrix *m[20]
> 
> for ( i = 0 ; i < 20; ++i )
>     m[i] = gsl_matrix_calloc( row, col );
> }
> 
> Has any out there done this with dynamically allocating the m array?
> If you have please send me an example, I can't get the order or syntax
> correct.
> 
> Thanks in advance,
> Danny
> 
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]