![]() |
NumCpp
2.16.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
|
Namespaces | |
| namespace | detail |
Data Structures | |
| class | SVD |
| Performs the singular value decomposition of a general matrix. More... | |
matrix cholesky decomposition A = L * L.transpose()
NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.cholesky.html#numpy.linalg.cholesky
| inMatrix | NdArray to be decomposed |
matrix determinant. NOTE: can get verrrrry slow for large matrices (order > 10)
SciPy Reference: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.det.html#scipy.linalg.det
| inArray |
| std::pair< NdArray< double >, NdArray< double > > nc::linalg::eig | ( | const NdArray< dtype > & | inA, |
| double | inTolerance = 1e-12 |
||
| ) |
Compute the eigen values and eigen vectors of a real symmetric matrix.
NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.linalg.eig.html#numpy.linalg.eig
| inA | Matrix for which the eigen values and eigen vectors will be computed, must be a real, symmetric MxM array |
| inTolerance | (default 1e-12) |
Compute the eigen values of a real symmetric matrix.
NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.linalg.eigvals.html
| inA | Matrix for which the eigen values and will be computed, must be a real, symmetric MxM array |
| inTolerance | (default 1e-12) |
| 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
| 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 |
matrix inverse
SciPy Reference: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html#scipy.linalg.inv
| inArray |
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
| inA | coefficient matrix |
| inB | Ordinate or "dependent variable" values. If b is two-dimensional, the least-squares solution is calculated for each of the K columns of b. |
| std::pair< NdArray< double >, NdArray< double > > nc::linalg::lu_decomposition | ( | const NdArray< dtype > & | inMatrix | ) |
matrix LU decomposition A = LU
| inMatrix | NdArray to be decomposed |
Raise a square matrix to the (integer) power n.
For positive integers n, the power is computed by repeated matrix squarings and matrix multiplications. If n == 0, the identity matrix of the same shape as M is returned. If n < 0, the inverse is computed and then raised to the abs(n).
NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.matrix_power.html#numpy.linalg.matrix_power
| inArray | |
| inPower |
Compute the dot product of two or more arrays in a single function call.
NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.multi_dot.html#numpy.linalg.multi_dot
| inList | list of arrays |
matrix psuedo-inverse
NumPy Reference: https://numpy.org/doc/stable/reference/generated/numpy.linalg.pinv.html
| inArray |
| std::tuple< NdArray< double >, NdArray< double >, NdArray< double > > nc::linalg::pivotLU_decomposition | ( | const NdArray< dtype > & | inMatrix | ) |
matrix pivot LU decomposition PA = LU
| inMatrix | NdArray to be decomposed |
Solve a linear matrix equation, or system of linear scalar equations. Computes the “exact” solution, x, of the well-determined, i.e., full rank, linear matrix equation ax = b.
https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
| inA | |
| inB |
| void nc::linalg::svd | ( | const NdArray< dtype > & | inArray, |
| NdArray< double > & | outU, | ||
| NdArray< double > & | outS, | ||
| NdArray< double > & | outVT | ||
| ) |
matrix svd
NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html#numpy.linalg.svd
| inArray | NdArray to be SVDed |
| outU | NdArray output U |
| outS | NdArray output S |
| outVT | NdArray output V transpose |