On Fri, 17 Jun 2011 22:59:54 +0100, Brian Gough <b...@gnu.org> wrote:
> At Thu, 16 Jun 2011 13:07:07 -0500,
> Waclaw Kusnierczyk wrote:
>> I can't find appropriate routines in the interface -- I'm thinking about
>> something like
>>
>>      int nrows = gsl_matrix_size1(const gsl_matrix *m);
>>
>> It's possible to write code like
>>
>>      int nrows = m->size1;
>>
>> but I'd prefer to avoid breaking the abstraction barrier.
> 
> No need to worry about that - the matrix and vector structs are part
> of the API, it is ok to use the struct parameters for them.  They
> definitely won't change.

That's right, the struct content is made explicit in the docs, so it
doesn't feel that bad to use it directly.  (I come from a tradition in
programming where abstraction rules, hence the hesitation.  But direct
access to the components will surely be more efficient than calling a
function, unless inlined.)

> If it's a concern you can wrap them in a macro.

That's probably the most elegant and efficient approach in this case. 
The alternative of an inline function might be an overkill for the need.

Thanks.
vQ


_______________________________________________
Help-gsl mailing list
Help-gsl@gnu.org
https://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to