Documentation of 'mikera.arrayz.impl.SliceArray' Java class
SliceArray
mikera.arrayz.impl

Class SliceArray<T extends INDArray>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<INDArray>, INDArray


    public final class SliceArray<T extends INDArray>
    extends BaseShapedArray
    A general N-dimensional double array implemented as a collection of (n-1) dimensional slices Must have dimensionality 1 or above, and contain at least one slice
    See Also:
    Serialized Form
    • Method Detail

      • of

        @SafeVarargs
        public static <T extends INDArraySliceArray<T> of(T... slices)
        Create a SliceArray by wrapping a set of slices.
        Parameters:
        slices -
        Returns:
      • repeat

        public static SliceArray<INDArray> repeat(INDArray slice,
                                                  int n)
        Create a SliceArray by repeating the same slice instance a given number of times
        Parameters:
        slice -
        n -
        Returns:
      • dimensionality

        public int dimensionality()
        Description copied from interface: INDArray
        Returns the dimensionality of the array (i.e. the number of dimensions in the array shape) e.g. 0 for a scalar, 1 for a vector, 2 for a matrix etc.
        Specified by:
        dimensionality in interface INDArray
        Overrides:
        dimensionality in class BaseShapedArray
      • get

        public double get(int... indexes)
        Description copied from interface: INDArray
        Returns the double value at the specified index position in an array
      • set

        public void set(double value)
        Description copied from interface: INDArray
        Sets all elements of an array to a specific double value
        Specified by:
        set in interface INDArray
        Overrides:
        set in class AbstractArray<INDArray>
      • fill

        public void fill(double value)
        Description copied from interface: INDArray
        Fills this array with a single double value. Requires the array to be mutable.
        Specified by:
        fill in interface INDArray
        Overrides:
        fill in class AbstractArray<INDArray>
      • set

        public void set(int[] indexes,
                        double value)
        Description copied from interface: INDArray
        Sets the element at the given indexed position in a mutable array
      • reshape

        public INDArray reshape(int... dimensions)
        Description copied from interface: INDArray
        Returns a new array by rearranging the elements of this array into the desired shape Truncates or zero-pads the elements as required to fill the new shape
        Specified by:
        reshape in interface INDArray
        Overrides:
        reshape in class AbstractArray<INDArray>
      • slice

        public T slice(int majorSlice)
        Description copied from interface: INDArray
        Returns the specified major slice of this array as a view (slice along dimension 0) 0 dimensional slice results are permitted, but attempting to slice a 0 dimensional array will result in an error.
      • getComponent

        public T getComponent(int k)
        Description copied from interface: INDArray
        Gets a component from the array at the specified index Will throw an error if components are not supported, or if the component is out of bounds as defined by 0 <= k
        Specified by:
        getComponent in interface INDArray
        Overrides:
        getComponent in class AbstractArray<INDArray>
        Returns:
      • slice

        public INDArray slice(int dimension,
                              int index)
        Description copied from interface: INDArray
        Returns a slice view of this array along the specified dimension
      • elementCount

        public long elementCount()
        Description copied from interface: INDArray
        Returns the total number of elements in this array. Equivalent to the product of all dimension sizes.
        Specified by:
        elementCount in interface INDArray
        Overrides:
        elementCount in class BaseShapedArray
      • 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 AbstractArray<INDArray>
      • isZero

        public boolean isZero()
        Description copied from interface: INDArray
        Returns true if the array is zero (all elements equal to zero)
        Specified by:
        isZero in interface INDArray
        Overrides:
        isZero in class BaseShapedArray
      • 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.
      • applyOp

        public void applyOp(IOperator op)
        Description copied from interface: INDArray
        Applies a unary operator to all elements of the array (in-place)
        Specified by:
        applyOp in interface INDArray
        Overrides:
        applyOp in class AbstractArray<INDArray>
        Parameters:
        op - The operator to apply to the array
      • equals

        public boolean equals(INDArray a)
        Description copied from interface: INDArray
        Checks if two arrays are equal exactly in terms of both value and shape Element equality checks are consistent with compareTo
        Specified by:
        equals in interface INDArray
        Overrides:
        equals in class AbstractArray<INDArray>
      • exactClone

        public SliceArray<T> exactClone()
        Description copied from interface: INDArray
        Creates a deep clone of an array, using the same class implementation as the original array
        Returns:
        A clone of the original array
      • getSlices

        public java.util.List<?> getSlices()
        Description copied from interface: INDArray
        Returns a list of all major slices of this array. Returns a list of Double values if a 1-dimensional array is sliced, otherwise a list of INDArray instances
        Specified by:
        getSlices in interface INDArray
        Overrides:
        getSlices in class AbstractArray<INDArray>
      • equalsArray

        public boolean equalsArray(double[] values,
                                   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 AbstractArray<INDArray>
        Parameters:
        values - Array of double element values to check for equality
        offset - Offset into the data array
        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 AbstractArray<INDArray>
      • get

        public double get(int x)
        Description copied from interface: INDArray
        Returns the double value at the specified position in a 1D vector
        Specified by:
        get in interface INDArray
        Specified by:
        get in class AbstractArray<INDArray>
      • get

        public double get(int x,
                          int y)
        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 class AbstractArray<INDArray>

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.