[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] accessing matrix dimensions?

From: Wacek Kusnierczyk
Subject: Re: [Help-gsl] accessing matrix dimensions?
Date: Mon, 20 Jun 2011 16:00:38 +0200
User-agent: RoundCube Webmail/0.4-trunk

On Fri, 17 Jun 2011 22:59:54 +0100, Brian Gough <address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]