[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] gsl Splines
From: |
Brian Gough |
Subject: |
Re: [Help-gsl] gsl Splines |
Date: |
Tue, 23 Jun 2009 17:48:43 +0100 |
User-agent: |
Wanderlust/2.14.0 (Africa) Emacs/22.1 Mule/5.0 (SAKAKI) |
At Mon, 22 Jun 2009 14:31:37 +0100,
Henry Butowsky wrote:
>
> Hi there,
> I wish to uses the gsl spline library in a "threaded context"
> So for example
>
> *MAIN THREAD
> *double x[4]={1,2,3,4};
> double y[4]={0,.2.7.9,1.2};
> const gsl_interp_type t_m=gsl_interp_cspline_periodic;
> gsl_spline=gsl_spline_alloc(t_m,4);
>
>
> *THREAD 1
> *double x1=2.5;
> double y1;
> gsl_interp_accel *acc=gsl_interp_accel_alloc();*
> *y1=gsl_spline_eval(spline,x1,acc);
>
> Where "spline is a "global" type variable,
> x1,y1, acc are variables local to each thread
>
>
> So will the above code work ? Or will the "state" maintained in
> gsl_spline->interp cause a crash or a segfault ?
>
Provided you only call eval functions (which are read-only), with a
separate accelerator for each thread, then it should be fine. In the
main thread you would also need a call to gsl_spline_init before any
of the eval functions can be used.
--
Brian Gough
(GSL Maintainer)
Support freedom by joining the FSF
http://www.fsf.org/associate/support_freedom/join_fsf?referrer=37