Alternate version of db1ink_default, where the boundary conditions can be specified.
Note
The spline order kx must be at least 3.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in), | dimension(:) | :: | x |
vector of abscissae of length |
|
| integer(kind=ip), | intent(in) | :: | nx |
number of data points, |
||
| real(kind=wp), | intent(in), | dimension(:) | :: | fcn |
vector of ordinates of length |
|
| integer(kind=ip), | intent(in) | :: | kx |
spline order ( |
||
| integer(kind=ip), | intent(in) | :: | ibcl |
selection parameter for left boundary condition:
constrain the |
||
| integer(kind=ip), | intent(in) | :: | ibcr |
selection parameter for right boundary condition:
constrain the |
||
| real(kind=wp), | intent(in) | :: | fbcl |
left boundary values governed by |
||
| real(kind=wp), | intent(in) | :: | fbcr |
right boundary values governed by |
||
| integer(kind=ip), | intent(in) | :: | kntopt |
knot selection parameter:
|
||
| real(kind=wp), | intent(out), | dimension(:) | :: | tx |
knot array of length |
|
| real(kind=wp), | intent(out), | dimension(:) | :: | bcoef |
b spline coefficient array of length |
|
| integer(kind=ip), | intent(out) | :: | iflag |
status flag (see dbint4) |
pure subroutine db1ink_alt(x,nx,fcn,kx,ibcl,ibcr,fbcl,fbcr,kntopt,tx,bcoef,iflag) implicit none real(wp),dimension(:),intent(in) :: x !! \(x\) vector of abscissae of length `nx`, distinct !! and in increasing order integer(ip),intent(in) :: nx !! number of data points, \( n_x \ge \max(2,k_x-2) \) real(wp),dimension(:),intent(in) :: fcn !! \(y\) vector of ordinates of length `nx` integer(ip),intent(in) :: kx !! spline order (`kx >= 3`) integer(ip),intent(in) :: ibcl !! selection parameter for left boundary condition: !! constrain the `ibcl`-th derivative at `x(1)` to `fbcl` !! (`1 <= ibcl <= kx-1`, e.g. `ibcl = 2` for a natural spline) integer(ip),intent(in) :: ibcr !! selection parameter for right boundary condition: !! constrain the `ibcr`-th derivative at `x(nx)` to `fbcr` !! (`1 <= ibcr <= kx-1`, e.g. `ibcr = 2` for a natural spline) real(wp),intent(in) :: fbcl !! left boundary values governed by `ibcl` real(wp),intent(in) :: fbcr !! right boundary values governed by `ibcr` integer(ip),intent(in) :: kntopt !! knot selection parameter: !! !! * `kntopt = 1` sets knot multiplicity at `t(kx)` and !! `t(nx+3)` to `kx` !! * `kntopt = 2` sets a symmetric placement of knots !! about `t(kx)` and `t(nx+3)` real(wp),dimension(:),intent(out) :: tx !! knot array of length `nx+kx+2` real(wp),dimension(:),intent(out) :: bcoef !! b spline coefficient array of length `nx+2` integer(ip),intent(out) :: iflag !! status flag (see [[dbint4]]) integer(ip) :: n !! number of coefficients (n=nx+2) logical :: status_ok !! status flag for error checking real(wp),dimension(0),parameter :: tleft = 0.0_wp !! not used for this case (see [[dbint4]]) real(wp),dimension(0),parameter :: tright = 0.0_wp !! not used for this case (see [[dbint4]]) if (kntopt /= 1_ip .and. kntopt /= 2_ip) then iflag = 2005_ip ! use db1ink_alt_2 to specify the end knots else call check_inputs( 1_ip,& ! so it will check size of t iflag,& nx=nx,& kx=kx,& x=x,& f1=fcn,& bcoef1=bcoef,& tx=tx,& status_ok=status_ok,& alt=.true.) if (status_ok) then call dbint4(x,fcn,nx,ibcl,ibcr,fbcl,fbcr,kntopt,tleft,tright,tx,bcoef,n,kx,iflag) end if end if end subroutine db1ink_alt