SparseVector class

Represents a sparse vector that stores only non-zero elements.

Available extensions

Constructors

SparseVector(List<double> value)
Creates a SparseVector from a list of doubles with all values.
factory
SparseVector.fromBinary(Uint8List bytes)
Creates a SparseVector from its binary representation.
factory
SparseVector.fromMap(Map<int, double> map, int dimensions)
Creates a SparseVector from a map of indices to values.
factory

Properties

dimensions int
The total number of dimensions in the vector.
final
hashCode int
The hash code for this object.
no setteroverride
indices List<int>
The indices of non-zero values in the vector.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values List<double>
The non-zero values in the vector.
final

Methods

clone() SparseVector

Available on SparseVector, provided by the CloneSparseVector extension

Creates a deep copy of the SparseVector, mutations to the original will not affect the copy.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBinary() Uint8List
Converts the sparse vector to its binary representation.
toJson() String

Available on SparseVector, provided by the SparseVectorJsonExtension extension

Returns a serialized version of the SparseVector as a String.
toList() List<double>
Returns the sparse vector as a dense list of double values.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

fromString(String value) SparseVector
Creates a SparseVector from a string representation.