Package org.nd4j.linalg.indexing
Class IntervalIndex
- java.lang.Object
-
- org.nd4j.linalg.indexing.IntervalIndex
-
- All Implemented Interfaces:
INDArrayIndex
- Direct Known Subclasses:
NDArrayIndexAll
public class IntervalIndex extends Object implements INDArrayIndex
And indexing representing an interval. An interval over a given dimension will create a view similar to aPointIndex
starting from a position and ending at one. Negative indices can also be specified allowing for dynamic resolution of dimensions/coordinates at runtime.- Author:
- Adam Gibson
-
-
Constructor Summary
Constructors Constructor Description IntervalIndex(boolean inclusive, long stride)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description INDArrayIndex
dup()
Deep copy of thisINDArrayIndex
long
end()
The ending for this indexboolean
equals(Object o)
int
hashCode()
void
init(long begin, long end)
Initialize based on the specified begin and endvoid
init(long begin, long end, long max)
void
init(INDArray arr, int dimension)
Init the index wrt the dimension and the given nd arrayvoid
init(INDArray arr, long begin, int dimension)
Init the index wrt the dimension and the given nd arrayboolean
initialized()
Returns true if this index has been initialized.boolean
isInterval()
Returns true if the index is an intervallong
length()
The total length of this index (end - start)long
offset()
The start of this indexvoid
reverse()
Reverse the indexeslong
stride()
The stride for the index (most of the time will be 1)String
toString()
-
-
-
Method Detail
-
end
public long end()
Description copied from interface:INDArrayIndex
The ending for this index- Specified by:
end
in interfaceINDArrayIndex
- Returns:
-
offset
public long offset()
Description copied from interface:INDArrayIndex
The start of this index- Specified by:
offset
in interfaceINDArrayIndex
- Returns:
-
length
public long length()
Description copied from interface:INDArrayIndex
The total length of this index (end - start)- Specified by:
length
in interfaceINDArrayIndex
- Returns:
-
stride
public long stride()
Description copied from interface:INDArrayIndex
The stride for the index (most of the time will be 1)- Specified by:
stride
in interfaceINDArrayIndex
- Returns:
-
reverse
public void reverse()
Description copied from interface:INDArrayIndex
Reverse the indexes- Specified by:
reverse
in interfaceINDArrayIndex
-
isInterval
public boolean isInterval()
Description copied from interface:INDArrayIndex
Returns true if the index is an interval- Specified by:
isInterval
in interfaceINDArrayIndex
- Returns:
-
init
public void init(INDArray arr, long begin, int dimension)
Description copied from interface:INDArrayIndex
Init the index wrt the dimension and the given nd array- Specified by:
init
in interfaceINDArrayIndex
- Parameters:
arr
- the array to initialize onbegin
- the beginning indexdimension
- the dimension to initialize on
-
init
public void init(INDArray arr, int dimension)
Description copied from interface:INDArrayIndex
Init the index wrt the dimension and the given nd array- Specified by:
init
in interfaceINDArrayIndex
- Parameters:
arr
- the array to initialize ondimension
- the dimension to initialize on
-
init
public void init(long begin, long end, long max)
- Specified by:
init
in interfaceINDArrayIndex
-
init
public void init(long begin, long end)
Description copied from interface:INDArrayIndex
Initialize based on the specified begin and end- Specified by:
init
in interfaceINDArrayIndex
-
initialized
public boolean initialized()
Description copied from interface:INDArrayIndex
Returns true if this index has been initialized. Sometimes indices may define certain constraints such as negative indices that may not be resolved until use.INDArray.get(INDArrayIndex...)
will check for when an index is initialized and if not initialize it upon use.- Specified by:
initialized
in interfaceINDArrayIndex
- Returns:
-
dup
public INDArrayIndex dup()
Description copied from interface:INDArrayIndex
Deep copy of thisINDArrayIndex
- Specified by:
dup
in interfaceINDArrayIndex
- Returns:
-
-