elementAt method
Returns an updated layout with the given axis
resolved to index
.
Implementation
Layout elementAt(int index, {int axis = 0}) {
final axis_ = checkIndex(axis, rank, 'axis');
final index_ = checkIndex(index, shape[axis_], 'index');
return Layout(
shape: [...shape.take(axis_), ...shape.skip(axis_ + 1)],
strides: [...strides.take(axis_), ...strides.skip(axis_ + 1)],
offset: offset + index_ * strides[axis_],
);
}