|
| Matrix () |
| Construct a new MxN matrix without initializing it. More...
|
|
| Matrix (T value) |
| Initialize the matrix with constant entries. More...
|
|
| Matrix (const T _m[M][N]) |
| Initialize the matrix from a given MxN array. More...
|
|
| Matrix (const T _m[M *N]) |
| Initialize the matrix from a given (flat) MxN array in row-major order. More...
|
|
| Matrix (Stream *stream) |
| Unserialize a matrix from a stream. More...
|
|
| Matrix (const Matrix &mtx) |
| Copy constructor. More...
|
|
void | setIdentity () |
| Initialize with the identity matrix. More...
|
|
void | setZero () |
| Initialize with zeroes. More...
|
|
T & | operator() (int i, int j) |
| Indexing operator. More...
|
|
const T & | operator() (int i, int j) const |
| Indexing operator (const verions) More...
|
|
bool | operator== (const Matrix &mat) const |
| Equality operator. More...
|
|
bool | operator!= (const Matrix &mat) const |
| Inequality operator. More...
|
|
Matrix & | operator= (const Matrix &mat) |
| Assignment operator. More...
|
|
Matrix | operator+ (const Matrix &mat) const |
| Matrix addition (returns a temporary) More...
|
|
Matrix | operator+ (T value) const |
| Matrix-scalar addition (returns a temporary) More...
|
|
const Matrix & | operator+= (const Matrix &mat) |
| Matrix addition. More...
|
|
const Matrix & | operator+= (T value) |
| Matrix-scalar addition. More...
|
|
Matrix | operator- (const Matrix &mat) const |
| Matrix subtraction (returns a temporary) More...
|
|
Matrix | operator- (T value) const |
| Matrix-scalar subtraction (returns a temporary) More...
|
|
const Matrix & | operator-= (const Matrix &mat) |
| Matrix subtraction. More...
|
|
const Matrix & | operator- (T value) |
| Matrix-scalar subtraction. More...
|
|
const Matrix & | operator-= (T value) |
| Matrix-scalar addition. More...
|
|
Matrix | operator- () const |
| Component-wise negation. More...
|
|
Matrix | operator* (T value) const |
| Scalar multiplication (creates a temporary) More...
|
|
const Matrix & | operator*= (T value) |
| Scalar multiplication. More...
|
|
Matrix | operator/ (T value) const |
| Scalar division (creates a temporary) More...
|
|
const Matrix & | operator/= (T value) |
| Scalar division. More...
|
|
const Matrix & | operator*= (const Matrix &mat) |
| Matrix multiplication (for square matrices) More...
|
|
Float | trace () const |
| Compute the trace of a square matrix. More...
|
|
Float | frob () const |
| Compute the Frobenius norm. More...
|
|
bool | lu (Matrix &LU, int piv[M], int &pivsign) const |
| Compute the LU decomposition of a matrix. More...
|
|
bool | chol (Matrix &L) const |
|
template<int K> |
void | cholSolve (const Matrix< M, K, T > &B, Matrix< M, K, T > &X) const |
|
template<int K> |
void | luSolve (const Matrix< M, K, T > &B, Matrix< M, K, T > &X, int piv[M]) const |
|
T | luDet (int pivsign) const |
| Compute the determinant of a decomposed matrix created by lu() More...
|
|
T | cholDet () const |
| Compute the determinant of a decomposed matrix created by chol() More...
|
|
bool | isZero () const |
| Check if the matrix is identically zero. More...
|
|
bool | isIdentity () const |
| Test if this is the identity matrix. More...
|
|
T | det () const |
| Compute the determinant of a square matrix (internally creates a LU decomposition) More...
|
|
bool | invert (Matrix &target) const |
| Compute the inverse of a square matrix using the Gauss-Jordan algorithm. More...
|
|
void | symEig (Matrix &Q, T d[M]) const |
| Perform a symmetric eigendecomposition of a square matrix into Q and D. More...
|
|
void | transpose (Matrix< N, M, T > &target) const |
| Compute the transpose of this matrix. More...
|
|
void | serialize (Stream *stream) const |
| Serialize the matrix to a stream. More...
|
|
std::string | toString () const |
| Return a string representation. More...
|
|
template<int K> |
void | cholSolve (const Matrix< M, K, T > &B, Matrix< M, K, T > &X) const |
|
template<int K> |
void | luSolve (const Matrix< M, K, T > &B, Matrix< M, K, T > &X, int piv[M]) const |
|
template<int M, int N, typename T>
struct mitsuba::Matrix< M, N, T >
Generic fixed-size dense matrix class using a row-major storage format.
template<int M, int N, typename T>
bool Matrix< M, N, T >::lu |
( |
Matrix< M, N, T > & |
LU, |
|
|
int |
piv[M], |
|
|
int & |
pivsign |
|
) |
| const |
Compute the LU decomposition of a matrix.
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U,
and a permutation vector piv of length m so that A(piv,:) = L*U. If m < n, then L is m-by-m and U is m-by-n.
The LU decomposition with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the
LU decomposition is in the solution of square systems of simultaneous linear equations.
- Parameters
-
Target | matrix (the L and U parts will be stored together in a packed format) |
piv | Storage for the permutation created by the pivoting |
pivsign | Sign of the permutation |
- Returns
true
if the matrix was nonsingular.
Based on the implementation in JAMA.