[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] find a maximum for a cspline
From: |
Rajeev Singh |
Subject: |
Re: [Help-gsl] find a maximum for a cspline |
Date: |
Sat, 12 Sep 2009 09:25:36 +0530 |
Hi Alex,
You can define explicit C-function after you have constructed the spline.
Let me give an example:
struct param_spline {
gsl_interp_accel *acc_u;
gsl_spline *spline_u;
};
double func(double t, void * params) {
struct param_spline *p = (struct param_spline *)params;
return gsl_spline_eval(p->spline_u, t, p->acc_u);
}
main() {
...
struct param_spline p;
...
// constructing the spline
gsl_spline_init( spline_data, x, y, N);
p.spline_u =spline_data;
p.acc_u = acc_u;
...
}
Now a pointer to func can be sent to the minimizer. I hope this helps you.
It has worked for me earlier.
Rajeev