Академический Документы
Профессиональный Документы
Культура Документы
(in C++)
Numerical methods II
(Gaussian elimination)
Jordi Cortadella
Dept. of Computer Science, UPC
System of Linear Equations
Gaussian elimination
Back-substitution
=
Ax=b
A x b
Assumption: triangular system of equations
without zeroes in the diagonal
Introduction to Programming © Dept. CS, UPC 5
Back-substitution
0
i
=
n-1
i
=
n-1
return x;
}
n-1
Invariant: The rows 0..k have been reduced
(zeroes at the left of the diagonal)
swap
What is the best pivot? rows
(max absolute value)
For each row i, add a multiple of row k such that A[i][k] becomes zero.
The coefficient is –A[i][k]/A[k][k].
return imax;
}
Introduction to Programming © Dept. CS, UPC 13
Solving multiple systems of equations
return X;
}