Interface SparseVector
- All Superinterfaces:
Vector
- All Known Implementing Classes:
SparseByteVector, SparseDoubleVector, SparseFloatVector
public sealed interface SparseVector
extends Vector
permits SparseDoubleVector, SparseFloatVector, SparseByteVector
Common contract for sparse vector representations.
- Since:
- 5.0.0
-
Field Summary
-
Method Summary
Methods inherited from interface Vector
getType, toByteArray, toDoubleArray, toFloatArray, toSparseByteVector, toSparseDoubleVector, toSparseFloatVector
-
Method Details
-
length
int length()- Returns:
- dense vector length (number of dimensions)
-
indices
int[] indices()- Returns:
- sorted non-zero indices
-
size
default int size()- Returns:
- number of stored non-zero entries
-
validate
static void validate(int length, int[] indices, int valuesLength) Validates sparse vector shape constraints.- Parameters:
length- dense vector lengthindices- sorted non-zero indicesvaluesLength- non-zero values length
-