Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 39 and 311]

(no description)

File Size: 282 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

LUDecomposition:: (8 methods):
  __construct()
  getL()
  getU()
  getPivot()
  getDoublePivot()
  isNonsingular()
  det()
  solve()


Class: LUDecomposition  - X-Ref

For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
unit lower triangular matrix L, an n-by-n upper triangular matrix U,
and a permutation vector piv of length m so that A(piv,:) = L*U.
If m < n, then L is m-by-m and U is m-by-n.

The LU decompostion with pivoting always exists, even if the matrix is
singular, so the constructor will never fail. The primary use of the
LU decomposition is in the solution of square systems of simultaneous
linear equations. This will fail if isNonsingular() returns false.

__construct($A)   X-Ref
LU Decomposition constructor.

param: Matrix $A Rectangular matrix

getL()   X-Ref
Get lower triangular factor.

return: Matrix Lower triangular factor

getU()   X-Ref
Get upper triangular factor.

return: Matrix Upper triangular factor

getPivot()   X-Ref
Return pivot permutation vector.

return: array Pivot vector

getDoublePivot()   X-Ref
Alias for getPivot.


isNonsingular()   X-Ref
Is the matrix nonsingular?

return: bool true if U, and hence A, is nonsingular

det()   X-Ref
Count determinants.

return: array d matrix deterninat

solve($B)   X-Ref
Solve A*X = B.

param: mixed $B a Matrix with as many rows as A and any number of columns
return: Matrix X so that L*U*X = B(piv,:)