nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
numerics.hpp
Go to the documentation of this file.
1
3
// toolboxes/control/include/nk/control/internal/numerics.hpp
4
//
5
// Shared numerical kernels for toolboxes/control. All matrices are stored
6
// column-major in flat std::vector<double>.
7
//
8
// This header is INTERNAL — only toolboxes/control TUs include it. The
9
// kernels were originally inline-duplicated in response/discretize/
10
// freq/lyapunov/state, leading to ~4× the LU code, 2× the expm code
11
// and 2× the Faddeev char-poly code. Cycle 44 of the autonomous
12
// /loop consolidates them here. No behavioural change.
13
14
#pragma once
15
16
#include <cstddef>
17
#include <vector>
18
19
namespace
nk::control::internal {
20
23
24
25
using
Mat = std::vector<double>;
26
using
Vec = std::vector<double>;
27
41
bool
solveInPlace
(Mat &A, Mat &B, std::size_t n, std::size_t nrhs);
42
54
Mat
expm
(
const
Mat &A, std::size_t n);
55
68
Vec
charPoly
(
const
Mat &A, std::size_t n);
69
76
Mat
matmulSq
(
const
Mat &A,
const
Mat &B, std::size_t n);
77
78
80
}
// namespace nk::control::internal
nk::control::internal::solveInPlace
bool solveInPlace(Mat &A, Mat &B, std::size_t n, std::size_t nrhs)
In-place partial-pivot LU decomposition + back-substitution.
nk::control::internal::expm
Mat expm(const Mat &A, std::size_t n)
Matrix exponential via the canonical [6/6] Padé approximant with scaling and squaring.
nk::control::internal::matmulSq
Mat matmulSq(const Mat &A, const Mat &B, std::size_t n)
Square matrix multiply C = A·B (all n×n column-major).
nk::control::internal::charPoly
Vec charPoly(const Mat &A, std::size_t n)
Faddeev–LeVerrier characteristic polynomial of an n×n column-major matrix.
src
toolboxes
control
include
nk
control
internal
numerics.hpp
Generated by
1.17.0