ltrisol#
Purpose#
Computes the solution of \(Lx = b\) where L is a lower triangular matrix.
Format#
- x = ltrisol(b, L)#
- Parameters:
b (PxK matrix) – data
L (PxP matrix) – lower triangular matrix
- Returns:
x (PxK matrix) – solution of \(Lx = b\).
Examples#
rndseed 123131;
// Create lower triangular matrix
l = lowmat(rndn(4, 4));
// Create random b matrix
b = rndn(4, 1);
print "b/l ="; b/l;
x = ltrisol(b, l);
print "x ="; x;
This code produces
b/l =
1.31626
3.24920
-4.95390
4.62379
x =
1.31626
3.24920
-4.95390
4.62379
Remarks#
ltrisol()
applies a forward solve to \(Lx = b\) to solve for x. If b has more
than one column, each column will be solved for separately,
i.e., ltrisol()
will apply a forward solve to \(L*x[., i] = b[., i]\).