lubksb

void lubksb(double** a, int n, int* indx, double* b)

Given a matrix a and permutation vector indx returned from ludcmp, this routines solves the set of linear equations a.x = b. On input b holds the right-hand side vector. On output, it holds the solution vector x. a and indx are not modified by this routine and can be left in place for successive colls with different right-hand sides b.

Parameters:
aDecomposed matrix.
nSize of a.
indxPermutation vector.
bSolution vector.

Returns:
On return, the b contains the solution vector.

Usage:

double** a;
int* p;
int d;
BOOL success;
a = dmatrix(0, 3, 0, 3);
p = ivector(0, 3);
// initialize the a[i][j] elements
success = ludcmp(a, 4, p, &d);
if(success){
	double* b;
	b = dvector(0, 3);
	// initialize the b[j] elements
	lubksb(a, 4, p, b);
	free_dvector(b, 0);
}	
free_dmatrix(a, 0, 3, 0);
free_ivector(p, 0);
}

Header:
#include "linalg.hpp"

See Also:
ludcmp