public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Szymon Jaroszewicz <sj@cs.umb.edu>
To: Daniel Konkle <daniel.konkle@dynetics.com>
Cc: gsl-discuss@sources.redhat.com
Subject: Re: Allocating Arrays of matrixes
Date: Tue, 31 Dec 2002 09:55:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.05.10205311351220.27272-100000@u5.cs.umb.edu> (raw)
In-Reply-To: <1022867069.25383.102.camel@newyork.rc.dynetics.com>

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

WARNING: multiple messages have this Message-ID
From: Szymon Jaroszewicz <sj@cs.umb.edu>
To: Daniel Konkle <daniel.konkle@dynetics.com>
Cc: gsl-discuss@sources.redhat.com
Subject: Re: Allocating Arrays of matrixes
Date: Fri, 31 May 2002 12:02:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.05.10205311351220.27272-100000@u5.cs.umb.edu> (raw)
Message-ID: <20020531120200.AbAfEdN4F79WtdZqeZNZbT8u7-dSrgrmBbTy_qdxLpg@z> (raw)
In-Reply-To: <1022867069.25383.102.camel@newyork.rc.dynetics.com>

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

  parent reply	other threads:[~2002-05-31 17:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-31  9:55 Daniel Konkle
2002-05-31 10:53 ` Daniel Konkle
2002-12-31  9:55 ` Szymon Jaroszewicz [this message]
2002-05-31 12:02   ` Szymon Jaroszewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.05.10205311351220.27272-100000@u5.cs.umb.edu \
    --to=sj@cs.umb.edu \
    --cc=daniel.konkle@dynetics.com \
    --cc=gsl-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).