    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JSci.maths.LinearMath

    java.lang.Object
       |
       +----JSci.maths.AbstractMath
               |
               +----JSci.maths.LinearMath

public final class LinearMath
extends AbstractMath

The linear math library. This class cannot be subclassed or instantiated because all methods are static.

##

eigenSolveHermitian(ComplexSquareMatrix, ComplexVector[])
  This method finds the eigenvalues and eigenvectors of a Hermitian matrix.
eigenSolveSymmetric(DoubleSquareMatrix, DoubleVector[])
  This method finds the eigenvalues and eigenvectors of a symmetric square matrix.
eigenSolveSymmetric(DoubleTridiagonalMatrix, DoubleVector[])
  This method finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the QL method.
eigenvalueSolveHermitian(ComplexSquareMatrix)
  This method finds the eigenvalues of a Hermitian matrix.
eigenvalueSolveSymmetric(DoubleSquareMatrix)
  This method finds the eigenvalues of a symmetric square matrix.
eigenvalueSolveSymmetric(DoubleTridiagonalMatrix)
  This method finds the eigenvalues of a symmetric tridiagonal matrix by the QL method.
leastSquaresFit(int, double[][])
  Fits an nth degree polynomial to data using the method of least squares.
linearRegression(double[][])
  Fits a line to multi-dimensional data using the method of least squares.
solve(DoubleSquareMatrix[], DoubleVector)
  Solves the linear system Mx=v.
solveGMRes(DoubleMatrix, DoubleVector, int, double)
  Solves the unsymmetric linear system Ax=b using the Generalized Minimum Residual method (doesn't require A to be nonsingular).

##

solve

     public static DoubleVector solve(DoubleSquareMatrix lu[],
                                      DoubleVector v)

  Solves the linear system Mx=v.

  Parameters:
    lu - the decomposed matrix M
    v - a double vector
  Returns:
    the double vector x
  See Also:
    luDecompose, choleskyDecompose

solveGMRes

     public static DoubleVector solveGMRes(DoubleMatrix A,
                                           DoubleVector b,
                                           int max_iter,
                                           double tol) throws MaximumIterationsExceededException

  Solves the unsymmetric linear system Ax=b using the Generalized Minimum Residual method (doesn't require A to be nonsingular). While slower than LU decomposition, it is more robust and should be used with large matrices. It is guaranted to converge exactly in N iterations for an N by N matrix (minus some numerical errors).

  Parameters:
    max_iter - maximum number of iterations
    tol - tolerance
  Throws: IllegalArgumentException
    if either the tolerance or the number of iterations is not positive. Also, if an unexpected error occurs.
  Throws: MaximumIterationsExceededException
    if it cannot converge according to the given parameters.

leastSquaresFit

     public static DoubleVector leastSquaresFit(int n,
                                                double data[][])

  Fits an nth degree polynomial to data using the method of least squares.

  Parameters:
    n - the degree of the polynomial
    data - [0][] contains the x-series, [1][] contains the y-series
  Returns:
    a vector containing the polynomial's coefficients (in ascending degree order)

linearRegression

     public static DoubleVector linearRegression(double data[][])

  Fits a line to multi-dimensional data using the method of least squares.

  Parameters:
    data - [0...n-1][] contains the x-series' (they must be linearly uncorrelated), [n][] contains the y-series
  Returns:
    a vector containing the coefficients

eigenvalueSolveHermitian

     public static double[] eigenvalueSolveHermitian(ComplexSquareMatrix matrix) throws MaximumIterationsExceededException

  This method finds the eigenvalues of a Hermitian matrix.

  Parameters:
    matrix - a Hermitian matrix
  Returns:
    an array containing the eigenvalues
  Throws: MaximumIterationsExceededException
    If it takes more than 50 iterations to determine an eigenvalue.

eigenSolveHermitian

     public static double[] eigenSolveHermitian(ComplexSquareMatrix matrix,
                                                ComplexVector eigenvector[]) throws MaximumIterationsExceededException

  This method finds the eigenvalues and eigenvectors of a Hermitian matrix.

  Parameters:
    matrix - a Hermitian matrix
    eigenvector - an empty array of complex vectors to hold the eigenvectors. All eigenvectors will be orthogonal.
  Returns:
    an array containing the eigenvalues
  Throws: MaximumIterationsExceededException
    If it takes more than 50 iterations to determine an eigenvalue.

eigenvalueSolveSymmetric

     public static double[] eigenvalueSolveSymmetric(DoubleTridiagonalMatrix matrix) throws MaximumIterationsExceededException

  This method finds the eigenvalues of a symmetric tridiagonal matrix by the QL method. It is based on the NETLIB algol/fortran procedure tql1 by Bowdler, Martin, Reinsch and Wilkinson.

  Parameters:
    matrix - a double symmetric tridiagonal matrix
  Returns:
    an array containing the eigenvalues
  Throws: MaximumIterationsExceededException
    If it takes more than 50 iterations to determine an eigenvalue.

eigenSolveSymmetric

     public static double[] eigenSolveSymmetric(DoubleTridiagonalMatrix matrix,
                                                DoubleVector eigenvector[]) throws MaximumIterationsExceededException

  This method finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the QL method. It is based on the NETLIB algol/fortran procedure tql2 by Bowdler, Martin, Reinsch and Wilkinson.

  Parameters:
    matrix - a double symmetric tridiagonal matrix
    eigenvector - an empty array of double vectors to hold the eigenvectors. All eigenvectors will be orthogonal.
  Returns:
    an array containing the eigenvalues
  Throws: MaximumIterationsExceededException
    If it takes more than 50 iterations to determine an eigenvalue.

eigenvalueSolveSymmetric

     public static double[] eigenvalueSolveSymmetric(DoubleSquareMatrix matrix) throws MaximumIterationsExceededException

  This method finds the eigenvalues of a symmetric square matrix. The matrix is reduced to tridiagonal form and then the QL method is applied. It is based on the NETLIB algol/fortran procedure tred1/tql1 by Bowdler, Martin, Reinsch and Wilkinson.

  Parameters:
    matrix - a double symmetric square matrix
  Returns:
    an array containing the eigenvalues
  Throws: MaximumIterationsExceededException
    If it takes more than 50 iterations to determine an eigenvalue.

eigenSolveSymmetric

     public static double[] eigenSolveSymmetric(DoubleSquareMatrix matrix,
                                                DoubleVector eigenvector[]) throws MaximumIterationsExceededException

  This method finds the eigenvalues and eigenvectors of a symmetric square matrix. The matrix is reduced to tridiagonal form and then the QL method is applied. It is based on the NETLIB algol/fortran procedure tred2/tql2 by Bowdler, Martin, Reinsch and Wilkinson.

  Parameters:
    matrix - a double symmetric square matrix
    eigenvector - an empty array of double vectors to hold the eigenvectors. All eigenvectors will be orthogonal.
  Returns:
    an array containing the eigenvalues
  Throws: MaximumIterationsExceededException
    If it takes more than 50 iterations to determine an eigenvalue.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index