47 std::vector < LinearEquation > smatrix = this->
matrix;
49 unsigned order = smatrix.size();
50 for (
unsigned row = 0; row < order - 1; row++) {
52 for (
unsigned i = row;
i < order;
i++) {
53 if (smatrix[
i][row] != 0.0f) {
56 smatrix[
i] = smatrix[row];
64 smatrix[row] *= (1.0f / smatrix[row][row]);
67 for (
unsigned i = row + 1;
i < order;
i++) {
69 t *= -1.0f * smatrix[
i][row];
70 smatrix[
i] = smatrix[
i] +
t;
76 std::vector <double> ret(order, 0.0f);
77 for (
int row = order - 1; row >= 0; row--) {
79 ret[row] = -smatrix[row][smatrix[row].cnt()] / smatrix[row][row];
81 for (
int i = row - 1;
i >= 0;
i--) {
82 smatrix[
i][smatrix[
i].cnt()] += ret[row] * smatrix[
i][row];
83 smatrix[
i][row] = 0.0f;