Packages

object SVDecomp extends SVDecomp

The SVDecomp object provides several test matrices as well as methods for making full representations, reducing dimensionality, determining rank and testing SVD factorizations.

Linear Supertypes
SVDecomp, Factorization, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SVDecomp
  2. SVDecomp
  3. Factorization
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type FactorType = (MatriD, VectoD, MatriD)

    Factor type contains 'u, s, v' which are the left orthogonal matrix, the diagonal matrix/vector containing singular values and the right orthogonal matrix.

    Factor type contains 'u, s, v' which are the left orthogonal matrix, the diagonal matrix/vector containing singular values and the right orthogonal matrix.

    Definition Classes
    SVDecomp
  2. type FactorTypeFull = (MatriD, MatriD, MatriD)
    Definition Classes
    SVDecomp

Value Members

  1. val a1: MatrixD
  2. val a2: MatrixD
  3. val a3: MatrixD
  4. val a4: MatrixD
  5. val a5: MatrixD
  6. val a6: MatrixD
  7. val a7: MatrixD
  8. val a8: MatrixD
  9. def conditionNum: Double

    Compute the condition number of 'this' matrix, i.e., the ratio of the largest singular value to the smallest.

    Compute the condition number of 'this' matrix, i.e., the ratio of the largest singular value to the smallest. Note, if not of full rank, it will be infinity.

    Definition Classes
    SVDecomp
  10. def factor(): SVDecomp

    Factor/deflate the matrix by iteratively turning elements not in the main diagonal to zero.

    Factor/deflate the matrix by iteratively turning elements not in the main diagonal to zero.

    Definition Classes
    SVDecompFactorization
  11. def factor1(): MatriD

    Factor a matrix into the product of two matrices, e.g., 'a = l * l.t', returning only the first matrix.

    Factor a matrix into the product of two matrices, e.g., 'a = l * l.t', returning only the first matrix.

    Definition Classes
    Factorization
  12. def factor12(): (MatriD, MatriD)

    Factor a matrix into the product of two matrices, e.g., 'a = l * l.t' or a = q * r, returning both the first and second matrices.

    Factor a matrix into the product of two matrices, e.g., 'a = l * l.t' or a = q * r, returning both the first and second matrices.

    Definition Classes
    Factorization
  13. def factor123(): FactorType

    Factor/deflate the matrix by iteratively turning elements not in the main diagonal to zero.

    Factor/deflate the matrix by iteratively turning elements not in the main diagonal to zero. Then return the vector of singular values (i.e., the main diagonal), along with the left and right singular matrices.

    Definition Classes
    SVDecomp
  14. def factor2(): MatriD

    Factor a matrix into the product of two matrices, e.g., 'a = l * l.t', returning only the second matrix.

    Factor a matrix into the product of two matrices, e.g., 'a = l * l.t', returning only the second matrix.

    Definition Classes
    Factorization
  15. def factorFull(u_s_v: FactorType): FactorTypeFull

    Convert an SVD factoring to its full representation, returning the result as three matrices.

    Convert an SVD factoring to its full representation, returning the result as three matrices.

    u_s_v

    the 3-way factorization

  16. def factors: (MatriD, MatriD)

    Return the two factored matrices.

    Return the two factored matrices.

    Definition Classes
    SVDecompFactorization
  17. def flip(u: MatriD, v: MatriD): Unit

    Flip negative main diagonal elements in the singular vectors to positive.

    Flip negative main diagonal elements in the singular vectors to positive.

    u

    the left orthongonal matrix

    v

    the right orthongonal matrix

    Definition Classes
    SVDecomp
  18. def flip(u: MatriD, s: VectoD): Unit

    Flip negative singular values to positive and set singular values close to zero to zero.

    Flip negative singular values to positive and set singular values close to zero to zero.

    u

    the left orthongonal matrix

    s

    the vector of singular values

    Definition Classes
    SVDecomp
  19. def rank(s: VectorD): Int

    Determine the rank of a matrix by counting the number of non-zero singular values.

    Determine the rank of a matrix by counting the number of non-zero singular values. The implementation assumes zero singular values are last in the vector.

    s

    the vector of singular values for the matrix whose rank is sought

  20. def reduce(u_s_v: FactorType, k: Int): FactorType

    Reduce the dimensionality of the 'u', 's' and 'v' matrices from 'n' to 'k'.

    Reduce the dimensionality of the 'u', 's' and 'v' matrices from 'n' to 'k'. If 'k = rank', there is no loss of information; when 'k < rank', multiplying the three matrices results in an approximation (little is lost so long as the singular values set to zero (i.e., clipped) are small).

    u_s_v

    the 3-way factorization

    k

    the desired dimensionality

  21. def reorder(ft: FactorType): Unit

    Reorder the singular values to be in non-increasing order.

    Reorder the singular values to be in non-increasing order. Must swap singular vectors in lock step with singular values. To minimize the number of swaps, selection sort is used.

    ft

    the factored matrix (u, s, v)

    Definition Classes
    SVDecomp
  22. def solve(b: VectoD): VectoD

    Solve for 'x' in 'a^t*a*x = b' using SVD.

    Solve for 'x' in 'a^t*a*x = b' using SVD.

    b

    the constant vector

    Definition Classes
    SVDecompFactorization
  23. def test(a: MatriD, svd: SVDecomp, name: String): Unit

    Test the SVD Factorization algorithm on matrix 'a' by factoring the matrix into a left matrix u, a vector s, and a right matrix v.

    Test the SVD Factorization algorithm on matrix 'a' by factoring the matrix into a left matrix u, a vector s, and a right matrix v. Then multiply back to recover the original matrix 'u ** s * v.t'.

    a

    the orginal matrix

    name

    the name of the test case