IntDenseNdArray

public class IntDenseNdArray

Public Methods

IntNdArray
copyTo(NdArray<Integer> dst)
static IntNdArray
create(IntDataBuffer buffer, Shape shape)
int
getInt(long... indices)
Returns the integer value of the scalar found at the given coordinates.
IntNdArray
IntNdArray
setInt(int value, long... indices)
Assigns the integer value of the scalar found at the given coordinates.
IntNdArray

Inherited Methods

Public Methods

public IntNdArray copyTo (NdArray<Integer> dst)

public static IntNdArray create (IntDataBuffer buffer, Shape shape)

public int getInt (long... indices)

Returns the integer 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:

IntNdArray matrix = NdArrays.ofInts(shape(2, 2));  // matrix rank = 2
  matrix.getInt(0, 1);  // succeeds, returns 0
  matrix.getInt(0);  // throws IllegalRankException

  IntNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
  scalar.getInt();  // succeeds, returns 0
 

Parameters
indices coordinates of the scalar to resolve
Returns
  • value of that scalar

public IntNdArray read (IntDataBuffer dst)

public IntNdArray setInt (int value, long... indices)

Assigns the integer 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:

IntNdArray matrix = NdArrays.ofInts(shape(2, 2));  // matrix rank = 2
  matrix.setInt(10, 0, 1);  // succeeds
  matrix.setInt(10, 0);  // throws IllegalRankException

  IntNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
  scalar.setInt(10);  // succeeds
 

Parameters
value value to assign
indices coordinates of the scalar to assign
Returns
  • this array

public IntNdArray write (IntDataBuffer src)