Class BaseNDArray

    • Field Detail

      • shapeInformation

        protected transient volatile DataBuffer shapeInformation
      • data

        protected transient volatile DataBuffer data
      • compressed

        protected transient boolean compressed
      • closeable

        protected transient boolean closeable
      • released

        protected transient boolean released
      • jvmShapeInfo

        protected transient JvmShapeInfo jvmShapeInfo
      • arrayId

        protected transient long arrayId
    • Constructor Detail

      • BaseNDArray

        public BaseNDArray()
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer)
        Parameters:
        buffer -
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           int[] shape,
                           int[] stride,
                           long offset,
                           char ordering)
        Parameters:
        buffer -
        shape -
        stride -
        offset -
        ordering -
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           long[] shape,
                           long[] stride,
                           long offset,
                           long ews,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering,
                           DataType dataType)
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           long[] shape,
                           long[] stride,
                           long offset,
                           long ews,
                           char ordering,
                           DataType dataType)
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           long[] shape,
                           long[] stride,
                           char ordering,
                           DataType type)
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           DataType dataType,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(double[][] data)
        Initialize the ndarray as a matrix with the given data (indices preserved)
        Parameters:
        data -
      • BaseNDArray

        public BaseNDArray​(double[][] data,
                           char ordering)
        Parameters:
        data -
        ordering -
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           DataBuffer buffer)
        Create with the specified shape and buffer
        Parameters:
        shape - the shape
        buffer - the buffer
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           char ordering)
        Create this ndarray with the given data and shape and 0 offset
        Parameters:
        data - the data to use
        shape - the shape of the ndarray
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           long offset,
                           char ordering)
        Parameters:
        data - the data to use
        shape - the shape of the ndarray
        offset - the desired offset
        ordering - the ordering of the ndarray
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           long[] shape,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           long[] shape,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           int[] stride,
                           long offset,
                           char ordering)
        Construct an ndarray of the specified shape with an empty data array
        Parameters:
        shape - the shape of the ndarray
        stride - the stride of the ndarray
        offset - the desired offset
        ordering - the ordering of the ndarray
      • BaseNDArray

        public BaseNDArray​(long[] shape,
                           long[] stride,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           int[] stride,
                           long offset,
                           char ordering,
                           boolean initialize)
        Construct an ndarray of the specified shape.
        Parameters:
        shape - the shape of the ndarray
        stride - the stride of the ndarray
        offset - the desired offset
        ordering - the ordering of the ndarray
        initialize - Whether to initialize the INDArray. If true: initialize. If false: don't.
      • BaseNDArray

        public BaseNDArray​(long[] shape,
                           long[] stride,
                           long offset,
                           char ordering,
                           boolean initialize)
      • BaseNDArray

        public BaseNDArray​(DataType type,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering,
                           boolean initialize)
      • BaseNDArray

        public BaseNDArray​(DataType type,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering,
                           boolean initialize,
                           MemoryWorkspace workspace)
      • BaseNDArray

        public BaseNDArray​(DataType type,
                           long[] shape,
                           long[] paddings,
                           long[] paddingOffsets,
                           char ordering,
                           MemoryWorkspace workspace)
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           int[] stride,
                           char ordering)
        Create the ndarray with the specified shape and stride and an offset of 0
        Parameters:
        shape - the shape of the ndarray
        stride - the stride of the ndarray
        ordering - the ordering of the ndarray
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           long offset,
                           char ordering)
        Parameters:
        shape -
        offset -
        ordering -
      • BaseNDArray

        public BaseNDArray​(long[] shape,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(int[] shape)
        Create an ndarray with the given shape
        Parameters:
        shape -
      • BaseNDArray

        public BaseNDArray​(long[] shape)
      • BaseNDArray

        public BaseNDArray​(int newRows,
                           int newColumns,
                           char ordering)
        Creates a new n times m DoubleMatrix.
        Parameters:
        newRows - the number of rows (n) of the new matrix.
        newColumns - the number of columns (m) of the new matrix.
      • BaseNDArray

        public BaseNDArray​(long newRows,
                           long newColumns,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           int[] shape,
                           char ordering)
        Create an ndarray from the specified slices. This will go through and merge all of the data from each slice in to one ndarray which will then take the specified shape
        Parameters:
        slices - the slices to merge
        shape - the shape of the ndarray
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           long[] shape,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           int[] shape,
                           int[] stride,
                           char ordering)
        Create an ndarray from the specified slices. This will go through and merge all of the data from each slice in to one ndarray which will then take the specified shape
        Parameters:
        slices - the slices to merge
        shape - the shape of the ndarray
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           long[] shape,
                           long[] stride,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           int[] stride,
                           char ordering)
        Parameters:
        data -
        shape -
        stride -
        ordering -
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           int[] stride,
                           long offset,
                           char ordering)
        Parameters:
        data -
        shape -
        stride -
        offset -
        ordering -
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           long[] shape,
                           long[] stride,
                           long offset,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(DataBuffer data,
                           int[] shape,
                           int[] stride,
                           long offset)
        Parameters:
        data -
        shape -
        stride -
        offset -
      • BaseNDArray

        public BaseNDArray​(int[] data,
                           int[] shape,
                           int[] strides)
        Parameters:
        data -
        shape -
        strides -
      • BaseNDArray

        public BaseNDArray​(DataBuffer data,
                           int[] shape)
        Parameters:
        data -
        shape -
      • BaseNDArray

        public BaseNDArray​(DataBuffer data,
                           long[] shape)
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           int[] shape,
                           long offset)
        Parameters:
        buffer -
        shape -
        offset -
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           int[] shape,
                           char ordering)
        Parameters:
        buffer -
        shape -
        ordering -
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           long[] shape,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           int[] shape,
                           char ordering)
        Parameters:
        data -
        shape -
        ordering -
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           long[] shape,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           long[] shape,
                           char ordering)
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           int[] shape,
                           int[] stride,
                           long offset,
                           char ordering)
        Parameters:
        data -
        shape -
        stride -
        offset -
        ordering -
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           char order)
        Parameters:
        data -
        order -
      • BaseNDArray

        public BaseNDArray​(DataBuffer floatBuffer,
                           char order)
        Parameters:
        floatBuffer -
        order -
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           int[] shape,
                           int[] strides)
        Parameters:
        buffer -
        shape -
        strides -
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape)
        Create this ndarray with the given data and shape and 0 offset
        Parameters:
        data - the data to use
        shape - the shape of the ndarray
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           long offset)
        Parameters:
        data -
        shape -
        offset -
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           int[] stride,
                           long offset)
        Construct an ndarray of the specified shape with an empty data array
        Parameters:
        shape - the shape of the ndarray
        stride - the stride of the ndarray
        offset - the desired offset
      • BaseNDArray

        public BaseNDArray​(long[] shape,
                           long[] stride,
                           long offset)
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           int[] stride)
        Create the ndarray with the specified shape and stride and an offset of 0
        Parameters:
        shape - the shape of the ndarray
        stride - the stride of the ndarray
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           long offset)
        Parameters:
        shape -
        offset -
      • BaseNDArray

        public BaseNDArray​(int[] shape,
                           char ordering)
        Parameters:
        shape -
        ordering -
      • BaseNDArray

        public BaseNDArray​(int newRows,
                           int newColumns)
        Creates a new n times m DoubleMatrix.
        Parameters:
        newRows - the number of rows (n) of the new matrix.
        newColumns - the number of columns (m) of the new matrix.
      • BaseNDArray

        public BaseNDArray​(long newRows,
                           long newColumns)
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           int[] shape)
        Create an ndarray from the specified slices. This will go through and merge all of the data from each slice in to one ndarray which will then take the specified shape
        Parameters:
        slices - the slices to merge
        shape - the shape of the ndarray
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           long[] shape)
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           int[] shape,
                           int[] stride)
        Create an ndarray from the specified slices. This will go through and merge all of the data from each slice in to one ndarray which will then take the specified shape
        Parameters:
        slices - the slices to merge
        shape - the shape of the ndarray
      • BaseNDArray

        public BaseNDArray​(List<INDArray> slices,
                           long[] shape,
                           long[] stride)
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           int[] stride)
        Parameters:
        data -
        shape -
        stride -
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           int[] shape,
                           int[] stride,
                           long offset)
        Parameters:
        data -
        shape -
        stride -
        offset -
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           long[] shape,
                           long[] stride,
                           long offset)
      • BaseNDArray

        public BaseNDArray​(float[] data,
                           long[] shape,
                           long[] stride,
                           long offset)
      • BaseNDArray

        public BaseNDArray​(float[] data)
        Parameters:
        data -
      • BaseNDArray

        public BaseNDArray​(float[][] data)
        Initialize the ndarray with the given data
        Parameters:
        data -
      • BaseNDArray

        public BaseNDArray​(float[][] data,
                           char ordering)
        Parameters:
        data -
        ordering -
      • BaseNDArray

        public BaseNDArray​(DataBuffer buffer,
                           int[] shape,
                           long offset,
                           char ordering)
        Constructor for stride and offset
        Parameters:
        buffer -
        shape -
        offset -
        ordering -
      • BaseNDArray

        public BaseNDArray​(double[] data,
                           int[] shape,
                           int[] stride,
                           long offset)
    • Method Detail

      • isCompressed

        public boolean isCompressed()
        Description copied from interface: INDArray
        Check if this array is compressed.
        Specified by:
        isCompressed in interface INDArray
        Returns:
        true if this array is compressed.
      • markAsCompressed

        public void markAsCompressed​(boolean reallyCompressed)
        Description copied from interface: INDArray
        This method marks INDArray instance as compressed PLEASE NOTE: Do not use this method unless you 100% have to
        Specified by:
        markAsCompressed in interface INDArray
        Parameters:
        reallyCompressed - new value for compressed.
      • internalCreateBuffer

        protected static DataBuffer internalCreateBuffer​(float[] data)
      • internalCreateBuffer

        protected static DataBuffer internalCreateBuffer​(double[] data)
      • internalCreateBuffer

        protected static DataBuffer internalCreateBuffer​(int[] data)
      • internalCreateBuffer

        protected static DataBuffer internalCreateBuffer​(float[] data,
                                                         long offset)
      • internalCreateBuffer

        protected static DataBuffer internalCreateBuffer​(double[] data,
                                                         long offset)
      • isValid

        @Deprecated
        public boolean isValid()
        Deprecated.
        Returns whether the ndarray is valid or not
        Returns:
        true if the ndarray is valid false otherwise
      • elementWiseStride

        public int elementWiseStride()
        Description copied from interface: INDArray
        Element wise stride
        Specified by:
        elementWiseStride in interface INDArray
        Returns:
        the element wise stride
      • tensorsAlongDimension

        public long tensorsAlongDimension​(int... dimension)
        Description copied from interface: INDArray
        Returns the number of possible vectors for a given dimension
        Specified by:
        tensorsAlongDimension in interface INDArray
        Parameters:
        dimension - the dimension to calculate the number of vectors for
        Returns:
        the number of possible vectors along a dimension
      • tensorAlongDimension

        public INDArray tensorAlongDimension​(long index,
                                             int... dimension)
        Description copied from interface: INDArray
        Get the vector along a particular dimension
        Specified by:
        tensorAlongDimension in interface INDArray
        Parameters:
        index - the index of the vector to getScalar
        dimension - the dimension to getScalar the vector from
        Returns:
        the vector along a particular dimension
      • vectorsAlongDimension

        public long vectorsAlongDimension​(int dimension)
        Description copied from interface: INDArray
        Returns the number of possible vectors for a given dimension
        Specified by:
        vectorsAlongDimension in interface INDArray
        Parameters:
        dimension - the dimension to calculate the number of vectors for
        Returns:
        the number of possible vectors along a dimension
      • vectorAlongDimension

        public INDArray vectorAlongDimension​(int index,
                                             int dimension)
        Description copied from interface: INDArray
        Get the vector along a particular dimension
        Specified by:
        vectorAlongDimension in interface INDArray
        Parameters:
        index - the index of the vector to getScalar
        dimension - the dimension to getScalar the vector from
        Returns:
        the vector along a particular dimension
      • setOrder

        public void setOrder​(char order)
        Description copied from interface: INDArray
        Set the ordering
        Specified by:
        setOrder in interface INDArray
        Parameters:
        order - the ordering to set
      • setShapeAndStride

        public void setShapeAndStride​(int[] shape,
                                      int[] stride)
        Description copied from interface: INDArray
        Shape and stride setter
        Specified by:
        setShapeAndStride in interface INDArray
        Parameters:
        shape - new value for shape
        stride - new value for stride
      • cumsumi

        public INDArray cumsumi​(int dimension)
        Description copied from interface: INDArray
        Returns the cumulative sum along a dimension. In-place method.
        Specified by:
        cumsumi in interface INDArray
        Parameters:
        dimension - the dimension to perform cumulative sum along.
        Returns:
        this object.
      • normmaxNumber

        public Number normmaxNumber()
        Description copied from interface: INDArray
        Return the max norm (aka infinity norm, equal to the maximum absolute value) for the entire array
        Specified by:
        normmaxNumber in interface INDArray
        Returns:
        Max norm for the entire array
      • norm2Number

        public Number norm2Number()
        Description copied from interface: INDArray
        Return the norm2 (L2 norm, sqrt(sum(x_i^2), also known as Euclidean norm) for the entire array
        Specified by:
        norm2Number in interface INDArray
        Returns:
        L2 norm for the array
      • norm1Number

        public Number norm1Number()
        Description copied from interface: INDArray
        Calculate and return norm1 (L1 norm, i.e., sum of absolute values; also known as Taxicab or Manhattan norm) for the entire array
        Specified by:
        norm1Number in interface INDArray
        Returns:
        Norm 1 for the array
      • stdNumber

        public Number stdNumber()
        Description copied from interface: INDArray
        Calculate the standard deviation for the entire array
        Specified by:
        stdNumber in interface INDArray
        Returns:
        standard deviation
      • prodNumber

        public Number prodNumber()
        Description copied from interface: INDArray
        Calculate the product of all values in the array
        Specified by:
        prodNumber in interface INDArray
        Returns:
        Product of all values in the array
      • meanNumber

        public Number meanNumber()
        Description copied from interface: INDArray
        Returns the overall mean of this ndarray
        Specified by:
        meanNumber in interface INDArray
        Returns:
        the mean along the specified dimension of this ndarray
      • ameanNumber

        public Number ameanNumber()
        Description copied from interface: INDArray
        Returns the absolute overall mean of this ndarray
        Specified by:
        ameanNumber in interface INDArray
        Returns:
        the mean along the specified dimension of this ndarray
      • varNumber

        public Number varNumber()
        Description copied from interface: INDArray
        Returns the overall variance of all values in this INDArray
        Specified by:
        varNumber in interface INDArray
        Returns:
        variance
      • maxNumber

        public Number maxNumber()
        Description copied from interface: INDArray
        Returns maximum value in this INDArray
        Specified by:
        maxNumber in interface INDArray
        Returns:
        maximum value
      • amaxNumber

        public Number amaxNumber()
        Description copied from interface: INDArray
        Returns maximum (absolute) value in this INDArray
        Specified by:
        amaxNumber in interface INDArray
        Returns:
        Max absolute value
      • minNumber

        public Number minNumber()
        Description copied from interface: INDArray
        Returns min value in this INDArray
        Specified by:
        minNumber in interface INDArray
        Returns:
        Minimum value in the array
      • aminNumber

        public Number aminNumber()
        Description copied from interface: INDArray
        Returns absolute min value in this INDArray
        Specified by:
        aminNumber in interface INDArray
        Returns:
        Absolute min value
      • scan

        public Number scan​(Condition condition)
        Description copied from interface: INDArray
        This method takes boolean condition, and returns number of elements matching this condition
        Specified by:
        scan in interface INDArray
        Parameters:
        condition - Condition to calculate matches for
        Returns:
        Number of elements matching condition
      • sumNumber

        public Number sumNumber()
        Description copied from interface: INDArray
        Sum the entire array
        Specified by:
        sumNumber in interface INDArray
        Returns:
        Sum of array
      • entropyNumber

        public Number entropyNumber()
        Description copied from interface: INDArray
        Returns entropy value for this INDArray
        Specified by:
        entropyNumber in interface INDArray
        Returns:
        entropy value
      • shannonEntropyNumber

        public Number shannonEntropyNumber()
        Description copied from interface: INDArray
        Returns non-normalized Shannon entropy value for this INDArray
        Specified by:
        shannonEntropyNumber in interface INDArray
        Returns:
        non-normalized Shannon entropy
      • logEntropyNumber

        public Number logEntropyNumber()
        Description copied from interface: INDArray
        Returns log entropy value for this INDArray
        Specified by:
        logEntropyNumber in interface INDArray
        Returns:
        log entropy value
      • cumsum

        public INDArray cumsum​(int dimension)
        Description copied from interface: INDArray
        Returns the cumulative sum along a dimension.
        Specified by:
        cumsum in interface INDArray
        Parameters:
        dimension - the dimension to perform cumulative sum along.
        Returns:
        the cumulative sum along the specified dimension
      • assign

        public INDArray assign​(INDArray arr)
        Description copied from interface: INDArray
        Assign all of the elements in the given ndarray to this ndarray
        Specified by:
        assign in interface INDArray
        Parameters:
        arr - the elements to assign
        Returns:
        this
      • putScalar

        public INDArray putScalar​(long i,
                                  double value)
        Description copied from interface: INDArray
        Insert the number linearly in to the ndarray
        Specified by:
        putScalar in interface INDArray
        Parameters:
        i - the index to insert into
        value - the value to insert
        Returns:
        this
      • putScalar

        public INDArray putScalar​(long i,
                                  float value)
        Description copied from interface: INDArray
        Insert a scalar float at the specified index
        Specified by:
        putScalar in interface INDArray
        Parameters:
        i - The index to insert into
        value - Value to insert
        Returns:
        This array
      • putScalar

        public INDArray putScalar​(long i,
                                  int value)
        Description copied from interface: INDArray
        Insert a scalar int at the specified index
        Specified by:
        putScalar in interface INDArray
        Parameters:
        i - The index to insert into
        value - Value to insert
        Returns:
        This array
      • putScalar

        public INDArray putScalar​(int[] indexes,
                                  double value)
        Description copied from interface: INDArray
        Insert the item at the specified indices
        Specified by:
        putScalar in interface INDArray
        Parameters:
        indexes - the indices to insert at
        value - the number to insert
        Returns:
        this
      • putScalar

        public INDArray putScalar​(long row,
                                  long col,
                                  double value)
        Description copied from interface: INDArray
        Insert the value at the specified indices, in a 2d (rank 2) NDArray
        Equivalent to INDArray.putScalar(int[], double) but avoids int[] creation
        Specified by:
        putScalar in interface INDArray
        Parameters:
        row - Row (dimension 0) index
        col - Column (dimension 1) index
        value - Value to put
        Returns:
        This INDArray
      • putScalar

        public INDArray putScalar​(long dim0,
                                  long dim1,
                                  long dim2,
                                  double value)
        Description copied from interface: INDArray
        Insert the value at the specified indices, in a 3d (rank 3) NDArray
        Equivalent to INDArray.putScalar(int[], double) but avoids int[] creation
        Specified by:
        putScalar in interface INDArray
        Parameters:
        dim0 - Dimension 0 index
        dim1 - Dimension 1 index
        dim2 - Dimension 2 index
        value - Value to put
        Returns:
        This INDArray
      • putScalar

        public INDArray putScalar​(long dim0,
                                  long dim1,
                                  long dim2,
                                  long dim3,
                                  double value)
        Description copied from interface: INDArray
        Insert the value at the specified indices, in a 4d (rank 4) NDArray
        Equivalent to INDArray.putScalar(int[], double) but avoids int[] creation
        Specified by:
        putScalar in interface INDArray
        Parameters:
        dim0 - Dimension 0 index
        dim1 - Dimension 1 index
        dim2 - Dimension 2 index
        dim3 - Dimension 3 index
        value - Value to put
        Returns:
        This INDArray
      • putScalar

        public INDArray putScalar​(int[] indexes,
                                  float value)
        Description copied from interface: INDArray
        Put the specified float value at the specified indices in this array
        Specified by:
        putScalar in interface INDArray
        Parameters:
        indexes - Indices to place the value
        value - Value to insert
        Returns:
        This array
      • putScalar

        public INDArray putScalar​(int[] indexes,
                                  int value)
        Description copied from interface: INDArray
        Put the specified integer value at the specified indices in this array
        Specified by:
        putScalar in interface INDArray
        Parameters:
        indexes - Indices to place the value
        value - Value to insert
        Returns:
        This array
      • eps

        public INDArray eps​(Number other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Epsilon equals" comparison.
        Specified by:
        eps in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        the binary ndarray for "Epsilon equals" comparison.
      • eps

        public INDArray eps​(INDArray other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Epsilon equals" comparison.
        Specified by:
        eps in interface INDArray
        Parameters:
        other - the ndarray to compare.
        Returns:
        the binary ndarray for "Epsilon equals" comparison.
      • lt

        public INDArray lt​(Number other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Less" comparison.
        Specified by:
        lt in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        the binary ndarray for "Less" comparison.
      • lte

        public INDArray lte​(Number other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Less or equals" comparison.
        Specified by:
        lte in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        the binary ndarray for "Less or equals" comparison.
      • eq

        public INDArray eq​(Number other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Equals" comparison.
        Specified by:
        eq in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        the binary ndarray for "Equals" comparison.
      • gt

        public INDArray gt​(Number other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Greater" comparison.
        Specified by:
        gt in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        the binary ndarray for "Greater" comparison.
      • gte

        public INDArray gte​(Number other)
        Description copied from interface: INDArray
        Returns binary ndarray for "Greter or equals" comparison.
        Specified by:
        gte in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        binary ndarray for "Greter or equals" comparison.
      • lt

        public INDArray lt​(INDArray other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Less" comparison.
        Specified by:
        lt in interface INDArray
        Parameters:
        other - the ndarray to compare.
        Returns:
        the binary ndarray for "Less" comparison.
      • neq

        public INDArray neq​(Number other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Not equals" comparison.
        Specified by:
        neq in interface INDArray
        Parameters:
        other - the number to compare.
        Returns:
        the binary ndarray for "Not equals" comparison.
      • neq

        public INDArray neq​(INDArray other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Not equals" comparison.
        Specified by:
        neq in interface INDArray
        Parameters:
        other - the ndarray to compare.
        Returns:
        the binary ndarray for "Not equals" comparison.
      • eq

        public INDArray eq​(INDArray other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Equals" comparison.
        Specified by:
        eq in interface INDArray
        Parameters:
        other - the ndarray to compare.
        Returns:
        the binary ndarray for "Equals" comparison.
      • gt

        public INDArray gt​(INDArray other)
        Description copied from interface: INDArray
        Returns the binary ndarray for "Greater Than" comparison.
        Specified by:
        gt in interface INDArray
        Parameters:
        other - the ndarray to compare.
        Returns:
        the binary ndarray for "Greater Than" comparison.
      • isInfinite

        public INDArray isInfinite()
        Description copied from interface: INDArray
        Returns the binary NDArray with value true where this array's entries are infinite, or false where they are not infinite
        Specified by:
        isInfinite in interface INDArray
      • isNaN

        public INDArray isNaN()
        Description copied from interface: INDArray
        Returns the binary NDArray with value true where this array's entries are NaN, or false where they are not infinite
        Specified by:
        isNaN in interface INDArray
      • neg

        public INDArray neg()
        Description copied from interface: INDArray
        Returns the ndarray negative (cloned)
        Specified by:
        neg in interface INDArray
        Returns:
        Array copy with all values negated
      • negi

        public INDArray negi()
        Description copied from interface: INDArray
        In place setting of the negative version of this ndarray
        Specified by:
        negi in interface INDArray
        Returns:
        This array with all values negated
      • rdiv

        public INDArray rdiv​(Number n,
                             INDArray result)
        Description copied from interface: INDArray
        Reverse division (number / ndarray)
        Specified by:
        rdiv in interface INDArray
        Parameters:
        n - the number to divide by
        result - Array to place the result in. Must match shape of this array
        Returns:
        Result array
      • rdivi

        public INDArray rdivi​(Number n,
                              INDArray result)
        Description copied from interface: INDArray
        Reverse in place division
        Specified by:
        rdivi in interface INDArray
        Parameters:
        n - the number to divide by
        result - the result ndarray
        Returns:
        the result ndarray
      • rsub

        public INDArray rsub​(Number n,
                             INDArray result)
        Description copied from interface: INDArray
        Reverse subtraction
        Specified by:
        rsub in interface INDArray
        Parameters:
        n - the number to subtract by
        result - the result ndarray
        Returns:
        the result ndarray
      • rsubi

        public INDArray rsubi​(Number n,
                              INDArray result)
        Description copied from interface: INDArray
        Reverse in place subtraction
        Specified by:
        rsubi in interface INDArray
        Parameters:
        n - the number to subtract by
        result - the result ndarray
        Returns:
        the result ndarray
      • div

        public INDArray div​(Number n,
                            INDArray result)
        Description copied from interface: INDArray
        Division if ndarray by number
        Specified by:
        div in interface INDArray
        Parameters:
        n - the number to divide by
        result - the result ndarray
        Returns:
        the result ndarray
      • divi

        public INDArray divi​(Number n,
                             INDArray result)
        Description copied from interface: INDArray
        In place division of this ndarray
        Specified by:
        divi in interface INDArray
        Parameters:
        n - the number to divide by
        result - the result ndarray
        Returns:
        the result ndarray
      • mul

        public INDArray mul​(Number n,
                            INDArray result)
        Description copied from interface: INDArray
        Multiplication of ndarray.
        Specified by:
        mul in interface INDArray
        Parameters:
        n - the number to multiply by
        result - the result ndarray
        Returns:
        the result ndarray
      • muli

        public INDArray muli​(Number n,
                             INDArray result)
        Description copied from interface: INDArray
        In place multiplication of this ndarray
        Specified by:
        muli in interface INDArray
        Parameters:
        n - the number to divide by
        result - the result ndarray
        Returns:
        the result ndarray
      • sub

        public INDArray sub​(Number n,
                            INDArray result)
        Description copied from interface: INDArray
        Subtraction of this ndarray
        Specified by:
        sub in interface INDArray
        Parameters:
        n - the number to subtract by
        result - the result ndarray
        Returns:
        the result ndarray
      • subi

        public INDArray subi​(Number n,
                             INDArray result)
        Description copied from interface: INDArray
        In place subtraction of this ndarray
        Specified by:
        subi in interface INDArray
        Parameters:
        n - the number to subtract by
        result - the result ndarray
        Returns:
        the result ndarray
      • add

        public INDArray add​(Number n,
                            INDArray result)
        Description copied from interface: INDArray
        Addition of this ndarray.
        Specified by:
        add in interface INDArray
        Parameters:
        n - the number to add
        result - the result ndarray
        Returns:
        the result ndarray
      • addi

        public INDArray addi​(Number n,
                             INDArray result)
        Description copied from interface: INDArray
        In place addition
        Specified by:
        addi in interface INDArray
        Parameters:
        n - the number to add
        result - the result ndarray
        Returns:
        the result ndarray
      • getScalar

        public INDArray getScalar​(long row,
                                  long column)
        Description copied from interface: INDArray
        Returns the element at the specified row/column
        Specified by:
        getScalar in interface INDArray
        Parameters:
        row - the row of the element to return
        column - the row of the element to return
        Returns:
        a scalar indarray of the element at this index
      • dup

        public INDArray dup()
        Description copied from interface: INDArray
        Returns a copy of this ndarray
        Specified by:
        dup in interface INDArray
        Returns:
        a copy of this ndarray
      • dup

        public INDArray dup​(char order)
        Description copied from interface: INDArray
        Returns a copy of this ndarray, where the returned ndarray has the specified order
        Specified by:
        dup in interface INDArray
        Parameters:
        order - order of the NDArray. 'f' or 'c'
        Returns:
        copy of ndarray with specified order
      • getInt

        public int getInt​(int... indices)
        Description copied from interface: INDArray
        Get an integer value at the specified indices. Result will be cast to an integer, precision loss is possible.
        Specified by:
        getInt in interface INDArray
        Parameters:
        indices - Indices to get the integer at. Number of indices must match the array rank.
        Returns:
        Integer value at the specified index
      • getLong

        public long getLong​(long index)
        Description copied from interface: INDArray
        Get a long value at the specified index.
        Specified by:
        getLong in interface INDArray
        Parameters:
        index - Index to get the integer at.
        Returns:
        long value at the specified index
      • getLong

        public long getLong​(long... indices)
        Description copied from interface: INDArray
        Get a long value at the specified indices.
        Specified by:
        getLong in interface INDArray
        Parameters:
        indices - Indices to get the double at. Number of indices must match the array rank.
        Returns:
        long value at the specified index
      • getDouble

        public double getDouble​(int... indices)
        Description copied from interface: INDArray
        Get a double value at the specified indices.
        Specified by:
        getDouble in interface INDArray
        Parameters:
        indices - Indices to get the double at. Number of indices must match the array rank.
        Returns:
        Double value at the specified index
      • getFloat

        public float getFloat​(int... indices)
        Description copied from interface: INDArray
        Returns the elements at the specified indices
        Specified by:
        getFloat in interface INDArray
        Parameters:
        indices - the indices to getScalar
        Returns:
        the array with the specified elements
      • isScalar

        public boolean isScalar()
        Description copied from interface: INDArray
        Returns true if this ndarray is a scalar
        Specified by:
        isScalar in interface INDArray
        Returns:
        whether this ndarray is a scalar
      • put

        public INDArray put​(int[] indices,
                            INDArray element)
        Description copied from interface: INDArray
        Inserts the element at the specified index
        Specified by:
        put in interface INDArray
        Parameters:
        indices - the indices to insert into
        element - a scalar ndarray
        Returns:
        a scalar ndarray of the element at this index
      • match

        public INDArray match​(INDArray comp,
                              Condition condition)
        Description copied from interface: INDArray
        Return a mask on whether each element matches the given condition
        Specified by:
        match in interface INDArray
        Returns:
      • getWhere

        public INDArray getWhere​(INDArray comp,
                                 Condition condition)
        Description copied from interface: INDArray
        Boolean indexing: Return the element if it fulfills the condition in result array
        Specified by:
        getWhere in interface INDArray
        Parameters:
        comp - the comparison array
        condition - the condition to apply
        Returns:
        the array fulfilling the criteria
      • getWhere

        public INDArray getWhere​(Number comp,
                                 Condition condition)
        Description copied from interface: INDArray
        Boolean indexing: Return the element if it fulfills the condition in result array
        Specified by:
        getWhere in interface INDArray
        Parameters:
        comp - the comparison array
        condition - the condition to apply
        Returns:
        the array fulfilling the criteria
      • putWhere

        public INDArray putWhere​(INDArray comp,
                                 INDArray put,
                                 Condition condition)
        Description copied from interface: INDArray
        Assign the element according to the comparison array
        Specified by:
        putWhere in interface INDArray
        Parameters:
        comp - the comparison array
        put - the elements to put
        condition - the condition for masking on
        Returns:
        a copy of this array with the conditional assignments.
      • putWhere

        public INDArray putWhere​(Number comp,
                                 INDArray put,
                                 Condition condition)
        Description copied from interface: INDArray
        Assign the element according to the comparison array
        Specified by:
        putWhere in interface INDArray
        Parameters:
        comp - the comparison array
        put - the elements to put
        condition - the condition for masking on
        Returns:
        a copy of this array with the conditional assignments.
      • putWhere

        public INDArray putWhere​(Number comp,
                                 Number put,
                                 Condition condition)
        Description copied from interface: INDArray
        Assign the element according to the comparison array
        Specified by:
        putWhere in interface INDArray
        Parameters:
        comp - the comparison array
        put - the elements to put
        condition - the condition for masking on
        Returns:
        a copy of this array with the conditional assignments.
      • putWhereWithMask

        public INDArray putWhereWithMask​(INDArray mask,
                                         INDArray put)
        Description copied from interface: INDArray
        Use a pre computed mask for assigning arrays
        Specified by:
        putWhereWithMask in interface INDArray
        Parameters:
        mask - the mask to use
        put - the array to put
        Returns:
        a copy of this array with the conditional assignments.
      • putWhereWithMask

        public INDArray putWhereWithMask​(INDArray mask,
                                         Number put)
        Description copied from interface: INDArray
        Use a pre computed mask for assigning arrays
        Specified by:
        putWhereWithMask in interface INDArray
        Parameters:
        mask - the mask to use
        put - the array to put
        Returns:
        a copy of this array with the conditional assignments.
      • put

        public INDArray put​(int i,
                            int j,
                            INDArray element)
        Description copied from interface: INDArray
        Inserts the element at the specified index
        Specified by:
        put in interface INDArray
        Parameters:
        i - the row insert into
        j - the column to insert into
        element - a scalar ndarray
        Returns:
        a scalar ndarray of the element at this index
      • put

        public INDArray put​(int i,
                            int j,
                            Number element)
        Description copied from interface: INDArray
        Inserts the element at the specified index
        Specified by:
        put in interface INDArray
        Parameters:
        i - the row insert into
        j - the column to insert into
        element - a scalar ndarray
        Returns:
        a scalar ndarray of the element at this index
      • putSlice

        public INDArray putSlice​(int slice,
                                 INDArray put)
        Description copied from interface: INDArray
        Assigns the given matrix (put) to the specified slice
        Specified by:
        putSlice in interface INDArray
        Parameters:
        slice - the slice to assign
        put - the slice to applyTransformToDestination
        Returns:
        this for chainability
      • assertSlice

        protected void assertSlice​(INDArray put,
                                   long slice)
      • isMatrix

        public boolean isMatrix()
        Description copied from interface: INDArray
        Returns true if this ndarray is a matrix
        Specified by:
        isMatrix in interface INDArray
        Returns:
        whether this ndarray is a matrix
      • newShape

        protected INDArray newShape​(long[] newShape,
                                    char ordering)
      • create

        protected INDArray create​(DataBuffer data,
                                  int[] newShape,
                                  int[] newStrides,
                                  long offset,
                                  char ordering)
      • create

        protected INDArray create​(DataBuffer data,
                                  long[] newShape,
                                  long[] newStrides,
                                  long offset,
                                  char ordering)
      • create

        protected INDArray create​(DataBuffer data,
                                  int[] newShape,
                                  int[] newStrides,
                                  long offset)
      • create

        protected INDArray create​(int[] shape)
      • create

        protected INDArray create​(int[] shape,
                                  int[] strides,
                                  long offset)
      • getStrides

        protected int[] getStrides​(int[] shape,
                                   char ordering)
      • squaredDistance

        public double squaredDistance​(INDArray other)
        Description copied from interface: INDArray
        Returns the square of the Euclidean distance.
        Specified by:
        squaredDistance in interface INDArray
      • distance2

        public double distance2​(INDArray other)
        Description copied from interface: INDArray
        Returns the (euclidean) distance.
        Specified by:
        distance2 in interface INDArray
      • distance1

        public double distance1​(INDArray other)
        Description copied from interface: INDArray
        Returns the (1-norm) distance.
        Specified by:
        distance1 in interface INDArray
      • get

        public INDArray get​(INDArray indices)
        Description copied from interface: INDArray
        Get the elements from this ndarray based on the specified indices
        Specified by:
        get in interface INDArray
        Parameters:
        indices - an ndaray of the indices to get the elements for
        Returns:
        the elements to get the array for
      • put

        public INDArray put​(INDArray indices,
                            INDArray element)
        Description copied from interface: INDArray
        Put element in to the indices denoted by the indices ndarray. In numpy this is equivalent to: a[indices] = element
        Specified by:
        put in interface INDArray
        Parameters:
        indices - the indices to put
        element - the element array to put
        Returns:
        this array
      • put

        public INDArray put​(INDArrayIndex[] indices,
                            INDArray element)
        Description copied from interface: INDArray
        Put the elements of the ndarray in to the specified indices
        Specified by:
        put in interface INDArray
        Parameters:
        indices - the indices to put the ndarray in to
        element - the ndarray to put
        Returns:
        this ndarray
      • put

        public INDArray put​(INDArrayIndex[] indices,
                            Number element)
        Description copied from interface: INDArray
        Put the elements of the ndarray in to the specified indices
        Specified by:
        put in interface INDArray
        Parameters:
        indices - the indices to put the ndarray in to
        element - the ndarray to put
        Returns:
        this ndarray
      • swapAxes

        public INDArray swapAxes​(int dimension,
                                 int with)
        Description copied from interface: INDArray
        Mainly here for people coming from numpy. This is equivalent to a call to permute
        Specified by:
        swapAxes in interface INDArray
        Parameters:
        dimension - the dimension to swap
        with - the one to swap it with
        Returns:
        the swapped axes view
      • isView

        public boolean isView()
        Description copied from interface: INDArray
        Check if this array is a view or not.
        Specified by:
        isView in interface INDArray
        Returns:
        true if array is a view.
      • isSparse

        public boolean isSparse()
        Description copied from interface: INDArray
        Check if this array is sparse
        Specified by:
        isSparse in interface INDArray
        Returns:
        true if this array is sparse.
      • data

        public DataBuffer data()
        Description copied from interface: INDArray
        Returns a linear double array representation of this ndarray
        Specified by:
        data in interface INDArray
        Returns:
        the linear double array representation of this ndarray
      • setData

        public void setData​(DataBuffer data)
        Description copied from interface: INDArray
        Set the data for this ndarray.
        Specified by:
        setData in interface INDArray
        Parameters:
        data - new value for the ndarray data.
      • slices

        public long slices()
        Description copied from interface: INDArray
        Returns the number of slices in this ndarray
        Specified by:
        slices in interface INDArray
        Returns:
        the number of slices in this ndarray
      • cond

        public INDArray cond​(Condition condition)
        Description copied from interface: INDArray
        Returns a binary INDArray with value 'true' if the element matches the specified condition and 'false' otherwise
        Specified by:
        cond in interface INDArray
        Parameters:
        condition - Condition to apply
        Returns:
        Copy of this array with values 0 (condition does not apply), or one (condition applies)
      • init

        protected void init​(int[] shape,
                            int[] stride)
      • init

        protected void init​(long[] shape,
                            long[] stride)
      • getScalar

        public INDArray getScalar​(long i)
        Description copied from interface: INDArray
        Returns the element at the specified index
        Specified by:
        getScalar in interface INDArray
        Parameters:
        i - the index of the element to return
        Returns:
        a scalar ndarray of the element at this index
      • doColumnWise

        protected INDArray doColumnWise​(INDArray columnVector,
                                        char operation)
        Do a row wise op (a,s,m,d) a : add s : subtract m : multiply d : divide h : reverse subtraction t : reverse division
        Parameters:
        columnVector - the column vector
        operation - the operation
        Returns:
      • doRowWise

        protected INDArray doRowWise​(INDArray rowVector,
                                     char operation)
        Do a row wise op (a,s,m,d) a : add s : subtract m : multiply d : divide h : reverse subtraction t : reverse division
        Parameters:
        rowVector - the row vector
        operation - the operation
        Returns:
      • stride

        public int stride​(int dimension)
        Description copied from interface: INDArray
        Calculate the stride along a particular dimension
        Specified by:
        stride in interface INDArray
        Parameters:
        dimension - the dimension to get the stride for
        Returns:
        the stride for a particular dimension
      • rdiviColumnVector

        public INDArray rdiviColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place reverse divison of a column vector
        Specified by:
        rdiviColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector used for division
        Returns:
        the result of the division
      • rdivColumnVector

        public INDArray rdivColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        Reverse division of a column vector (copy)
        Specified by:
        rdivColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector used for division
        Returns:
        the result of the division
      • rdiviRowVector

        public INDArray rdiviRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        In place reverse division of a column vector
        Specified by:
        rdiviRowVector in interface INDArray
        Parameters:
        rowVector - the row vector used for division
        Returns:
        the result of the division
      • rdivRowVector

        public INDArray rdivRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        Reverse division of a column vector (copy)
        Specified by:
        rdivRowVector in interface INDArray
        Parameters:
        rowVector - the row vector used for division
        Returns:
        the result of the division
      • rsubiColumnVector

        public INDArray rsubiColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place reverse subtraction of a column vector
        Specified by:
        rsubiColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to subtract
        Returns:
        the result of the subtraction
      • rsubColumnVector

        public INDArray rsubColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        Reverse subtraction of a column vector (copy)
        Specified by:
        rsubColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to subtract
        Returns:
        the result of the subtraction
      • rsubiRowVector

        public INDArray rsubiRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        In place reverse subtraction of a row vector
        Specified by:
        rsubiRowVector in interface INDArray
        Parameters:
        rowVector - the row vector to subtract
        Returns:
        the result of the subtraction
      • rsubRowVector

        public INDArray rsubRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        Reverse subtraction of a row vector (copy)
        Specified by:
        rsubRowVector in interface INDArray
        Parameters:
        rowVector - the row vector to subtract
        Returns:
        the result of the subtraction
      • put

        public INDArray put​(int i,
                            INDArray element)
        Description copied from interface: INDArray
        Inserts the element at the specified index
        Specified by:
        put in interface INDArray
        Parameters:
        i - the index insert into
        element - a scalar ndarray
        Returns:
        a scalar ndarray of the element at this index
      • diviColumnVector

        public INDArray diviColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place division of a column vector
        Specified by:
        diviColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector used for division
        Returns:
        the result of the division
      • divColumnVector

        public INDArray divColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        Division of a column vector (copy)
        Specified by:
        divColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector used for division
        Returns:
        the result of the division
      • diviRowVector

        public INDArray diviRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        In place division of a row vector
        Specified by:
        diviRowVector in interface INDArray
        Parameters:
        rowVector - the row vector used for division
        Returns:
        the result of the division
      • divRowVector

        public INDArray divRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        Division of a row vector (copy)
        Specified by:
        divRowVector in interface INDArray
        Parameters:
        rowVector - the row vector used for division
        Returns:
        the result of the division
      • muliColumnVector

        public INDArray muliColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place multiplication of a column vector
        Specified by:
        muliColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector used for multiplication
        Returns:
        the result of the multiplication
      • mulColumnVector

        public INDArray mulColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        Multiplication of a column vector (copy)
        Specified by:
        mulColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector used for multiplication
        Returns:
        the result of the multiplication
      • muliRowVector

        public INDArray muliRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        In place multiplication of a row vector
        Specified by:
        muliRowVector in interface INDArray
        Parameters:
        rowVector - the row vector used for multiplication
        Returns:
        the result of the multiplication
      • mulRowVector

        public INDArray mulRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        Multiplication of a row vector (copy)
        Specified by:
        mulRowVector in interface INDArray
        Parameters:
        rowVector - the row vector used for multiplication
        Returns:
        the result of the multiplication
      • subiColumnVector

        public INDArray subiColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place subtraction of a column vector
        Specified by:
        subiColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to subtract
        Returns:
        the result of the subtraction
      • subColumnVector

        public INDArray subColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        Subtraction of a column vector (copy)
        Specified by:
        subColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to subtract
        Returns:
        the result of the subtraction
      • subiRowVector

        public INDArray subiRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        In place subtraction of a row vector
        Specified by:
        subiRowVector in interface INDArray
        Parameters:
        rowVector - the row vector to subtract
        Returns:
        the result of the subtraction
      • subRowVector

        public INDArray subRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        Subtraction of a row vector (copy)
        Specified by:
        subRowVector in interface INDArray
        Parameters:
        rowVector - the row vector to subtract
        Returns:
        the result of the subtraction
      • addiColumnVector

        public INDArray addiColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place addition of a column vector
        Specified by:
        addiColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to add
        Returns:
        the result of the addition
      • putiColumnVector

        public INDArray putiColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        In place assignment of a column vector
        Specified by:
        putiColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to add
        Returns:
        the result of the addition
      • addColumnVector

        public INDArray addColumnVector​(INDArray columnVector)
        Description copied from interface: INDArray
        Addition of a column vector (copy)
        Specified by:
        addColumnVector in interface INDArray
        Parameters:
        columnVector - the column vector to add
        Returns:
        the result of the addition
      • addiRowVector

        public INDArray addiRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        In place addition of a row vector
        Specified by:
        addiRowVector in interface INDArray
        Parameters:
        rowVector - the row vector to add
        Returns:
        the result of the addition
      • putiRowVector

        public INDArray putiRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        in place assignment of row vector, to each row of this array
        Specified by:
        putiRowVector in interface INDArray
        Parameters:
        rowVector - Row vector to put
        Returns:
        This array, after assigning every road to the specified value
      • addRowVector

        public INDArray addRowVector​(INDArray rowVector)
        Description copied from interface: INDArray
        Addition of a row vector (copy)
        Specified by:
        addRowVector in interface INDArray
        Parameters:
        rowVector - the row vector to add
        Returns:
        the result of the addition
      • mmul

        public INDArray mmul​(INDArray other,
                             INDArray result,
                             MMulTranspose mMulTranspose)
        Description copied from interface: INDArray
        Perform an copy matrix multiplication
        Specified by:
        mmul in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        result - the result ndarray
        mMulTranspose - the transpose status of each array
        Returns:
        the result of the matrix multiplication
      • mmul

        public INDArray mmul​(INDArray other,
                             MMulTranspose mMulTranspose)
        Description copied from interface: INDArray
        Perform a copy matrix multiplication
        Specified by:
        mmul in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        Returns:
        the result of the matrix multiplication
      • mmul

        public INDArray mmul​(INDArray other,
                             char resultOrder)
        Description copied from interface: INDArray
        Perform a copy matrix multiplication
        Specified by:
        mmul in interface INDArray
        Parameters:
        other - other the other matrix to perform matrix multiply with
        resultOrder - either C or F order for result array
        Returns:
        the result of the matrix multiplication
      • mmul

        public INDArray mmul​(INDArray other)
        Description copied from interface: INDArray
        Perform a copy matrix multiplication
        Specified by:
        mmul in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        Returns:
        the result of the matrix multiplication
      • create

        protected INDArray create​(int[] shape,
                                  char ordering)
      • toDoubleMatrix

        public double[][] toDoubleMatrix()
        Description copied from interface: INDArray
        Convert this ndarray to a 2d double matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toDoubleMatrix in interface INDArray
        Returns:
        a copy of this array as a 2d double array
      • toDoubleVector

        public double[] toDoubleVector()
        Description copied from interface: INDArray
        Convert this ndarray to a 1d double matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toDoubleVector in interface INDArray
        Returns:
        a copy of this array as a 1d double array
      • toFloatVector

        public float[] toFloatVector()
        Description copied from interface: INDArray
        Convert this ndarray to a 1d float vector. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toFloatVector in interface INDArray
        Returns:
        a copy of this array as a 1d float array
      • toFloatMatrix

        public float[][] toFloatMatrix()
        Description copied from interface: INDArray
        Convert this ndarray to a 2d float matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toFloatMatrix in interface INDArray
        Returns:
        a copy of this array as a 2d float array
      • toIntVector

        public int[] toIntVector()
        Description copied from interface: INDArray
        Convert this ndarray to a 1d int matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toIntVector in interface INDArray
        Returns:
        a copy of this array as a 1d int array
      • toLongVector

        public long[] toLongVector()
        Description copied from interface: INDArray
        Convert this ndarray to a 1d long matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toLongVector in interface INDArray
        Returns:
        a copy of this array as a 1d long array
      • toLongMatrix

        public long[][] toLongMatrix()
        Description copied from interface: INDArray
        Convert this ndarray to a 2d int matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toLongMatrix in interface INDArray
        Returns:
        a copy of this array as a 2d int array
      • toIntMatrix

        public int[][] toIntMatrix()
        Description copied from interface: INDArray
        Convert this ndarray to a 2d int matrix. Note that THIS SHOULD NOT BE USED FOR SPEED. This is mainly used for integrations with other libraries. Due to nd4j's off heap nature, moving data on heap is very expensive and should not be used if possible.
        Specified by:
        toIntMatrix in interface INDArray
        Returns:
        a copy of this array as a 2d int array
      • mmul

        public INDArray mmul​(INDArray other,
                             INDArray result)
        Perform an copy matrix multiplication
        Specified by:
        mmul in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        result - the result ndarray
        Returns:
        the result of the matrix multiplication
      • div

        public INDArray div​(INDArray other)
        Description copied from interface: INDArray
        Copy (element wise) division of two NDArrays
        Specified by:
        div in interface INDArray
        Parameters:
        other - the second ndarray to divide
        Returns:
        the result of the divide
      • div

        public INDArray div​(INDArray other,
                            INDArray result)
        Description copied from interface: INDArray
        copy (element wise) division of two NDArrays
        Specified by:
        div in interface INDArray
        Parameters:
        other - the second ndarray to divide
        result - the result ndarray
        Returns:
        the result of the divide
      • mul

        public INDArray mul​(INDArray other)
        Description copied from interface: INDArray
        copy (element wise) multiplication of two NDArrays
        Specified by:
        mul in interface INDArray
        Parameters:
        other - the second ndarray to multiply
        Returns:
        the result of the addition
      • mul

        public INDArray mul​(INDArray other,
                            INDArray result)
        Description copied from interface: INDArray
        copy (element wise) multiplication of two NDArrays
        Specified by:
        mul in interface INDArray
        Parameters:
        other - the second ndarray to multiply
        result - the result ndarray
        Returns:
        the result of the multiplication
      • sub

        public INDArray sub​(INDArray other)
        Description copied from interface: INDArray
        copy subtraction of two NDArrays
        Specified by:
        sub in interface INDArray
        Parameters:
        other - the second ndarray to subtract
        Returns:
        the result of the addition
      • sub

        public INDArray sub​(INDArray other,
                            INDArray result)
        Description copied from interface: INDArray
        copy subtraction of two NDArrays
        Specified by:
        sub in interface INDArray
        Parameters:
        other - the second ndarray to subtract
        result - the result ndarray
        Returns:
        the result of the subtraction
      • add

        public INDArray add​(INDArray other)
        Description copied from interface: INDArray
        Element-wise copy addition of two NDArrays
        Specified by:
        add in interface INDArray
        Parameters:
        other - the second ndarray to add
        Returns:
        the result of the addition
      • add

        public INDArray add​(INDArray other,
                            INDArray result)
        Description copied from interface: INDArray
        Element-wise copy addition of two NDArrays
        Specified by:
        add in interface INDArray
        Parameters:
        other - the second ndarray to add
        result - the result ndarray
        Returns:
        the result of the addition
      • mmuli

        public INDArray mmuli​(INDArray other,
                              MMulTranspose transpose)
        Description copied from interface: INDArray
        Perform an copy matrix multiplication
        Specified by:
        mmuli in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        transpose - the transpose status of each ndarray
        Returns:
        the result of the matrix multiplication
      • mmuli

        public INDArray mmuli​(INDArray other)
        Description copied from interface: INDArray
        Perform an inplace matrix multiplication
        Specified by:
        mmuli in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        Returns:
        the result of the matrix multiplication
      • mmuli

        public INDArray mmuli​(INDArray other,
                              INDArray result,
                              MMulTranspose transpose)
        Description copied from interface: INDArray
        Perform an in place matrix multiplication
        Specified by:
        mmuli in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        result - the result ndarray
        Returns:
        the result of the matrix multiplication
      • mmuli

        public INDArray mmuli​(INDArray other,
                              INDArray result)
        Description copied from interface: INDArray
        Perform an inplace matrix multiplication
        Specified by:
        mmuli in interface INDArray
        Parameters:
        other - the other matrix to perform matrix multiply with
        result - the result ndarray
        Returns:
        the result of the matrix multiplication
      • divi

        public INDArray divi​(INDArray other)
        Description copied from interface: INDArray
        in place (element wise) division of two NDArrays
        Specified by:
        divi in interface INDArray
        Parameters:
        other - the second ndarray to divide
        Returns:
        the result of the divide
      • divi

        public INDArray divi​(INDArray other,
                             INDArray result)
        Description copied from interface: INDArray
        in place (element wise) division of two NDArrays
        Specified by:
        divi in interface INDArray
        Parameters:
        other - the second ndarray to divide
        result - the result ndarray
        Returns:
        the result of the divide
      • muli

        public INDArray muli​(INDArray other)
        Description copied from interface: INDArray
        in place (element wise) multiplication of two NDArrays
        Specified by:
        muli in interface INDArray
        Parameters:
        other - the second ndarray to multiply
        Returns:
        the result of the multiplication
      • muli

        public INDArray muli​(INDArray other,
                             INDArray result)
        Description copied from interface: INDArray
        in place (element wise) multiplication of two NDArrays
        Specified by:
        muli in interface INDArray
        Parameters:
        other - the second ndarray to multiply
        result - the result ndarray
        Returns:
        the result of the multiplication
      • subi

        public INDArray subi​(INDArray other)
        Description copied from interface: INDArray
        in place (element wise) subtraction of two NDArrays
        Specified by:
        subi in interface INDArray
        Parameters:
        other - the second ndarray to subtract
        Returns:
        the result of the subtraction
      • subi

        public INDArray subi​(INDArray other,
                             INDArray result)
        in place subtraction of two matrices
        Specified by:
        subi in interface INDArray
        Parameters:
        other - the second ndarray to subtract
        result - the result ndarray
        Returns:
        the result of the subtraction
      • addi

        public INDArray addi​(INDArray other)
        Description copied from interface: INDArray
        in place (element wise) addition of two NDArrays
        Specified by:
        addi in interface INDArray
        Parameters:
        other - the second ndarray to add
        Returns:
        the result of the addition
      • addi

        public INDArray addi​(INDArray other,
                             INDArray result)
        Description copied from interface: INDArray
        in place (element wise) addition of two NDArrays
        Specified by:
        addi in interface INDArray
        Parameters:
        other - the second ndarray to add
        result - the result ndarray
        Returns:
        the result of the addition
      • normmax

        public INDArray normmax​(boolean keepDims,
                                int... dimension)
        Description copied from interface: INDArray
        Returns the max norm (aka infinity norm, equal to the maximum absolute value) along the specified dimension(s)
        Specified by:
        normmax in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to the max norm along
        Returns:
        Max norm along the specified dimension
      • normmax

        public INDArray normmax​(int... dimension)
        Description copied from interface: INDArray
        Returns the max norm (aka infinity norm, equal to the maximum absolute value) along the specified dimension(s)
        Specified by:
        normmax in interface INDArray
        Parameters:
        dimension - the dimension to the max norm along
        Returns:
        Max norm along the specified dimension
      • rdiv

        public INDArray rdiv​(INDArray other)
        Description copied from interface: INDArray
        Reverse division, elements wise. i.e., other / this
        Specified by:
        rdiv in interface INDArray
        Parameters:
        other - the matrix to divide from
        Returns:
        Copy of this array after performing element wise reverse division
      • rdivi

        public INDArray rdivi​(INDArray other)
        Description copied from interface: INDArray
        Reverse divsion (in place). i.e., other / this
        Specified by:
        rdivi in interface INDArray
        Parameters:
        other - The matrix to divide from
        Returns:
        This array after performing element wise reverse division
      • rdiv

        public INDArray rdiv​(INDArray other,
                             INDArray result)
        Description copied from interface: INDArray
        Reverse division
        Specified by:
        rdiv in interface INDArray
        Parameters:
        other - the matrix to divide from
        result - the result ndarray
        Returns:
        the result ndarray
      • rdivi

        public INDArray rdivi​(INDArray other,
                              INDArray result)
        Description copied from interface: INDArray
        Reverse division (in-place)
        Specified by:
        rdivi in interface INDArray
        Parameters:
        other - the matrix to divide from
        result - the result ndarray
        Returns:
        the ndarray with the operation applied
      • rsub

        public INDArray rsub​(INDArray other,
                             INDArray result)
        Description copied from interface: INDArray
        Reverse subtraction
        Specified by:
        rsub in interface INDArray
        Parameters:
        other - the matrix to subtract from
        result - the result ndarray
        Returns:
        the result ndarray
      • rsub

        public INDArray rsub​(INDArray other)
        Description copied from interface: INDArray
        Element-wise reverse subtraction (copy op). i.e., other - this
        Specified by:
        rsub in interface INDArray
        Parameters:
        other - Other array to use in reverse subtraction
        Returns:
        Copy of this array, after applying reverse subtraction
      • rsubi

        public INDArray rsubi​(INDArray other)
        Description copied from interface: INDArray
        Element-wise reverse subtraction (in the place op) - i.e., other - this
        Specified by:
        rsubi in interface INDArray
        Parameters:
        other - Other way to use in reverse subtraction operation
        Returns:
        This array, after applying reverse subtraction
      • rsubi

        public INDArray rsubi​(INDArray other,
                              INDArray result)
        Description copied from interface: INDArray
        Reverse subtraction (in-place)
        Specified by:
        rsubi in interface INDArray
        Parameters:
        other - the other ndarray to subtract
        result - the result ndarray
        Returns:
        the ndarray with the operation applied
      • assign

        public INDArray assign​(Number value)
        Description copied from interface: INDArray
        Set all entries of the ndarray to the specified value
        Specified by:
        assign in interface INDArray
        Parameters:
        value - the value to assign
        Returns:
        the ndarray with the values
      • assign

        public INDArray assign​(boolean value)
        Description copied from interface: INDArray
        Set all entries of the ndarray to the specified value
        Specified by:
        assign in interface INDArray
        Parameters:
        value - the value to assign
        Returns:
        the ndarray with the values
      • assignIf

        public INDArray assignIf​(INDArray arr,
                                 Condition condition)
        Description copied from interface: INDArray
        Assign all elements from given ndarray that are matching given condition, ndarray to this ndarray
        Specified by:
        assignIf in interface INDArray
        Parameters:
        arr - the elements to assign
        Returns:
        this
      • replaceWhere

        public INDArray replaceWhere​(INDArray arr,
                                     Condition condition)
        Description copied from interface: INDArray
        Replaces all elements in this ndarray that are matching give condition, with corresponding elements from given array
        Specified by:
        replaceWhere in interface INDArray
        Parameters:
        arr - Source array
        condition - Condition to apply
        Returns:
        New array with values conditionally replaced
      • linearIndex

        @Deprecated
        public long linearIndex​(long i)
        Deprecated.
        Description copied from interface: INDArray
        Get the linear index of the data in to the array
        Specified by:
        linearIndex in interface INDArray
        Parameters:
        i - the index to getScalar
        Returns:
        the linear index in to the data
      • slice

        public INDArray slice​(long slice)
        Description copied from interface: INDArray
        Returns the specified slice of this ndarray
        Specified by:
        slice in interface INDArray
        Parameters:
        slice - the index of the slice to return
        Returns:
        the specified slice of this ndarray
      • createScalarForIndex

        protected INDArray createScalarForIndex​(long i,
                                                boolean applyOffset)
      • createScalar

        protected INDArray createScalar​(double d)
      • getTrailingOnes

        public int getTrailingOnes()
        Description copied from interface: INDArray
        Get the number of trailing ones in the array shape. For example, a rank 3 array with shape [10, 1, 1] would return 2 for this method
        Specified by:
        getTrailingOnes in interface INDArray
        Returns:
        Number of trailing ones in shape
      • getLeadingOnes

        public int getLeadingOnes()
        Description copied from interface: INDArray
        Get the number of leading ones in the array shape. For example, a rank 3 array with shape [1, 10, 1] would return value 1 for this method
        Specified by:
        getLeadingOnes in interface INDArray
        Returns:
        Number of leading ones in shape
      • slice

        public INDArray slice​(long slice,
                              int dimension)
        Description copied from interface: INDArray
        Returns the slice of this from the specified dimension
        Specified by:
        slice in interface INDArray
        Parameters:
        slice - the index of the slice to return
        dimension - the dimension of the slice to return
        Returns:
        the slice of this matrix from the specified dimension and dimension
      • getScalar

        public INDArray getScalar​(int[] indexes)
        Description copied from interface: INDArray
        Returns the elements at the specified indices
        Specified by:
        getScalar in interface INDArray
        Parameters:
        indexes - the indices to getScalar
        Returns:
        the array with the specified elements
      • rdiv

        public INDArray rdiv​(Number n)
        Description copied from interface: INDArray
        Reverse division with a scalar - i.e., (n / thisArrayValues)
        Specified by:
        rdiv in interface INDArray
        Parameters:
        n - Value to use for reverse division
        Returns:
        Copy of array after applying reverse division
      • rdivi

        public INDArray rdivi​(Number n)
        Description copied from interface: INDArray
        In place reverse division - i.e., (n / thisArrayValues)
        Specified by:
        rdivi in interface INDArray
        Parameters:
        n - Value to use for reverse division
        Returns:
        This array after applying reverse division
      • rsub

        public INDArray rsub​(Number n)
        Description copied from interface: INDArray
        Reverse subtraction with duplicates - i.e., (n - thisArrayValues)
        Specified by:
        rsub in interface INDArray
        Parameters:
        n - Value to use for reverse subtraction
        Returns:
        Copy of array after reverse subtraction
      • rsubi

        public INDArray rsubi​(Number n)
        Description copied from interface: INDArray
        Reverse subtraction in place - i.e., (n - thisArrayValues)
        Specified by:
        rsubi in interface INDArray
        Parameters:
        n - Value to use for reverse subtraction
        Returns:
        This array after reverse subtraction
      • div

        public INDArray div​(Number n)
        Description copied from interface: INDArray
        Division by a number
        Specified by:
        div in interface INDArray
        Parameters:
        n - Number to divide values by
        Returns:
        Copy of array after division
      • divi

        public INDArray divi​(Number n)
        Description copied from interface: INDArray
        In place scalar division
        Specified by:
        divi in interface INDArray
        Parameters:
        n - Number to divide values by
        Returns:
        This array, after applying division operation
      • mul

        public INDArray mul​(Number n)
        Description copied from interface: INDArray
        Scalar multiplication (copy)
        Specified by:
        mul in interface INDArray
        Parameters:
        n - the number to multiply by
        Returns:
        a copy of this ndarray multiplied by the given number
      • muli

        public INDArray muli​(Number n)
        Description copied from interface: INDArray
        In place scalar multiplication
        Specified by:
        muli in interface INDArray
        Parameters:
        n - The number to multiply by
        Returns:
        This array, after applying scaler multiplication
      • sub

        public INDArray sub​(Number n)
        Description copied from interface: INDArray
        Scalar subtraction (copied)
        Specified by:
        sub in interface INDArray
        Parameters:
        n - the number to subtract by
        Returns:
        Copy of this array after applying subtraction operation
      • subi

        public INDArray subi​(Number n)
        Description copied from interface: INDArray
        In place scalar subtraction
        Specified by:
        subi in interface INDArray
        Parameters:
        n - Number to subtract
        Returns:
        This array, after applying subtraction operation
      • add

        public INDArray add​(Number n)
        Description copied from interface: INDArray
        Scalar addition (cloning)
        Specified by:
        add in interface INDArray
        Parameters:
        n - the number to add
        Returns:
        a clone with this matrix + the given number
      • addi

        public INDArray addi​(Number n)
        Description copied from interface: INDArray
        In place scalar addition
        Specified by:
        addi in interface INDArray
        Parameters:
        n - Number to add
        Returns:
        This array, after adding value
      • repmat

        public INDArray repmat​(long[] shape)
        Description copied from interface: INDArray
        Replicate and tile array to fill out to the given shape See: https://github.com/numpy/numpy/blob/master/numpy/matlib.py#L310-L358
        Specified by:
        repmat in interface INDArray
        Parameters:
        shape - the new shape of this ndarray
        Returns:
        the shape to fill out to
      • repeat

        public INDArray repeat​(int dimension,
                               long... repeats)
        Description copied from interface: INDArray
        Repeat elements along a specified dimension.
        Specified by:
        repeat in interface INDArray
        Parameters:
        dimension - the dimension to repeat
        repeats - the number of elements to repeat on each element
        Returns:
        Repeated array
      • putRow

        public INDArray putRow​(long row,
                               INDArray toPut)
        Description copied from interface: INDArray
        Insert a row in to this array Will throw an exception if this ndarray is not a matrix
        Specified by:
        putRow in interface INDArray
        Parameters:
        row - the row insert into
        toPut - the row to insert
        Returns:
        this
      • putColumn

        public INDArray putColumn​(int column,
                                  INDArray toPut)
        Description copied from interface: INDArray
        Insert a column in to this array Will throw an exception if this ndarray is not a matrix
        Specified by:
        putColumn in interface INDArray
        Parameters:
        column - the column to insert
        toPut - the array to put
        Returns:
        this
      • getNumber

        public Number getNumber​(long i)
        Description copied from interface: INDArray
        Get the numeric value at the specified index.
        Specified by:
        getNumber in interface INDArray
        Parameters:
        i - index to retreive.
        Returns:
        numeric value at the specified index.
      • getNumber

        public Number getNumber​(long... idx)
        Description copied from interface: INDArray
        Get a numeric value at the specified indices.
        Specified by:
        getNumber in interface INDArray
        Parameters:
        idx - Indices to get the value from. Number of indices must match the array rank.
        Returns:
        Numeric value at the specified index
      • getDouble

        public double getDouble​(long i)
        Description copied from interface: INDArray
        Get the double value at the specified linear index in the array
        Specified by:
        getDouble in interface INDArray
        Parameters:
        i - Index
        Returns:
        Double value at the specified index
      • getDouble

        public double getDouble​(long i,
                                long j)
        Description copied from interface: INDArray
        Get the double value at the specified indices. Can only be used for 2D (rank 2) arrays.
        Specified by:
        getDouble in interface INDArray
        Parameters:
        i - Dimension 0 (row) index
        j - Dimension 1 (column) index
        Returns:
        double value at the specified indices
      • getFloat

        public float getFloat​(long i)
        Description copied from interface: INDArray
        Return the item at the linear index i
        Specified by:
        getFloat in interface INDArray
        Parameters:
        i - the index of the item to getScalar
        Returns:
        the item at index j
      • getFloat

        public float getFloat​(long i,
                              long j)
        Description copied from interface: INDArray
        Return the item at row i column j Note that this is the same as calling getScalar(new int[]{i,j}
        Specified by:
        getFloat in interface INDArray
        Parameters:
        i - the row to getScalar
        j - the column to getScalar
        Returns:
        the item at row i column j
      • transpose

        public INDArray transpose()
        Description copied from interface: INDArray
        Flip the rows and columns of a matrix
        Specified by:
        transpose in interface INDArray
        Returns:
        the flipped rows and columns of a matrix
      • transposei

        public INDArray transposei()
        Return transposed version of this matrix. PLEASE NOTE: This method is NOT in place, it will return transposed copy instead.
        Specified by:
        transposei in interface INDArray
        Returns:
        the flipped rows and columns of a matrix
      • reshape

        @Deprecated
        public INDArray reshape​(char order,
                                int... newShape)
        Deprecated.
        Description copied from interface: INDArray
        Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping without copying is impossible.
        Specified by:
        reshape in interface INDArray
        newShape - the new shape of the ndarray
        Returns:
        the reshaped ndarray
      • reshape

        public INDArray reshape​(char order,
                                long... newShape)
        Description copied from interface: INDArray
        Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping without copying is impossible.
        Specified by:
        reshape in interface INDArray
        newShape - the new shape of the ndarray
        Returns:
        the reshaped ndarray
      • reshape

        public INDArray reshape​(char order,
                                boolean enforceView,
                                long... newShape)
        Description copied from interface: INDArray
        Reshapes the ndarray (note: it's not possible to change the length of the ndarray). Typically this will be a view, unless reshaping without copying (i.e., returning a view) is impossible.
        In that case, the behaviour will depend on the enforceView argument: enforceView == true: throw an exception
        enforceView == false: return a copy
        Specified by:
        reshape in interface INDArray
        newShape - the new shape of the ndarray
        Returns:
        the reshaped ndarray
      • getDoubleUnsafe

        public double getDoubleUnsafe​(long offset)
        Description copied from interface: INDArray
        Get a double at the given linear offset unsafe, without checks.
        Specified by:
        getDoubleUnsafe in interface INDArray
        Parameters:
        offset - the offset to get at
        Returns:
        double value at offset
      • putScalarUnsafe

        public INDArray putScalarUnsafe​(long offset,
                                        double value)
        Description copied from interface: INDArray
        Insert a scalar at the given linear offset
        Specified by:
        putScalarUnsafe in interface INDArray
        Parameters:
        offset - the offset to insert at
        value - the value to insert
        Returns:
        this
      • reshape

        public INDArray reshape​(char order,
                                int rows,
                                int columns)
        Description copied from interface: INDArray
        Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping without copying is impossible.
        Specified by:
        reshape in interface INDArray
        rows - the rows of the matrix
        columns - the columns of the matrix
        Returns:
        the reshaped ndarray
      • reshape

        public INDArray reshape​(int[] shape)
        Reshape the ndarray in to the specified dimensions, possible errors being thrown for invalid shapes Note here that one dimension can be -1. The dimension that is -1 will be inferred from the shape and the length of the ndarray
        Specified by:
        reshape in interface INDArray
        Parameters:
        shape - the shape of the ndarray.
        Returns:
        the new reshaped nd array
      • reshape

        public INDArray reshape​(long... shape)
        Description copied from interface: INDArray
        Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping without copying is impossible.
        Specified by:
        reshape in interface INDArray
        Parameters:
        shape - the new shape of the ndarray
        Returns:
        the reshaped ndarray
      • prod

        public INDArray prod​(boolean keepDims,
                             int... dimension)
        Description copied from interface: INDArray
        Returns the product along a given dimension
        Specified by:
        prod in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the product along
        Returns:
        the product along the specified dimension
      • prod

        public INDArray prod​(int... dimension)
        Description copied from interface: INDArray
        Returns the product along a given dimension
        Specified by:
        prod in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the product along
        Returns:
        the product along the specified dimension
      • mean

        public INDArray mean​(boolean keepDims,
                             int... dimension)
        Description copied from interface: INDArray
        Returns the overall mean of this ndarray
        Specified by:
        mean in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the mean along
        Returns:
        the mean along the specified dimension of this ndarray
      • mean

        public INDArray mean​(int... dimension)
        Description copied from interface: INDArray
        Returns the overall mean of this ndarray
        Specified by:
        mean in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the mean along
        Returns:
        the mean along the specified dimension of this ndarray
      • amean

        public INDArray amean​(int... dimension)
        Description copied from interface: INDArray
        Returns the absolute overall mean of this ndarray
        Specified by:
        amean in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the mean along
        Returns:
        the absolute mean along the specified dimension of this ndarray
      • mean

        public INDArray mean​(@NonNull
                             @NonNull INDArray result,
                             boolean keepDims,
                             int... dimension)
        Description copied from interface: INDArray
        Returns the overall mean of this ndarray
        Specified by:
        mean in interface INDArray
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the mean along
        Returns:
        the mean along the specified dimension of this ndarray
      • mean

        public INDArray mean​(@NonNull
                             @NonNull INDArray result,
                             int... dimension)
        Description copied from interface: INDArray
        Returns the overall mean of this ndarray
        Specified by:
        mean in interface INDArray
        dimension - the dimension to getScalar the mean along
        Returns:
        the mean along the specified dimension of this ndarray
      • var

        public INDArray var​(int... dimension)
        Description copied from interface: INDArray
        Returns the overall variance of this ndarray
        Specified by:
        var in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the variance along
        Returns:
        the variance along the specified dimension of this ndarray
      • var

        public INDArray var​(boolean biasCorrected,
                            int... dimension)
        Description copied from interface: INDArray
        Returns the overall variance of this ndarray
        Specified by:
        var in interface INDArray
        Parameters:
        biasCorrected - boolean on whether to apply corrected bias
        dimension - the dimension to getScalar the variance along
        Returns:
        the variance along the specified dimension of this ndarray
      • max

        public INDArray max​(boolean keepDims,
                            int... dimension)
        Description copied from interface: INDArray
        Returns the overall max of this ndarray along given dimensions
        Specified by:
        max in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the max along
        Returns:
        the max along the specified dimension of this ndarray
      • max

        public INDArray max​(int... dimension)
        Description copied from interface: INDArray
        Returns the overall max of this ndarray along given dimensions
        Specified by:
        max in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the max along
        Returns:
        the max along the specified dimension of this ndarray
      • amax

        public INDArray amax​(int... dimension)
        Description copied from interface: INDArray
        Returns the absolute overall max of this ndarray along given dimensions
        Specified by:
        amax in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the amax along
        Returns:
        the amax along the specified dimension of this ndarray
      • min

        public INDArray min​(boolean keepDims,
                            int... dimension)
        Description copied from interface: INDArray
        Returns the overall min of this ndarray
        Specified by:
        min in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the min along
        Returns:
        the min along the specified dimension of this ndarray
      • min

        public INDArray min​(int... dimension)
        Description copied from interface: INDArray
        Returns the overall min of this ndarray
        Specified by:
        min in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the min along
        Returns:
        the min along the specified dimension of this ndarray
      • amin

        public INDArray amin​(int... dimension)
        Description copied from interface: INDArray
        Returns minimum (absolute) value in this INDArray, along the specified dimensions
        Specified by:
        amin in interface INDArray
        Returns:
        Minimum absolute value
      • sum

        public INDArray sum​(int... dimension)
        Description copied from interface: INDArray
        Returns the sum along the last dimension of this ndarray
        Specified by:
        sum in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the sum along
        Returns:
        the sum along the specified dimension of this ndarray
      • sum

        public INDArray sum​(boolean keepDim,
                            int... dimension)
        Description copied from interface: INDArray
        Returns the sum along the last dimension of this ndarray
        Specified by:
        sum in interface INDArray
        Parameters:
        keepDim - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the sum along
        Returns:
        the sum along the specified dimension of this ndarray
      • entropy

        public INDArray entropy​(int... dimension)
        Description copied from interface: INDArray
        Returns entropy value for this INDArray along specified dimension(s)
        Specified by:
        entropy in interface INDArray
        Parameters:
        dimension - specified dimension(s)
        Returns:
        entropy value
      • shannonEntropy

        public INDArray shannonEntropy​(int... dimension)
        Description copied from interface: INDArray
        Returns Shannon entropy value for this INDArray along specified dimension(s)
        Specified by:
        shannonEntropy in interface INDArray
        Parameters:
        dimension - specified dimension(s)
        Returns:
        Shannon entropy
      • logEntropy

        public INDArray logEntropy​(int... dimension)
        Description copied from interface: INDArray
        Returns log entropy value for this INDArray along specified dimension(s)
        Specified by:
        logEntropy in interface INDArray
        Parameters:
        dimension - specified dimension(s)
        Returns:
        log entropy value
      • sum

        public INDArray sum​(@NonNull
                            @NonNull INDArray result,
                            boolean keepDims,
                            int... dimension)
        Description copied from interface: INDArray
        Returns the sum along the last dimension of this ndarray
        Specified by:
        sum in interface INDArray
        Parameters:
        result - result of this operation will be stored here
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the sum along
        Returns:
        the sum along the specified dimension of this ndarray
      • sum

        public INDArray sum​(@NonNull
                            @NonNull INDArray result,
                            int... dimension)
        Description copied from interface: INDArray
        Returns the sum along the last dimension of this ndarray
        Specified by:
        sum in interface INDArray
        Parameters:
        result - result of this operation will be stored here
        dimension - the dimension to getScalar the sum along
        Returns:
        the sum along the specified dimension of this ndarray
      • norm1

        public INDArray norm1​(int... dimension)
        Description copied from interface: INDArray
        Returns the norm1 (L1 norm, i.e., sum of absolute values; also known as Taxicab or Manhattan norm) along the specified dimension
        Specified by:
        norm1 in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the norm1 along
        Returns:
        the norm1 along the specified dimension
      • norm1

        public INDArray norm1​(boolean keepDims,
                              int... dimension)
        Description copied from interface: INDArray
        Returns the norm1 (L1 norm, i.e., sum of absolute values; also known as Taxicab or Manhattan norm) along the specified dimension
        Specified by:
        norm1 in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the norm1 along
        Returns:
        the norm1 along the specified dimension
      • std

        public INDArray std​(int... dimension)
        Description copied from interface: INDArray
        Standard deviation of an INDArray along one or more dimensions
        Specified by:
        std in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the std along
        Returns:
        the standard deviation along a particular dimension
      • std

        public INDArray std​(boolean biasCorrected,
                            int... dimension)
        Description copied from interface: INDArray
        Standard deviation of an ndarray along a dimension
        Specified by:
        std in interface INDArray
        dimension - the dimension to getScalar the std along
        Returns:
        the standard deviation along a particular dimension
      • std

        public INDArray std​(boolean biasCorrected,
                            boolean keepDims,
                            int... dimension)
        Description copied from interface: INDArray
        Standard deviation of an ndarray along a dimension
        Specified by:
        std in interface INDArray
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the std along
        Returns:
        the standard deviation along a particular dimension
      • stdNumber

        public Number stdNumber​(boolean biasCorrected)
        Description copied from interface: INDArray
        Calculate the standard deviation for the entire array, specifying whether it is bias corrected or not
        Specified by:
        stdNumber in interface INDArray
        Parameters:
        biasCorrected - If true: bias corrected standard deviation. False: not bias corrected
        Returns:
        Standard dev
      • norm2

        public INDArray norm2​(boolean keepDims,
                              int... dimension)
        Description copied from interface: INDArray
        Returns the norm2 (L2 norm, sqrt(sum(x_i^2), also known as Euclidean norm) along the specified dimension(s)
        Specified by:
        norm2 in interface INDArray
        Parameters:
        keepDims - whether to keep reduced dimensions as dimensions of size 1
        dimension - the dimension to getScalar the norm2 along
        Returns:
        the norm2 along the specified dimension
      • norm2

        public INDArray norm2​(int... dimension)
        Description copied from interface: INDArray
        Returns the norm2 (L2 norm, sqrt(sum(x_i^2), also known as Euclidean norm) along the specified dimension(s)
        Specified by:
        norm2 in interface INDArray
        Parameters:
        dimension - the dimension to getScalar the norm2 along
        Returns:
        the norm2 along the specified dimension
      • columns

        public int columns()
        Description copied from interface: INDArray
        Returns the number of columns in this matrix (throws exception if not 2d)
        Specified by:
        columns in interface INDArray
        Returns:
        the number of columns in this matrix
      • rows

        public int rows()
        Description copied from interface: INDArray
        Returns the number of rows in this matrix (throws exception if not 2d)
        Specified by:
        rows in interface INDArray
        Returns:
        the number of rows in this matrix
      • ravel

        public INDArray ravel​(char ordering)
        Description copied from interface: INDArray
        Returns a flattened version (row vector) of this ndarray
        Specified by:
        ravel in interface INDArray
        Returns:
        a flattened version (row vector) of this ndarray
      • ravel

        public INDArray ravel()
        Description copied from interface: INDArray
        Returns a flattened version (row vector) of this ndarray
        Specified by:
        ravel in interface INDArray
        Returns:
        a flattened version (row vector) of this ndarray
      • sliceVectors

        public void sliceVectors​(List<INDArray> list)
        Description copied from interface: INDArray
        Flattens the array for linear indexing in list.
        Specified by:
        sliceVectors in interface INDArray
      • reshape

        public INDArray reshape​(long newRows,
                                long newColumns)
        Description copied from interface: INDArray
        Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping without copying is impossible.
        Specified by:
        reshape in interface INDArray
        Parameters:
        newRows - the rows of the matrix
        newColumns - the columns of the matrix
        Returns:
        the reshaped ndarray
      • getColumn

        public INDArray getColumn​(long c)
        Description copied from interface: INDArray
        Returns the specified column. Throws an exception if its not a matrix
        Specified by:
        getColumn in interface INDArray
        Parameters:
        c - the column to getScalar
        Returns:
        the specified column
      • getColumn

        public INDArray getColumn​(long c,
                                  boolean keepDim)
        Description copied from interface: INDArray
        Returns the specified column. Throws an exception if its not a matrix (rank 2). Returned array will either be 1D (keepDim = false) or 2D (keepDim = true) with shape [length, 1]
        Specified by:
        getColumn in interface INDArray
        Parameters:
        c - the row to get
        keepDim - If true: return [length, 1] array. Otherwise: return [length] array
        Returns:
        the specified row
      • getRows

        public INDArray getRows​(int[] rindices)
        Description copied from interface: INDArray
        Get an INDArray comprised of the specified rows only. Copy operation
        Specified by:
        getRows in interface INDArray
        Parameters:
        rindices - Rose to extract from this array
        Returns:
        Array with only the specified rows
      • get

        public INDArray get​(INDArrayIndex... indexes)
        Description copied from interface: INDArray
        Returns a subset of this array based on the specified indexes
        Specified by:
        get in interface INDArray
        Parameters:
        indexes - the indexes in to the array
        Returns:
        a view of the array with the specified indices
      • getColumns

        public INDArray getColumns​(int... cindices)
        Description copied from interface: INDArray
        Get an INDArray comprised of the specified columns only. Copy operation.
        Specified by:
        getColumns in interface INDArray
        Parameters:
        cindices - Columns to extract out of the current array
        Returns:
        Array with only the specified columns
      • create

        protected INDArray create​(int rows,
                                  int length)
      • getRow

        public INDArray getRow​(long r)
        Description copied from interface: INDArray
        Returns the specified row as a 1D vector. Throws an exception if its not a matrix
        Specified by:
        getRow in interface INDArray
        Parameters:
        r - the row to getScalar
        Returns:
        the specified row
      • getRow

        public INDArray getRow​(long r,
                               boolean keepDim)
        Description copied from interface: INDArray
        Returns the specified row. Throws an exception if its not a matrix. Returned array will either be 1D (keepDim = false) or 2D (keepDim = true) with shape [1, length]
        Specified by:
        getRow in interface INDArray
        Parameters:
        r - the row to get
        keepDim - If true: return [1,length] array. Otherwise: return [length] array
        Returns:
        the specified row
      • equalsWithEps

        public boolean equalsWithEps​(Object o,
                                     double eps)
        Description copied from interface: INDArray
        This method checks 2 INDArrays equality with given eps
        Specified by:
        equalsWithEps in interface INDArray
        Parameters:
        o - INDArray to compare against.
        eps - Epsilon value to use for the quality operation
        Returns:
        True if ndarrays are equal within eps.
      • equalShapes

        public boolean equalShapes​(@NonNull
                                   @NonNull INDArray other)
        Description copied from interface: INDArray
        This method checks 2 INDArrays for equal shapes.
        Shapes are considered equal if:
        (a) Both arrays have equal rank, and
        (b) size(0)...size(rank()-1) are equal for both arrays
        Specified by:
        equalShapes in interface INDArray
        Parameters:
        other - Other
        Returns:
        True if shap
      • equals

        public boolean equals​(Object o)
        Compare two matrices. Returns true if and only if other is also a DoubleMatrix which has the same size and the maximal absolute difference in matrix elements is smaller than 1e-5.
        Overrides:
        equals in class Object
        Parameters:
        o -
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • shape

        public long[] shape()
        Description copied from interface: INDArray
        Returns the shape of this ndarray
        Specified by:
        shape in interface INDArray
        Returns:
        the shape of this ndarray
      • shapeInfoToString

        public String shapeInfoToString()
        Description copied from interface: INDArray
        Returns the shape information debugging information
        Specified by:
        shapeInfoToString in interface INDArray
        Returns:
        the shape information.
      • stride

        public long[] stride()
        Description copied from interface: INDArray
        Returns the stride of this ndarray
        Specified by:
        stride in interface INDArray
        Returns:
        the stride of this ndarray
      • offset

        public long offset()
        Description copied from interface: INDArray
        Returns the start of where the ndarray is for the underlying data
        Specified by:
        offset in interface INDArray
        Returns:
        the starting offset
      • ordering

        public char ordering()
        Description copied from interface: INDArray
        Return the ordering (fortran or c 'f' and 'c' respectively) of this ndarray
        Specified by:
        ordering in interface INDArray
        Returns:
        the ordering of this ndarray
      • size

        public long size​(int dimension)
        Description copied from interface: INDArray
        Returns the size along a specified dimension
        Specified by:
        size in interface INDArray
        Parameters:
        dimension - the dimension to return the size for
        Returns:
        the size of the array along the specified dimension
      • rank

        public int rank()
        Description copied from interface: INDArray
        Returns the rank of the ndarray (the number of dimensions).
        Specified by:
        rank in interface INDArray
        Returns:
        the rank for the ndarray.
      • length

        public long length()
        Description copied from interface: INDArray
        Returns the total number of elements in the ndarray
        Specified by:
        length in interface INDArray
        Returns:
        the number of elements in the ndarray
      • broadcast

        public INDArray broadcast​(INDArray result)
        Description copied from interface: INDArray
        Broadcasts this ndarray to be the specified shape
        Specified by:
        broadcast in interface INDArray
        Returns:
        the broadcasted ndarray
      • broadcast

        public INDArray broadcast​(long... shape)
        Description copied from interface: INDArray
        Broadcasts this ndarray to be the specified shape
        Specified by:
        broadcast in interface INDArray
        Parameters:
        shape - the new shape of this ndarray
        Returns:
        the broadcasted ndarray
      • dimShuffle

        @Deprecated
        public INDArray dimShuffle​(Object[] rearrange,
                                   int[] newOrder,
                                   boolean[] broadCastable)
        Deprecated.
        Description copied from interface: INDArray
        Dimshuffle: an extension of permute that adds the ability to broadcast various dimensions. This will only accept integers and xs.

        An x indicates a dimension should be broadcasted rather than permuted. Examples originally from the theano docs: http://deeplearning.net/software/theano/library/tensor/basic.html Returns a view of this tensor with permuted dimensions. Typically the pattern will include the integers 0, 1, ... ndim-1, and any number of 'x' characters in dimensions where this tensor should be broadcasted. A few examples of patterns and their effect: ('x') -> make a 0d (scalar) into a 1d vector (0, 1) -> identity for 2d vectors (1, 0) -> inverts the first and second dimensions ('x', 0) -> make a row out of a 1d vector (N to 1xN) (0, 'x') -> make a column out of a 1d vector (N to Nx1) (2, 0, 1) -> AxBxC to CxAxB (0, 'x', 1) -> AxB to Ax1xB (1, 'x', 0) -> AxB to Bx1xA (1,) -> This remove dimensions 0. It must be a broadcastable dimension (1xA to A)

        Specified by:
        dimShuffle in interface INDArray
        Parameters:
        rearrange - the dimensions to swap to
        newOrder - the new order (think permute)
        broadCastable - (whether the dimension is broadcastable) (must be same length as new order)
        Returns:
        the newly permuted array
      • dimShuffle

        public INDArray dimShuffle​(Object[] rearrange,
                                   long[] newOrder,
                                   boolean[] broadCastable)
        Dimshuffle: an extension of permute that adds the ability to broadcast various dimensions.

        See theano for more examples. This will only accept integers and xs.

        An x indicates a dimension should be broadcasted rather than permuted.

        Specified by:
        dimShuffle in interface INDArray
        Parameters:
        rearrange - the dimensions to swap to
        Returns:
        the newly permuted array
      • permute

        public INDArray permute​(int... rearrange)
        Description copied from interface: INDArray
        See: http://www.mathworks.com/help/matlab/ref/permute.html
        Specified by:
        permute in interface INDArray
        Parameters:
        rearrange - the dimensions to swap to
        Returns:
        the newly permuted array
      • permutei

        public INDArray permutei​(int... rearrange)
        Description copied from interface: INDArray
        An in-place version of permute. The array shape information (shape, strides) is modified by this operation (but not the data itself) See: http://www.mathworks.com/help/matlab/ref/permute.html
        Specified by:
        permutei in interface INDArray
        Parameters:
        rearrange - the dimensions to swap to
        Returns:
        the current array
      • doPermuteSwap

        @Deprecated
        protected long[] doPermuteSwap​(LongBuffer shape,
                                       int[] rearrange)
        Deprecated.
      • doPermuteSwap

        @Deprecated
        protected int[] doPermuteSwap​(IntBuffer shape,
                                      int[] rearrange)
        Deprecated.
      • doPermuteSwap

        @Deprecated
        protected int[] doPermuteSwap​(DataBuffer shape,
                                      int[] rearrange)
        Deprecated.
      • doPermuteSwap

        protected long[] doPermuteSwap​(long[] shape,
                                       int[] rearrange)
      • checkArrangeArray

        protected void checkArrangeArray​(int[] arr)
      • autoProcessScalarCall

        protected void autoProcessScalarCall()
      • isVector

        public boolean isVector()
        Checks whether the matrix is a vector.
        Specified by:
        isVector in interface INDArray
        Returns:
        whether this ndarray is a vector
      • isVectorOrScalar

        public boolean isVectorOrScalar()
        Description copied from interface: INDArray
        Returns true if this ndarray is a vector or scalar
        Specified by:
        isVectorOrScalar in interface INDArray
        Returns:
        whether this ndarray is a vector or scalar
      • isSquare

        public boolean isSquare()
        Description copied from interface: INDArray
        Returns whether the matrix has the same rows and columns
        Specified by:
        isSquare in interface INDArray
        Returns:
        true if the matrix has the same rows and columns false otherwise
      • isRowVector

        public boolean isRowVector()
        Description copied from interface: INDArray
        Returns true if the number of rows is 1
        Specified by:
        isRowVector in interface INDArray
        Returns:
        true if the number of rows is 1
      • isColumnVector

        public boolean isColumnVector()
        Description copied from interface: INDArray
        Returns true if the number of columns is 1
        Specified by:
        isColumnVector in interface INDArray
        Returns:
        true if the number of columns is 1
      • isColumnVectorOrScalar

        public boolean isColumnVectorOrScalar()
        Description copied from interface: INDArray
        Returns true if the number of columns is 1
        Specified by:
        isColumnVectorOrScalar in interface INDArray
        Returns:
        true if the number of columns is 1
      • isRowVectorOrScalar

        public boolean isRowVectorOrScalar()
        Description copied from interface: INDArray
        Returns true if the number of rows is 1
        Specified by:
        isRowVectorOrScalar in interface INDArray
        Returns:
        true if the number of rows is 1
      • toString

        public String toString()
        Generate string representation of the matrix. Printing will switch to scientific notation on a per element basis - when abs value is greater than or equal to 10000 - when abs value is less than or equal to 0.0001 and not zero If the number of elements in the array is greater than 1000 (by default) only the first and last three elements in a dimension are included. This can be changed globally using NDArrayStrings#setMaxPrintElements(long)
        Overrides:
        toString in class Object
      • toString

        public String toString​(@NonNull
                               @NonNull NDArrayStrings options)
        Description copied from interface: INDArray
        Get a string representation of the array with configurable formatting
        Specified by:
        toString in interface INDArray
        Parameters:
        options - format options
      • toString

        public String toString​(long maxElements,
                               boolean forceSummarize,
                               int precision)
        Description copied from interface: INDArray
        Get a string representation of the array
        Specified by:
        toString in interface INDArray
        Parameters:
        maxElements - Summarize if more than maxElements in the array
        forceSummarize - Force a summary instead of a full print
        precision - The number of decimals to print. Doesn't print trailing 0s if negative
        Returns:
        string representation of the array
      • element

        public Object element()
        Description copied from interface: INDArray
        Returns a scalar (individual element) of a scalar ndarray
        Specified by:
        element in interface INDArray
        Returns:
        the individual item in this ndarray
      • remainder

        public INDArray remainder​(INDArray denominator)
        Description copied from interface: INDArray
        Remainder operator
        Specified by:
        remainder in interface INDArray
        Parameters:
        denominator - the denominator
        Returns:
        remainder
      • remainder

        public INDArray remainder​(INDArray denominator,
                                  INDArray result)
        Description copied from interface: INDArray
        Remainder operator
        Specified by:
        remainder in interface INDArray
        Parameters:
        denominator - the denominator
        result - the result array to put this in
        Returns:
        Remainder
      • remainder

        public INDArray remainder​(Number denominator)
        Description copied from interface: INDArray
        The scalar remainder
        Specified by:
        remainder in interface INDArray
        Parameters:
        denominator - the denominator as a scalar
        Returns:
        Remainder
      • remainder

        public INDArray remainder​(Number denominator,
                                  INDArray result)
        Description copied from interface: INDArray
        The scalar remainder
        Specified by:
        remainder in interface INDArray
        Parameters:
        denominator - the denominator as a scalar
        result - the result array to put this in
        Returns:
        Remainder
      • remainderi

        public INDArray remainderi​(INDArray denominator)
        Description copied from interface: INDArray
        In place remainder
        Specified by:
        remainderi in interface INDArray
        Parameters:
        denominator - the denominator
        Returns:
        Remainder
      • remainderi

        public INDArray remainderi​(Number denominator)
        Description copied from interface: INDArray
        In place remainder
        Specified by:
        remainderi in interface INDArray
        Parameters:
        denominator - the denominator
        Returns:
        Remainder
      • fmod

        public INDArray fmod​(INDArray denominator)
        Description copied from interface: INDArray
        remainder of division
        Specified by:
        fmod in interface INDArray
        Parameters:
        denominator - the array of denominators for each element in this array
        Returns:
        array of remainders
      • fmod

        public INDArray fmod​(INDArray denominator,
                             INDArray result)
        Description copied from interface: INDArray
        remainder of division
        Specified by:
        fmod in interface INDArray
        Parameters:
        denominator - the array of denominators for each element in this array
        result - the result array
        Returns:
        array of remainders
      • fmod

        public INDArray fmod​(Number denominator)
        Description copied from interface: INDArray
        remainder of division by scalar.
        Specified by:
        fmod in interface INDArray
        Parameters:
        denominator - the denominator
        Returns:
        array of remainders
      • fmod

        public INDArray fmod​(Number denominator,
                             INDArray result)
        Description copied from interface: INDArray
        remainder of division by scalar.
        Specified by:
        fmod in interface INDArray
        Parameters:
        denominator - the denominator
        result - the result array
        Returns:
        array of remainders
      • fmodi

        public INDArray fmodi​(INDArray denominator)
        Description copied from interface: INDArray
        In place fmod
        Specified by:
        fmodi in interface INDArray
        Parameters:
        denominator - the array of denominators for each element in this array
        Returns:
        array of remainders
      • fmodi

        public INDArray fmodi​(Number denominator)
        Description copied from interface: INDArray
        In place fmod
        Specified by:
        fmodi in interface INDArray
        Parameters:
        denominator - the denominator as a scalar
        Returns:
        array of remainders
      • originalOffset

        public long originalOffset()
        Description copied from interface: INDArray
        Returns the start of where the ndarray is for the original data buffer
        Specified by:
        originalOffset in interface INDArray
        Returns:
        original offset.
      • argMax

        public INDArray argMax​(int... dimension)
        Description copied from interface: INDArray
        This method returns index of highest value along specified dimension(s)
        Specified by:
        argMax in interface INDArray
        Parameters:
        dimension - Dimension along which to perform the argMax operation
        Returns:
        Array containing indices
      • isAttached

        public boolean isAttached()
        Description copied from interface: INDArray
        This method returns True, if this INDArray instance is attached to some Workspace. False otherwise.
        Specified by:
        isAttached in interface INDArray
        Returns:
        True if attached to workspace, false otherwise
      • isInScope

        public boolean isInScope()
        Description copied from interface: INDArray
        This method checks, if given attached INDArray is still in scope of its parent Workspace PLEASE NOTE: if this INDArray isn't attached to any Workspace, this method will return true
        Specified by:
        isInScope in interface INDArray
        Returns:
        true if attached to workspace.
      • detach

        public INDArray detach()
        Description copied from interface: INDArray
        This method detaches INDArray from Workspace, returning copy. Basically it's dup() into new memory chunk. PLEASE NOTE: If this INDArray instance is NOT attached - it will be returned unmodified.
        Specified by:
        detach in interface INDArray
        Returns:
        The attached copy of array, or original if not in workspace
      • leverage

        public INDArray leverage()
        Description copied from interface: INDArray
        This method detaches INDArray from current Workspace, and attaches it to Workspace above, if any. PLEASE NOTE: If this INDArray instance is NOT attached - it will be returned unmodified. PLEASE NOTE: If current Workspace is the top-tier one, effect will be equal to detach() call - detached copy will be returned
        Specified by:
        leverage in interface INDArray
        Returns:
        this ndarray or a detached copy.
      • leverageTo

        public INDArray leverageTo​(String id)
        Description copied from interface: INDArray
        This method detaches INDArray from current Workspace, and attaches it to Workspace with a given Id - if a workspace with that ID exists. If no workspace with the specified ID exists, the current INDArray is returned unmodified.
        Specified by:
        leverageTo in interface INDArray
        See Also:
        INDArray.leverageTo(String, boolean)
      • leverageOrDetach

        public INDArray leverageOrDetach​(String id)
        Description copied from interface: INDArray
        This method detaches INDArray from current Workspace, and attaches it to Workspace with a given Id, if a workspace with the given ID is open and active. If the workspace does not exist, or is not active, the array is detached from any workspaces.
        Specified by:
        leverageOrDetach in interface INDArray
        Parameters:
        id - ID of the workspace to leverage to
        Returns:
        The INDArray, leveraged to the specified workspace (if it exists and is active) otherwise the detached array
        See Also:
        INDArray.leverageTo(String)
      • migrate

        public INDArray migrate()
        Description copied from interface: INDArray
        This method pulls this INDArray into current Workspace. PLEASE NOTE: If there's no current Workspace - INDArray returned as is
        Specified by:
        migrate in interface INDArray
        Returns:
        Migrated INDArray or this if no current workspace
        See Also:
        INDArray.migrate(boolean)
      • migrate

        public INDArray migrate​(boolean detachOnNoWs)
        Description copied from interface: INDArray
        This method pulls this INDArray into current Workspace, or optionally detaches if no workspace is present.
        That is:
        If current workspace is present/active, INDArray is migrated to it.
        If no current workspace is present/active, one of two things occur: 1. If detachOnNoWs arg is true: if there is no current workspace, INDArray is detached 2. If detachOnNoWs arg is false: this INDArray is returned as-is (no-op) - equivalent to INDArray.migrate()
        Specified by:
        migrate in interface INDArray
        Parameters:
        detachOnNoWs - If true: detach on no WS. If false and no workspace: return this.
        Returns:
        Migrated INDArray
      • percentileNumber

        public Number percentileNumber​(Number quantile)
        Description copied from interface: INDArray
        This method returns percentile value for this INDArray
        Specified by:
        percentileNumber in interface INDArray
        Parameters:
        quantile - target percentile in range of 0..100
        Returns:
        percentile value
      • medianNumber

        public Number medianNumber()
        Description copied from interface: INDArray
        This method returns median value for this INDArray
        Specified by:
        medianNumber in interface INDArray
        Returns:
        Median value for array
      • median

        public INDArray median​(int... dimension)
        Description copied from interface: INDArray
        This method returns median along given dimension(s)
        Specified by:
        median in interface INDArray
        Parameters:
        dimension - Dimension to calculate median
        Returns:
        Median along specified dimensions
      • getPercentile

        protected double getPercentile​(Number quantile,
                                       INDArray sorted)
      • percentile

        public INDArray percentile​(Number quantile,
                                   int... dimension)
        Description copied from interface: INDArray
        This method returns percentile along given dimension(s)
        Specified by:
        percentile in interface INDArray
        Parameters:
        quantile - target percentile in range of 0..100
        dimension - Dimension to calculate percentile for
        Returns:
        array with percentiles
      • stringBuffer

        protected abstract int stringBuffer​(com.google.flatbuffers.FlatBufferBuilder builder,
                                            DataBuffer buffer)
      • toFlatArray

        public int toFlatArray​(com.google.flatbuffers.FlatBufferBuilder builder)
        Description copied from interface: INDArray
        Add an INDArray to flatbuffers builder
        Specified by:
        toFlatArray in interface INDArray
        Parameters:
        builder - the builder to use
        Returns:
        the offset to add
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: INDArray
        This method returns true if this INDArray is special case: no-value INDArray
        Specified by:
        isEmpty in interface INDArray
        Returns:
        True if empty.
      • shapeInfoJava

        public long[] shapeInfoJava()
        Description copied from interface: INDArray
        This method returns shapeInformation as jvm long array
        Specified by:
        shapeInfoJava in interface INDArray
        Returns:
        shapeInformation
      • dataType

        public DataType dataType()
        Description copied from interface: INDArray
        This method returns dtype for this INDArray
        Specified by:
        dataType in interface INDArray
        Returns:
        Datattype
      • isR

        public boolean isR()
        Description copied from interface: INDArray
        This method checks if this INDArray instance is one of Real types
        Specified by:
        isR in interface INDArray
        Returns:
        true if data type is floating point, false otherwise
      • isZ

        public boolean isZ()
        Description copied from interface: INDArray
        This method checks if this INDArray instance is one of integer types
        Specified by:
        isZ in interface INDArray
        Returns:
        true if integer type
      • isB

        public boolean isB()
        Description copied from interface: INDArray
        This method checks if this INDArray instance has boolean type
        Specified by:
        isB in interface INDArray
        Returns:
        true if boolean type.
      • isS

        public boolean isS()
        Description copied from interface: INDArray
        This method checks if this INDArray instance has String type
        Specified by:
        isS in interface INDArray
        Returns:
        true if string type.
      • castTo

        public INDArray castTo​(DataType dataType)
        Description copied from interface: INDArray
        This method cast elements of this INDArray to new data type
        Specified by:
        castTo in interface INDArray
        Parameters:
        dataType - new datatype.
        Returns:
        this if datatype matches, otherwise a new array of specified datatype.
      • all

        public boolean all()
        Description copied from interface: INDArray
        This method checks if all elements within this array are non-zero (or true, in case of boolean)
        Specified by:
        all in interface INDArray
        Returns:
        true if all non-zero.
      • any

        public boolean any()
        Description copied from interface: INDArray
        This method checks if any of the elements within this array are non-zero (or true, in case of boolean)
        Specified by:
        any in interface INDArray
        Returns:
        true if any non-zero.
      • none

        public boolean none()
        Description copied from interface: INDArray
        This method checks if any of the elements within this array are non-zero (or true, in case of boolean)
        Specified by:
        none in interface INDArray
        Returns:
        true if any non-zero
      • validateNumericalArray

        protected void validateNumericalArray​(String opName,
                                              boolean allowEmpty)
        Validate that the operation is being applied on a numerical array (not boolean or utf8). Some operations (such as sum, norm2, add(Number) etc don't make sense when applied to boolean/utf8 arrays
        Parameters:
        opName - Operation name to print in the exception
      • closeable

        public boolean closeable()
        Description copied from interface: INDArray
        This method checks, if this INDArray instalce can use close() method
        Specified by:
        closeable in interface INDArray
        Returns:
        true if array can be released, false otherwise
      • close

        public void close()
        Description copied from interface: INDArray
        This method releases exclusive off-heap resources uses by this INDArray instance. If INDArray relies on shared resources, exception will be thrown instead PLEASE NOTE: This method is NOT safe by any means
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface INDArray
      • like

        public INDArray like()
        Description copied from interface: INDArray
        This method returns empty array with the same dtype/order/shape as this one
        Specified by:
        like in interface INDArray
        Returns:
        empty array with the same dtype/order/shape
      • ulike

        public INDArray ulike()
        Description copied from interface: INDArray
        This method returns uninitialized array with the same dtype/order/shape as this one
        Specified by:
        ulike in interface INDArray
        Returns:
        uninitialized array with the same dtype/order/shape
      • wasClosed

        public boolean wasClosed()
        Description copied from interface: INDArray
        This method checks if array or its buffer was closed before
        Specified by:
        wasClosed in interface INDArray
        Returns:
        true if was closed, false otherwise
      • getId

        public long getId()
        Description copied from interface: INDArray
        A unique ID for the INDArray object instance. Does not account for views.
        Specified by:
        getId in interface INDArray
        Returns:
        INDArray unique ID
      • assignNewId

        public void assignNewId()