This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: simple question on passing matrix arguments to functions
- From: Slaven Peles <peles at cns dot physics dot gatech dot edu>
- To: <john dot boik at ompress dot com>, <gsl-discuss at sources dot redhat dot com>
- Date: Sat, 5 Jul 2003 15:54:20 -0400
- Subject: Re: simple question on passing matrix arguments to functions
- References: <OOEGLGMJPMKLOFAEEDLFMEIMCKAA.john.boik@ompress.com>
On July 3, 2003 10:57, John Boik wrote:
> Hello. I have another simple question for the group. There are no
> examples in the gsl manual (that I could find) of passing a matrix or
> vector to a function.
Actually, there are quite a few examples throughout the Manual. For example,
have a look at:
http://sources.redhat.com/gsl/ref/gsl-ref_33.html#SEC445
> If you create a matrix, say M, in main(), how do you
> pass it on to newfunction()? I assume you pass the pointer as *M, but that
> does not seem to work for me. In the new function, calls to
> gsl_matrix_get(M,i,j) give me an error on compilation.
The newfunction should look something like this:
void newfunction ( gsl_matrix * M )
{
blah, blah, blah...
}
and you call it from main as
newfunction(M);
> Do you need to use
> a gsl_matrix_view_array command to remake the matrix in newfunction()?
I don't think so.
Slaven