You are on page 1of 2

www.numerical-methods.

com
Numerical Methods Library in Excel VBA


Module

LUfac.bas


Title


Carries out an LU factorisation of a real matrix.


Description

The spreadsheet contains the VBA source files for carrying out a LU
factorisation of a real square matrix , so that



where is a lower-triangular matrix (with diagonal elements set to 1)
and is an upper-triangular matrix and is a permutation matrix.


Interface

Sub LUfac(a, n, perm, lfail)
real a: on input the nxn matrix A, on output L and U
integer n: the dimension of the matrix/vector
integer perm: an n-vector, the column index of the permutation matrix P
logical lfail: returns 'true' if the method fails, otherwise 'false'

Note the output matrix a is such that the diagonal and upper-triangular
elements is the U matrix and the lower-triangular elements together
with 1s on the diagonal is the matrix U.
On exit perm records the row exchanges that have occurred as a result
of pivoting, otherwise known as a permutation matrix P. It would be
wasteful of computer memory to store the permutation matrix as an nxn
array. P is taken to be made up of all zeros, except for P[j,i]=1 when
perm(i)=j.


Web source of
code.

http://www.numerical-methods.com/Excel_VBA/LU.xlsm

(key Developer then Visual Basic and then LUfac_module)


Web source of
this guide


www.numerical-methods.com/Excel_VBA/LUfac_bas.htm


Web source of
the algorithm


http://www.numerical-methods.com/lineq/LU Factorisation.htm


Dependent
routines


NONE



www.numerical-methods.com

Test problems


The Excel file contains spreadsheet test programs that demonstrate the
LU factorisation of either a set of test matrices of various dimensions or
a chosen matrix.

http://www.numerical-methods.com/Excel_VBA/LU.xlsm


Licence


This is open source; the software may be used and applied within other
systems as long as its provenance is appropriately acknowledged.
See the GNU Licence for more information or contact
webmaster@numerical-methods.com


Similar codes
that may be of
interest


LUFAC, www.numerical-methods.com/fortran/CLUFAC_FOR.htm , for
real-valued systems in FORTRAN



Bibilography


Solution of Linear Systems of Equations (Matlab/Freemat/Scilab/Octave)

Linear Systems and 2x2 Matrices

Tutorials on Matlab/Freemat

Numerical Methods

You might also like