org.apache.commons.math3.linear

## Class SingularValueDecomposition.Solver

- java.lang.Object
- - org.apache.commons.math3.linear.SingularValueDecomposition.Solver

- All Implemented Interfaces:
    DecompositionSolver
  Enclosing class:
    SingularValueDecomposition

      private static class SingularValueDecomposition.Solver
      extends Object
      implements DecompositionSolver

  Specialized solver.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `nonSingular` Singularity indicator.
    `private RealMatrix` | `pseudoInverse` Pseudo-inverse of the initial matrix.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `SingularValueDecomposition.Solver(double[] singularValues, RealMatrix uT, RealMatrix v, boolean nonSingular, double tol)` Build a solver from decomposed matrix.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RealMatrix` | `getInverse()` Get the pseudo-inverse of the decomposed matrix.
    `boolean` | `isNonSingular()` Check if the decomposed matrix is non-singular.
    `RealMatrix` | `solve(RealMatrix b)` Solve the linear equation A × X = B in least square sense.
    `RealVector` | `solve(RealVector b)` Solve the linear equation A × X = B in least square sense.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### pseudoInverse

          private final RealMatrix pseudoInverse

      Pseudo-inverse of the initial matrix.

    - #### nonSingular

          private boolean nonSingular

      Singularity indicator.

  - ### Constructor Detail

    - #### SingularValueDecomposition.Solver

          private SingularValueDecomposition.Solver(double[] singularValues,
                                           RealMatrix uT,
                                           RealMatrix v,
                                           boolean nonSingular,
                                           double tol)

      Build a solver from decomposed matrix.
      Parameters:
        `singularValues` - Singular values.
        `uT` - UT matrix of the decomposition.
        `v` - V matrix of the decomposition.
        `nonSingular` - Singularity indicator.
        `tol` - tolerance for singular values

  - ### Method Detail

    - #### solve

          public RealVector solve(RealVector b)

      Solve the linear equation A × X = B in least square sense.

      The m×n matrix A may not be square, the solution X is such that ||A × X - B|| is minimal.

      Specified by:
        `solve` in interface `DecompositionSolver`
      Parameters:
        `b` - Right-hand side of the equation A × X = B
      Returns:
        a vector X that minimizes the two norm of A × X - B
      Throws:
        `DimensionMismatchException` - if the matrices dimensions do not match.

    - #### solve

          public RealMatrix solve(RealMatrix b)

      Solve the linear equation A × X = B in least square sense.

      The m×n matrix A may not be square, the solution X is such that ||A × X - B|| is minimal.

      Specified by:
        `solve` in interface `DecompositionSolver`
      Parameters:
        `b` - Right-hand side of the equation A × X = B
      Returns:
        a matrix X that minimizes the two norm of A × X - B
      Throws:
        `DimensionMismatchException` - if the matrices dimensions do not match.

    - #### isNonSingular

          public boolean isNonSingular()

      Check if the decomposed matrix is non-singular.
      Specified by:
        `isNonSingular` in interface `DecompositionSolver`
      Returns:
        `true` if the decomposed matrix is non-singular.

    - #### getInverse

          public RealMatrix getInverse()

      Get the pseudo-inverse of the decomposed matrix.
      Specified by:
        `getInverse` in interface `DecompositionSolver`
      Returns:
        the inverse matrix.

Copyright (c) 2003-2013 Apache Software Foundation