cholsol

void cholsol(double** a, int n, double* p, double* x, double* b)

Solves the set of n linear equations a.x = b, where a is a positive-definite symmetric matrix. a and p are input as the output of the routine choldcmp. Only the lower triangle of a is accessed. b is input as the right-hand side vector. The solution vector is returned in x[0..n-1]. a, and p are not modified and can be left in place for successive calls with different right-hand sides b. b is not modified unless you identify b as x in the calling sequence, which is allowed.

Parameters:
aDecompose matrix
nSize of a.
pDiagonal elements of decomposed matrix.
xSolution vector.
bRight hand side vector.

Returns:
On exit, x contains the solution to the system of equations.

Usage:

double** a;
double* p;
BOOL success;
a = dmatrix(0, 3, 0, 3);
p = dvector(0, 3);
// initialize the a[i][j] elements
success = choldcmp(a, 4, p);
if(success){
    double* b;
	double* x;
	b = dvector(0, 3);
	x = dvector(0, 3);
    // initialize the b[i] elements
    cholsol(a, 4, p, x, b);
	free_dvector(b, 0);
	free_dvector(x, 0);
}
free_dmatrix(a, 0, 3, 0);
free_dvector(p, 0);

Header:
#include "linalg.h"

See Also:
choldcmp