Math::MatrixDecomposition::LU - LU decomposition
use Math::MatrixDecomposition::LU; $LU = Math::MatrixDecomposition::LU->new; $LU->decompose ($A = [...]); $LU->solve ($b = [...]); # Decomposition is the default action for 'new'. # This one-liner is equivalent to the command sequence above. Math::MatrixDecomposition::LU->new ($A = [...])->solve ($b = [...]);
The procedural form is even shorter.
use Math::MatrixDecomposition qw(lu); lu ($A = [...])->solve ($b = [...]);
lufunction is the short form of
Math::MatrixDecomposition::LU->new(which see). The
lufunction has to be used as a subroutine. It is not exported by default.
Create a new object. Any arguments are forwarded to the
decomposemethod (which see). The
newconstructor can be used as a class or instance method.
decompose(a, m, n, ...)
Perform a LU decomposition with partial pivoting of a real matrix.
First argument a is an array reference to the matrix elements. Matrix elements are interpreted in row-major layout.
Optional second argument m is the number of matrix rows. If omitted, it is assumed that the matrix is square.
Optional third argument n is the number of matrix columns. If omitted, the number of matrix columns is calculated automatically.
Remaining arguments are property/value pairs with the following meaning.
Return value is the LU object.
Solve a system of linear equations 'A X = B'.
The LU object represents the coefficients of the left-hand side of the system, that is the matrix 'A'.
First argument b is an array reference. Array elements are the right-hand side of the system. Argument b may have more than one column (matrix elements of b are interpreted in row-major layout).
Optional second argument x is an array reference. The solution of the system is saved in x. Default is to save the solution in place of b.
Return value is the solution x.
Return the value of the determinant.
Ralph Schleicher <firstname.lastname@example.org>