Interpolation Module Source file:Interpolation

Dependencies

Subroutines
  • cubic_spline_derivatives(n, x, y, d2, dy, End1, End2)
    Build a cubic spline and return both second derivatives and first derivatives at knots.
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: x(n)
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(out) :: d2(n)
    • real(sp_acc) intent(out) :: dy(n)
    • real(sp_acc) intent(in), optional :: End1
    • real(sp_acc) intent(in), optional :: End2
  • cubic_spline_derivatives_from_second_derivs(n, x, y, d2, dy)
    First derivatives at knots for an existing cubic spline second-derivative table.
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: x(n)
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(in) :: d2(n)
    • real(sp_acc) intent(out) :: dy(n)
  • cubic_spline_horner_coefficients(n, x, y, d2, horner)
    Interval polynomial coefficients for cubic spline evaluation in normalized Horner form.
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: x(n)
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(in) :: d2(n)
    • real(sp_acc) intent(out) :: horner(:, :)
  • cubic_spline_integral_array(n, x, y, d2, yint)
    Cumulative integral of a cubic spline at the input knots.
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: x(n)
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(in) :: d2(n)
    • real(sp_acc) intent(out) :: yint(n)
  • cubic_spline_regular_horner_coefficients(n, delta, y, d2, horner)
    Interval polynomial coefficients for a regular-grid cubic spline in normalized Horner form.
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: delta
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(in) :: d2(n)
    • real(sp_acc) intent(out) :: horner(:, :)
  • cubic_spline_regular_second_derivs(n, delta, y, d2, End1, End2)
    Second derivatives for a regular-grid cubic spline; delta is x(i+1)-x(i).
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: delta
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(out) :: d2(n)
    • real(sp_acc) intent(in), optional :: End1
    • real(sp_acc) intent(in), optional :: End2
  • cubic_spline_second_derivs(n, x, y, d2, End1, End2)
    Second derivatives for a cubic spline; omitted endpoints use natural boundary conditions.
    • integer intent(in) :: n
    • real(sp_acc) intent(in) :: x(n)
    • real(sp_acc) intent(in) :: y(n)
    • real(sp_acc) intent(out) :: d2(n)
    • real(sp_acc) intent(in), optional :: End1
    • real(sp_acc) intent(in), optional :: End2
  • rgbi3p(md, nxd, nyd, xd, yd, zd, nip, xi, yi, zi, ier, wk)
    Code converted using TO_F90 by Alan Miller Date: 2003-06-11 Time: 10:11:03 Rectangular-grid bivariate interpolation (a master subroutine of the RGBI3P/RGSF3P subroutine package) Hiroshi Akima U.S. Department of Commerce, NTIA/ITS Version of 1995/08 This subroutine performs interpolation of a bivariate function, z(x,y), on a rectangular grid in the x-y plane. It is based on the revised Akima method. In this subroutine, the interpolating function is a piecewise function composed of a set of bicubic (bivariate third-degree) polynomials, each applicable to a rectangle of the input grid in the x-y plane. Each polynomial is determined locally. This subroutine has the accuracy of a bicubic polynomial, i.e., it interpolates accurately when all data points lie on a surface of a bicubic polynomial. The grid lines can be unevenly spaced. The input arguments are MD = mode of computation = 1 for new XD, YD, or ZD data (default) = 2 for old XD, YD, and ZD data, NXD = number of the input-grid data points in the x coordinate (must be 2 or greater), NYD = number of the input-grid data points in the y coordinate (must be 2 or greater), XD = array of dimension NXD containing the x coordinates of the input-grid data points (must be in a monotonic increasing order), YD = array of dimension NYD containing the y coordinates of the input-grid data points (must be in a monotonic increasing order), ZD = two-dimensional array of dimension NXD*NYD containing the z(x,y) values at the input-grid data points, NIP = number of the output points at which interpolation of the z value is desired (must be 1 or greater), XI = array of dimension NIP containing the x coordinates of the output points, YI = array of dimension NIP containing the y coordinates of the output points. The output arguments are ZI = array of dimension NIP where the interpolated z values at the output points are to be stored, IER = error flag = 0 for no errors = 1 for NXD = 1 or less = 2 for NYD = 1 or less = 3 for identical XD values or XD values out of sequence = 4 for identical YD values or YD values out of sequence = 5 for NIP = 0 or less. N.B. The workspace has been removed from the argument list. WK = three dimensional array of dimension 3*NXD*NYD used internally as a work area. The very fisrt call to this subroutine and the call with a new XD, YD, and ZD array must be made with MD=1. The call with MD=2 must be preceded by another call with the same XD, YD, and ZD arrays. Between the call with MD = 2 and its preceding call, the WK array must not be disturbed. The constant in the PARAMETER statement below is NIPIMX = maximum number of output points to be processed at a time. The constant value has been selected empirically. This subroutine calls the RGPD3P, RGLCTN, and RGPLNL subroutines. Specification statements .. Parameters ..
    • integer intent(in) :: md
    • integer intent(in) :: nxd
    • integer intent(in) :: nyd
    • real(GI) intent(in) :: xd(nxd)
    • real(GI) intent(in) :: yd(nyd)
    • real(GI) intent(in) :: zd(nxd, nyd)
    • integer intent(in) :: nip
    • real(GI) intent(in) :: xi(nip)
    • real(GI) intent(in) :: yi(nip)
    • real(GI) intent(out) :: zi(nip)
    • integer intent(out) :: ier
    • real(GI) intent(inout) :: wk(3, nxd, nyd)
  • rglctn(nxd, nyd, xd, yd, nip, xi, yi, inxi, inyi)
    Location of the desired points in a rectangular grid (a supporting subroutine of the RGBI3P/RGSF3P subroutine package) Hiroshi Akima U.S. Department of Commerce, NTIA/ITS Version of 1995/08 This subroutine locates the desired points in a rectangular grid in the x-y plane. The grid lines can be unevenly spaced. The input arguments are NXD = number of the input-grid data points in the x coordinate (must be 2 or greater), NYD = number of the input-grid data points in the y coordinate (must be 2 or greater), XD = array of dimension NXD containing the x coordinates of the input-grid data points (must be in a monotonic increasing order), YD = array of dimension NYD containing the y coordinates of the input-grid data points (must be in a monotonic increasing order), NIP = number of the output points to be located (must be 1 or greater), XI = array of dimension NIP containing the x coordinates of the output points to be located, YI = array of dimension NIP containing the y coordinates of the output points to be located. The output arguments are INXI = integer array of dimension NIP where the interval numbers of the XI array elements are to be stored, INYI = integer array of dimension NIP where the interval numbers of the YI array elements are to be stored. The interval numbers are between 0 and NXD and between 0 and NYD, respectively. Specification statements .. Scalar Arguments ..
    • integer intent(in) :: nxd
    • integer intent(in) :: nyd
    • real(GI) intent(in) :: xd(nxd)
    • real(GI) intent(in) :: yd(nyd)
    • integer intent(in) :: nip
    • real(GI) intent(in) :: xi(nip)
    • real(GI) intent(in) :: yi(nip)
    • integer intent(out) :: inxi(nip)
    • integer intent(out) :: inyi(nip)
  • rgpd3p(nxd, nyd, xd, yd, zd, pdd)
    Partial derivatives of a bivariate function on a rectangular grid (a supporting subroutine of the RGBI3P/RGSF3P subroutine package) Hiroshi Akima U.S. Department of Commerce, NTIA/ITS Version of 1995/08 This subroutine estimates three partial derivatives, zx, zy, and zxy, of a bivariate function, z(x,y), on a rectangular grid in the x-y plane. It is based on the revised Akima method that has the accuracy of a bicubic polynomial. The input arguments are NXD = number of the input-grid data points in the x coordinate (must be 2 or greater), NYD = number of the input-grid data points in the y coordinate (must be 2 or greater), XD = array of dimension NXD containing the x coordinates of the input-grid data points (must be in a monotonic increasing order), YD = array of dimension NYD containing the y coordinates of the input-grid data points (must be in a monotonic increasing order), ZD = two-dimensional array of dimension NXD*NYD containing the z(x,y) values at the input-grid data points. The output argument is PDD = three-dimensional array of dimension 3*NXD*NYD, where the estimated zx, zy, and zxy values at the input-grid data points are to be stored. Specification statements .. Scalar Arguments ..
    • integer intent(in) :: nxd
    • integer intent(in) :: nyd
    • real(GI) intent(in) :: xd(nxd)
    • real(GI) intent(in) :: yd(nyd)
    • real(GI) intent(in) :: zd(nxd, nyd)
    • real(GI) intent(out) :: pdd(3, nxd, nyd)
  • rgplnl(nxd, nyd, xd, yd, zd, pdd, nip, xi, yi, inxi, inyi, zi)
    Polynomials for rectangular-grid bivariate interpolation and surface fitting (a supporting subroutine of the RGBI3P/RGSF3P subroutine package) Hiroshi Akima U.S. Department of Commerce, NTIA/ITS Version of 1995/08 This subroutine determines a polynomial in x and y for a rectangle of the input grid in the x-y plane and calculates the z value for the desired points by evaluating the polynomial for rectangular-grid bivariate interpolation and surface fitting. The input arguments are NXD = number of the input-grid data points in the x coordinate (must be 2 or greater), NYD = number of the input-grid data points in the y coordinate (must be 2 or greater), XD = array of dimension NXD containing the x coordinates of the input-grid data points (must be in a monotonic increasing order), YD = array of dimension NYD containing the y coordinates of the input-grid data points (must be in a monotonic increasing order), ZD = two-dimensional array of dimension NXD*NYD containing the z(x,y) values at the input-grid data points, PDD = three-dimensional array of dimension 3*NXD*NYD containing the estimated zx, zy, and zxy values at the input-grid data points, NIP = number of the output points at which interpolation is to be performed, XI = array of dimension NIP containing the x coordinates of the output points, YI = array of dimension NIP containing the y coordinates of the output points, INXI = integer array of dimension NIP containing the interval numbers of the input grid intervals in the x direction where the x coordinates of the output points lie, INYI = integer array of dimension NIP containing the interval numbers of the input grid intervals in the y direction where the y coordinates of the output points lie. The output argument is ZI = array of dimension NIP, where the interpolated z values at the output points are to be stored. Specification statements .. Scalar Arguments ..
    • integer intent(in) :: nxd
    • integer intent(in) :: nyd
    • real(GI) intent(in) :: xd(nxd)
    • real(GI) intent(in) :: yd(nyd)
    • real(GI) intent(in) :: zd(nxd, nyd)
    • real(GI) intent(in) :: pdd(3, nxd, nyd)
    • integer intent(in) :: nip
    • real(GI) intent(in) :: xi(nip)
    • real(GI) intent(in) :: yi(nip)
    • integer intent(in) :: inxi(nip)
    • integer intent(in) :: inyi(nip)
    • real(GI) intent(out) :: zi(nip)
  • rgsf3p(md, nxd, nyd, xd, yd, zd, nxi, xi, nyi, yi, zi, ier, wk)
    Rectangular-grid surface fitting (a master subroutine of the RGBI3P/RGSF3P subroutine package) Hiroshi Akima U.S. Department of Commerce, NTIA/ITS Version of 1995/08 This subroutine performs surface fitting by interpolating values of a bivariate function, z(x,y), on a rectangular grid in the x-y plane. It is based on the revised Akima method. In this subroutine, the interpolating function is a piecewise function composed of a set of bicubic (bivariate third-degree) polynomials, each applicable to a rectangle of the input grid in the x-y plane. Each polynomial is determined locally. This subroutine has the accuracy of a bicubic polynomial, i.e., it fits the surface accurately when all data points lie on a surface of a bicubic polynomial. The grid lines of the input and output data can be unevenly spaced. The input arguments are MD = mode of computation = 1 for new XD, YD, or ZD data (default) = 2 for old XD, YD, and ZD data, NXD = number of the input-grid data points in the x coordinate (must be 2 or greater), NYD = number of the input-grid data points in the y coordinate (must be 2 or greater), XD = array of dimension NXD containing the x coordinates of the input-grid data points (must be in a monotonic increasing order), YD = array of dimension NYD containing the y coordinates of the input-grid data points (must be in a monotonic increasing order), ZD = two-dimensional array of dimension NXD*NYD containing the z(x,y) values at the input-grid data points, NXI = number of output grid points in the x coordinate (must be 1 or greater), XI = array of dimension NXI containing the x coordinates of the output grid points, NYI = number of output grid points in the y coordinate (must be 1 or greater), YI = array of dimension NYI containing the y coordinates of the output grid points. The output arguments are ZI = two-dimensional array of dimension NXI*NYI, where the interpolated z values at the output grid points are to be stored, IER = error flag = 0 for no error = 1 for NXD = 1 or less = 2 for NYD = 1 or less = 3 for identical XD values or XD values out of sequence = 4 for identical YD values or YD values out of sequence = 5 for NXI = 0 or less = 6 for NYI = 0 or less. N.B. The workspace has been removed from the argument list. WK = three-dimensional array of dimension 3*NXD*NYD used internally as a work area. The very first call to this subroutine and the call with a new XD, YD, or ZD array must be made with MD=1. The call with MD=2 must be preceded by another call with the same XD, YD, and ZD arrays. Between the call with MD = 2 and its preceding call, the WK array must not be disturbed. The constant in the PARAMETER statement below is NIPIMX = maximum number of output points to be processed at a time. The constant value has been selected empirically. This subroutine calls the RGPD3P, RGLCTN, and RGPLNL subroutines. Specification statements .. Parameters ..
    • integer intent(in) :: md
    • integer intent(in) :: nxd
    • integer intent(in) :: nyd
    • real(GI) intent(in) :: xd(nxd)
    • real(GI) intent(in) :: yd(nyd)
    • real(GI) intent(in) :: zd(nxd, nyd)
    • integer intent(in) :: nxi
    • real(GI) intent(in) :: xi(nxi)
    • integer intent(in) :: nyi
    • real(GI) intent(in) :: yi(nyi)
    • real(GI) intent(out) :: zi(nxi, nyi)
    • integer intent(out) :: ier
    • real(GI) intent(inout) :: wk(3, nxd, nyd)
Functions
  • real(GI)
    z2f(xx1, xx2, zz0, zz1)
    • real(GI) intent(in) :: xx1
    • real(GI) intent(in) :: xx2
    • real(GI) intent(in) :: zz0
    • real(GI) intent(in) :: zz1
  • real(GI)
    z3f(xx1, xx2, xx3, zz0, zz1, zz2)
    • real(GI) intent(in) :: xx1
    • real(GI) intent(in) :: xx2
    • real(GI) intent(in) :: xx3
    • real(GI) intent(in) :: zz0
    • real(GI) intent(in) :: zz1
    • real(GI) intent(in) :: zz2