Bicubic Hermite interpolation on a rectilinear grid.
Every grid cell is a C1 bicubic patch defined by the values, the first partial derivatives and the mixed derivative at its four corners. The derivatives are estimated from the grid values by finite differences.
Bicubic Hermite interpolation on a rectilinear grid. Every grid cell is a C1 bicubic patch defined by the values, the first partial derivatives and the mixed derivative at its four corners. The derivatives are estimated from the grid values by finite differences.
(bicubic xs ys vss)Creates a C1 bicubic Hermite interpolator of values given on a rectilinear grid.
The surface passes through all grid values. Every cell is a bicubic patch built from the values, the first partial derivatives fx, fy and the mixed derivative fxy at its corners. Derivatives are estimated by finite differences of the grid values (nonuniform spacing is supported):
fx = (f[i+1] - f[i-1]) / (x[i+1] - x[i-1]) and the same for fy; fxy is the product of both differences. This is the rule of Apache Commons Math BicubicInterpolator.The result is continuous with continuous first derivatives (C1) across the cell borders, the second derivatives jump. It reproduces exactly every function a + b x + c y + d x y on all cells including the border cells and the extrapolation.
Parameters:
xs (sequence of numbers): nodes of the first axis, at least 2, strictly increasing and finiteys (sequence of numbers): nodes of the second axis, at least 2, strictly increasing and finitevss (sequence of sequences of numbers): values, vss[i][j] is the value at (xs[i], ys[j]); count xs rows of count ys values each. NaN or infinite values make the cells around the node NaNReturns a function of two arguments (f x y) or one vector argument (f [x y]). Outside the grid the patch of the nearest border cell is continued (extrapolation, no exception, which differs from OutOfRangeException of the Apache implementation). NaN coordinates give NaN.
A grid of 2 x 2 points gives the bilinear interpolation. Throws ex-info (:type :invalid-input) when an axis has less than two nodes, is not finite or not strictly increasing, or when vss does not have the shape count xs times count ys.
See also fastmath.interpolation.cubic/cubic-2d (natural tensor spline, C2), fastmath.interpolation/bilinear.
Creates a C1 bicubic Hermite interpolator of values given on a rectilinear grid. The surface passes through all grid values. Every cell is a bicubic patch built from the values, the first partial derivatives `fx`, `fy` and the mixed derivative `fxy` at its corners. Derivatives are estimated by finite differences of the grid values (nonuniform spacing is supported): - interior nodes: central differences between the two neighbours, `fx = (f[i+1] - f[i-1]) / (x[i+1] - x[i-1])` and the same for `fy`; `fxy` is the product of both differences. This is the rule of Apache Commons Math `BicubicInterpolator`. - boundary nodes: second order one-sided three point differences on the actual spacing, instead of zero derivatives, so the cells at the border are as accurate as the inner ones. - an axis with two nodes: the secant of the two values. The result is continuous with continuous first derivatives (C1) across the cell borders, the second derivatives jump. It reproduces exactly every function `a + b x + c y + d x y` on all cells including the border cells and the extrapolation. Parameters: - `xs` (sequence of numbers): nodes of the first axis, at least `2`, strictly increasing and finite - `ys` (sequence of numbers): nodes of the second axis, at least `2`, strictly increasing and finite - `vss` (sequence of sequences of numbers): values, `vss[i][j]` is the value at `(xs[i], ys[j])`; `count xs` rows of `count ys` values each. `NaN` or infinite values make the cells around the node `NaN` Returns a function of two arguments `(f x y)` or one vector argument `(f [x y])`. Outside the grid the patch of the nearest border cell is continued (extrapolation, no exception, which differs from `OutOfRangeException` of the Apache implementation). `NaN` coordinates give `NaN`. A grid of `2 x 2` points gives the bilinear interpolation. Throws `ex-info` (`:type :invalid-input`) when an axis has less than two nodes, is not finite or not strictly increasing, or when `vss` does not have the shape `count xs` times `count ys`. See also [[fastmath.interpolation.cubic/cubic-2d]] (natural tensor spline, C2), [[fastmath.interpolation/bilinear]].
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |