Class Int2DoubleMapVector

java.lang.Object
it.unimi.dsi.law.vector.Vector
it.unimi.dsi.law.vector.Int2DoubleMapVector
All Implemented Interfaces:
Serializable

public class Int2DoubleMapVector
extends Vector
A mutable implementation of Vector for sparse vectors. It is possible to create sparse vector by iteratively adding values. This implementation uses the supertype method for every operation. It should be converted with toImmutableSparseVector() before being actually used.
See Also:
Serialized Form
  • Method Details

    • getInstance

      public static Int2DoubleMapVector getInstance​(int size, int id)
      Returns an instance of given size with zero values.
      Parameters:
      size - the size.
      id - the id of description of this vector.
      Returns:
      a vector
    • getInstance

      public static Int2DoubleMapVector getInstance​(int size, Int2DoubleMap value, int id)
      Returns an instance from the given Int2DoubleMap.
      Parameters:
      size - the size.
      value - a map of values.
      id - the id of description of this vector.
      Returns:
      a vector.
    • set

      public void set​(int idx, double val)
      Description copied from class: Vector
      Sets the value val at index idx.
      Specified by:
      set in class Vector
      Parameters:
      idx - the index.
      val - the value.
    • get

      public double get​(int idx)
      Description copied from class: Vector
      Gets the value at index idx.
      Specified by:
      get in class Vector
      Parameters:
      idx - the index.
      Returns:
      the value at index idx.
    • toImmutableSparseVector

      public ImmutableSparseVector toImmutableSparseVector()