Math::MatrixDecomposition::LU - LU decomposition
Object-oriented interface.
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 = [...]);
lu
The lu function is the short form of Math::MatrixDecomposition::LU->new (which see). The lu function has to be used as a subroutine. It is not exported by default.
Math::MatrixDecomposition::LU->new
new
Create a new object. Any arguments are forwarded to the decompose method (which see). The new constructor can be used as a class or instance method.
decompose
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.
capture
Whether or not to decompose the matrix a in-place. Default is false.
Return value is the LU object.
solve
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.
det
Return the value of the determinant.
Math::MatrixDecomposition
Wikipedia, http://en.wikipedia.org/wiki/LU_decomposition
MathWorld, http://mathworld.wolfram.com/LUDecomposition.html
Ralph Schleicher <ralph@cpan.org>
To install Math::MatrixDecomposition, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::MatrixDecomposition
CPAN shell
perl -MCPAN -e shell install Math::MatrixDecomposition
For more information on module installation, please visit the detailed CPAN module installation guide.