Hi, One strange thing, SequentialAccessSparseVector.dot() seems does NOT work correctly. When I change the Vector w = new RandomAccessSparseVector(Integer.MAX_VALUE, 12); Then the code works well.
I check the source code of SequentialAccessSparseVector.dot(), it checks the index of two Vectors(if both of them are instance of SequentialAccessSparseVector), once they mis-match, it will return 0.0. *Why do we need such constrain? * In this case, what's the best way to get dot product between two mis-matched SequentialAccessSparseVector instances? Code: Vector w = new SequentialAccessSparseVector(Integer.MAX_VALUE, 12); w.set(1, 0.4); w.set(2, 0.4); w.set(3, -0.666666667); Vector v = new SequentialAccessSparseVector(Integer.MAX_VALUE, 12); v.set(3, 1); System.out.println(datastore.getFeatureRow(2).dot(w)); The result is 0.0 (should be -0.666666667). -- ------------------------------------------------------------- Zhen-Dong Zhao (Maxim) <><<><><><><><><><>><><><><><>>>>>> Department of Computer Science School of Computing National University of Singapore >>>>>>><><><><><><><><<><>><><<<<<<
