This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Interpolation interface.



I'm afraid I've been becoming increasingly annoyed with the 
semantics of the interpolation functions. Apologies to whoever
designed them, but they seem horribly unwieldy:
firstly because you have to pass the addresses of your arrays
into the functions *every* time you do anything, despite having
given them to the interpolation object
secondly the (as far as I can see) unnecessary separation between
accelerator object and interpolation object
thirdly the fact that the allocate and set semantics are entirely
different from the rest of gsl.

So rather than just moaning, I've implemented a more sensible
(to my eye at least) interface as follows:

gsl_interp_obj *(gsl_interp_obj_alloc)(gsl_interp_factory)

        allocates space; including hidden accelerator.

int gsl_interp_obj_set(gsl_interp_obj obj, double *x_array, 
                       double *y_array, size_t size)

        sets/resets obj to use x_array & y_array of length size.

and eliminate x_array, y_array and gsl_interp_accel from 
the argument lists for all the gsl_interp_eval_* functions.
There is no need to worry explicitly about allocating/freeing
accelerator objects - that's all taken care of inside the 
interp_obj alloc/freeing functions. 

So far I've only done this properly for the linear objects - but they're
fully tested. The changes don't affect the mathematical internals,
only the interfaces. If this is all any use to anybody, I'll finish
off the cspline & akima objects.

But do feel free to tell me that I'm being dim and that there's
actually a good reason for the current arrangements.

There's a diff of what I've done on the linear objects at
<URL:http://ket.ch.cam.ac.uk/people/tow/interp.diff>

Toby

-- 
Toby White, University Chemical Lab., Lensfield Road, Cambridge. CB2 1EW. U.K.
Email: <tow@theor.ch.cam.ac.uk> GPG Key ID: 1DE9DE75
Web: <URL:http://ket.ch.cam.ac.uk/people/tow/index.html>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]