public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Allocating Arrays of matrixes
  2002-12-31  9:55 Allocating Arrays of matrixes Daniel Konkle
@ 2002-05-31 10:53 ` Daniel Konkle
  2002-12-31  9:55 ` Szymon Jaroszewicz
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Konkle @ 2002-05-31 10:53 UTC (permalink / raw)
  To: gsl-discuss


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allocating Arrays of matrixes
  2002-12-31  9:55 ` Szymon Jaroszewicz
@ 2002-05-31 12:02   ` Szymon Jaroszewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Szymon Jaroszewicz @ 2002-05-31 12:02 UTC (permalink / raw)
  To: Daniel Konkle; +Cc: gsl-discuss

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
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allocating Arrays of matrixes
  2002-12-31  9:55 Allocating Arrays of matrixes Daniel Konkle
  2002-05-31 10:53 ` Daniel Konkle
@ 2002-12-31  9:55 ` Szymon Jaroszewicz
  2002-05-31 12:02   ` Szymon Jaroszewicz
  1 sibling, 1 reply; 4+ messages in thread
From: Szymon Jaroszewicz @ 2002-12-31  9:55 UTC (permalink / raw)
  To: Daniel Konkle; +Cc: gsl-discuss

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
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Allocating Arrays of matrixes
@ 2002-12-31  9:55 Daniel Konkle
  2002-05-31 10:53 ` Daniel Konkle
  2002-12-31  9:55 ` Szymon Jaroszewicz
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Konkle @ 2002-12-31  9:55 UTC (permalink / raw)
  To: gsl-discuss


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-05-31 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-31  9:55 Allocating Arrays of matrixes Daniel Konkle
2002-05-31 10:53 ` Daniel Konkle
2002-12-31  9:55 ` Szymon Jaroszewicz
2002-05-31 12:02   ` Szymon Jaroszewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).