[Gambas-user] Gambas3 and Gnu scientific library

Jussi Lahtinen jussi.lahtinen at ...626...
Mon May 16 17:46:51 CEST 2011


Not very easy task...
Here is interpolation example in C.
http://www.gnu.org/software/gsl/manual/html_node/Interpolation-Example-programs.html

As you can see, you need to call several functions to get what you want.
Declaring those in Gambas is OK, *except* determining interpolation type!

You can find definition of interpolation type from "gsl_interp.h",
and unfortunately it is not anything simple;

typedef struct {
  const char * name;
  unsigned int min_size;
  void *  (*alloc) (size_t size);
  int     (*init)    (void *, const double xa[], const double ya[], size_t
size);
  int     (*eval)    (const void *, const double xa[], const double ya[],
size_t size, double x, gsl_interp_accel *, double * y);
  int     (*eval_deriv)  (const void *, const double xa[], const double
ya[], size_t size, double x, gsl_interp_accel *, double * y_p);
  int     (*eval_deriv2) (const void *, const double xa[], const double
ya[], size_t size, double x, gsl_interp_accel *, double * y_pp);
  int     (*eval_integ)  (const void *, const double xa[], const double
ya[], size_t size, gsl_interp_accel *, double a, double b, double * result);
  void    (*free)         (void *);

} gsl_interp_type;

GSL_VAR const gsl_interp_type * gsl_interp_cspline; * <-- this is used in
example*


Right now I don't know how to implement that reasonably in Gambas.
There are at least three possibilities to overcome this problem:

1. Hope that Benoit will implement new feature to use external structures.
2. Use C to write your own interface between GSL and Gambas. Perhaps easiest
option.
3. Do not use GSL at all, and write what you need purely with Gambas.

That's all I can say...
Also because you didn't specify what you need exactly, nor are you using
Gambas 2 or 3.

Jussi


On Mon, May 16, 2011 at 09:32, wally <wally at ...2037...> wrote:

> Hello,
>
> i need to process an integerarray using GSL (Gnu Scientific Library)
> but i do not know how to do it. Does anybody have a code example
> how to provide the array data to gsl and get back interpolation, derivative
> and integral  data ?
>
> wally
>
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list