C4 Engine Terathon Software C4 Engine API Documentation

• Math Library

API Links
Developer Links

Math::LUDecompose

Defined in:  C4Computation.h
Performs the LU decomposition of an n × n matrix M.
Prototype

bool LUDecompose(int32 n, float *m, unsigned_int16 *index, float *detSign = nullptr);

Parameters
n The size of the n × n matrix M.
m A pointer to the n2 entries of the matrx M, stored in column-major order. The LU-decomposed matrix entries are returned in this array.
index A pointer to an array of size n where the row permutation information can be stored.
detSign A pointer to a location where the parity of the row exchanges can be stored. This parameter may be nullptr if this information is not needed.
Description
The LUDecompose function performs the LU decomposition of an n × n matrix M. The decomposition is performed in place—the decomposed matrix entries are returned in the space occupied by M. This function also returns an array of indexes that indicate how the rows were permuted during the decomposition process. The decomposed matrix and the permutation array are passed to the Math::LUBacksubstitute function to solve linear systems.

The LUDecompose function returns false if the matrix M is singular and true otherwise.
See Also

Math::LUBacksubstitute

Math::LURefineSolution