Benoit keeps on amazing us! Jussi P.S. I haven't test it yet...
On Wed, May 18, 2011 at 18:21, wally <wa...@voosen.eu> wrote: > > Thanks a lot ! :) > wally > > On Wednesday, May 18, 2011 17:07:09 Benoît Minisini wrote: > > > Hello Jussi, > > > > > > in C the stuff works pretty nice, so i agree to your suggestion 2. > > > > > > Do all math stuff directly in Gambas is an option i should check. > > > > > > I think i mentioned that i use Gambas3 and want to make interpolations, > > > derivatives and integrals from an integrarray. > > > The array contains ADC outputs from a CCD linear array sensor > measurment > > > > > > wally > > > > > > On Monday, May 16, 2011 17:46:51 Jussi Lahtinen wrote: > > > > Not very easy task... > > > > Here is interpolation example in C. > > > > > http://www.gnu.org/software/gsl/manual/html_node/Interpolation-Example- > > > > pr og rams.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 > > > > Hi, > > > > I added a System.GetExternSymbol() method in the last revision so that > you > > can get the address of the interpolation type structure. > > > > You have to do something like that: > > > > Dim gsl_interp_cspline As Pointer > > > > gsl_interp_cspline = Pointer@(System.GetExternSymbol("libgsl", > > "gsl_interp_cspline")) > > > > Maybe the Pointer@() is not needed, I don't know. The symbol can be > > directly the address of the structure (no Pointer@ needed), or a pointer > > to the address of the structure. > > > > Try and tell me. > > > > Regards, > > > ------------------------------------------------------------------------------ > What Every C/C++ and Fortran developer Should Know! > Read this article and learn how Intel has extended the reach of its > next-generation tools to help Windows* and Linux* C/C++ and Fortran > developers boost performance applications - including clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user