Initialize a bspline_1d type (with automatically-computed knots). This is a wrapper for db1ink.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(bspline_1d), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(:) | :: | x |
|
|
real(kind=wp), | intent(in), | dimension(:) | :: | fcn |
|
|
integer(kind=ip), | intent(in) | :: | kx |
The order of spline pieces in ( ) (order = polynomial degree + 1) |
||
integer(kind=ip), | intent(out) | :: | iflag |
status flag (see db1ink) |
||
logical, | intent(in), | optional | :: | extrap |
if true, then extrapolation is allowed (default is false) |
pure subroutine initialize_1d_auto_knots(me,x,fcn,kx,iflag,extrap) implicit none class(bspline_1d),intent(inout) :: me real(wp),dimension(:),intent(in) :: x !! `(nx)` array of \(x\) abcissae. Must be strictly increasing. real(wp),dimension(:),intent(in) :: fcn !! `(nx)` array of function values to interpolate. `fcn(i)` should !! contain the function value at the point `x(i)` integer(ip),intent(in) :: kx !! The order of spline pieces in \(x\) !! ( \( 2 \le k_x < n_x \) ) !! (order = polynomial degree + 1) integer(ip),intent(out) :: iflag !! status flag (see [[db1ink]]) logical,intent(in),optional :: extrap !! if true, then extrapolation is allowed !! (default is false) integer(ip) :: iknot integer(ip) :: nx call me%destroy() nx = size(x,kind=ip) me%nx = nx me%kx = kx allocate(me%tx(nx+kx)) allocate(me%bcoef(nx)) allocate(me%work_val_1(3_ip*kx)) iknot = 0_ip !knot sequence chosen by db1ink call db1ink(x,nx,fcn,kx,iknot,me%tx,me%bcoef,iflag) if (iflag==0_ip) then call me%set_extrap_flag(extrap) end if me%initialized = iflag==0_ip me%iflag = iflag end subroutine initialize_1d_auto_knots