public interface Index
A slice, i.e. a reduced view, of an N-dimensional array is obtain by calling
NdArray.slice(Index...), given a list of indices
that select which elements on a given dimension should be included/excluded
from that view.
| Modifier and Type | Method and Description |
|---|---|
default Dimension |
apply(Dimension dim)
Applies this index to the given dimension.
|
default boolean |
isPoint()
Returns true if this index is a single point, reducing the number of dimensions by one
|
long |
mapCoordinate(long coordinate,
Dimension dim)
Transforms an element coordinate to a new coordinate by applying this index to the
given dimension.
|
long |
numElements(Dimension dim)
Returns the number of elements that can be retrieved using this index on the
given dimension.
|
long numElements(Dimension dim)
An index that maps one-by-one all elements of the dimensions will return a value
equal to dim.numElements(), while an index that only maps a subset of these
will return a smaller value.
dim - the indexed dimensionlong mapCoordinate(long coordinate,
Dimension dim)
For example, if the coordinate is 0 and this index flips the n elements on this
dimension, then the returned value will be n-1.
coordinate - coordinate to transformdim - dimension the indexed dimensiondefault Dimension apply(Dimension dim)
When accessing the elements from the returned dimension, this index will automatically apply and may transform the original position.
dim - dimension to apply this index todefault boolean isPoint()
Copyright © 2015–2020. All rights reserved.