| Constructor and Description |
|---|
Indices() |
| Modifier and Type | Method and Description |
|---|---|
static Index |
all()
An index that returns all elements of a dimension in the original order.
|
static Index |
at(long coord)
A coordinate that selects a specific element on a given dimension.
|
static Index |
at(NdArray<? extends Number> coord)
A coordinate that selects a specific element on a given dimension.
|
static Index |
even()
An index that returns only elements found at an even position in the
original dimension.
|
static Index |
flip()
An index that returns only elements on a given dimension between two coordinates.
|
static Index |
from(long start)
An index that returns only elements on a given dimension starting at a
specific coordinate.
|
static Index |
hyperslab(long start,
long stride,
long count,
long block)
An index that returns elements according to an hyperslab defined by
start,
stride, count, block. |
static Index |
odd()
An index that returns only elements found at an odd position in the
original dimension.
|
static Index |
range(long start,
long end)
An index that returns only elements on a given dimension between two coordinates.
|
static Index |
seq(long... coords)
An index that returns only specific elements on a given dimension.
|
static Index |
seq(NdArray<? extends Number> coords)
An index that returns only specific elements on a given dimension.
|
static Index |
step(long stepLength)
An index that skips a fixed amount of coordinates between each values returned.
|
static Index |
to(long end)
An index that returns only elements on a given dimension up to a
specific coordinate.
|
public static Index at(long coord)
When this index is applied to a given dimension, the dimension is resolved as a single element and therefore is excluded from the computation of the rank.
For example, given a 3D matrix on the axis [x, y, z], if
matrix.slice(all(), at(0), at(0), then the rank of the returned slice is 1 and its
number of elements is x.numElements()
coord - coordinate of the element on the indexed axispublic static Index at(NdArray<? extends Number> coord)
This is equivalent to call at(long) but where the value of the coordinate is
provided by an N-dimensional array.
coord - scalar indicating the coordinate of the element on the indexed axisIllegalRankException - if coord is not a scalar (rank 0)public static Index all()
Applying this index to a given dimension will return the original dimension directly.
For example, given a vector with n elements, all() returns
x0, x1, ..., xn-1
public static Index seq(long... coords)
For example, given a vector with n elements on the x axis, and n > 10,
seq(8, 0, 3) returns x8, x0, x3
coords - coordinates of the elements in the sequencepublic static Index seq(NdArray<? extends Number> coords)
This is equivalent to seq(long...) but where the coordinates of the elements in
the sequence are provided by an N-dimensional array.
coords - vector of coordinates of the elements in the sequenceIllegalRankException - if coords is not a vector (rank 1)public static Index even()
For example, given a vector with n elements on the x axis, and n is even,
even() returns x0, x2, ..., xn-2
public static Index odd()
For example, given a vector with n elements on the x axis, and n is even,
odd() returns x1, x3, ..., xn-1
public static Index step(long stepLength)
For example, given a vector with n elements on the x axis,
step(k) returns x0, xk, xk*2, ...
stepLength - the number of elements between each stepspublic static Index from(long start)
For example, given a vector with n elements on the x axis, and n > k,
from(k) returns xk, xk+1, ..., xn-1
start - coordinate of the first element of the sequencepublic static Index to(long end)
For example, given a vector with n elements on the x axis, and n > k,
to(k) returns x0, x1, ..., xk
end - coordinate of the last element of the sequence (exclusive)public static Index range(long start, long end)
For example, given a vector with n elements on the x axis, and n > k > j,
range(j, k) returns xj, xj+1, ..., xk
start - coordinate of the first element of the sequenceend - coordinate of the last element of the sequence (exclusive)public static Index flip()
For example, given a vector with n elements on the x axis, and n > k > j,
range(j, k) returns xj, xj+1, ..., xk
public static Index hyperslab(long start, long stride, long count, long block)
start,
stride, count, block. See Hyperslab.start - Starting location for the hyperslab.stride - The number of elements to separate each element or block to be selected.count - The number of elements or blocks to select along the dimension.block - The size of the block selected from the dimension.Copyright © 2015–2020. All rights reserved.