nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
spline.hpp
Go to the documentation of this file.
1
3// toolboxes/stats/include/nk/stats/spline/spline.hpp
4//
5// Knot-manipulation primitives and pp-form splines.
6
7#pragma once
8
9#include <memory_resource>
10#include <nk/value/value.hpp>
11
12#include <string>
13#include <tuple>
14
15namespace nk::stats {
16
19
20
31Value aveknt(const Value &t, int k, std::pmr::memory_resource *mr = nullptr);
32
43Value augknt(const Value &knots, int k,
44 std::pmr::memory_resource *mr = nullptr);
45
56Value brk2knt(const Value &breaks, const Value &mults,
57 std::pmr::memory_resource *mr = nullptr);
58
68std::tuple<Value, Value>
69knt2brk(const Value &knots, std::pmr::memory_resource *mr = nullptr);
70
83Value ppmak(const Value &breaks, const Value &coefs, int d,
84 std::pmr::memory_resource *mr = nullptr);
85
96Value fnval(const Value &pp, const Value &x,
97 std::pmr::memory_resource *mr = nullptr);
98
109Value fnder(const Value &pp, int order,
110 std::pmr::memory_resource *mr = nullptr);
111
121Value fnint(const Value &pp, std::pmr::memory_resource *mr = nullptr);
122
133Value csapi(const Value &x, const Value &y,
134 std::pmr::memory_resource *mr = nullptr);
135
146Value fnbrk(const Value &pp, const std::string &part,
147 std::pmr::memory_resource *mr = nullptr);
148
165Value fncmb(const Value &pp1, double c1,
166 const Value &pp2 = Value::Empty, double c2 = 0.0,
167 std::pmr::memory_resource *mr = nullptr);
168
169
171} // namespace nk::stats
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
static const Value Empty
MATLAB-style empty matrix sentinel — a 0×0 DOUBLE value.
Definition value.hpp:136
Value csapi(const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr)
Not-a-knot cubic spline interpolation (pp = csapi(x, y)).
Value fncmb(const Value &pp1, double c1, const Value &pp2=Value::Empty, double c2=0.0, std::pmr::memory_resource *mr=nullptr)
Combine pp-form splines linearly (pp = fncmb(pp1, c1, pp2, c2)).
std::tuple< Value, Value > knt2brk(const Value &knots, std::pmr::memory_resource *mr=nullptr)
Decompose knot vector ([breaks, mults] = knt2brk(knots)).
Value ppmak(const Value &breaks, const Value &coefs, int d, std::pmr::memory_resource *mr=nullptr)
Piecewise-polynomial constructor (pp = ppmak(breaks, coefs, d)).
Value aveknt(const Value &t, int k, std::pmr::memory_resource *mr=nullptr)
Greville knot averages (a = aveknt(t, k)).
Value fnder(const Value &pp, int order, std::pmr::memory_resource *mr=nullptr)
Differentiate a pp-form spline (dpp = fnder(pp, order)).
Value fnbrk(const Value &pp, const std::string &part, std::pmr::memory_resource *mr=nullptr)
Extract a named field from a pp-form spline (v = fnbrk(pp, part)).
Value fnint(const Value &pp, std::pmr::memory_resource *mr=nullptr)
Antiderivative of a pp-form spline (ipp = fnint(pp)).
Value augknt(const Value &knots, int k, std::pmr::memory_resource *mr=nullptr)
Augment knot sequence (aug = augknt(knots, k)).
Value fnval(const Value &pp, const Value &x, std::pmr::memory_resource *mr=nullptr)
Evaluate a pp-form spline (y = fnval(pp, x)).
Value brk2knt(const Value &breaks, const Value &mults, std::pmr::memory_resource *mr=nullptr)
Replicate breaks by multiplicities (t = brk2knt(breaks, mults)).