db1min Subroutine

public pure subroutine db1min(tx, nx, kx, bcoef, xa, xb, xmin, fmin, iflag)

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.

See also

Arguments

Type IntentOptional 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, kx >= 2

real(kind=wp), intent(in), dimension(nx) :: bcoef

b-spline coefficient array

real(kind=wp), intent(in) :: xa

left end of the interval, in t(kx) <= x <= t(nx+1)

real(kind=wp), intent(in) :: xb

right end of the interval, in t(kx) <= x <= t(nx+1)

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:

  • 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)

Calls

proc~~db1min~~CallsGraph proc~db1min db1min proc~db1extremum db1extremum proc~db1min->proc~db1extremum proc~check_root_inputs check_root_inputs proc~db1extremum->proc~check_root_inputs proc~dbspvd dbspvd proc~db1extremum->proc~dbspvd proc~dbvalu dbvalu proc~db1extremum->proc~dbvalu proc~spline_derivative spline_derivative proc~db1extremum->proc~spline_derivative proc~spline_roots spline_roots proc~db1extremum->proc~spline_roots proc~dbspvn dbspvn proc~dbspvd->proc~dbspvn proc~dintrv dintrv proc~dbvalu->proc~dintrv proc~spline_roots->proc~dbvalu proc~in_flat_region in_flat_region proc~spline_roots->proc~in_flat_region proc~root_dup_tol root_dup_tol proc~spline_roots->proc~root_dup_tol proc~sort_unique sort_unique proc~spline_roots->proc~sort_unique proc~get_temp_x_for_extrap get_temp_x_for_extrap proc~dintrv->proc~get_temp_x_for_extrap proc~in_flat_region->proc~dintrv

Called by

proc~~db1min~~CalledByGraph proc~db1min db1min proc~minimum_1d bspline_1d%minimum_1d proc~minimum_1d->proc~db1min

Source Code

    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