This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: gsl_matrix_add
- From: John Lamb <J dot D dot Lamb at btinternet dot com>
- To: gsl-discuss at sources dot redhat dot com
- Date: Wed, 04 Aug 2004 18:51:03 +0100
- Subject: Re: gsl_matrix_add
- References: <200408031341.01120.rwerp@gazeta.pl>
Roman Werpachowski wrote:
Since gsl_matrix_add is a basic function for adding matrices, it should perfom
and operation
gsl_matrix_add(a, b, c) --> c = a + b
not just
gsl_matrix_add(a, b) --> a = a + b.
Now to add two matrices and store the result in the third, I have to call two
functions instead of just one.
The second is more efficient if you want the equivalent of the C operation
a += b;
You could write your own function
gsl_matrix_Add( gsl_matrix* c,
const gsl_matrix* a, const gsl_matrix* b ){
gsl_matrix_copy( c, a );
gsl_mtarix_add( c, b);
}
Then you only have to call one function. If you use C++, you can even
give both functions the same name ;-)
--
JDL