9#include <memory_resource>
11#include <nk/value/value.hpp>
12#include <nk/value/span.hpp>
13#include <nk/value/fn_handle.hpp>
15namespace nk::builtin {
57std::tuple<Value, Value>
polyder(
const Value &b,
const Value &a, std::pmr::memory_resource *mr =
nullptr);
137std::tuple<Value, Value, Value>
tf2zp(
const Value &b,
const Value &a, std::pmr::memory_resource *mr =
nullptr);
147std::tuple<Value, Value>
zp2tf(
const Value &z,
const Value &p,
double k, std::pmr::memory_resource *mr =
nullptr);
310std::tuple<Value, Value>
gradient2(
const Value &f,
double hx = 1.0,
double hy = 1.0, std::pmr::memory_resource *mr =
nullptr);
318Value del2(
const Value &u,
double h = 1.0, std::pmr::memory_resource *mr =
nullptr);
380Value integral(FnHandle fn,
double a,
double b,
double absTol = 1e-10, std::pmr::memory_resource *mr =
nullptr);
392Value integral2(FnHandle fn,
double a,
double b,
double c,
double d,
double absTol = 1e-10, std::pmr::memory_resource *mr =
nullptr);
406Value integral3(FnHandle fn,
double a,
double b,
double c,
double d,
double e,
double f,
double absTol = 1e-10, std::pmr::memory_resource *mr =
nullptr);
Core MATLAB-compatible multidimensional array and scalar value type.
Value polyint(const Value &p, double k=0.0, std::pmr::memory_resource *mr=nullptr)
Computes polynomial integral (polyint(p, k)).
Value spline(const Value &x, const Value &y, const Value &xq=Value(), std::pmr::memory_resource *mr=nullptr)
Cubic spline data interpolation (spline(x, y, xq)).
Value griddata(const Value &x, const Value &y, const Value &v, const Value &xq, const Value &yq, std::pmr::memory_resource *mr=nullptr)
Interpolates scattered 2-D data onto query points (griddata(x, y, v, xq, yq, method)).
Value pchip(const Value &x, const Value &y, const Value &xq=Value(), std::pmr::memory_resource *mr=nullptr)
Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) (pchip(x, y, xq)).
ResidueResult residue(const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr)
Partial fraction expansion (residues) in Laplace s-domain ([r, p, k] = residue(b, a)).
PadeCoef padecoef(double T, int N, std::pmr::memory_resource *mr=nullptr)
Padé approximation of time delay ([num, den] = padecoef(T, N)).
Value cumtrapz(const Value &y, std::pmr::memory_resource *mr=nullptr)
Cumulative trapezoidal numerical integration with unit spacing (cumtrapz(y)).
PolyxpolyResult polyxpoly(const Value &x1, const Value &y1, const Value &x2, const Value &y2, std::pmr::memory_resource *mr=nullptr)
Intersection points of polygonal lines or boundaries ([xi, yi] = polyxpoly(x1, y1,...
Value boundary(const Value &x, const Value &y, double shrink=0.5, std::pmr::memory_resource *mr=nullptr)
Computes boundary / alpha-shape around 2-D point cloud (boundary(x, y, shrink)).
Value convhull(const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr)
Computes 2-D convex hull of planar point set (convhull(x, y)).
Value mkpp(const Value &breaks, const Value &coefs, std::pmr::memory_resource *mr=nullptr)
Constructs a piecewise polynomial structure (ppform).
Value ppval(const Value &pp, const Value &xq, std::pmr::memory_resource *mr=nullptr)
Evaluates a piecewise polynomial structure at query points xq.
std::tuple< Value, Value > gradient2(const Value &f, double hx=1.0, double hy=1.0, std::pmr::memory_resource *mr=nullptr)
Numerical 2-D gradient along rows and columns ([fx, fy] = gradient(f, hx, hy)).
Value interp1(const Value &x, const Value &v, const Value &xq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr)
1-D table lookup and data interpolation (interp1(x, v, xq, method)).
Value integral3(FnHandle fn, double a, double b, double c, double d, double e, double f, double absTol=1e-10, std::pmr::memory_resource *mr=nullptr)
Numerical 3-D triple integration over cuboid region (integral3(fn, a, b, c, d, e, f)).
Value polyarea(const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr)
Area of 2-D polygonal contour (polyarea(x, y)).
Value histcounts2(const Value &x, const Value &y, const Value &xedgesV, const Value &yedgesV, std::pmr::memory_resource *mr=nullptr)
Computes 2-D bivariate histogram bin counts (histcounts2(x, y, xedges, yedges)).
Value inpolygon(const Value &xq, const Value &yq, const Value &xv, const Value &yv, std::pmr::memory_resource *mr=nullptr)
Tests if 2-D query points are inside polygonal region (inpolygon(xq, yq, xv, yv)).
Value interp2(const Value &V, const Value &Xq, const Value &Yq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr)
2-D data interpolation on a grid (interp2(x, y, v, xq, yq, method)).
Value integral2(FnHandle fn, double a, double b, double c, double d, double absTol=1e-10, std::pmr::memory_resource *mr=nullptr)
Numerical 2-D double integration over rectangular region (integral2(fn, a, b, c, d)).
Value integral(FnHandle fn, double a, double b, double absTol=1e-10, std::pmr::memory_resource *mr=nullptr)
Numerical 1-D adaptive quadrature integration (integral(fn, a, b)).
Value polyder(const Value &p, std::pmr::memory_resource *mr=nullptr)
Computes polynomial derivative (polyder(p)).
InpolygonResult inpolygon2(const Value &xq, const Value &yq, const Value &xv, const Value &yv, std::pmr::memory_resource *mr=nullptr)
Tests points inside and on edge of 2-D polygonal region ([in, on] = inpolygon(xq, yq,...
Value griddatan(const Value &Xv, const Value &vv, const Value &xi, std::pmr::memory_resource *mr=nullptr)
N-D scattered data interpolation (griddatan(Xv, vv, xi, method)).
Value del2(const Value &u, double h=1.0, std::pmr::memory_resource *mr=nullptr)
Five-point discrete Laplacian / Laplace operator (del2(u, h)).
Value trapz(const Value &y, std::pmr::memory_resource *mr=nullptr)
Trapezoidal numerical integration with unit spacing (trapz(y)).
Value interp3(const Value &V, const Value &Xq, const Value &Yq, const Value &Zq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr)
3-D data interpolation on a uniform grid (interp3(V, Xq, Yq, Zq, method)).
Value polyfit(const Value &x, const Value &y, int n, std::pmr::memory_resource *mr=nullptr)
Polynomial least-squares curve fitting (polyfit(x, y, n)).
Value polyvalm(const Value &p, const Value &A, std::pmr::memory_resource *mr=nullptr)
Matrix polynomial evaluation (polyvalm(p, A)).
Value unmkpp(const Value &pp, std::pmr::memory_resource *mr=nullptr)
Extracts piecewise polynomial structure fields ([breaks, coefs, l, k, d] = unmkpp(pp)).
Value gradient(const Value &f, double h=1.0, std::pmr::memory_resource *mr=nullptr)
Numerical gradient of 1-D array or uniform multi-dimensional array (gradient(f, h)).
Value makima(const Value &x, const Value &y, const Value &xq, std::pmr::memory_resource *mr=nullptr)
Modified Akima cubic Hermite interpolation (makima(x, y, xq)).
PolyDiv polydiv(const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr)
Polynomial deconvolution and division ([q, r] = polydiv(b, a)).
Value poly_of_matrix(const Value &A, std::pmr::memory_resource *mr=nullptr)
Characteristic polynomial of square matrix (poly_of_matrix(A)).
MatchpairsResult matchpairs(const Value &C, double cU, const std::string &mode="min", std::pmr::memory_resource *mr=nullptr)
Solves linear sum assignment problem with cost threshold (matchpairs(C, cU, mode)).
Value cumtrapzDim(const Value &y, int dim, std::pmr::memory_resource *mr=nullptr)
Cumulative trapezoidal numerical integration with unit spacing along dimension (cumtrapz(y,...
std::tuple< Value, Value > zp2tf(const Value &z, const Value &p, double k, std::pmr::memory_resource *mr=nullptr)
Zero-pole-gain to transfer function conversion ([b, a] = zp2tf(z, p, k)).
std::tuple< Value, Value, Value > tf2zp(const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr)
Transfer function to zero-pole-gain conversion ([z, p, k] = tf2zp(b, a)).
Value poly(const Value &r, std::pmr::memory_resource *mr=nullptr)
Polynomial with specified roots or characteristic polynomial of a matrix.
ResidueResult residuez(const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr)
Partial fraction expansion in Z-domain ([r, p, k] = residuez(b, a)).
Value roots(const Value &p, std::pmr::memory_resource *mr=nullptr)
Computes polynomial roots (roots(p)).
Value delaunay(const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr)
2-D Delaunay triangulation of planar point set (delaunay(x, y)).
Value polyval(const Value &p, const Value &x, std::pmr::memory_resource *mr=nullptr)
Evaluates polynomial p at points x via Horner's scheme.
Result of 2-D polygon inclusion test (inpolygon).
Value in
Logical array of points inside polygon.
Value on
Logical array of points on polygon boundary.
Result of linear assignment problem (matchpairs).
Value uR
Unmatched row indices.
Value uC
Unmatched column indices.
Value M
Matched index pairs [row, col].
Padé approximation numerator and denominator polynomials.
Value num
Numerator polynomial coefficients.
Value den
Denominator polynomial coefficients.
Result of polynomial division and deconvolution ([q, r] = polydiv(b, a)).
Value q
Quotient polynomial coefficients.
Value r
Remainder polynomial coefficients.
Result of polygon intersection (polyxpoly).
Value xi
Intersection x-coordinates.
Value segments
Intersection line segments.
Value yi
Intersection y-coordinates.
Result of partial fraction expansion (residues, poles, direct term).
Value p
Vector of complex poles.
Value r
Vector of complex residues.
Value k
Vector of direct term polynomial coefficients.