I am trying to use the sparse vector class in the JScience package but I am confused as to how. I want to make several sparse vectors of dimension, say, 1000. But, I see that there is no constructor and also suppose that I want to put certain values in a sparse vector at certain indexes, how is this supposed to be achieved?
From the documentation:
Sparse vectors can be created using an index-to-element mapping or by adding single elements sparse vectors together.
This corresponds to the first two static valueOf
methods.
valueOf(int dimension, F zero, int i, F element)
Returns a sparse vector having a single element at the specified index.
valueOf(int dimension, F zero, java.util.Map<javolution.util.Index,F> elements)
Returns a sparse vector from the specified index to element mapping.