FloatDenseNdArray

public class FloatDenseNdArray

Public Methods

FloatDataBuffer
buffer()
FloatNdArray
copyTo(NdArray<Float> dst)
static FloatNdArray
create(FloatDataBuffer buffer, Shape shape)
float
getFloat(long... indices)
Returns the float value of the scalar found at the given coordinates.
FloatNdArray
FloatNdArray
setFloat(float value, long... indices)
Assigns the float value of the scalar found at the given coordinates.
FloatNdArray

Inherited Methods

Public Methods

public FloatDataBuffer buffer ()

public FloatNdArray copyTo (NdArray<Float> dst)

public static FloatNdArray create (FloatDataBuffer buffer, Shape shape)

public float getFloat (long... indices)

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

FloatNdArray matrix = NdArrays.ofFloats(shape(2, 2));  // matrix rank = 2
  matrix.getFloat(0, 1);  // succeeds, returns 0.0f
  matrix.getFloat(0);  // throws IllegalRankException

  FloatNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
  scalar.getFloat();  // succeeds, returns 0.0f
 

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

public FloatNdArray read (FloatDataBuffer dst)

public FloatNdArray setFloat (float value, long... indices)

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

FloatNdArray matrix = NdArrays.ofFloats(shape(2, 2));  // matrix rank = 2
  matrix.setFloat(10.0f, 0, 1);  // succeeds
  matrix.setFloat(10.0f, 0);  // throws IllegalRankException

  FloatNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
  scalar.setFloat(10.0f);  // succeeds
 

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

public FloatNdArray write (FloatDataBuffer src)