Record Class SparseTensorData<T>
java.lang.Object
java.lang.Record
org.flag4j.arrays.SparseTensorData<T>
- Type Parameters:
T
- Type of the data of the tensor.- Record Components:
shape
- Shape of the tensor.data
- Non-zero data of the sparse tensor.indices
- Non-zero indices of the sparse tensor.
Data class for storing information for a sparse COO tensor.
This record stores two arrays: the non-zero data, the non-zero indices.
-
Constructor Summary
ConstructorsConstructorDescriptionSparseTensorData
(Shape shape, List<T> data, List<int[]> indices) Creates an instance of aSparseTensorData
record class. -
Method Summary
Modifier and TypeMethodDescriptiondata()
Returns the value of thedata
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.List
<int[]> indices()
Returns the value of theindices
record component.int[][]
Converts the indices of this sparse tensor data to a 2D primitive integer array.shape()
Returns the value of theshape
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
SparseTensorData
-
-
Method Details
-
indicesToArray
public int[][] indicesToArray()Converts the indices of this sparse tensor data to a 2D primitive integer array.- Returns:
- A 2D primitive integer array containing the indices of this sparse tensor data.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
shape
-
data
-
indices
-