C4 Engine Terathon Software C4 Engine API Documentation

• Math Library

API Links
Developer Links

Math::SolveLinearSystem

Defined in:  C4Computation.h
Solves the n × n linear system Mx = r.
Prototype

bool SolveLinearSystem(int32 n, float *m, float *r);

Parameters
n The size of the n × n coefficient matrix M.
m A pointer to the n2 entries of the coefficient matrx M, stored in column-major order. These entries are modified by this function.
r A pointer to the constant vector r. The solution vector x is returned in this array.
Description
The SolveLinearSystem function solves the linear system Mx = r using Guassian elimination with implicit pivoting. If the system can be solved, the return value is true, but if the matrix M is singular, the return value is false.

The entries of the matrix M and the vector r are transformed in place by the SolveLinearSystem function. If these values are still needed after solving the linear system, then they should be copied before calling SolveLinearSystem.

The solution vector x is returned in the array pointed to by the r parameter.
See Also

Math::LUDecompose

Math::LUBacksubstitute

Math::SolveTridiagonalSystem