Class StrideIndex
java.lang.Object
org.bytedeco.javacpp.indexer.Index
org.bytedeco.javacpp.indexer.StrideIndex
- Direct Known Subclasses:
HyperslabIndex
An Index that computes a linear index from given array sizes and strides.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final long[]The number of elements to skip to reach the next element in a given dimension. -
Constructor Summary
ConstructorsConstructorDescriptionStrideIndex(long... sizes) CallsStrideIndex(sizes, defaultStrides(sizes)).StrideIndex(long[] sizes, long[] strides) Constructor to set theIndex.sizesandstrides. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Field Details
-
strides
protected final long[] stridesThe number of elements to skip to reach the next element in a given dimension.strides[i] > strides[i + 1] && strides[strides.length - 1] == 1preferred.
-
-
Constructor Details
-
StrideIndex
public StrideIndex(long... sizes) CallsStrideIndex(sizes, defaultStrides(sizes)). -
StrideIndex
public StrideIndex(long[] sizes, long[] strides) Constructor to set theIndex.sizesandstrides.
-
-
Method Details
-
defaultStrides
public static long[] defaultStrides(long... sizes) Returns default (row-major contiguous) strides for the given sizes. -
strides
public long[] strides()Returnsstrides. -
index
-
index
-
index
-
index
-