Skip to main content

Numerical

The Numerical namespaces provide a collection of high-performance functions for linear algebra operations, including LU, QR, and SVD decompositions. These tools are essential for solving linear systems, computing matrix inverses, and performing numerical analysis in graphics, simulation, and scientific computing. Each algorithm is designed with a strong emphasis on numerical stability, computational efficiency, and flexibility for use with custom matrix and vector types.

#include <math/TellusimNumerical.h>

LU

The LU namespace provides functions for performing LU Decomposition, which decomposes a matrix A into the product of a lower triangular matrix L and an upper triangular matrix U. LU Decomposition is used for solving linear systems, matrix inversion, and computing the determinant of a matrix.

Computes A = l * u decomposition.

bool decompose(const MatrixNxM<N, N> &a, MatrixNxM<N, N> &lu, VectorN<uint32_t, N> &indices, Type threshold = 0.0f)
bool decompose(const MatrixNxM<N, N> &a, MatrixNxM<N, N> &l, MatrixNxM<N, N> &u, Type threshold = 0.0f)

Computes x vector for A * x = b equation.

VectorN<N> solve(const MatrixNxM<N, N> &lu, const VectorN<uint32_t, N> &indices, const VectorN<N> &b)

Matrix inversion.

MatrixNxM<N, N> inverse(const MatrixNxM<N, N> &lu, const VectorN<uint32_t, N> &indices)
MatrixNxM<N, N> inverse(const MatrixNxM<N, N> &m)

QR

The QR namespace provides methods for performing QR Decomposition, which factorizes a matrix A into an orthogonal matrix Q and an upper triangular matrix R. QR Decomposition is commonly used in solving linear systems of equations, eigenvalue problems, and least squares fitting.

Computes A = q * r decomposition.

bool decompose(const MatrixNxM<N, N> &a, MatrixNxM<N, N> &qr, VectorN<N> &c, VectorN<N> &d)
bool decompose(const MatrixNxM<N, N> &a, MatrixNxM<N, N> &q, MatrixNxM<N, N> &r)

Computes x vector for A * x = b equation.

VectorN<N> solve(const MatrixNxM<N, N> &qr, const VectorN<N> &c, const VectorN<N> &d, const VectorN<N> &b)

Matrix inversion.

MatrixNxM<N, N> inverse(const MatrixNxM<N, N> &qr, const VectorN<N> &c, const VectorN<N> &d)
MatrixNxM<N, N> inverse(const MatrixNxM<N, N> &m)

SVD

The SVD namespace provides a set of functions to perform Singular Value Decomposition (SVD), solve systems of linear equations, and compute matrix inverses based on the SVD. SVD is a factorization method used in many linear algebra and signal processing applications, which decomposes a matrix into three components: two orthogonal matrices U and V and a diagonal matrix of singular values W. This factorization is crucial for solving linear systems, matrix inversions, and understanding the properties of matrices.

Computes A = u * diagonal(w) * transpose(v) matrix decomposition.

bool decompose(const MatrixNxM<N, M> &a, MatrixNxM<N, M> &u, VectorN<N> &w, MatrixNxM<N, N> &v)

Computes x vector for A * x = b equation.

VectorN<N> solve(const MatrixNxM<N, M> &u, const VectorN<N> &w, const MatrixNxM<N, N> &v, const VectorN<M> &b, Type threshold = 1e-6f)

Computes v * diagonal(1/w) * transpose(u) matrix.

MatrixNxM<N, N> inverse(const MatrixNxM<N, N> &u, const VectorN<N> &w, const MatrixNxM<N, N> &v, Type threshold = 1e-6f)
MatrixNxM<N, N> inverse(const MatrixNxM<N, N> &m, Type threshold = 1e-6f)