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: 249 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

QRDecomposition:: (6 methods):
  __construct()
  isFullRank()
  getH()
  getR()
  getQ()
  solve()


Class: QRDecomposition  - X-Ref

For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
orthogonal matrix Q and an n-by-n upper triangular matrix R so that
A = Q*R.

The QR decompostion always exists, even if the matrix does not have
full rank, so the constructor will never fail.  The primary use of the
QR decomposition is in the least squares solution of nonsquare systems
of simultaneous linear equations.  This will fail if isFullRank()
returns false.

__construct($A)   X-Ref
QR Decomposition computed by Householder reflections.

param: matrix $A Rectangular matrix

isFullRank()   X-Ref
Is the matrix full rank?

return: bool true if R, and hence A, has full rank, else false

getH()   X-Ref
Return the Householder vectors.

return: Matrix Lower trapezoidal matrix whose columns define the reflections

getR()   X-Ref
Return the upper triangular factor.

return: Matrix upper triangular factor

getQ()   X-Ref
Generate and return the (economy-sized) orthogonal factor.

return: Matrix orthogonal factor

solve($B)   X-Ref
Least squares solution of A*X = B.

param: Matrix $B a Matrix with as many rows as A and any number of columns
return: Matrix matrix that minimizes the two norm of Q*R*X-B