This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: gsl_vector_subvector
- To: "E. Robert Tisdale" <edwin at netwood dot net>
- Subject: Re: gsl_vector_subvector
- From: Brian Gough <bjg at network-theory dot co dot uk>
- Date: Wed, 19 Jul 2000 21:48:16 +0100 (BST)
- Cc: gsl-discuss at sourceware dot cygnus dot com
- References: <3975091B.692F1969@netwood.net>
- Reply-To: gsl-discuss at sources dot redhat dot com
Thanks. I will correct that to v->offset.
The GSL convention is to return pointers for objects allocated on the
heap (in the style of malloc/free). The functions which return an
object on the stack are intended for temporary views. This allows a
stylistic distinction to be made within a function between views
defined in the local scope and vectors passed as arguments (pointers).
E. Robert Tisdale writes:
> There is a documentation error for
>
> gsl_vector gsl_vector_subvector(gsl_vector* v,
> size_t i, size_t n);
> It says
>
> v'(i) = v-->data[(offset + i)*v->stride]
> It seems strange that the GSL would define a function
>
> gsl_vector gsl_vector_subvector(gsl_vector* v,
> size_t i, size_t n);
> which returns a gsl_vector object for subvectors and a function
>
> gsl_vector* gsl_vector_alloc(size_t n);
> which returns a pointer to a gsl_vector for vectors. Does anybody
> know why?
> If gsl_vector_subvector returned a pointer to a gsl_vector object,
> it might be practical to implement reference counting.
>
>