Class BooleanDenseNdArray

All Implemented Interfaces:
BooleanNdArray, NdArray<Boolean>, Shaped

public class BooleanDenseNdArray extends AbstractDenseNdArray<Boolean, BooleanNdArray> implements BooleanNdArray
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public static BooleanNdArray create(BooleanDataBuffer buffer, Shape shape)
    • getBoolean

      public boolean getBoolean(long... indices)
      Description copied from interface: BooleanNdArray
      Returns the boolean value of the scalar found at the given coordinates.

      To access the scalar element, the number of coordinates provided must be equal to the number of dimensions of this array (i.e. its rank). For example:

       BooleanNdArray matrix = NdArrays.ofBooleans(shape(2, 2));  // matrix rank = 2
       matrix.getBoolean(0, 1);  // succeeds, returns false
       matrix.getBoolean(0);  // throws IllegalRankException
      
       BooleanNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
       scalar.getBoolean();  // succeeds, returns false
      
      Specified by:
      getBoolean in interface BooleanNdArray
      Parameters:
      indices - coordinates of the scalar to resolve
      Returns:
      value of that scalar
    • setBoolean

      public BooleanNdArray setBoolean(boolean value, long... indices)
      Description copied from interface: BooleanNdArray
      Assigns the boolean value of the scalar found at the given coordinates.

      To access the scalar element, the number of coordinates provided must be equal to the number of dimensions of this array (i.e. its rank). For example:

       BooleanNdArray matrix = NdArrays.ofBooleans(shape(2, 2));  // matrix rank = 2
       matrix.setBoolean(true, 0, 1);  // succeeds
       matrix.setBoolean(true, 0);  // throws IllegalRankException
      
       BooleanNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
       scalar.setBoolean(true);  // succeeds
      
      Specified by:
      setBoolean in interface BooleanNdArray
      Parameters:
      value - the value to assign
      indices - coordinates of the scalar to assign
      Returns:
      this array
    • copyTo

      public BooleanNdArray copyTo(NdArray<Boolean> dst)
      Description copied from interface: NdArray
      Copy the content of this array to the destination array.

      The Shaped.shape() of the destination array must be equal to the shape of this array, or an exception is thrown. After the copy, the content of both arrays can be altered independently, without affecting each other.

      Specified by:
      copyTo in interface BooleanNdArray
      Specified by:
      copyTo in interface NdArray<Boolean>
      Parameters:
      dst - array to receive a copy of the content of this array
      Returns:
      this array
    • copyTo

      public BooleanNdArray copyTo(BooleanDataBuffer dst)
      Specified by:
      copyTo in interface BooleanNdArray
    • copyFrom

      public BooleanNdArray copyFrom(BooleanDataBuffer src)
      Specified by:
      copyFrom in interface BooleanNdArray
    • buffer

      protected BooleanDataBuffer buffer()
      Specified by:
      buffer in class AbstractDenseNdArray<Boolean, BooleanNdArray>
    • dimensions

      public DimensionalSpace dimensions()
    • shape

      public Shape shape()
      Specified by:
      shape in interface Shaped
      Returns:
      the shape of this container
    • scalars

      public NdArraySequence<BooleanNdArray> scalars()
      Description copied from interface: NdArray
      Returns a sequence of all scalars in this array.

      This is equivalent to call elements(shape().numDimensions() - 1)

      Specified by:
      scalars in interface NdArray<T>
      Returns:
      an NdArray sequence
    • slowHashCode

      protected int slowHashCode()
    • slowEquals

      protected boolean slowEquals(NdArray<?> array)