Finds the global minimum of a 1D b-spline on .
The candidates are the end points, the interior knots (where the
derivative may be discontinuous), and the roots of .
For kx = 4 (cubic) the derivative pieces are quadratic, so the
candidates are found in closed form.
At an interior knot where the spline itself is discontinuous (a knot
of multiplicity kx or more), is the value from the right,
and the limit from the left is not attained. If that limit is the
extremum, it is returned (with xmin at the knot) and iflag is set
to 4007.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in), | dimension(nx+kx) | :: | tx |
knot array |
|
| integer(kind=ip), | intent(in) | :: | nx |
number of b-spline coefficients |
||
| integer(kind=ip), | intent(in) | :: | kx |
order of the b-spline, |
||
| real(kind=wp), | intent(in), | dimension(nx) | :: | bcoef |
b-spline coefficient array |
|
| real(kind=wp), | intent(in) | :: | xa |
left end of the interval, in |
||
| real(kind=wp), | intent(in) | :: | xb |
right end of the interval, in |
||
| real(kind=wp), | intent(out) | :: | xmin |
location of the minimum |
||
| real(kind=wp), | intent(out) | :: | fmin |
minimum value of the spline |
||
| integer(kind=ip), | intent(out) | :: | iflag |
status flag:
|
pure subroutine db1min(tx,nx,kx,bcoef,xa,xb,xmin,fmin,iflag) implicit none integer(ip),intent(in) :: nx !! number of b-spline coefficients integer(ip),intent(in) :: kx !! order of the b-spline, `kx >= 2` real(wp),dimension(nx+kx),intent(in) :: tx !! knot array real(wp),dimension(nx),intent(in) :: bcoef !! b-spline coefficient array real(wp),intent(in) :: xa !! left end of the interval, in `t(kx) <= x <= t(nx+1)` real(wp),intent(in) :: xb !! right end of the interval, in `t(kx) <= x <= t(nx+1)` real(wp),intent(out) :: xmin !! location of the minimum real(wp),intent(out) :: fmin !! minimum value of the spline integer(ip),intent(out) :: iflag !! status flag: !! !! * 0: no errors !! * 4001: `kx` does not satisfy `kx >= 2` !! * 4002: `nx` does not satisfy `nx >= kx` !! * 4003: `xa` or `xb` or both do not !! satisfy `t(kx) <= x <= t(nx+1)` !! * 4007: the minimum is the limit from the !! left at a discontinuity (not attained) call db1extremum(tx,nx,kx,bcoef,xa,xb,.false.,xmin,fmin,iflag) end subroutine db1min