|
fitpack
Modern Fortran library for curve and surface fitting with splines
|
Tensor-product gridded smoothing-spline fitter for any domain dimension. More...


Public Member Functions | |
| procedure | destroy (this) |
| Release all allocated storage and reset the fit state. | |
| procedure | new_points (this, xg, z, m, row_major, order) |
Load new gridded data. z is assumed-rank: a rank-d array (2 <= d <= MAX_IDIM) whose shape gives the per-axis point counts, or a flat rank-1 array with explicit m. | |
| procedure | new_fit (this, xg, z, m, row_major, order, smoothing) |
| Load new gridded data and perform a fit in one call. | |
| procedure | fit (this, smoothing, order) |
| Fit a smoothing spline with automatic knot placement (delegates to regrid). | |
| procedure | least_squares (this, smoothing, reset_knots) |
| Least-squares fit on the current knots (optionally recomputing them first). | |
| procedure | interpolate (this) |
| Interpolating fit (s = 0). | |
| procedure | eval_ongrid (this, xg, m, ierr) |
| Evaluate the fitted spline on a rectangular grid (delegates to ndspev). | |
| generic | eval (this, x, ierr) |
| Evaluate at scattered points x(i,d) (ndspeu). For gridded output use eval_ongrid. | |
| generic | eval (this, xp, ierr) |
| Evaluate the fitted spline at scattered points (delegates to ndspeu). | |
| procedure | dfdx_ongrid (this, xg, m, nu, ierr) |
| Partial derivatives of order nu(:) on a rectangular grid (parder) | |
| generic | dfdx (this, x, nu, ierr) |
| Partial derivatives of order nu(:) at scattered points (pardeu) | |
| generic | dfdx (this, xp, nu, ierr) |
Evaluate partial derivatives of order nu(:) at scattered points (delegates to pardeu). | |
| procedure | integral (this, lower, upper) |
| Integral over a box [lower(d),upper(d)] (dblint) | |
| procedure | cross_section (this, ax, u, ierr) |
| Cross-section: fix one axis to obtain a (dims-1)-D spline (profil) | |
| procedure | derivative_spline (this, nu, ierr) |
| Partial-derivative spline: reduced degrees, trimmed knots (pardtc) | |
| procedure | comm_size (this) |
| Parallel communication. | |
| procedure | comm_pack (this, buffer) |
| Pack the fitter into a communication buffer. | |
| procedure | comm_expand (this, buffer) |
| Expand the fitter from a communication buffer. | |
Public Member Functions inherited from fitpack_fitters::fitpack_fitter | |
| procedure, non_overridable | mse (this) |
| MSE accessor (shared by all types) | |
| procedure, non_overridable | core_comm_size (this) |
| Base field helpers for comm (non-overridable, called by subtypes) | |
| procedure, non_overridable | core_comm_pack (this, buffer) |
| Pack base fields into communication buffer. | |
| procedure, non_overridable | core_comm_expand (this, buffer) |
| Expand base fields from communication buffer. | |
| procedure, non_overridable | destroy_base (this) |
| Base field reset (called by subtype destroy methods) | |
| procedure(comm_size_if), deferred | comm_size (this) |
| Deferred communication interface. | |
| procedure(comm_pack_if), deferred | comm_pack (this, buffer) |
| procedure(comm_expand_if), deferred | comm_expand (this, buffer) |
Public Attributes | |
| integer(fp_dim) | dims = 0 |
| Domain (tensor) dimension, 1 <= dims <= MAX_IDIM. Metadata below is active over 1:dims. | |
| integer(fp_size), dimension(max_idim) | order = 3 |
| Per-axis spline degree. | |
| integer(fp_size), dimension(max_idim) | m = 0 |
| Per-axis point counts, estimated/actual knot counts. | |
| integer(fp_size), dimension(max_idim) | nest = 0 |
| integer(fp_size), dimension(max_idim) | knots = 0 |
| real(fp_real), dimension(max_idim) | left = zero |
| Per-axis domain boundaries. | |
| real(fp_real), dimension(max_idim) | right = zero |
| real(fp_real), dimension(:,:), allocatable | t |
| Bulk arrays (only these are allocatable). t(:,d)=knots on axis d; xg(:,d)=grid coords on axis d; z(:)=flat function values (row-major, axis 1 slowest). c/wrk/iwrk/fp are inherited. | |
| real(fp_real), dimension(:,:), allocatable | xg |
| real(fp_real), dimension(:), allocatable | z |
Public Attributes inherited from fitpack_fitters::fitpack_fitter | |
| integer(fp_flag) | iopt = IOPT_NEW_SMOOTHING |
| Fitting state flag. | |
| real(fp_real) | smoothing = 1000.0_FP_REAL |
| Smoothing parameter. | |
| real(fp_real) | fp = zero |
| Weighted sum of squared residuals. | |
| real(fp_real), dimension(:), allocatable | c |
| B-spline coefficients. | |
| integer(fp_size) | lwrk = 0 |
| Real workspace and its size. | |
| real(fp_real), dimension(:), allocatable | wrk |
| integer(fp_size) | liwrk = 0 |
| Integer workspace and its size. | |
| integer(fp_size), dimension(:), allocatable | iwrk |
Private Member Functions | |
| procedure, private | grid_eval_one (this, x, ierr) |
| Evaluate at scattered points x(i,d) (ndspeu). For gridded output use eval_ongrid. | |
| procedure, private | grid_eval_many (this, xp, ierr) |
| Evaluate the fitted spline at scattered points (delegates to ndspeu). | |
| procedure, private | grid_derivatives_one (this, x, nu, ierr) |
| Partial derivatives of order nu(:) at scattered points (pardeu) | |
| procedure, private | grid_derivatives_many (this, xp, nu, ierr) |
Evaluate partial derivatives of order nu(:) at scattered points (delegates to pardeu). | |
Tensor-product gridded smoothing-spline fitter for any domain dimension.
| procedure fitpack_gridded_splines::fitpack_gridded_spline::comm_expand | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_comm), dimension(:), intent(in) | buffer ) |
Expand the fitter from a communication buffer.
| procedure fitpack_gridded_splines::fitpack_gridded_spline::comm_pack | ( | class(fitpack_gridded_spline), intent(in) | this, |
| real(fp_comm), dimension(:), intent(out) | buffer ) |
Pack the fitter into a communication buffer.
| procedure fitpack_gridded_splines::fitpack_gridded_spline::comm_size | ( | class(fitpack_gridded_spline), intent(in) | this | ) |
Parallel communication.
| procedure fitpack_gridded_splines::fitpack_gridded_spline::cross_section | ( | class(fitpack_gridded_spline), intent(in) | this, |
| integer(fp_dim), intent(in) | ax, | ||
| real(fp_real), intent(in) | u, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Cross-section: fix one axis to obtain a (dims-1)-D spline (profil)
The result is a fully-formed, evaluable fitpack_gridded_spline over the surviving axes (in their original relative order). Like the 2-D cross_section it carries only the spline (knots/degrees/ coefficients/bounds), not a data grid, so it is eval-only.
| [in] | ax | Axis to fix, 1 <= ax <= dims (requires dims >= 2). |
| [in] | u | Value at which axis ax is fixed. |
| [out] | ierr | Optional error flag. |
| procedure fitpack_gridded_splines::fitpack_gridded_spline::derivative_spline | ( | class(fitpack_gridded_spline), intent(in) | this, |
| integer(fp_size), dimension(:), intent(in) | nu, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Partial-derivative spline: reduced degrees, trimmed knots (pardtc)
| procedure fitpack_gridded_splines::fitpack_gridded_spline::destroy | ( | class(fitpack_gridded_spline), intent(inout) | this | ) |
Release all allocated storage and reset the fit state.
| generic fitpack_gridded_splines::fitpack_gridded_spline::dfdx | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), dimension(:), intent(in) | x, | ||
| integer(fp_size), dimension(:), intent(in) | nu, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Partial derivatives of order nu(:) at scattered points (pardeu)

| generic fitpack_gridded_splines::fitpack_gridded_spline::dfdx | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), dimension(:,:), intent(in), contiguous | xp, | ||
| integer(fp_size), dimension(:), intent(in) | nu, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Evaluate partial derivatives of order nu(:) at scattered points (delegates to pardeu).
| [in] | xp | Point coordinates, xp(d,i) = axis-d coordinate of point i (shape (dims,m), point i = contiguous column xp(:,i)). |
| procedure fitpack_gridded_splines::fitpack_gridded_spline::dfdx_ongrid | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), dimension(:,:), intent(in) | xg, | ||
| integer(fp_size), dimension(:), intent(in) | m, | ||
| integer(fp_size), dimension(:), intent(in) | nu, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Partial derivatives of order nu(:) on a rectangular grid (parder)
| [in] | xg | Per-axis evaluation grids, xg(1:m(d),d) strictly increasing. |
| [in] | m | Per-axis grid sizes. |
| [in] | nu | Per-axis derivative orders, 0 <= nu(d) < order(d). |
| [out] | ierr | Optional error flag. |
product(m). | generic fitpack_gridded_splines::fitpack_gridded_spline::eval | ( | class(fitpack_gridded_spline), intent(in) | this, |
| real(fp_real), dimension(:), intent(in) | x, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Evaluate at scattered points x(i,d) (ndspeu). For gridded output use eval_ongrid.

| generic fitpack_gridded_splines::fitpack_gridded_spline::eval | ( | class(fitpack_gridded_spline), intent(in) | this, |
| real(fp_real), dimension(:,:), intent(in), contiguous | xp, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Evaluate the fitted spline at scattered points (delegates to ndspeu).
| [in] | xp | Point coordinates, xp(d,i) = axis-d coordinate of point i (shape (dims,m), point i = contiguous column xp(:,i); matches curev/parcur layout). |
| [out] | ierr | Optional error flag. |
m points. | procedure fitpack_gridded_splines::fitpack_gridded_spline::eval_ongrid | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), dimension(:,:), intent(in) | xg, | ||
| integer(fp_size), dimension(:), intent(in) | m, | ||
| integer(fp_flag), intent(out), optional | ierr ) |
Evaluate the fitted spline on a rectangular grid (delegates to ndspev).
| [in] | xg | Evaluation coordinates, xg(1:m(d),d) strictly increasing on axis d. |
| [in] | m | Per-axis evaluation-grid sizes. |
| [out] | ierr | Optional error flag. |
product(m). | procedure fitpack_gridded_splines::fitpack_gridded_spline::fit | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), intent(in), optional | smoothing, | ||
| integer(fp_size), intent(in), optional | order ) |
Fit a smoothing spline with automatic knot placement (delegates to regrid).
|
private |
Evaluate partial derivatives of order nu(:) at scattered points (delegates to pardeu).
| [in] | xp | Point coordinates, xp(d,i) = axis-d coordinate of point i (shape (dims,m), point i = contiguous column xp(:,i)). |
|
private |
Partial derivatives of order nu(:) at scattered points (pardeu)
|
private |
Evaluate the fitted spline at scattered points (delegates to ndspeu).
| [in] | xp | Point coordinates, xp(d,i) = axis-d coordinate of point i (shape (dims,m), point i = contiguous column xp(:,i); matches curev/parcur layout). |
| [out] | ierr | Optional error flag. |
m points.
|
private |
Evaluate at scattered points x(i,d) (ndspeu). For gridded output use eval_ongrid.
| procedure fitpack_gridded_splines::fitpack_gridded_spline::integral | ( | class(fitpack_gridded_spline), intent(in) | this, |
| real(fp_real), dimension(:), intent(in) | lower, | ||
| real(fp_real), dimension(:), intent(in) | upper ) |
Integral over a box [lower(d),upper(d)] (dblint)
| procedure fitpack_gridded_splines::fitpack_gridded_spline::interpolate | ( | class(fitpack_gridded_spline), intent(inout) | this | ) |
Interpolating fit (s = 0).
| procedure fitpack_gridded_splines::fitpack_gridded_spline::least_squares | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), intent(in), optional | smoothing, | ||
| logical, intent(in), optional | reset_knots ) |
Least-squares fit on the current knots (optionally recomputing them first).
| procedure fitpack_gridded_splines::fitpack_gridded_spline::new_fit | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), dimension(:,:), intent(in) | xg, | ||
| real(fp_real), dimension(..), intent(in) | z, | ||
| integer(fp_size), dimension(:), intent(in), optional | m, | ||
| logical(fp_bool), intent(in), optional | row_major, | ||
| integer(fp_size), intent(in), optional | order, | ||
| real(fp_real), intent(in), optional | smoothing ) |
Load new gridded data and perform a fit in one call.
| procedure fitpack_gridded_splines::fitpack_gridded_spline::new_points | ( | class(fitpack_gridded_spline), intent(inout) | this, |
| real(fp_real), dimension(:,:), intent(in) | xg, | ||
| real(fp_real), dimension(..), intent(in) | z, | ||
| integer(fp_size), dimension(:), intent(in), optional | m, | ||
| logical(fp_bool), intent(in), optional | row_major, | ||
| integer(fp_size), intent(in), optional | order ) |
Load new gridded data. z is assumed-rank: a rank-d array (2 <= d <= MAX_IDIM) whose shape gives the per-axis point counts, or a flat rank-1 array with explicit m.
| [in] | xg | Grid coordinates, xg(1:m(d),d) strictly increasing on axis d. |
| [in] | z | Function values (see the module header for the layout conventions). |
| [in] | m | Per-axis point counts; REQUIRED when z is rank-1, ignored otherwise. |
| [in] | row_major | Layout of a rank-d z (default .true.); see the module header. |
| [in] | order | Optional per-axis spline degree (scalar, applied to all axes). |
| integer(fp_dim) fitpack_gridded_splines::fitpack_gridded_spline::dims = 0 |
Domain (tensor) dimension, 1 <= dims <= MAX_IDIM. Metadata below is active over 1:dims.
Per-axis domain boundaries.
Per-axis point counts, estimated/actual knot counts.
Per-axis spline degree.
| real(fp_real), dimension(:,:), allocatable fitpack_gridded_splines::fitpack_gridded_spline::t |
| real(fp_real), dimension(:,:), allocatable fitpack_gridded_splines::fitpack_gridded_spline::xg |
| real(fp_real), dimension(:), allocatable fitpack_gridded_splines::fitpack_gridded_spline::z |