linalg::gaussElim
-- Gaussian
eliminationlinalg::gaussElim
(A)
performs Gaussian
elimination on the matrix A to reduce A to an
upper row echelon form.
linalg::gaussElim(A <, All>)
A |
- | a matrix of a domain of category Cat::Matrix |
All |
- | additionally returns the rank and the determinant of
A (if A is a square) as well as the
characteristic column indices of the matrix in row echelon form. |
a matrix of the same domain type as A
, or the list
[T, rank(A), det(A), {j1,...,jr}]
when the option All is given (see below).
A
returned by
linalg::gaussElim
is not unique. See linalg::gaussJordan
for
computing the reduced row echelon form.A
must be an
integral domain, i.e., a domain of category Cat::IntegralDomain
.Cat::Field
, ordinary Gaussian
elimination is used. Otherwise, linalg::gaussElim
applies
fraction-free Gaussian elimination to A
.Dom::Matrix
for details about the
computation strategy of linalg::gaussElim
.A
and
{j1,...,jr} is the set of characteristic column indices of
T
.
If A
is not square, then the value FAIL
is
given instead of det(A).
linalg::gaussElim
serves as an interface function for
the method "gaussElim"
of the matrix domain of
A
, i.e., one may call A::dom::gaussElim(A)
directly instead of linalg::gaussElim
(A,
All)
We apply Gaussian elimination to the following matrix:
>> A := Dom::Matrix(Dom::Rational)( [[1, 2, 3, 4], [-1, 0, 1, 0], [3, 5, 6, 9]] )
+- -+ | 1, 2, 3, 4 | | | | -1, 0, 1, 0 | | | | 3, 5, 6, 9 | +- -+
which reduces A
to the following row
echelon form:
>> linalg::gaussElim(A)
+- -+ | 1, 2, 3, 4 | | | | 0, 2, 4, 4 | | | | 0, 0, -1, -1 | +- -+
We apply Gaussian elimination to the matrix:
>> B := Dom::Matrix(Dom::Integer)( [[1, 2, -1], [1, 0, 1], [2, -1, 4]] )
+- -+ | 1, 2, -1 | | | | 1, 0, 1 | | | | 2, -1, 4 | +- -+
and get the following result:
>> linalg::gaussElim(B, All)
-- +- -+ -- | | 1, 2, -1 | | | | | | | | 0, -2, 2 |, 3, -2, {1, 2, 3} | | | | | | | 0, 0, -2 | | -- +- -+ --
We see that rank(B)=3 and det(B)=-2.
The indices j1,j2,...,jr are the characteristic column indices of the matrix T.