Documentation of 'net.finmath.functions.LinearAlgebra' Java class
LinearAlgebra
net.finmath.functions

Class LinearAlgebra



  • public class LinearAlgebra
    extends java.lang.Object
    This class implements some methods from linear algebra (e.g. solution of a linear equation, PCA). It is basically a functional wrapper using either the Colt library or Apache commons math. I am currently preferring to use Colt, due to better performance in some situations, however it allows to easily switch some parts to Apache commons math (this is the motivation for this class).
    • Constructor Summary

      Constructors 
      Constructor and Description
      LinearAlgebra() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static double[][] factorReduction(double[][] correlationMatrix, int numberOfFactors)
      Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
      static cern.colt.matrix.DoubleMatrix2D factorReductionUsingColt(cern.colt.matrix.DoubleMatrix2D correlationMatrix, int numberOfFactors)
      Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
      static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors)
      Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
      static double[][] getFactorMatrix(double[][] correlationMatrix, int numberOfFactors)
      Returns the matrix of the n Eigenvectors corresponding to the first n largest Eigenvalues of a correlation matrix.
      static double[][] invert(double[][] matrix)
      Returns the inverse of a given matrix.
      static double[] solveLinearEquation(double[][] A, double[] b)
      Find a solution of the linear equation A x = b where A is an n x m - matrix given as double[n][m] b is an m - vector given as double[m], x is an n - vector given as double[n],
      static double[] solveLinearEquationLeastSquare(double[][] matrix, double[] vector)
      Find a solution of the linear equation A x = b in the least square sense where A is an n x m - matrix given as double[n][m] b is an m - vector given as double[m], x is an n - vector given as double[n],
      static double[] solveLinearEquationSymmetric(double[][] matrix, double[] vector)
      Find a solution of the linear equation A x = b where A is an symmetric n x n - matrix given as double[n][n] b is an n - vector given as double[n], x is an n - vector given as double[n],
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LinearAlgebra

        public LinearAlgebra()
    • Method Detail

      • solveLinearEquation

        public static double[] solveLinearEquation(double[][] A,
                                                   double[] b)
        Find a solution of the linear equation A x = b where
        • A is an n x m - matrix given as double[n][m]
        • b is an m - vector given as double[m],
        • x is an n - vector given as double[n],
        Parameters:
        A - The matrix (left hand side of the linear equation).
        b - The vector (right hand of the linear equation).
        Returns:
        A solution x to A x = b.
      • invert

        public static double[][] invert(double[][] matrix)
        Returns the inverse of a given matrix.
        Parameters:
        matrix - A matrix given as double[n][n].
        Returns:
        The inverse of the given matrix.
      • solveLinearEquationSymmetric

        public static double[] solveLinearEquationSymmetric(double[][] matrix,
                                                            double[] vector)
        Find a solution of the linear equation A x = b where
        • A is an symmetric n x n - matrix given as double[n][n]
        • b is an n - vector given as double[n],
        • x is an n - vector given as double[n],
        Parameters:
        matrix - The matrix A (left hand side of the linear equation).
        vector - The vector b (right hand of the linear equation).
        Returns:
        A solution x to A x = b.
      • solveLinearEquationLeastSquare

        public static double[] solveLinearEquationLeastSquare(double[][] matrix,
                                                              double[] vector)
        Find a solution of the linear equation A x = b in the least square sense where
        • A is an n x m - matrix given as double[n][m]
        • b is an m - vector given as double[m],
        • x is an n - vector given as double[n],
        Parameters:
        matrix - The matrix A (left hand side of the linear equation).
        vector - The vector b (right hand of the linear equation).
        Returns:
        A solution x to A x = b.
      • getFactorMatrix

        public static double[][] getFactorMatrix(double[][] correlationMatrix,
                                                 int numberOfFactors)
        Returns the matrix of the n Eigenvectors corresponding to the first n largest Eigenvalues of a correlation matrix. These Eigenvectors can also be interpreted as "principal components" (i.e., the method implements the PCA).
        Parameters:
        correlationMatrix - The given correlation matrix.
        numberOfFactors - The requested number of factors (eigenvectors).
        Returns:
        Matrix of n Eigenvectors (columns) (matrix is given as double[n][numberOfFactors], where n is the number of rows of the correlationMatrix.
      • factorReduction

        public static double[][] factorReduction(double[][] correlationMatrix,
                                                 int numberOfFactors)
        Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
        Parameters:
        correlationMatrix - The given correlation matrix.
        numberOfFactors - The requested number of factors (Eigenvectors).
        Returns:
        Factor reduced correlation matrix.
      • factorReductionUsingCommonsMath

        public static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix,
                                                                 int numberOfFactors)
        Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
        Parameters:
        correlationMatrix - The given correlation matrix.
        numberOfFactors - The requested number of factors (Eigenvectors).
        Returns:
        Factor reduced correlation matrix.
      • factorReductionUsingColt

        public static cern.colt.matrix.DoubleMatrix2D factorReductionUsingColt(cern.colt.matrix.DoubleMatrix2D correlationMatrix,
                                                                               int numberOfFactors)
        Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
        Parameters:
        correlationMatrix - The given correlation matrix.
        numberOfFactors - The requested number of factors (Eigenvectors).
        Returns:
        Factor reduced correlation matrix.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.