public void testExtendedDotProduct () { SparseVector v1 = new SparseVector (null, dbl3); SparseVector vInf = new SparseVector (null, dbl4); double dp = v1.dotProduct (vInf); assertTrue (!Double.isNaN(dp)); dp = vInf.dotProduct (v1); assertTrue (!Double.isNaN(dp)); }
public void testExtendedDotProduct () { SparseVector v1 = new SparseVector (null, dbl3); SparseVector vInf = new SparseVector (null, dbl4); double dp = v1.dotProduct (vInf); assertTrue (!Double.isNaN(dp)); dp = vInf.dotProduct (v1); assertTrue (!Double.isNaN(dp)); }
public void testCloneMatrixZeroed () { SparseVector s = (SparseVector) s1.cloneMatrixZeroed (); for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == 0.0); assertTrue (s.indexAtLocation (i) == idxs [i]); } }
public void testCloneMatrixZeroed () { SparseVector s = (SparseVector) s1.cloneMatrixZeroed (); for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == 0.0); assertTrue (s.indexAtLocation (i) == idxs [i]); } }
public void testIncrementValue () { SparseVector s = (SparseVector) s1.cloneMatrix (); s.incrementValue (5, 0.75); double[] ans = new double[] {1, 2.75, 3, 4, 5}; for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == ans[i]); } }
public void testSetValue () { SparseVector s = (SparseVector) s1.cloneMatrix (); s.setValue (5, 0.3); double[] ans = new double[] {1, 0.3, 3, 4, 5}; for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == ans[i]); } }
public void testIncrementValue () { SparseVector s = (SparseVector) s1.cloneMatrix (); s.incrementValue (5, 0.75); double[] ans = new double[] {1, 2.75, 3, 4, 5}; for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == ans[i]); } }
public void testSetValue () { SparseVector s = (SparseVector) s1.cloneMatrix (); s.setValue (5, 0.3); double[] ans = new double[] {1, 0.3, 3, 4, 5}; for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == ans[i]); } }