public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* gsl_matrix_add
@ 2004-08-03 12:15 Roman Werpachowski
  2004-08-04 17:51 ` gsl_matrix_add John Lamb
  0 siblings, 1 reply; 2+ messages in thread
From: Roman Werpachowski @ 2004-08-03 12:15 UTC (permalink / raw)
  To: gsl-discuss


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.

-- 
Ten e-mail został sprawdzony i 
zaakceptowany przez fretkę Tintin.



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

* Re: gsl_matrix_add
  2004-08-03 12:15 gsl_matrix_add Roman Werpachowski
@ 2004-08-04 17:51 ` John Lamb
  0 siblings, 0 replies; 2+ messages in thread
From: John Lamb @ 2004-08-04 17:51 UTC (permalink / raw)
  To: gsl-discuss

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

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

end of thread, other threads:[~2004-08-04 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-03 12:15 gsl_matrix_add Roman Werpachowski
2004-08-04 17:51 ` gsl_matrix_add John Lamb

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