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

Class ImmutableMatrix

    • Constructor Detail

      • ImmutableMatrix

        public ImmutableMatrix(AMatrix m)
    • Method Detail

      • wrap

        public static ImmutableMatrix wrap(Matrix source)
        Creates a new ImmutableMatrix wrapping the data array of a given Matrix WARNING: does not take a defensive copy. Should be used only if you can guarantee that the underlying data array will not be mutated elsewhere.
      • wrap

        public static ImmutableMatrix wrap(int rows,
                                           int cols,
                                           double[] data)
        Creates a new ImmutableMatrix wrapping the specified source array WARNING: does not take a defensive copy. Should be used only if you can guarantee that the data array will not be mutated elsewhere.
      • isMutable

        public 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 AMatrix
      • 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
        Specified by:
        isFullyMutable in class AMatrix
      • isView

        public boolean isView()
        Description copied from interface: INDArray
        Return true if this array is considered as a view type. This indicates (but does not guarantee): a) Data is *likely* to be shared with other arrays, so mutation of one may affect others b) It is *unlikely* to be in the most efficient general purpose format isView is intended to be used as for heuristics. It should *not* be used where the outcome might affect correctness.
        Specified by:
        isView in interface INDArray
        Overrides:
        isView in class AMatrix
      • nonZeroCount

        public long nonZeroCount()
        Description copied from interface: INDArray
        Returns the number of non-zero elements in the array.
        Specified by:
        nonZeroCount in interface INDArray
        Overrides:
        nonZeroCount in class AMatrix
      • 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
      • 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 AMatrix
      • get

        public double get(int i,
                          int j)
        Description copied from interface: INDArray
        Returns the double value at the specified position in a 2D matrix
        Specified by:
        get in interface INDArray
        Specified by:
        get in interface IMatrix
        Specified by:
        get in class AMatrix
      • getRowView

        public ImmutableVector getRowView(int row)
        Description copied from interface: IMatrix
        Returns a row of the matrix as a vector view. May be used to modify the original matrix.
        Specified by:
        getRowView in interface IMatrix
        Overrides:
        getRowView in class AMatrix
      • unsafeGet

        public double unsafeGet(int i,
                                int j)
        Description copied from class: AMatrix
        Gets an element in the matrix in an unsafe fashion, without performing bound checks The result is undefined if the row and column are out of bounds.
        Overrides:
        unsafeGet in class AMatrix
        Returns:
      • copyRowTo

        public final 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 AMatrix
        Parameters:
        row - The index of the selected row
        dest - Destination double[] array
        destOffset - Offset into destination array
      • innerProduct

        public Matrix 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:
      • copyColumnTo

        public final 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
      • elementSum

        public double elementSum()
        Description copied from class: AMatrix
        Returns the sum of all elements in this matrix
        Specified by:
        elementSum in interface INDArray
        Overrides:
        elementSum in class AMatrix
      • toVector

        public Vector toVector()
        Description copied from interface: INDArray
        Coerces the array into a flattened dense Vector, in row-major order. May return the same array if it is already a Vector instance.
        Specified by:
        toVector in interface INDArray
        Overrides:
        toVector in class AMatrix
      • 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 AMatrix
      • toMatrixTranspose

        public 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 AMatrix
      • toDoubleBuffer

        public void toDoubleBuffer(java.nio.DoubleBuffer dest)
        Description copied from interface: INDArray
        Copies the elements of this INDArray to the specified double buffer.
        Specified by:
        toDoubleBuffer in interface INDArray
        Overrides:
        toDoubleBuffer in class AMatrix
      • getElements

        public void getElements(double[] dest,
                                int offset)
        Description copied from interface: INDArray
        Copies all elements of this array a double array at the specified offset
        Specified by:
        getElements in interface INDArray
        Overrides:
        getElements in class AMatrix
      • addToArray

        public void addToArray(double[] data,
                               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 AMatrix
      • clone

        public Matrix 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
      • exactClone

        public AMatrix 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
      • equals

        public boolean equals(AMatrix a)
        Description copied from class: AMatrix
        Returns true if this matrix is exactly equal to another matrix
        Overrides:
        equals in class AMatrix
      • equalsArray

        public boolean equalsArray(double[] data,
                                   int offset)
        Description copied from interface: INDArray
        Returns true if the elements in this array exactly match the elements in the given array, in row-major order
        Specified by:
        equalsArray in interface INDArray
        Overrides:
        equalsArray in class AMatrix
        Parameters:
        data - Array of double element values to check for equality
        offset - Offset into the data array
        Returns:
      • getInternalData

        public double[] getInternalData()
        Unsafe method that returns the internal data array
        Returns:

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.