Documentation of 'smile.math.matrix.JMatrix' Java class
JMatrix
smile.math.matrix

Class JMatrix

    • Constructor Detail

      • JMatrix

        public JMatrix(double[][] A)
        Constructor.
        Parameters:
        A - the array of matrix.
      • JMatrix

        public JMatrix(double[] A)
        Constructor of a column vector/matrix with given array as the internal storage.
        Parameters:
        A - the array of column vector.
      • JMatrix

        public JMatrix(int rows,
                       int cols)
        Constructor of all-zero matrix.
      • JMatrix

        public JMatrix(int rows,
                       int cols,
                       double value)
        Constructor. Fill the matrix with given value.
      • JMatrix

        public JMatrix(int rows,
                       int cols,
                       double[] value)
        Constructor.
        Parameters:
        value - the array of matrix values arranged in column major format
    • Method Detail

      • data

        public double[] data()
        Description copied from class: DenseMatrix
        Returns the array of storing the matrix.
        Specified by:
        data in class DenseMatrix
      • nrows

        public int nrows()
        Description copied from class: Matrix
        Returns the number of rows.
        Specified by:
        nrows in class Matrix
      • ncols

        public int ncols()
        Description copied from class: Matrix
        Returns the number of columns.
        Specified by:
        ncols in class Matrix
      • ld

        public int ld()
        Description copied from class: DenseMatrix
        The LDA (and LDB, LDC, etc.) parameter in BLAS is effectively the stride of the matrix as it is laid out in linear memory. It is perfectly valid to have an LDA value which is larger than the leading dimension of the matrix which is being operated on. Typical cases where it is either useful or necessary to use a larger LDA value are when you are operating on a sub matrix from a larger dense matrix, and when hardware or algorithms offer performance advantages when storage is padded to round multiples of some optimal size (cache lines or GPU memory transaction size, or load balance in multiprocessor implementations, for example).
        Specified by:
        ld in class DenseMatrix
        Returns:
        the leading dimension
      • get

        public double get(int i,
                          int j)
        Description copied from class: Matrix
        Returns the entry value at row i and column j.
        Specified by:
        get in class Matrix
      • set

        public double set(int i,
                          int j,
                          double x)
        Description copied from class: DenseMatrix
        Set the entry value at row i and column j.
        Specified by:
        set in class DenseMatrix
      • add

        public double add(int i,
                          int j,
                          double x)
        Description copied from class: DenseMatrix
        A[i][j] += x
        Specified by:
        add in class DenseMatrix
      • sub

        public double sub(int i,
                          int j,
                          double x)
        Description copied from class: DenseMatrix
        A[i][j] -= x
        Specified by:
        sub in class DenseMatrix
      • mul

        public double mul(int i,
                          int j,
                          double x)
        Description copied from class: DenseMatrix
        A[i][j] *= x
        Specified by:
        mul in class DenseMatrix
      • div

        public double div(int i,
                          int j,
                          double x)
        Description copied from class: DenseMatrix
        A[i][j] /= x
        Specified by:
        div in class DenseMatrix
      • add

        public JMatrix add(double x)
        Description copied from class: DenseMatrix
        In place element-wise addition A = A + x
        Overrides:
        add in class DenseMatrix
      • sub

        public JMatrix sub(double x)
        Description copied from class: DenseMatrix
        In place element-wise subtraction A = A - x
        Overrides:
        sub in class DenseMatrix
      • mul

        public JMatrix mul(double x)
        Description copied from class: DenseMatrix
        In place element-wise multiplication A = A * x
        Overrides:
        mul in class DenseMatrix
      • div

        public JMatrix div(double x)
        Description copied from class: DenseMatrix
        In place element-wise division A = A / x
        Overrides:
        div in class DenseMatrix
      • sum

        public double sum()
        Description copied from class: DenseMatrix
        Returns the sum of all elements in the matrix.
        Overrides:
        sum in class DenseMatrix
        Returns:
        the sum of all elements.
      • ax

        public double[] ax(double[] x,
                           double[] y)
        Description copied from class: Matrix
        y = A * x
        Specified by:
        ax in class Matrix
        Returns:
        y
      • axpy

        public double[] axpy(double[] x,
                             double[] y)
        Description copied from class: Matrix
        y = A * x + y
        Specified by:
        axpy in class Matrix
        Returns:
        y
      • axpy

        public double[] axpy(double[] x,
                             double[] y,
                             double b)
        Description copied from class: Matrix
        y = A * x + b * y
        Specified by:
        axpy in class Matrix
        Returns:
        y
      • atx

        public double[] atx(double[] x,
                            double[] y)
        Description copied from class: Matrix
        y = A' * x
        Specified by:
        atx in class Matrix
        Returns:
        y
      • atxpy

        public double[] atxpy(double[] x,
                              double[] y)
        Description copied from class: Matrix
        y = A' * x + y
        Specified by:
        atxpy in class Matrix
        Returns:
        y
      • atxpy

        public double[] atxpy(double[] x,
                              double[] y,
                              double b)
        Description copied from class: Matrix
        y = A' * x + b * y
        Specified by:
        atxpy in class Matrix
        Returns:
        y
      • lu

        public LU lu()
        LU decomposition is computed by a "left-looking", dot-product, Crout/Doolittle algorithm.
        Specified by:
        lu in class DenseMatrix
      • cholesky

        public Cholesky cholesky()
        Cholesky decomposition for symmetric and positive definite matrix. Only the lower triangular part will be used in the decomposition.
        Specified by:
        cholesky in class DenseMatrix
        Throws:
        java.lang.IllegalArgumentException - if the matrix is not positive definite.
      • qr

        public QR qr()
        QR Decomposition is computed by Householder reflections.
        Specified by:
        qr in class DenseMatrix
      • svd

        public SVD svd()
        Description copied from class: DenseMatrix
        Returns the singular value decomposition. Note that the input matrix will hold U on output.
        Specified by:
        svd in class DenseMatrix
      • eig

        public double[] eig()
        Description copied from class: DenseMatrix
        Returns the eigen values in an array of size 2N. The first half and second half of returned array contain the real and imaginary parts, respectively, of the computed eigenvalues.
        Specified by:
        eig in class DenseMatrix
      • eigen

        public EVD eigen()
        Description copied from class: DenseMatrix
        Returns the eigen value decomposition. Note that the input matrix will be overwritten on output.
        Specified by:
        eigen in class DenseMatrix

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.