Class NDArrayIndexer


  • public abstract class NDArrayIndexer
    extends java.lang.Object
    A helper class for NDArray implementations for operations with an NDIndex.
    • Constructor Detail

      • NDArrayIndexer

        public NDArrayIndexer()
    • Method Detail

      • get

        public abstract NDArray get​(NDArray array,
                                    NDIndexFullPick fullPick)
        Returns a subarray by picking the elements.
        Parameters:
        array - the array to get from
        fullPick - the elements to pick
        Returns:
        the subArray
      • get

        public abstract NDArray get​(NDArray array,
                                    NDIndexFullSlice fullSlice)
        Returns a subarray at the slice.
        Parameters:
        array - the array to get from
        fullSlice - the fullSlice index of the array
        Returns:
        the subArray
      • get

        public NDArray get​(NDArray array,
                           NDIndex index)
        Returns a subarray at the given index.
        Parameters:
        array - the array to get from
        index - the index to get
        Returns:
        the subarray
      • set

        public abstract void set​(NDArray array,
                                 NDIndexFullSlice fullSlice,
                                 NDArray value)
        Sets the values of the array at the fullSlice with an array.
        Parameters:
        array - the array to set
        fullSlice - the fullSlice of the index to set in the array
        value - the value to set with
      • set

        public void set​(NDArray array,
                        NDIndexBooleans indices,
                        NDArray value)
        Sets the values of the array at the boolean locations with an array.
        Parameters:
        array - the array to set
        indices - a boolean array where true indicates values to update
        value - the value to set with when condition is true
      • set

        public void set​(NDArray array,
                        NDIndex index,
                        NDArray value)
        Sets the values of the array at the index locations with an array.
        Parameters:
        array - the array to set
        index - the index to set at in the array
        value - the value to set with
      • set

        public abstract void set​(NDArray array,
                                 NDIndexFullSlice fullSlice,
                                 java.lang.Number value)
        Sets the values of the array at the fullSlice with a number.
        Parameters:
        array - the array to set
        fullSlice - the fullSlice of the index to set in the array
        value - the value to set with
      • set

        public void set​(NDArray array,
                        NDIndex index,
                        java.lang.Number value)
        Sets the values of the array at the index locations with a number.
        Parameters:
        array - the array to set
        index - the index to set at in the array
        value - the value to set with
      • setScalar

        public void setScalar​(NDArray array,
                              NDIndex index,
                              java.lang.Number value)
        Sets a scalar value in the array at the indexed location.
        Parameters:
        array - the array to set
        index - the index to set at in the array
        value - the value to set with
        Throws:
        java.lang.IllegalArgumentException - if the index does not point to a scalar value in the array