Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
lu.c File Reference

LU decomposition and direct solver for small dense matrices. More...

#include <math.h>
#include "fasp.h"
#include "fasp_functs.h"

Go to the source code of this file.

Functions

SHORT fasp_smat_lu_decomp (REAL *A, INT pivot[], const INT n)
 LU decomposition of A usind Doolittle's method. More...
 
SHORT fasp_smat_lu_solve (REAL *A, REAL b[], INT pivot[], REAL x[], const INT n)
 Solving Ax=b using LU decomposition. More...
 

Detailed Description

LU decomposition and direct solver for small dense matrices.

Definition in file lu.c.

Function Documentation

SHORT fasp_smat_lu_decomp ( REAL A,
INT  pivot[],
const INT  n 
)

LU decomposition of A usind Doolittle's method.

Parameters
APointer to the full matrix
pivotPivoting positions
nSize of matrix A
Returns
FASP_SUCCESS if successed; otherwise, error information.
Note
Use Doolittle's method to decompose the n x n matrix A into a unit lower triangular matrix L and an upper triangular matrix U such that A = LU. The matrices L and U replace the matrix A. The diagonal elements of L are 1 and are not stored.
The Doolittle method with partial pivoting is: Determine the pivot row and interchange the current row with the pivot row, then assuming that row k is the current row, k = 0, ..., n - 1 evaluate in order the following pair of expressions U[k][j] = A[k][j] - (L[k][0]*U[0][j] + ... + L[k][k-1]*U[k-1][j]) for j = k, k+1, ... , n-1 L[i][k] = (A[i][k] - (L[i][0]*U[0][k] + . + L[i][k-1]*U[k-1][k])) / U[k][k] for i = k+1, ... , n-1.
Author
Xuehai Huang
Date
04/02/2009

Definition at line 46 of file lu.c.

SHORT fasp_smat_lu_solve ( REAL A,
REAL  b[],
INT  pivot[],
REAL  x[],
const INT  n 
)

Solving Ax=b using LU decomposition.

Parameters
APointer to the full matrix
bRight hand side array
pivotPivoting positions
xPointer to the solution array
nSize of matrix A
Returns
FASP_SUCCESS if successed; otherwise, error information.
Note
This routine uses Doolittle's method to solve the linear equation Ax = b. This routine is called after the matrix A has been decomposed into a product of a unit lower triangular matrix L and an upper triangular matrix U with pivoting. The solution proceeds by solving the linear equation Ly = b for y and subsequently solving the linear equation Ux = y for x.
Author
Xuehai Huang
Date
04/02/2009

Definition at line 117 of file lu.c.