help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] C++ Shell


From: slipbits
Subject: [Help-gsl] C++ Shell
Date: Wed, 27 Dec 2017 11:03:03 -0800
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

I constructed a shallow shell in C++ around the data operations and structures given in chapter 8. You are welcome to use it and/or expand on it and/or abandon it. If there is any interest then I will change the shell to deal with all of the supported data types (float, int, ...), and to provide internal documentation (see Doxygen). Otherwise, it's yours.

If (further) interested, a similar shell can be constructed for C programs. It takes a tad more effort but the end result is the same. Again, if there's any interest I'll try to provide it.

To see an example of a C interface, albeit in C++, take a look at gnu.org/software/gslip and look at the treatment of arithmetic operations (SlipDatum). This idea can be productively used in GSL.

The approach has the advantage of allowing simple and consistent interfaces to GSL functions. As an example:

GSLMatrix matrix(row, col);
GSLVector vector(row);
GSLVector v(row);

allows:
GSLMatrix view_vector = matrix.view_vector(vector, 2, 3); // and
int maxM = matrix.max_index();
int maxV = vector.max_index();
int err  = vector.add(v);

and so on.

I don't understand the insistence that views be put on the stack in C/C++. This restriction is easy to circumvent and appears to be directed to a preferred coding style. If this is accurate, that a preferred coding style is encouraged, then might I suggest that the reliance on stack based requirements be removed or that some explanation be provided in the GSL manual to indicate why the particular coding style is preferred.

Please provide feedback.
art

attach: gsl.zip
Files:    gslData      super class
             gslBlock     block data structure
             gslMatrix   matrix operations
             gslVector   vector operations

Attachment: gsl.zip
Description: Zip compressed data


reply via email to

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