Fast Auxiliary Space Preconditioning 2.7.7 Aug/28/2022
Loading...
Searching...
No Matches
BlaSmallMatLU.c File Reference

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

#include <math.h>
#include "fasp.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 using Doolittle's method. More...
 
SHORT fasp_smat_lu_solve (const REAL *A, REAL b[], const 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.

Note
This file contains Level-1 (Bla) functions.

Copyright (C) 2009–Present by the FASP team. All rights reserved.

Released under the terms of the GNU Lesser General Public License 3.0 or later.

Definition in file BlaSmallMatLU.c.

Function Documentation

◆ fasp_smat_lu_decomp()

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

LU decomposition of A using 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 52 of file BlaSmallMatLU.c.

◆ fasp_smat_lu_solve()

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

Solving Ax=b using LU decomposition.

Parameters
APointer to the full matrix
bRight hand side array (b is used as the working 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 124 of file BlaSmallMatLU.c.