I'm new to dealing with SparseVector
. I want to subtract two SparseVectors
and return result as SparseVector
too.
What is the difference between Vector
and SparseVector
?
I tried to start with define function that take two SparseVector
but didn't get antything that helped me!
import java.awt.Point;
import java.util.HashMap;
import cern.colt.list.DoubleArrayList;
import cern.colt.matrix.impl.SparseDoubleMatrix1D;
public class SparseVector extends SparseDoubleMatrix1D {
public SparseVector(int size) {
super(size);
}
public SparseVector(double[] values) {
super(values);
}
public SparseVector subtract(SparseVector v1, SparseVector v2) {
// TODO: How to implement it?
}
}