Class HeapMerger
java.lang.Object
org.tribuo.math.util.HeapMerger
- All Implemented Interfaces:
 Serializable,Merger,ProtoSerializable<org.tribuo.math.protos.MergerProto>
Merges each 
SparseVector separately using a PriorityQueue as a heap.
 
 Relies upon VectorIterator.compareTo(VectorIterator).
- See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic HeapMergerdeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.booleaninthashCode()static SparseVectormerge(List<SparseVector> vectors, int dimension, int[] indicesBuffer, double[] valuesBuffer) Merges a list of sparse vectors into a single sparse vector, summing the values.merge(DenseSparseMatrix[] inputs) Merges an array of DenseSparseMatrix into a single DenseSparseMatrix.merge(SparseVector[] inputs) Merges an array of SparseVector into a single SparseVector.org.tribuo.math.protos.MergerProtoSerializes this object to a protobuf. 
- 
Field Details
- 
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
 
 
 - 
 - 
Constructor Details
- 
HeapMerger
public HeapMerger()Constructs a HeapMerger. 
 - 
 - 
Method Details
- 
deserializeFromProto
public static HeapMerger deserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.- Parameters:
 version- The serialized object version.className- The class name.message- The serialized data.- Returns:
 - The deserialized object.
 
 - 
serialize
public org.tribuo.math.protos.MergerProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Specified by:
 serializein interfaceProtoSerializable<org.tribuo.math.protos.MergerProto>- Returns:
 - The protobuf.
 
 - 
merge
Description copied from interface:MergerMerges an array of DenseSparseMatrix into a single DenseSparseMatrix. - 
merge
Description copied from interface:MergerMerges an array of SparseVector into a single SparseVector. - 
merge
public static SparseVector merge(List<SparseVector> vectors, int dimension, int[] indicesBuffer, double[] valuesBuffer) Merges a list of sparse vectors into a single sparse vector, summing the values.- Parameters:
 vectors- The vectors to merge.dimension- The dimension of the sparse vector.indicesBuffer- A buffer for the indices.valuesBuffer- A buffer for the values.- Returns:
 - The merged SparseVector.
 
 - 
equals
 - 
hashCode
 
 -