Package org.bytedeco.javacpp.indexer
Class StrideIndex
- java.lang.Object
-
- org.bytedeco.javacpp.indexer.Index
-
- org.bytedeco.javacpp.indexer.StrideIndex
-
- Direct Known Subclasses:
HyperslabIndex
public class StrideIndex extends Index
An Index that computes a linear index from given array sizes and strides.
-
-
Constructor Summary
Constructors Constructor Description StrideIndex(long... sizes)CallsStrideIndex(sizes, defaultStrides(sizes)).StrideIndex(long[] sizes, long[] strides)Constructor to set theIndex.sizesandstrides.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long[]defaultStrides(long... sizes)Returns default (row-major contiguous) strides for the given sizes.longindex(long i)Returnsi * strides[0].longindex(long... indices)Computes the linear index as the dot product of indices and strides.longindex(long i, long j)Returnsi * strides[0] + j * strides[1].longindex(long i, long j, long k)Returnsi * strides[0] + j * strides[1] + k * strides[2].long[]strides()Returnsstrides.
-
-
-
Constructor Detail
-
StrideIndex
public StrideIndex(long... sizes)
CallsStrideIndex(sizes, defaultStrides(sizes)).
-
StrideIndex
public StrideIndex(long[] sizes, long[] strides)Constructor to set theIndex.sizesandstrides.
-
-
Method Detail
-
defaultStrides
public static long[] defaultStrides(long... sizes)
Returns default (row-major contiguous) strides for the given sizes.
-
strides
public long[] strides()
Returnsstrides.
-
index
public long index(long i, long j)Returnsi * strides[0] + j * strides[1].
-
index
public long index(long i, long j, long k)Returnsi * strides[0] + j * strides[1] + k * strides[2].
-
-