in
| reference points in form
x0,y0,x1,y1,...x<in_sz-1>,y<in_sz-1>
Totally sizeof(double)*2*in_sz bytes.
|
abcd
| result of evaluation in form
a0,b0,c0,d0,a1,b1,...a<in_sz-2>,...d<in_sz-2>
a0..d0 coefficiens are valid on segment (-inf,x1], a1..d1 are valid on [x1-x2], etc.,
and a<in_sz-2>..d<in_sz-2> are valid on [x<in_sz-2>,+inf) segment.
Totally sizeof(double)*4*(in_sz-1) bytes should be allocated for storing coefficients.
In final evaluation not original x-coordinates, but their offsets from reference
x-points should be used. This is made by design, which reduces error for
large numbers.
Point in position x on segment x<i>..x<i+1> can be found by equation
dx=x-in[i*2];
y=abcd[i*4]+abcd[i*4+1]*dx+abcd[i*4+2]*dx*dx+abcd[i*4+3]*dx*dx*dx;
|