48 unsigned order = smatrix.size();
49 for (
unsigned row = 0; row < order - 1; row++) {
51 for (
unsigned i = row;
i < order;
i++) {
52 if (smatrix[
i][row] != 0.0
f) {
55 smatrix[
i] = smatrix[row];
63 smatrix[row] *= (1.0f / smatrix[row][row]);
66 for (
unsigned i = row + 1;
i < order;
i++) {
68 t *= -1.0f * smatrix[
i][row];
69 smatrix[
i] = smatrix[
i] +
t;
76 for (
int row = order - 1; row >= 0; row--) {
78 ret[row] = -smatrix[row][smatrix[row].cnt()] / smatrix[row][row];
80 for (
int i = row - 1;
i >= 0;
i--) {
81 smatrix[
i][smatrix[
i].cnt()] += ret[row] * smatrix[
i][row];
82 smatrix[
i][row] = 0.0f;
std::vector< double > solve() const
std::vector< LinearEquation > matrix
This class describes a linear equation with constant coefficients.