lusol#
Purpose#
- Computes the solution of \(LUx = b\) where L is a lower triangular
matrix and U is an upper triangular matrix.
Format#
- x = lusol(b, L, U)#
- Parameters:
b (PxK matrix) – data
L (PxP matrix) – lower triangular matrix
U (PxP matrix) – upper triangular matrix
- Returns:
x (PxK matrix) – solution of LUx = b.
Examples#
A = { 3 -1 5,
-2 0 5,
7 2 -2};
b = { 6 -4,
3 2,
7 -5};
// Lower decomposition
{ l, u } = lu(A);
// Solve system of equations
X = lusol(b, l, u);
x = 0.87654 -1.00000
1.38272 1.00000
0.95062 0.00000
Remarks#
If b has more than one column, each column is solved for separately,
i.e., lusol()
solves \(LUx[., i] = b[., i]\).