This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: Allocating Arrays of matrixes
- From: Szymon Jaroszewicz <sj at cs dot umb dot edu>
- To: Daniel Konkle <daniel dot konkle at dynetics dot com>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Fri, 31 May 2002 13:53:21 -0400 (EDT)
- Subject: 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
>
>
>