GSL Error Handling

Brian Gough bjg@network-theory.co.uk
Wed Jul 19 13:57:00 GMT 2000


E. Robert Tisdale writes:
 >         int
 >         gsl_vector_memcpy(gsl_vector* dest, const gsl_vector* src) {
 > Why shouldn't the GSL library developer copy
 > the source vector into the first part of the destination vector
 > if src->size < dest->size or copy the first part
 > of the source vector into the destination vector
 > if dest->size < src->size?

The appropriate procedure for copying subvectors in GSL is to create a
corresponding subvector view then copy from that to the destination.
This shows explicitly that only part of the vector should be copied.
It is analogous to using an explicit cast in an assignment.

The behavior of GSL's vectors is based on the C++ valarray model
where copying valarrays of different lengths by assignment gives
undefined results (i.e. an error).


More information about the Gsl-discuss mailing list