Documentation of 'jsci.maths.LinearMath' Java class
LinearMath
jsci.maths

Class LinearMath



  • public final class LinearMath
    extends AbstractMath
    The linear math library. This class cannot be subclassed or instantiated because all methods are static.
    • Method Detail

      • solveGMRes

        public static AbstractDoubleVector solveGMRes(AbstractDoubleMatrix A,
                                                      AbstractDoubleVector 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:
        java.lang.IllegalArgumentException - If either the tolerance or the number of iterations is not positive. Also, if an unexpected error occurs.
        MaximumIterationsExceededException - If it cannot converge according to the given parameters.
      • leastSquaresFit

        public static RealPolynomial 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 (>= 0).
        data - [0][] contains the x-series, [1][] contains the y-series.
      • linearRegression

        public static AbstractDoubleVector 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 (zero component is the intercept, the rest are gradient components). E.g. y(x1, x2, ...) = coeffs(0) + coeffs(1) * x1 + coeffs(2) * x2 + ...
      • orthonormalize

        public static AbstractDoubleVector[] orthonormalize(AbstractDoubleVector[] vecs)
        The Gram-Schmidt orthonormalization method.
        Parameters:
        vecs - a set of linearly independent vectors.
        Returns:
        a set of orthonormal vectors.
      • 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 too many iterations to determine an eigenvalue.
      • eigenSolveSymmetric

        public static double[] eigenSolveSymmetric(DoubleTridiagonalMatrix matrix,
                                                   AbstractDoubleVector[] 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 too many iterations to determine an eigenvalue.
      • eigenvalueSolveSymmetric

        public static double[] eigenvalueSolveSymmetric(AbstractDoubleSquareMatrix 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 too many iterations to determine an eigenvalue.
      • eigenSolveSymmetric

        public static double[] eigenSolveSymmetric(AbstractDoubleSquareMatrix matrix,
                                                   AbstractDoubleVector[] 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 too many iterations to determine an eigenvalue.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.