Class BaseLapack

  • All Implemented Interfaces:
    Lapack

    public abstract class BaseLapack
    extends Object
    implements Lapack
    • Constructor Detail

      • BaseLapack

        public BaseLapack()
    • Method Detail

      • getrf

        public INDArray getrf​(INDArray A)
        Description copied from interface: Lapack
        LU decomposiiton of a matrix Factorize a matrix A The matrix A is overridden by the L & U combined. The permutation results are returned directly as a vector. To create the permutation matrix use getPFactor method To split out the L & U matrix use getLFactor and getUFactor methods getrf = triangular factorization (TRF) of a general matrix (GE)
        Specified by:
        getrf in interface Lapack
        Parameters:
        A - the input matrix, it will be overwritten with the factors
      • sgetrf

        public abstract void sgetrf​(int M,
                                    int N,
                                    INDArray A,
                                    INDArray IPIV,
                                    INDArray INFO)
        Float/Double versions of LU decomp. This is the official LAPACK interface (in case you want to call this directly) See getrf for full details on LU Decomp
        Parameters:
        M - the number of rows in the matrix A
        N - the number of cols in the matrix A
        A - the matrix to factorize - data must be in column order ( create with 'f' ordering )
        IPIV - an output array for the permutations ( must be int based storage )
        INFO - error details 1 int array, a positive number (i) implies row i cannot be factored, a negative value implies paramtere i is invalid
      • potrf

        public void potrf​(INDArray A,
                          boolean lower)
        Description copied from interface: Lapack
        Triangular decomposiiton of a positive definite matrix ( cholesky ) Factorize a matrix A such that A = LL* (assuming lower==true) or A = U*U (a * represents conjugate i.e. if matrix is real U* is a transpose) The matrix A is overridden by the L (or U). potrf = LU factorization of a positive definite matrix (PO) into a lower L ( or upper U ) triangular matrix
        Specified by:
        potrf in interface Lapack
        Parameters:
        A - the input matrix, it will be overwritten with the factors
      • spotrf

        public abstract void spotrf​(byte uplo,
                                    int N,
                                    INDArray A,
                                    INDArray INFO)
        Float/Double versions of cholesky decomp for positive definite matrices A = LL*
        Parameters:
        uplo - which factor to return L or U
        A - the matrix to factorize - data must be in column order ( create with 'f' ordering )
        INFO - error details 1 int array, a positive number (i) implies row i cannot be factored, a negative value implies paramtere i is invalid
      • dpotrf

        public abstract void dpotrf​(byte uplo,
                                    int N,
                                    INDArray A,
                                    INDArray INFO)
      • geqrf

        public void geqrf​(INDArray A,
                          INDArray R)
        Description copied from interface: Lapack
        QR decomposiiton of a matrix Factorize a matrix A such that A = QR The matrix A is overwritten by the Q component (i.e. destroyed) geqrf = QR factorization of a general matrix (GE) into an orthogonal matrix Q and an upper triangular R matrix
        Specified by:
        geqrf in interface Lapack
        Parameters:
        A - the input matrix, it will be overwritten with the factors
      • sgeqrf

        public abstract void sgeqrf​(int M,
                                    int N,
                                    INDArray A,
                                    INDArray R,
                                    INDArray INFO)
        Float/Double versions of QR decomp. This is the official LAPACK interface (in case you want to call this directly) See geqrf for full details on LU Decomp
        Parameters:
        M - the number of rows in the matrix A
        N - the number of cols in the matrix A
        A - the matrix to factorize - data must be in column order ( create with 'f' ordering )
        R - an output array for other part of factorization
        INFO - error details 1 int array, a positive number (i) implies row i cannot be factored, a negative value implies paramtere i is invalid
      • syev

        public int syev​(char jobz,
                        char uplo,
                        INDArray A,
                        INDArray V)
        Description copied from interface: Lapack
        Caclulate the eigenvalues and vectors of a symmetric matrix. The symmetric matrix means the results are guaranteed to be real (not complex) The matrix A is overridden by the eigenvectors. The eigenvalues are returned separately
        Specified by:
        syev in interface Lapack
        A - the input matrix, it will be overwritten with the eigenvectors
        V - the resulting eigenvalues
      • ssyev

        public abstract int ssyev​(char jobz,
                                  char uplo,
                                  int N,
                                  INDArray A,
                                  INDArray R)
        Float/Double versions of eigen value/vector calc.
        Parameters:
        jobz - 'N' - no eigen vectors, 'V' - return eigenvectors
        uplo - upper or lower part of symmetric matrix to use
        N - the number of rows & cols in the matrix A
        A - the matrix to calculate eigenvectors
        R - an output array for eigenvalues ( may be null )
      • dsyev

        public abstract int dsyev​(char jobz,
                                  char uplo,
                                  int N,
                                  INDArray A,
                                  INDArray R)
      • gesvd

        public void gesvd​(INDArray A,
                          INDArray S,
                          INDArray U,
                          INDArray VT)
        Description copied from interface: Lapack
        SVD decomposiiton of a matrix Factorize a matrix into its singular vectors and eigenvalues The decomposition is such that: A = U x S x VT gesvd = singular value decomposition (SVD) of a general matrix (GE)
        Specified by:
        gesvd in interface Lapack
        Parameters:
        A - the input matrix
        S - the eigenvalues as a vector
        U - the left singular vectors as a matrix. Maybe null if no S required
        VT - the right singular vectors as a (transposed) matrix. Maybe null if no V required
      • getPFactor

        public INDArray getPFactor​(int M,
                                   INDArray ipiv)
        Description copied from interface: Lapack
        This method takes one of the ipiv returns from LAPACK and creates the permutation matrix. When factorizing, it is useful to avoid underflows and overflows by reordering rows/and or columns of the input matrix (mostly these methods solve simultaneous equations, so order is not important). The ipiv method assumes that only row ordering is done ( never seen column ordering done )
        Specified by:
        getPFactor in interface Lapack
        Parameters:
        M - - the size of the permutation matrix ( usu. the # rows in factored matrix )
        ipiv - - the vector returned from a refactoring
      • getLFactor

        public INDArray getLFactor​(INDArray A)
        Description copied from interface: Lapack
        extracts the L (lower triangular) matrix from the LU factor result L will be the same dimensions as A
        Specified by:
        getLFactor in interface Lapack
        Parameters:
        A - - the combined L & U matrices returned from factorization
      • getUFactor

        public INDArray getUFactor​(INDArray A)
        Description copied from interface: Lapack
        extracts the U (upper triangular) matrix from the LU factor result U will be n x n matrix where n = num cols in A
        Specified by:
        getUFactor in interface Lapack
        Parameters:
        A - - the combined L & U matrices returned from factorization