Jolt Physics
A multi core friendly Game Physics Engine
|
Go to the source code of this file.
Functions | |
template<class MatrixA , class MatrixB > | |
JPH_NAMESPACE_BEGIN bool | GaussianElimination (MatrixA &ioA, MatrixB &ioB, float inTolerance=1.0e-16f) |
JPH_NAMESPACE_BEGIN bool GaussianElimination | ( | MatrixA & | ioA, |
MatrixB & | ioB, | ||
float | inTolerance = 1.0e-16f |
||
) |
This function performs Gauss-Jordan elimination to solve a matrix equation. A must be an NxN matrix and B must be an NxM matrix forming the equation A * x = B on output B will contain x and A will be destroyed.
This code can be used for example to compute the inverse of a matrix. Set A to the matrix to invert, set B to identity and let GaussianElimination solve the equation, on return B will be the inverse of A. And A is destroyed.
Taken and adapted from Numerical Recipies in C paragraph 2.1