klyn.math.NDArray._getScalar1D
method
public _getScalar1D(i as Long) as T
Description

Reads the typed scalar used by one-dimensional indexed mutations. Unlike ordinary indexing, this internal compiler entry never returns a row.

Parameters
ParameterDescription
iScalar index; negative indices count from the end.
Returns

The element at the normalized index.

Throws
  • ValueException if this tensor is not one-dimensional.
  • IndexException if the index is outside the tensor.
Example
values = NDArray<Int>([10, 20])
values[0] += 2
assert values[0] == 12