int MAfChSolve (const float *A, const float b, float x, int N);
Solve a positive definite set of equations
This routine uses the Cholesky decomposition algorithm to solve a set of
equations specified by a positive definite matrix. Cholesky decomposition is
used to express the matrix A in terms of a product of upper and lower
A = L U, where U = L' and L and U are triangular matrices.
The set of equations A x = b, becomes
L y = b, where y = U x .
The first triangular system of equations is solved by substitution to get
the vector y. The vector y is then used to solve the second triangular set
of equations to get the solution vector x.
This routine requires
N square roots,
(N^2+3N)/2 divides, and
(N^3+6N^2-7N)/6 multiplies and adds.
<- int MAfChSolve
Error code, zero for no error. If the error code is nonzero, the
decomposition of matrix A failed. The matrix A is not positive definite,
possibly due to loss of significance. The value k indicates that the
factorization failed at step k. The equations are solved for the (k-1)
by (k-1) sub-system, ignoring the rest of the matrix A and the rest of
the vector b. The solution appears as the first k-1 elements of vector
x. The remaining elements of x are set to zero.
-> const float *A
A is an array of pointers to the rows of an N by N matrix. The matrix is
assumed to be symmetric and positive definite. Only the lower triangular
portion of the matrix is accessed. Note that with ANSI C, if the actual
parameter is not declared to have the const attribute, an explicit cast
to (const float **) is required.
-> const float b
Right hand side vector (N elements)
<- float x
Solution vector (N elements). The vectors b and x can occupy the same
-> int N
Number of equations
Author / revision
/ Revision 1.12 2003/05/09
Main Index libtsp