Documentation of 'mikera.matrixx.impl.ADiagonalMatrix' Java class
ADiagonalMatrix
mikera.matrixx.impl

Class ADiagonalMatrix

    • Method Detail

      • isSquare

        public boolean isSquare()
        Description copied from interface: IMatrix
        Checks if this is a square matrix
        Specified by:
        isSquare in interface IMatrix
        Overrides:
        isSquare in class AMatrix
        Returns:
        true if square, false otherwise
      • isZero

        public boolean isZero()
        Description copied from class: AMatrix
        Returns true if the matrix is the zero matrix (all components zero)
        Specified by:
        isZero in interface INDArray
        Overrides:
        isZero in class ASingleBandMatrix
      • isBoolean

        public boolean isBoolean()
        Description copied from interface: INDArray
        Returns true if the array is boolean (contains only 0.0 or 1.0 values)
        Specified by:
        isBoolean in interface INDArray
        Overrides:
        isBoolean in class AMatrix
      • isDiagonal

        public boolean isDiagonal()
        Description copied from interface: IMatrix
        Returns true iff this matrix is a square diagonal matrix
        Specified by:
        isDiagonal in interface IMatrix
        Overrides:
        isDiagonal in class AMatrix
      • isUpperTriangular

        public boolean isUpperTriangular()
        Description copied from class: AMatrix
        Returns true if a matrix is upper triangular An upper triangular matrix is defined as having all elements equal to 0.0 where i > j
        Overrides:
        isUpperTriangular in class ABandedMatrix
      • isLowerTriangular

        public boolean isLowerTriangular()
        Description copied from class: AMatrix
        Returns true if a matrix is lower triangular. A lower triangular matrix is defined as having all elements equal to 0.0 where i < j
        Overrides:
        isLowerTriangular in class ABandedMatrix
      • isMutable

        public abstract boolean isMutable()
        Description copied from interface: INDArray
        Returns true if the INDArray is mutable (at least partially)
        Specified by:
        isMutable in interface INDArray
        Overrides:
        isMutable in class ABandedMatrix
      • isFullyMutable

        public boolean isFullyMutable()
        Description copied from interface: INDArray
        If this method returns true, the INDArray is guaranteed to be fully mutable in all positions i.e. every position can store any valid double value
        Specified by:
        isFullyMutable in interface INDArray
        Overrides:
        isFullyMutable in class ABandedMatrix
      • upperBandwidthLimit

        public final int upperBandwidthLimit()
        Description copied from class: AMatrix
        A limit on the upper bandwidth of the banded matrix. Actual upper bandwidth is guaranteed to be less than or equal to this value. Implementation should be O(1).
        Specified by:
        upperBandwidthLimit in class ABandedMatrix
        Returns:
      • lowerBandwidthLimit

        public final int lowerBandwidthLimit()
        Description copied from class: AMatrix
        A limit on the lower bandwidth of the banded matrix. Actual lower bandwidth is guaranteed to be less than or equal to this value. Implementation should be O(1).
        Specified by:
        lowerBandwidthLimit in class ABandedMatrix
        Returns:
      • getBand

        public AVector getBand(int band)
        Description copied from class: AMatrix
        Gets a specific band of the matrix, as a view vector. The band is truncated at the edges of the matrix, i.e. it does not wrap around the matrix.
        Specified by:
        getBand in interface IMatrix
        Specified by:
        getBand in interface IFastBands
        Overrides:
        getBand in class ASingleBandMatrix
        Returns:
      • determinant

        public double determinant()
        Description copied from class: AMatrix
        Calculates the determinant of the matrix.
        Overrides:
        determinant in class AMatrix
      • rank

        public int rank()
        Description copied from class: AMatrix
        Calculate the rank of a matrix. This is equivalent to the maximum number of linearly independent rows or columns.
        Overrides:
        rank in class ASingleBandMatrix
      • dimensions

        public int dimensions()
        Returns the number of dimensions of this diagonal matrix
        Returns:
      • isSameShape

        public boolean isSameShape(AMatrix m)
        Description copied from class: AMatrix
        Returns true iff this matrix is exactly the same shape as another matrix
        Overrides:
        isSameShape in class AMatrix
        Returns:
      • checkSquare

        public int checkSquare()
        Description copied from class: AMatrix
        Checks if a matrix is square. Returns the size if true, throws an exception otherwise;
        Overrides:
        checkSquare in class AMatrix
        Returns:
      • elementMax

        public double elementMax()
        Description copied from interface: INDArray
        Returns the maximum element value in this array. Throws an error if there are no elements.
        Specified by:
        elementMax in interface INDArray
        Overrides:
        elementMax in class AbstractArray<AVector>
      • elementMin

        public double elementMin()
        Description copied from interface: INDArray
        Returns the maximum element value in this array. Throws an error if there are no elements.
        Specified by:
        elementMin in interface INDArray
        Overrides:
        elementMin in class AbstractArray<AVector>
      • copyRowTo

        public void copyRowTo(int row,
                              double[] dest,
                              int destOffset)
        Description copied from class: AMatrix
        Copies the elements in a selected row of this matrix to a double array
        Overrides:
        copyRowTo in class ABandedMatrix
        Parameters:
        row - The index of the selected row
        dest - Destination double[] array
        destOffset - Offset into destination array
      • addToArray

        public void addToArray(double[] dest,
                               int offset)
        Description copied from interface: INDArray
        Adds all the elements of this array to a double array at the specified offset, in row-major order
        Specified by:
        addToArray in interface INDArray
        Overrides:
        addToArray in class ABandedMatrix
      • copyColumnTo

        public void copyColumnTo(int col,
                                 double[] dest,
                                 int destOffset)
        Description copied from class: AMatrix
        Copies the elements in a selected row of this matrix to a double array
        Overrides:
        copyColumnTo in class AMatrix
        dest - Destination double[] array
      • innerProduct

        public AMatrix innerProduct(ADiagonalMatrix a)
        Computes the inner product of this matrix with another diagonal matrix of the same shape. The result will be a diagnonal matrix of the same shape.
        Parameters:
        a -
        Returns:
      • innerProduct

        public AMatrix innerProduct(AMatrix a)
        Description copied from interface: IMatrix
        Computes the inner product of this matrix with another. Equivalent to matrix x matrix multiplication
        Specified by:
        innerProduct in interface IMatrix
        Overrides:
        innerProduct in class AMatrix
        Returns:
      • addOuterProductSparse

        public void addOuterProductSparse(AVector a,
                                          AVector b)
        Description copied from class: AMatrix
        Adds the outer product of two vectors to this matrix. Mutates only the non-sparse elements in this matrix
        Overrides:
        addOuterProductSparse in class AMatrix
      • rowCount

        public int rowCount()
        Description copied from interface: IMatrix
        Gets the number of rows in this matrix (dimension 0)
        Returns:
      • columnCount

        public int columnCount()
        Description copied from interface: IMatrix
        Gets the number of columns in this matrix (dimension 1)
        Returns:
      • isIdentity

        public boolean isIdentity()
        Description copied from interface: IMatrix
        Checks if this is an identity matrix (i.e. 1.0 in leading diagonal, 0.0 elsewhere)
        Specified by:
        isIdentity in interface IMatrix
        Overrides:
        isIdentity in class ASingleBandMatrix
        Returns:
        true if this matrix is a square identity matrix, false otherwise.
      • transposeInPlace

        public void transposeInPlace()
        Description copied from interface: IMatrix
        Transposes a matrix in place, if possible. Throws an exception if this is not possible (e.g. if the matrix is not square or not sufficiently mutable)
        Specified by:
        transposeInPlace in interface IMatrix
        Overrides:
        transposeInPlace in class AMatrix
      • rowDotProduct

        public double rowDotProduct(int i,
                                    AVector v)
        Description copied from class: AMatrix
        Returns the dot product of a specific row with a vector. Unsafe operation: performs no bounds checking
        Overrides:
        rowDotProduct in class AMatrix
        Returns:
      • set

        public void set(int row,
                        int column,
                        double value)
        Description copied from interface: INDArray
        Sets a value at a given position in a mutable 2D array
        Specified by:
        set in interface INDArray
        Specified by:
        set in interface IMatrix
        Specified by:
        set in class AMatrix
      • setSparse

        public void setSparse(double value)
        Description copied from interface: INDArray
        Sets the non-sparse elements of this array to the specified value May throw an exception if non-sparse elements are not mutable
        Specified by:
        setSparse in interface INDArray
        Overrides:
        setSparse in class ABandedMatrix
      • getLeadingDiagonal

        public abstract AVector getLeadingDiagonal()
        Description copied from class: AMatrix
        Returns a vector view of the leading diagonal values of the matrix
        Overrides:
        getLeadingDiagonal in class AMatrix
        Returns:
      • getDiagonalValue

        public double getDiagonalValue(int i)
      • getRow

        public ASingleElementVector getRow(int row)
        Description copied from interface: IMatrix
        Returns a row of the matrix. May or may not be a view, depending on matrix type. Intended for the fastest possible read access of the row. This often means a view, but might not be (e.g. getRow on a Matrix33 returns a Vector3).
        Specified by:
        getRow in interface IMatrix
        Overrides:
        getRow in class AMatrix
      • getColumn

        public ASingleElementVector getColumn(int col)
        Description copied from interface: IMatrix
        Returns a column of the matrix. May or may not be a view, depending on matrix type. Intended for the fastest possible read access of the column. This often means a view, but might not be (e.g. getColumn on a Matrix33 returns a Vector3).
        Specified by:
        getColumn in interface IMatrix
        Overrides:
        getColumn in class AMatrix
      • unsafeGetDiagonalValue

        public double unsafeGetDiagonalValue(int i)
      • getTranspose

        public ADiagonalMatrix getTranspose()
        Description copied from interface: INDArray
        Returns the transpose of this array. A transpose of an array is equivalent to reversing the order of dimensions. May or may not return a view depending on the array type.
        Specified by:
        getTranspose in interface INDArray
        Specified by:
        getTranspose in interface IMatrix
        Overrides:
        getTranspose in class AMatrix
        Returns:
        the transpose of this matrix
      • toMatrix

        public Matrix toMatrix()
        Description copied from class: AMatrix
        Coerces the matrix to the standard mutable Matrix type in row major order. Performs a copy if necessary.
        Overrides:
        toMatrix in class ABandedMatrix
      • trace

        public double trace()
        Description copied from interface: IMatrix
        Computes the trace of a matrix, i.e. the sum of all elements on the leading diagonal
        Specified by:
        trace in interface IMatrix
        Overrides:
        trace in class ABandedMatrix
        Returns:
      • toMatrixTranspose

        public final Matrix toMatrixTranspose()
        Description copied from class: AMatrix
        Coerces the transpose of a matrix to the standard mutable Matrix type in row major order. Performs a copy if necessary.
        Overrides:
        toMatrixTranspose in class ABandedMatrix
      • equalsTranspose

        public boolean equalsTranspose(AMatrix m)
        Description copied from class: AMatrix
        Tests if this matrix is exactly equal to the transpose of another matrix
        Overrides:
        equalsTranspose in class AMatrix
        Returns:
      • validate

        public void validate()
        Description copied from interface: INDArray
        Validates the internal data structure of the INDArray. Throws an exception on failure. Failure indicates a serious bug and/or data corruption.
        Specified by:
        validate in interface INDArray
        Overrides:
        validate in class ABandedMatrix
      • exactClone

        public abstract ADiagonalMatrix exactClone()
        Description copied from interface: INDArray
        Creates a deep clone of an array, using the same class implementation as the original array
        Specified by:
        exactClone in interface INDArray
        Specified by:
        exactClone in class AMatrix
        Returns:
        A clone of the original array
      • clone

        public AMatrix clone()
        Description copied from interface: INDArray
        Returns a clone of the array data, as a new array which will be fully mutable and may be of a different class to the original. Clone should attempt to return the most efficient possible array type. Clone should preserve sparsity property where possible, but this is not guaranteed.
        Specified by:
        clone in interface INDArray
        Overrides:
        clone in class AMatrix
      • hasUncountable

        public boolean hasUncountable()
        Description copied from class: AMatrix
        Checks to see if any element in the matrix is NaN of Infinite.
        Specified by:
        hasUncountable in interface INDArray
        Overrides:
        hasUncountable in class ASingleBandMatrix
        Returns:
        True if any element in the matrix is NaN of Infinite.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.