|
template<typename dtype > |
NdArray< double > | cholesky (const NdArray< dtype > &inMatrix) |
|
template<typename dtype > |
auto | det (const NdArray< dtype > &inArray) |
|
template<typename dtype , typename... Params, std::enable_if_t< std::is_arithmetic_v< dtype >, int > = 0, std::enable_if_t< all_arithmetic_v< Params... >, int > = 0, std::enable_if_t< all_same_v< dtype, Params... >, int > = 0> |
std::pair< NdArray< double >, double > | gaussNewtonNlls (const uint32 numIterations, const NdArray< dtype > &coordinates, const NdArray< dtype > &measurements, const std::function< dtype(const NdArray< dtype > &, const NdArray< dtype > &)> &function, const std::array< std::function< dtype(const NdArray< dtype > &, const NdArray< dtype > &)>, sizeof...(Params)> &derivatives, Params... initialGuess) |
|
template<typename dtype > |
NdArray< dtype > | hat (const NdArray< dtype > &inVec) |
|
NdArray< double > | hat (const Vec3 &inVec) |
|
template<typename dtype > |
NdArray< dtype > | hat (dtype inX, dtype inY, dtype inZ) |
|
template<typename dtype > |
NdArray< double > | inv (const NdArray< dtype > &inArray) |
|
template<typename dtype > |
NdArray< double > | lstsq (const NdArray< dtype > &inA, const NdArray< dtype > &inB, double inTolerance=1e-12) |
|
template<typename dtype > |
std::pair< NdArray< double >, NdArray< double > > | lu_decomposition (const NdArray< dtype > &inMatrix) |
|
template<typename dtype > |
NdArray< double > | matrix_power (const NdArray< dtype > &inArray, int16 inPower) |
|
template<typename dtype > |
NdArray< dtype > | multi_dot (const std::initializer_list< NdArray< dtype >> &inList) |
|
template<typename dtype > |
NdArray< double > | pinv (const NdArray< dtype > &inArray) |
|
template<typename dtype > |
std::tuple< NdArray< double >, NdArray< double >, NdArray< double > > | pivotLU_decomposition (const NdArray< dtype > &inMatrix) |
|
template<typename dtype > |
NdArray< double > | solve (const NdArray< dtype > &inA, const NdArray< dtype > &inB) |
|
template<typename dtype > |
void | svd (const NdArray< dtype > &inArray, NdArray< double > &outU, NdArray< double > &outS, NdArray< double > &outVt) |
|
template<typename dtype , typename... Params, std::enable_if_t< std::is_arithmetic_v< dtype >, int > = 0, std::enable_if_t< all_arithmetic_v< Params... >, int > = 0, std::enable_if_t< all_same_v< dtype, Params... >, int > = 0>
std::pair<NdArray<double>, double> nc::linalg::gaussNewtonNlls |
( |
const uint32 |
numIterations, |
|
|
const NdArray< dtype > & |
coordinates, |
|
|
const NdArray< dtype > & |
measurements, |
|
|
const std::function< dtype(const NdArray< dtype > &, const NdArray< dtype > &)> & |
function, |
|
|
const std::array< std::function< dtype(const NdArray< dtype > &, const NdArray< dtype > &)> |
, |
|
|
sizeof... |
Params, |
|
|
& |
derivatives, |
|
|
Params... |
initialGuess |
|
) |
| |
The Gauss�Newton algorithm is used to solve non-linear least squares problems. It is a modification of Newton's method for finding a minimum of a function. https://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm
- Parameters
-
numIterations | the number of iterations to perform |
coordinates | the coordinate values. The shape needs to be [n x d], where d is the number of diminsions of the fit function (f(x) is one dimensional, f(x, y) is two dimensions, etc), and n is the number of observations that are being fit to. |
measurements | the measured values that are being fit |
function | a std::function of the function that is being fit. The function takes as inputs an NdArray of a single set of the coordinate values, and an NdArray of the current values of the fit parameters |
derivatives | array of std::functions to calculate the function derivatives. The function that is being fit. The function takes as inputs an NdArray of a single set of the coordinate values, and an NdArray of the current values of the fit parameters |
initialGuess | the initial guess of the parameters to be solved for |
- Returns
- std::pair of NdArray of solved parameter values, and rms of the residuals value
- Examples
- GaussNewtonNlls.cpp.
template<typename dtype >
NdArray<double> nc::linalg::lstsq |
( |
const NdArray< dtype > & |
inA, |
|
|
const NdArray< dtype > & |
inB, |
|
|
double |
inTolerance = 1e-12 |
|
) |
| |
Solves the equation a x = b by computing a vector x that minimizes the Euclidean 2-norm || b - a x ||^2. The equation may be under-, well-, or over- determined (i.e., the number of linearly independent rows of a can be less than, equal to, or greater than its number of linearly independent columns). If a is square and of full rank, then x (but for round-off error) is the "exact" solution of the equation.
SciPy Reference: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.lstsq.html#scipy.linalg.lstsq
- Parameters
-
inA | coefficient matrix |
inB | Ordinate or "dependent variable" values |
inTolerance | (default 1e-12) |
- Returns
- NdArray
- Examples
- ReadMe.cpp.