Liking cljdoc? Tell your friends :D
Clojure only.

fastmath.interpolation.linear


bilinearclj

(bilinear xs ys vss)

Creates a 2D bilinear interpolator on a rectangular grid.

Within each cell of the grid the value is a bilinear form of the four corner values.

Parameters:

  • xs (sequence of numbers): nodes along the first axis, finite and strictly increasing; at least 2 points.
  • ys (sequence of numbers): nodes along the second axis, finite and strictly increasing; at least 2 points.
  • vss (sequence of sequences): values, (count xs) rows with (count ys) values each; vss[i][j] is the value at (xs[i], ys[j]).

Returns a function f such that (f x y) or (f [x y]) returns the interpolated double value. It equals scipy.interpolate.RegularGridInterpolator with method='linear' and fill_value=None. Outside the grid f extrapolates linearly using the formula of the nearest (edge) cell.

Throws ex-info (with :type :invalid-input, :method :bilinear and a :property) when an axis has fewer than 2 points, contains NaN or an infinity, is not strictly increasing, or when the shape of vss does not match the axes (:shape-mismatch).

See also linear, fastmath.interpolation.cubic/cubic-2d.

Creates a 2D bilinear interpolator on a rectangular grid.

Within each cell of the grid the value is a bilinear form of the four corner values.

Parameters:

- `xs` (sequence of numbers): nodes along the first axis, finite and strictly increasing; at least 2 points.
- `ys` (sequence of numbers): nodes along the second axis, finite and strictly increasing; at least 2 points.
- `vss` (sequence of sequences): values, `(count xs)` rows with `(count ys)` values each; `vss[i][j]` is the value at `(xs[i], ys[j])`.

Returns a function `f` such that `(f x y)` or `(f [x y])` returns the interpolated `double` value. It equals `scipy.interpolate.RegularGridInterpolator` with `method='linear'` and `fill_value=None`. Outside the grid `f` extrapolates linearly using the formula of the nearest (edge) cell.

Throws `ex-info` (with `:type :invalid-input`, `:method :bilinear` and a `:property`) when an axis has fewer than 2 points, contains `NaN` or an infinity, is not strictly increasing, or when the shape of `vss` does not match the axes (`:shape-mismatch`).

See also [[linear]], [[fastmath.interpolation.cubic/cubic-2d]].
raw docstring

linearclj

(linear xs ys)

Creates a 1D piecewise linear interpolator.

Connects consecutive data points with straight line segments.

Parameters:

  • xs (sequence of numbers): nodes, finite and strictly increasing; at least 2 points.
  • ys (sequence of numbers): values, the same length as xs.

Returns a function f such that (f x) returns the interpolated double value at x. It equals numpy.interp inside the domain. Outside the domain f extrapolates linearly with the slope of the first or the last segment (like scipy.interpolate.interp1d with fill_value='extrapolate').

Throws ex-info (with :type :invalid-input, :method :linear and a :property) when the lengths differ, there are fewer than 2 points, xs contains NaN or an infinity, or xs is not strictly increasing (unsorted or duplicated).

See also fastmath.interpolation.cubic/cubic, fastmath.interpolation.monotone/monotone, bilinear.

Creates a 1D piecewise linear interpolator.

Connects consecutive data points with straight line segments.

Parameters:

- `xs` (sequence of numbers): nodes, finite and strictly increasing; at least 2 points.
- `ys` (sequence of numbers): values, the same length as `xs`.

Returns a function `f` such that `(f x)` returns the interpolated `double` value at `x`. It equals `numpy.interp` inside the domain. Outside the domain `f` extrapolates linearly with the slope of the first or the last segment (like `scipy.interpolate.interp1d` with `fill_value='extrapolate'`).

Throws `ex-info` (with `:type :invalid-input`, `:method :linear` and a `:property`) when the lengths differ, there are fewer than 2 points, `xs` contains `NaN` or an infinity, or `xs` is not strictly increasing (unsorted or duplicated).

See also [[fastmath.interpolation.cubic/cubic]], [[fastmath.interpolation.monotone/monotone]], [[bilinear]].
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close