#include <functional>#include <memory_resource>#include <string>#include <nk/value/value.hpp>#include <nk/value/span.hpp>#include <nk/value/fn_handle.hpp>#include <tuple>Go to the source code of this file.
Classes | |
| struct | nk::builtin::PolyDiv |
| Result of polynomial division and deconvolution ([q, r] = polydiv(b, a)). More... | |
| struct | nk::builtin::PadeCoef |
| Padé approximation numerator and denominator polynomials. More... | |
| struct | nk::builtin::ResidueResult |
| Result of partial fraction expansion (residues, poles, direct term). More... | |
| struct | nk::builtin::MatchpairsResult |
| Result of linear assignment problem (matchpairs). More... | |
| struct | nk::builtin::InpolygonResult |
| Result of 2-D polygon inclusion test (inpolygon). More... | |
| struct | nk::builtin::PolyxpolyResult |
| Result of polygon intersection (polyxpoly). More... | |
Typedefs | |
| using | nk::builtin::FnHandle |
| MATLAB-style function-handle callback. | |
Functions | |
| Value | nk::builtin::roots (const Value &p, std::pmr::memory_resource *mr=nullptr) |
| Computes polynomial roots (roots(p)). | |
| Value | nk::builtin::poly (const Value &r, std::pmr::memory_resource *mr=nullptr) |
| Polynomial with specified roots or characteristic polynomial of a matrix. | |
| Value | nk::builtin::polyval (const Value &p, const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Evaluates polynomial p at points x via Horner's scheme. | |
| Value | nk::builtin::polyder (const Value &p, std::pmr::memory_resource *mr=nullptr) |
| Computes polynomial derivative (polyder(p)). | |
| std::tuple< Value, Value > | nk::builtin::polyder (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Computes derivative of polynomial quotient b / a ([q, d] = polyder(b, a)). | |
| Value | nk::builtin::polyint (const Value &p, double k=0.0, std::pmr::memory_resource *mr=nullptr) |
| Computes polynomial integral (polyint(p, k)). | |
| Value | nk::builtin::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 | nk::builtin::polyvalm (const Value &p, const Value &A, std::pmr::memory_resource *mr=nullptr) |
| Matrix polynomial evaluation (polyvalm(p, A)). | |
| Value | nk::builtin::poly_of_matrix (const Value &A, std::pmr::memory_resource *mr=nullptr) |
| Characteristic polynomial of square matrix (poly_of_matrix(A)). | |
| PadeCoef | nk::builtin::padecoef (double T, int N, std::pmr::memory_resource *mr=nullptr) |
| Padé approximation of time delay ([num, den] = padecoef(T, N)). | |
| PolyDiv | nk::builtin::polydiv (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Polynomial deconvolution and division ([q, r] = polydiv(b, a)). | |
| std::tuple< Value, Value, Value > | nk::builtin::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)). | |
| std::tuple< Value, Value > | nk::builtin::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)). | |
| ResidueResult | nk::builtin::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)). | |
| ResidueResult | nk::builtin::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 | nk::builtin::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 | nk::builtin::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 | nk::builtin::interp2 (const Value &x, const Value &y, 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 | nk::builtin::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 | nk::builtin::interp3 (const Value &X, const Value &Y, const Value &Z, 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 grid (interp3(X, Y, Z, V, Xq, Yq, Zq, method)). | |
| Value | nk::builtin::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 | nk::builtin::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)). | |
| Value | nk::builtin::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)). | |
| Value | nk::builtin::mkpp (const Value &breaks, const Value &coefs, std::pmr::memory_resource *mr=nullptr) |
| Constructs a piecewise polynomial structure (ppform). | |
| Value | nk::builtin::unmkpp (const Value &pp, std::pmr::memory_resource *mr=nullptr) |
| Extracts piecewise polynomial structure fields ([breaks, coefs, l, k, d] = unmkpp(pp)). | |
| Value | nk::builtin::ppval (const Value &pp, const Value &xq, std::pmr::memory_resource *mr=nullptr) |
| Evaluates a piecewise polynomial structure at query points xq. | |
| Value | nk::builtin::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)). | |
| std::tuple< Value, Value > | nk::builtin::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 | nk::builtin::del2 (const Value &u, double h=1.0, std::pmr::memory_resource *mr=nullptr) |
| Five-point discrete Laplacian / Laplace operator (del2(u, h)). | |
| Value | nk::builtin::trapz (const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Trapezoidal numerical integration with unit spacing (trapz(y)). | |
| Value | nk::builtin::trapz (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Trapezoidal numerical integration over coordinates x (trapz(x, y)). | |
| Value | nk::builtin::trapz (const Value &x, const Value &y, int dim, std::pmr::memory_resource *mr=nullptr) |
| Trapezoidal numerical integration along specified dimension (trapz(x, y, dim)). | |
| Value | nk::builtin::cumtrapz (const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration with unit spacing (cumtrapz(y)). | |
| Value | nk::builtin::cumtrapz (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration over coordinates x (cumtrapz(x, y)). | |
| Value | nk::builtin::cumtrapz (const Value &x, const Value &y, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration along dimension (cumtrapz(x, y, dim)). | |
| Value | nk::builtin::cumtrapzDim (const Value &y, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration with unit spacing along dimension (cumtrapz(y, dim)). | |
| Value | nk::builtin::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 | nk::builtin::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 | nk::builtin::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 | nk::builtin::polyarea (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Area of 2-D polygonal contour (polyarea(x, y)). | |
| Value | nk::builtin::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)). | |
| InpolygonResult | nk::builtin::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, xv, yv)). | |
| Value | nk::builtin::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)). | |
| PolyxpolyResult | nk::builtin::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, x2, y2)). | |
| MatchpairsResult | nk::builtin::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 | nk::builtin::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 | nk::builtin::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 | nk::builtin::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 | nk::builtin::griddata (const Value &x, const Value &y, const Value &v, const Value &xq, const Value &yq, const std::string &method, std::pmr::memory_resource *mr=nullptr) |
| Interpolates scattered 2-D data onto query points with specified method (griddata(x, y, v, xq, yq, method)). | |
| Value | nk::builtin::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 | nk::builtin::griddatan (const Value &Xv, const Value &vv, const Value &xi, const std::string &method, std::pmr::memory_resource *mr=nullptr) |
| N-D scattered data interpolation with method (griddatan(Xv, vv, xi, method)). | |
| Value | nk::builtin::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)). | |
| using nk::FnHandle |
MATLAB-style function-handle callback.
args carries the per-call inputs; outs is the caller-allocated output buffer (its .size() is the requested nargout). mr is the caller's memory resource — the callback should honour it when constructing the output Values so PMR allocation chains through. The callback fills outs[0..outs.size()).
Definition at line 54 of file fn_handle.hpp.