linsolve

BOOL linsolve(double **m, double *b, int n, int method)

Given a matrix mat[0..n-1][0..n-1] and vector b[0..n-1], the solution vector x is found for the linear system m.x = b. The solution vector is returned in b. The routine returns TRUE if the solution vector is successfully found, otherwise it returns FALSE. Both m and b are destroyed by this routine.

Parameters:
aMatrix to solve.
bRight hand side vector.
nSize of a.
methodMethod used to solve the system of equations.

Returns:
TRUE if a solution was successfully found, FALSE otherwise. On return, b contains the solution vector.

Usage:

double** a;
double* b;
BOOL success;
a = dmatrix(0, 3, 0, 3);
b = dvector(0, 3);
// initialize the a[i][j] elements
success = linsolve(a, b, 4, LINSOLVE_LU);
free_dmatrix(a, 0, 3, 0);
free_dvector(b, 0);

Header:
#include "linalg.h"

See Also:
LinearSolveMethod