.
A B.
X, AX = B.
, xi.
O(N3).
C++
//
double* SLE (matrix & a, double b[])
{
matrix B = matrix (b, a.N (), 0);
matrix c = a.concateMatrix (B);
c = gauss (c);
if (detTriang (c) == 0)
return 0;
double *x = new double[a.N ()];
for (int i = a.N () - 1; i >= 0; -- i)
{
double sum = c[i][a.N ()];
for (int j = i + 1; j < a.N (); ++ j)
sum -= c[i][j] * x[j];
x[i] = sum / c[i][i];
}
return x;
}
17:01 04.01.2011
17:03 04.01.2011
По всем вопросам обращаться: rumterg@gmail.com