SVD class

Singular Value Decomposition. 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 = USV'. 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.

References

  1. "Jama". https://math.nist.gov/javanumerics/jama/. Retrieved 2019-07-19.
  2. "Jama Github". https://github.com/fiji/Jama. Retrieved 2019-07-19.
  3. "Apache Commons Math Github". https://github.com/apache/commons-math. Retrieved 2019-07-19.

Examples

var svd = SVD(Array2d([
  Array([4.0, 2.0, 1.0]),
  Array([16.0, 4.0, 1.0]),
  Array([64.0, 8.0, 1.0])
]));
var u = svd.U();
var s = svd.S();

print(u);
print(s);

/* output:
Array2d([
  Array([0.06370191, 0.63944931, -0.76618969]),
  Array([0.24598854, 0.73399958,  0.63303575]),
  Array([0.96717718, -0.22879947, -0.11054003])
]);

Array2d([
  Array([66.69193778, 0.0, 0.0]),
  Array([0.0, 2.66694684, 0.0]),
  Array([0.0, 0.0, 0.26986934]),
]);
*/

References

  1. "svd Singular value decomposition". https://www.mathworks.com/help/matlab/ref/double.svd.html;jsessionid=b19a9f98e76836a49be98bcce77c . Retrieved 2021-05-17.
  2. "Singular Value Decomposition more columns than rows". https://stats.stackexchange.com/questions/96574/singular-value-decomposition-more-columns-than-rows/524664#524664 . Retrieved 2021-05-17.
  3. "Wolfram Alpha". https://www.wolframalpha.com/input/?i=SVD+%7B%7B1%2C2%2C3%7D%2C%7B4%2C5%2C6%7D%7D . Retrieved 2021-05-17.
  4. "Jama Singular Value Decomposition". https://github.com/fiji/Jama/blob/master/src/main/java/Jama/SingularValueDecomposition.java . Retrieved 2021-05-17.
  5. "Scipy svd". https://github.com/scipy/scipy/blob/v1.6.3/scipy/linalg/decomp_svd.py#L13-L136 . Retrieved 2021-05-17.
  6. "Simple SVD algorithms". https://towardsdatascience.com/simple-svd-algorithms-13291ad2eef2 . Retrieved 2021-05-17.
  7. "Library that add functionality of all maths sections that don't exist in dart:math". https://pub.dev/packages/extended_math . Retrieved 2021-05-17.
  8. "How to Calculate the SVD from Scratch with Python". https://machinelearningmastery.com/singular-value-decomposition-for-machine-learning/ . Retrieved 2021-05-17.
  9. "Singular Value Decomposition (SVD) of a Matrix calculator". https://atozmath.com/MatrixEv.aspx?q=svd&q1=1%2c2%2c3%3b4%2c5%2c6%60svd%60&dm=D&dp=8&do=1#PrevPart . Retrieved 2021-05-17.

Constructors

SVD(Array2d Arg)
Construct the singular value decomposition Structure to access U, S and V.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cond() double
Two norm condition number return max(S)/min(S)
norm2() double
Two norm return max(S)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rank() int
Effective numerical matrix rank return Number of nonnegligible singular values.
S() Array2d
Return the diagonal matrix of singular values return S
singularValues() Array
Return the one-dimensional array of singular values return diagonal of S.
toString() String
A string representation of this object.
inherited
U() Array2d
Return the left singular vectors return U
V() Array2d
Return the right singular vectors return V

Operators

operator ==(Object other) bool
The equality operator.
inherited