This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
Re: vector, matrix copy
- To: Thomas Walter <walter at pctc dot chemie dot uni-erlangen dot de>
- Subject: Re: vector, matrix copy
- From: Brian Gough <bjg at network-theory dot co dot uk>
- Date: Wed, 1 Mar 2000 10:33:57 +0000 (GMT)
- Cc: gsl-discuss at sourceware dot cygnus dot com
- References: <200002290951.KAA26699@server2.chemie.uni-erlangen.de>
Thomas Walter writes:
> there was recently a name change from 'gsl_vector_copy' to
> 'gsl_vector_cpy'.
> I think this should be done for 'gsl_matrix_copy' too, or do I
> missunderstand something.
Thanks..
> What about adding something like
> if (dest == src)
> {
> /* Destination and source are the same, nothing to do */
> return GSL_SUCCESS;
> }
>
> in the copy sources. The advantage is one can write for example
> gsl_vector_cpy (w, v)
> in algorithms which can be written to work in-place and it depends on
> the calling function whether one gets the result in a new workspace or
> overwrites the input.
The case dest == src is currently safe, so this would be an
optimization for that case. Sounds reasonable.