Documentation of 'jsat.linear.DenseMatrix' Java class
DenseMatrix
jsat.linear

Class DenseMatrix

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class DenseMatrix
    extends GenericMatrix
    See Also:
    Serialized Form
    • Constructor Detail

      • DenseMatrix

        public DenseMatrix(Vec a,
                           Vec b)
        Creates a new matrix based off the given vectors.
        Parameters:
        a - the first Vector, this new Matrix will have as many rows as the length of this vector
        b - the second Vector, this new Matrix will have as many columns as this length of this vector
      • DenseMatrix

        public DenseMatrix(int rows,
                           int cols)
        Creates a new matrix of zeros
        Parameters:
        rows - the number of rows
        cols - the number of columns
      • DenseMatrix

        public DenseMatrix(double[][] matrix)
        Creates a new matrix that is a clone of the given matrix. An error will be throw if the rows of the given matrix are not all the same size
        Parameters:
        matrix - the matrix to clone the values of
      • DenseMatrix

        public DenseMatrix(Matrix toCopy)
        Creates a new dense matrix that has a copy of all the same values as the given one
        Parameters:
        toCopy - the matrix to copy
    • Method Detail

      • mutableAdd

        public void mutableAdd(double c,
                               Matrix b)
        Description copied from class: Matrix
        Alters the current matrix to store the value A+c*B
        Overrides:
        mutableAdd in class GenericMatrix
        Parameters:
        c - the scalar constant to multiple B by
        b - the matrix to add to this
      • multiply

        public void multiply(Vec b,
                             double z,
                             Vec c)
        Description copied from class: Matrix
        If this matrix is Am x n, and b has a length of n, and c has a length of m, then this will mutate c to store c = c + A*b*z
        Overrides:
        multiply in class GenericMatrix
        Parameters:
        b - the vector to be treated as a colum vector
        z - the constant to multiply the A*b value by.
        c - where to place the result by addition
      • transposeMultiply

        public void transposeMultiply(double c,
                                      Vec b,
                                      Vec x)
        Description copied from class: Matrix
        Alters the vector x to be equal to x = x + A'*b*c
        Overrides:
        transposeMultiply in class GenericMatrix
        Parameters:
        c - the scalar constant to multiply by
        b - the vector to multiply by
        x - the vector the add the result to
      • changeSize

        public void changeSize(int newRows,
                               int newCols)
        Description copied from class: Matrix
        This method alters the size of a matrix, either adding or subtracting rows from the internal structure of the matrix. Every resize call may cause a new allocation internally, and should not be called for excessive changing of a matrix. All added rows/ columns will have values of zero. If a row / column is removed, it is always the bottom/right most row / column removed. Values of the removed rows / columns will be lost.
        Specified by:
        changeSize in class Matrix
        Parameters:
        newRows - the new number of rows, must be positive
        newCols - the new number of columns, must be positive.
      • transposeMultiply

        public void transposeMultiply(Matrix b,
                                      Matrix C)
        Description copied from class: Matrix
        Alters the matrix C so that C = C + A'*B
        Overrides:
        transposeMultiply in class GenericMatrix
        Parameters:
        b - the matrix to multiply by
        C - the matrix to add the result to
      • transposeMultiply

        public void transposeMultiply(Matrix b,
                                      Matrix C,
                                      java.util.concurrent.ExecutorService threadPool)
        Description copied from class: Matrix
        Alters the matrix C so that C = C + A'*B
        Overrides:
        transposeMultiply in class GenericMatrix
        Parameters:
        b - the matrix to multiply by
        C - the matrix to place the results in
        threadPool - the source of threads to do computation in parallel
      • multiply

        public void multiply(Matrix b,
                             Matrix C)
        Description copied from class: Matrix
        Alters the matrix C to be equal to C = C+A*B
        Overrides:
        multiply in class GenericMatrix
        Parameters:
        b - the matrix to multiply this with
        C - the matrix to add the result to
      • multiply

        public void multiply(Matrix b,
                             Matrix C,
                             java.util.concurrent.ExecutorService threadPool)
        Description copied from class: Matrix
        Alters the matrix C to be equal to C = C+A*B
        Overrides:
        multiply in class GenericMatrix
        Parameters:
        b - the matrix to multiply this with
        C - the matrix to add the result to
        threadPool - the source of threads to do computation in parallel
      • mutableMultiply

        public void mutableMultiply(double c)
        Description copied from class: Matrix
        Alters the current matrix to be equal to A*c
        Overrides:
        mutableMultiply in class GenericMatrix
        Parameters:
        c - the scalar constant to multiply by
      • mutableTranspose

        public void mutableTranspose()
        Description copied from class: Matrix
        Transposes the current matrix in place, altering its value. Only valid for square matrices
        Overrides:
        mutableTranspose in class GenericMatrix
      • transpose

        public DenseMatrix transpose()
        Description copied from class: Matrix
        Returns a new matrix that is the transpose of this matrix.
        Overrides:
        transpose in class Matrix
        Returns:
        a new matrix A'
      • transpose

        public void transpose(Matrix C)
        Description copied from class: Matrix
        Overwrites the values stored in matrix C to store the value of A'
        Overrides:
        transpose in class GenericMatrix
        Parameters:
        C - the matrix to store the transpose of the current matrix
      • get

        public double get(int i,
                          int j)
        Description copied from class: Matrix
        Returns the value stored at at the matrix position Ai,j
        Specified by:
        get in class Matrix
        Parameters:
        i - the row, starting from 0
        j - the column, starting from 0
        Returns:
        the value at Ai,j
      • set

        public void set(int i,
                        int j,
                        double value)
        Description copied from class: Matrix
        Sets the value stored at at the matrix position Ai,j
        Specified by:
        set in class Matrix
        Parameters:
        i - the row, starting from 0
        j - the column, starting from 0
        value - the value to place at Ai,j
      • rows

        public int rows()
        Description copied from class: Matrix
        Returns the number of rows stored in this matrix
        Specified by:
        rows in class Matrix
        Returns:
        the number of rows stored in this matrix
      • cols

        public int cols()
        Description copied from class: Matrix
        Returns the number of columns stored in this matrix
        Specified by:
        cols in class Matrix
        Returns:
        the number of columns stored in this matrix
      • isSparce

        public boolean isSparce()
        Description copied from class: Matrix
        Returns true if the matrix is sparse, false otherwise
        Specified by:
        isSparce in class Matrix
        Returns:
        true if the matrix is sparse, false otherwise
      • swapRows

        public void swapRows(int r1,
                             int r2)
        Description copied from class: Matrix
        Alters the current matrix by swapping the values stored in two different rows.
        Overrides:
        swapRows in class GenericMatrix
        Parameters:
        r1 - the first row to swap
        r2 - the second row to swap
      • zeroOut

        public void zeroOut()
        Description copied from class: Matrix
        Alters the current matrix so that all values are equal to zero.
        Overrides:
        zeroOut in class GenericMatrix
      • getRowView

        public Vec getRowView(int r)
        Description copied from class: Matrix
        Obtains a vector that is backed by this, at very little memory cost. Mutations to this vector will alter the values stored in the matrix, and vice versa.
        Overrides:
        getRowView in class Matrix
        Parameters:
        r - the row to obtain a view of
        Returns:
        a vector backed by the specified row of the matrix
      • lup

        public Matrix[] lup(java.util.concurrent.ExecutorService threadPool)
        Overrides:
        lup in class GenericMatrix
      • qr

        public Matrix[] qr(java.util.concurrent.ExecutorService threadPool)
        Overrides:
        qr in class GenericMatrix

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.