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

Defines 1 class

SingularValueDecomposition:: (8 methods):
  __construct()
  getU()
  getV()
  getSingularValues()
  getS()
  norm2()
  cond()
  rank()


Class: SingularValueDecomposition  - X-Ref

For an m-by-n matrix A with m >= n, the singular value decomposition is
an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
an n-by-n orthogonal matrix V so that A = U*S*V'.

The singular values, sigma[$k] = S[$k][$k], are ordered so that
sigma[0] >= sigma[1] >= ... >= sigma[n-1].

The singular value decompostion always exists, so the constructor will
never fail.  The matrix condition number and the effective numerical
rank can be computed from this decomposition.

__construct($Arg)   X-Ref
Construct the singular value decomposition.

Derived from LINPACK code.

param: mixed $Arg Rectangular matrix

getU()   X-Ref
Return the left singular vectors.

return: Matrix U

getV()   X-Ref
Return the right singular vectors.

return: Matrix V

getSingularValues()   X-Ref
Return the one-dimensional array of singular values.

return: array diagonal of S

getS()   X-Ref
Return the diagonal matrix of singular values.

return: Matrix S

norm2()   X-Ref
Two norm.

return: float max(S)

cond()   X-Ref
Two norm condition number.

return: float max(S)/min(S)

rank()   X-Ref
Effective numerical matrix rank.

return: int Number of nonnegligible singular values