126 int ihi=ilo+1, middle;
128 while(ihi < lxt-1 && x >= xt[ihi])
138 middle = (ihi+ilo)/2;
157 static double bvalue(
159 const double bcoef[],
271 int i, ilo, imk,
j, jc, jcmin, jcmax, jj, kmj, km1, nmi;
282 if(interv(
t, n+
k,
x,
pi)!=0)
317 for(
j=0;
j<jcmax;
j++)
318 dr[
j] =
t[
i+
j+1] -
x;
319 for(
j=jcmax-1;
j< km1;
j++)
327 dr[
j] =
t[
i+
j+1] -
x;
329 for(jc=jcmin; jc<jcmax; jc++)
330 aj[jc] = bcoef[imk+jc];
333 for(
j=1;
j<=jderiv;
j++)
338 for(jj=1; jj<=kmj; jj++)
339 aj[jj-1] = ((aj[jj] - aj[jj-1])/(dl[--ilo] + dr[jj-1]))*fkmj;
345 for(
j=jderiv;
j<km1;
j++)
349 for(jj=0; jj<kmj; jj++)
352 aj[jj] = (aj[jj+1]*dl[ilo] + aj[jj]*dr[jj])/(dl[ilo] + dr[jj]);
435 #if __STDC_VERSION__ < 199901L
436 #define IMSL_NAN HUGE_VAL
438 #define IMSL_NAN (nan("")==0.0 ? HUGE_VAL : nan(""))
445 case 1:
return DBL_MIN;
450 #if __STDC_VERSION__ < 199901L
454 return DBL_MAX*(1.0-DBL_EPSILON);
456 return nextafter(
DBL_MAX, 0.0);
459 case 3:
return DBL_EPSILON/FLT_RADIX;
460 case 4:
return DBL_EPSILON;
461 case 5:
return log10(FLT_RADIX);
466 #if __STDC_VERSION__ < 199901L
467 return HUGE_VAL*(1.0-DBL_EPSILON);
469 return nextafter(HUGE_VAL, 0.0);
472 case 8:
return -HUGE_VAL;
580 const double *xvec=
NULL;
582 int i=0, grid=0, deriv=0;
583 int arg, knot, n=0, num_knots,
val;
588 while(( arg=va_arg(ap,
int) ))
590 if(arg == IMSL_DERIV)
591 deriv = va_arg(ap,
int);
592 else if(arg == IMSL_GRID_USER)
595 xvec = (
const double *)va_arg(ap,
double *);
596 value_user = va_arg(ap,
double*);
608 sp->coef==
NULL || sp->knots[0]==
NULL || sp->coef[0] ==
NULL)
626 if(sp->num_coef[0] < sp->order[0])
638 num_knots = sp->num_coef[0] + sp->order[0];
649 epsilon = pow((sp->knots[0][num_knots-1] - sp->knots[0][0])/
DBL_MAX,
650 1.0/(
double)sp->order[0]);
653 for(knot=0; knot<num_knots-1; knot++)
655 if(sp->knots[0][knot] > sp->knots[0][knot+1])
666 for(knot=0; knot<sp->num_coef[0]; knot++)
668 if(sp->knots[0][knot+sp->order[0]] - sp->knots[0][knot] <=
epsilon)
678 return bvalue(sp->knots[0], sp->coef[0], sp->num_coef[0], sp->order[0],
703 value_user[
val] = bvalue(sp->knots[0], sp->coef[0], sp->num_coef[0],
704 sp->order[0], xvec[
val], deriv, &
i);