Class Indices
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Indexall()An index that returns all elements of a dimension in the original order.static Indexat(long coord) A coordinate that selects a specific element on a given dimension.static Indexat(long coord, boolean keepDim) A coordinate that selects a specific element on a given dimension.static IndexA coordinate that selects a specific element on a given dimension.static IndexA coordinate that selects a specific element on a given dimension.static Indexellipsis()An index that expands to fill all available source dimensions.static Indexeven()An index that returns only elements found at an even position in the original dimension.static Indexflip()An index that returns only elements on a given dimension between two coordinates.static Indexhyperslab(long start, long stride, long count, long block) An index that returns elements according to an hyperslab defined bystart,stride,count,block.static IndexnewAxis()An index that inserts a new dimension of size 1 into the resulting array.static Indexodd()An index that returns only elements found at an odd position in the original dimension.static Indexrange(long start, long end) An index that returns only elements on a given dimension between two coordinates.static Indexseq(long... coords) An index that returns only specific elements on a given dimension.static IndexAn index that returns only specific elements on a given dimension.static Indexslice(long start, long end) An index that returns elements betweenstartandend.static Indexslice(long start, long end, long stride) An index that returns everystride-th element betweenstartandend.static IndexAn index that returns elements betweenstartandend.static IndexAn index that returns everystride-th element betweenstartandend.static IndexsliceFrom(long start) An index that returns only elements on a given dimension starting at a specific coordinate.static IndexsliceFrom(long start, long stride) An index that returns only elements on a given dimension starting at a specific coordinate, using the given stride.static IndexsliceTo(long end) An index that returns only elements on a given dimension up to a specific coordinate.static IndexsliceTo(long end, long stride) An index that returns only elements on a given dimension up to a specific coordinate, using the given stride.static Indexstep(long stride) An index that skips a fixed amount of coordinates between each values returned.
-
Constructor Details
-
Indices
public Indices()
-
-
Method Details
-
at
A coordinate that selects a specific element on a given dimension.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 isx.numElements()- Parameters:
coord- coordinate of the element on the indexed axis- Returns:
- index
-
at
A coordinate that selects a specific element on a given dimension.This is equivalent to call
at(long)but where the value of the coordinate is provided by an N-dimensional array.- Parameters:
coord- scalar indicating the coordinate of the element on the indexed axis- Returns:
- index
- Throws:
IllegalRankException- ifcoordis not a scalar (rank 0)
-
at
A coordinate that selects a specific element on a given dimension.When this index is applied to a given dimension, the dimension is resolved as a single element and therefore, if
keepDimis false, is excluded from the computation of the rank. If keepDim is true, the dimension is collapsed down to one element.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 isx.numElements()- Parameters:
coord- coordinate of the element on the indexed axiskeepDim- whether to remove the dimension.- Returns:
- index
-
at
A coordinate that selects a specific element on a given dimension.This is equivalent to call
at(long, boolean)but where the value of the coordinate is provided by an N-dimensional array.If keepDim is true, the dimension is collapsed down to one element instead of being removed.
- Parameters:
coord- scalar indicating the coordinate of the element on the indexed axiskeepDim- whether to remove the dimension.- Returns:
- index
- Throws:
IllegalRankException- ifcoordis not a scalar (rank 0)
-
all
An index that returns all elements of a dimension in the original order.Applying this index to a given dimension will return the original dimension directly.
For example, given a vector with
nelements,all()returns x0, x1, ..., xn-1- Returns:
- index
-
seq
An index that returns only specific elements on a given dimension.For example, given a vector with
nelements on thexaxis, andn > 10,seq(8, 0, 3)returns x8, x0, x3- Parameters:
coords- coordinates of the elements in the sequence- Returns:
- index
-
seq
An index that returns only specific elements on a given dimension.This is equivalent to
seq(long...)but where the coordinates of the elements in the sequence are provided by an N-dimensional array.- Parameters:
coords- vector of coordinates of the elements in the sequence- Returns:
- index
- Throws:
IllegalRankException- ifcoordsis not a vector (rank 1)
-
even
An index that returns only elements found at an even position in the original dimension.For example, given a vector with
nelements on thexaxis, and n is even,even()returns x0, x2, ..., xn-2- Returns:
- index
-
odd
An index that returns only elements found at an odd position in the original dimension.For example, given a vector with
nelements on thexaxis, and n is even,odd()returns x1, x3, ..., xn-1- Returns:
- index
-
step
An index that skips a fixed amount of coordinates between each values returned.For example, given a vector with
nelements on thexaxis,step(k)returns x0, xk, xk*2, ...- Parameters:
stride- the number of elements between each steps- Returns:
- index
-
sliceFrom
An index that returns only elements on a given dimension starting at a specific coordinate.For example, given a vector with
nelements on thexaxis, andn > k,from(k)returns xk, xk+1, ..., xn-1- Parameters:
start- coordinate of the first element of the sequence- Returns:
- index
-
sliceFrom
An index that returns only elements on a given dimension starting at a specific coordinate, using the given stride.For example, given a vector with
nelements on thexaxis, andn > k,from(k)returns xk, xk+1, ..., xn-1- Parameters:
start- coordinate of the first element of the sequencestride- the stride to use- Returns:
- index
- See Also:
-
sliceTo
An index that returns only elements on a given dimension up to a specific coordinate.For example, given a vector with
nelements on thexaxis, andn > k,to(k)returns x0, x1, ..., xk- Parameters:
end- coordinate of the last element of the sequence (exclusive)- Returns:
- index
-
sliceTo
An index that returns only elements on a given dimension up to a specific coordinate, using the given stride.For example, given a vector with
nelements on thexaxis, andn > k,to(k)returns x0, x1, ..., xk- Parameters:
end- coordinate of the last element of the sequence (exclusive)stride- the stride to use- Returns:
- index
- See Also:
-
range
An index that returns only elements on a given dimension between two coordinates.For example, given a vector with
nelements on thexaxis, andn > k > j,range(j, k)returns xj, xj+1, ..., xk- Parameters:
start- coordinate of the first element of the sequenceend- coordinate of the last element of the sequence (exclusive)- Returns:
- index
-
flip
An index that returns only elements on a given dimension between two coordinates.For example, given a vector with
nelements on thexaxis, andn > k > j,range(j, k)returns xj, xj+1, ..., xk- Returns:
- index
-
hyperslab
An index that returns elements according to an hyperslab defined bystart,stride,count,block. SeeHyperslab.- Parameters:
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.- Returns:
- index
-
newAxis
An index that inserts a new dimension of size 1 into the resulting array.- Returns:
- index
-
ellipsis
An index that expands to fill all available source dimensions. Works the same as Python's....- Returns:
- index
-
slice
An index that returns elements betweenstartandend. Ifstartorendisnull, starts or ends at the beginning or the end, respectively.Analogous to Python's
:slice syntax.- Returns:
- index
-
slice
An index that returns everystride-th element betweenstartandend. Ifstartorendisnull, starts or ends at the beginning or the end, respectively.Analogous to Python's
:slice syntax.- Returns:
- index
-
slice
-
slice
-