public class Indices extends Object
Constructor and Description |
---|
Indices() |
Modifier and Type | Method and Description |
---|---|
static NDArrayIndex[] |
adjustIndices(int[] originalShape,
NDArrayIndex... indexes)
Prunes indices of greater length than the shape
and fills in missing indices if there are any
|
static NDArrayIndex[] |
createFromStartAndEnd(INDArray start,
INDArray end)
Create an n dimensional index
based on the given interval indices.
|
static NDArrayIndex[] |
createFromStartAndEnd(INDArray start,
INDArray end,
boolean inclusive)
Create indices representing intervals
along each dimension
|
static NDArrayIndex[] |
fillIn(int[] shape,
NDArrayIndex... indexes)
Fill in the missing indices to be the
same length as the original shape.
|
static boolean |
isContiguous(int[] indices)
Returns whether the indices are contiguous by one or not
|
static boolean |
isContiguous(int[] indices,
int diff)
Returns whether indices are contiguous
by a certain amount or not
|
static boolean |
isContiguous(int diff,
NDArrayIndex... indexes)
Returns whether indices are contiguous
by a certain amount or not
|
static boolean |
isContiguous(NDArrayIndex... indexes)
Returns whether the indices are contiguous by one or not
|
static int[] |
linearIndices(INDArray arr)
Calculate the linear indices for an
ndarray
|
static int |
linearOffset(int index,
INDArray arr)
Compute the linear offset
for an index in an ndarray.
|
static int[] |
offsets(NDArrayIndex... indices)
The offsets (begin index) for each index
|
static int |
rowNumber(int index,
INDArray arr)
Compute the linear offset
for an index in an ndarray.
|
static int[] |
shape(int[] shape,
int[] offsets,
NDArrayIndex... indices)
Calculate the shape for the given set of indices and offsets.
|
static int[] |
shape(int[] shape,
NDArrayIndex... indices)
Calculate the shape for the given set of indices.
|
static int[] |
shape(NDArrayIndex... indices)
Calculate the shape for the given set of indices.
|
static int[] |
strides(char ordering,
NDArrayIndex... indexes)
Calculate the strides based on the given indices
|
public static int rowNumber(int index, INDArray arr)
index
- the indexarr
- the arraypublic static int linearOffset(int index, INDArray arr)
index
- the indexarr
- the arraypublic static int[] linearIndices(INDArray arr)
arr
- the array to calculate forpublic static int[] offsets(NDArrayIndex... indices)
indices
- the indicespublic static NDArrayIndex[] fillIn(int[] shape, NDArrayIndex... indexes)
shape
- the original shapeindexes
- the indexes to start frompublic static NDArrayIndex[] adjustIndices(int[] originalShape, NDArrayIndex... indexes)
originalShape
- the original shape to adjust toindexes
- the indexes to adjustpublic static int[] strides(char ordering, NDArrayIndex... indexes)
ordering
- the ordering to calculate strides forindexes
- the indices to calculate stride forpublic static int[] shape(NDArrayIndex... indices)
indices
- the indices to calculate the shape forpublic static boolean isContiguous(NDArrayIndex... indexes)
indexes
- the indices to testpublic static boolean isContiguous(int diff, NDArrayIndex... indexes)
indexes
- the indices to testdiff
- the difference considered to be contiguouspublic static boolean isContiguous(int[] indices)
indices
- the indices to testpublic static boolean isContiguous(int[] indices, int diff)
indices
- the indices to testdiff
- the difference considered to be contiguouspublic static NDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end)
start
- the start indexesend
- the end indexespublic static NDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end, boolean inclusive)
start
- the start indexend
- the end indexinclusive
- whether the last
index should be includedpublic static int[] shape(int[] shape, int[] offsets, NDArrayIndex... indices)
shape
- the original shapeoffsets
- the offsets for the indexingindices
- the indices to calculate the shape forpublic static int[] shape(int[] shape, NDArrayIndex... indices)
shape
- the original shapeindices
- the indices to calculate the shape forCopyright © 2015. All Rights Reserved.