27 int row, col, c, pivot = 0, i;
28 double coef, temp, mult;
31 for (col = 0; col < size - 1; col++)
35 for (row = col; row < size; row++)
38 coef = (coef < 0.0 ? - coef : coef);
49 for (i = 0; i < size; i++)
52 sq[pivot][i] = sq[col][i];
55 temp = solution[pivot];
56 solution[pivot] = solution[col];
60 for (row = col + 1; row < size; row++)
62 mult = sq[row][col] / sq[col][col];
63 for (c = col; c < size; c++)
65 sq[row][c] -= mult * sq[col][c];
67 solution[row] -= mult * solution[col];
72 for (row = size - 1; row >= 0; row--)
74 double val = solution[row];
75 for (col = size - 1; col > row; col--)
77 val -= solution[col] * sq[row][col];
79 solution[row] = val / sq[row][row];
88 double fac, sqlen = 0.0;
90 for (i = 0; i < iLen; i++)
92 const double val = iVec[i];
100 fac = 1.0 / sqrt(sqlen);
101 for (i = 0; i < iLen; i++)
static bool SolveLinearSystem33(double *solution, double sq[3][3])
static bool Normalize(double *iVec, int iLen)