|
VISH
0.2
|
An n x n matrix (i.e., a vector of length n*n), stored row-wise: that is, A(i,j) = A[ij], where ij = i*n + j. More...
#include </home/werner/origo/vish/ocean/eagle/QuadraticMatrix.hpp>
An n x n matrix (i.e., a vector of length n*n), stored row-wise: that is, A(i,j) = A[ij], where ij = i*n + j.
| bool Eagle::Quadratic::GaussDecompose | ( | FixedArray< int, N > & | perm, |
| double | EPSWEIGHT = 1E-3 |
||
| ) | [inline] |
Perform gauss decomposition of the matrix, which can and should be used instead of computing the inverse of a matrix.
The permutation operations during the composition is stored in the perm parameter, which then needs to be provided to the GaussSolve() routine.
| EPSWEIGHT | square root of the absolut precision of the computation |
| void Eagle::Quadratic::GaussSolve | ( | const PermutationVector_t & | perm, |
| const Column< N, value > & | b, | ||
| Column< N, value > & | x | ||
| ) | const [inline] |
Instead of inverting a matrix, solve a linear system of equations
by forward and backward elimination.
| perm | A permutation vector as computed by GaussDecompose() |
| b | The right-hand side of the equation |
| x | On return, will contain the solution. |
Eagle::Quadratic<3, double> A;
Eagle::Column<3, double> b;
Eagle::Column<3, double> x;
Eagle::FixedArray<int, 3> perm;
A = 2.5, 3.0, 1.1,
0.2, 0.1, 2.1,
0.12, 1.0, 0.3;
b = 39.0, 1.0, 34.33;
A.GaussDecompose(perm);
A.GaussSolve(perm, b, x);
The result in x then is < 16.809817, -24.730900, 16.013638 >.
1.7.5