Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

lu.h File Reference

Solves systems of linear equations by LU-decomposition. More...

#include <stdlib.h>
#include "matrect.h"

Include dependency graph for lu.h:

Include dependency graph

Go to the source code of this file.

Functions

int lu_decomp (Matrect_ *M, int *Perm)
 lu_decomp(M, Perm): performs an LU-decomposition in place on the square matrix *M. More...

double lu_det (const Matrect_ *Lu, int Psign)
 lu_det(Lu, Psign): calculates the determinant of the LU-decomposed square matrix *Lu. More...

void lu_solve (const Matrect_ *M, const int Perm[], double b[])
 lu_solve(M, Perm, b): solves the linear equation A*x=b (A is n*n, x,b are n-long arrays). More...


Detailed Description

Solves systems of linear equations by LU-decomposition.

Definition in file lu.h.


Function Documentation

int lu_decomp ( Matrect_ * M,
int * Perm )
 

lu_decomp(M, Perm): performs an LU-decomposition in place on the square matrix *M.

Based on partial pivoting: the row permutations are done in Perm[] (assumed to be of correct size) and will be used by lu_solve(). If Perm==NULL, then a permutation vector will be created internally and will be freed before return. This option can be used when only the determinant is calculated from the LU-decomposition. Note that the contents of *M will be overwritten. Return value: the sign of the determinant of the permutation matrix (+/-1) or 0 if *M is singular. If *M is not square, a warning is printed and 0 is returned.

double lu_det ( const Matrect_ * Lu,
int Psign )
 

lu_det(Lu, Psign): calculates the determinant of the LU-decomposed square matrix *Lu.

Psign is the permutation sign returned by lu_decomp(*Lu, NULL). If you did not invoke lu_decomp(..) before lu_det(..), then you can blame only yourself :-)

void lu_solve ( const Matrect_ * M,
const int Perm[],
double b[] )
 

lu_solve(M, Perm, b): solves the linear equation A*x=b (A is n*n, x,b are n-long arrays).

A is supposed to have been LU-decomposed by lu_decomp() above and the row permutation is stored in Perm[]. You must invoke lu_decomp(M, Perm) with a pre-allocated Perm vector before using this routine. b[] is the "right-hand-side" vector which contains the solution on return.


Generated at Wed Aug 21 09:33:46 2002 for The Razorback C library: Linear Algebra by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001