DoubleDenseNdArray

public class DoubleDenseNdArray

Public Methods

DoubleNdArray
copyTo ( NdArray <Double> dst)
static DoubleNdArray
double
getDouble (long... indices)
Returns the double value of the scalar found at the given coordinates.
DoubleNdArray
DoubleNdArray
setDouble (double value, long... indices)
Assigns the double value of the scalar found at the given coordinates.
DoubleNdArray

Inherited Methods

Public Methods

public DoubleNdArray copyTo ( NdArray <Double> dst)

public static DoubleNdArray create ( DoubleDataBuffer buffer, Shape shape)

public double getDouble (long... indices)

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

DoubleNdArray matrix = NdArrays.ofDoubles(shape(2, 2));  // matrix rank = 2
  matrix.getDouble(0, 1);  // succeeds, returns 0.0
  matrix.getDouble(0);  // throws IllegalRankException

  DoubleNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
  scalar.getDouble();  // succeeds, returns 0.0
 

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

public DoubleNdArray setDouble (double value, long... indices)

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

DoubleNdArray matrix = NdArrays.ofDoubles(shape(2, 2));  // matrix rank = 2
  matrix.setDouble(10.0, 0, 1);  // succeeds
  matrix.setDouble(10.0, 0);  // throws IllegalRankException

  DoubleNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
  scalar.setDouble(10.0);  // succeeds
 

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