public void testCloneMatrixZeroed () { IndexedSparseVector s = (IndexedSparseVector) 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 () { IndexedSparseVector s = (IndexedSparseVector) s1.cloneMatrixZeroed (); for (int i = 0; i < s.numLocations(); i++) { assertTrue (s.valueAtLocation (i) == 0.0); assertTrue (s.indexAtLocation (i) == idxs [i]); } }
public void testSerializable () throws IOException, ClassNotFoundException { IndexedSparseVector s = (IndexedSparseVector) s1.cloneMatrix (); IndexedSparseVector sPrime = (IndexedSparseVector) TestSerializable.cloneViaSerialization (s); assertEquals (s.numLocations (), sPrime.numLocations ()); assertTrue (Arrays.equals (s.getIndices (), sPrime.getIndices ())); assertTrue (Arrays.equals (s.getValues (), sPrime.getValues ())); }
public void testSerializable () throws IOException, ClassNotFoundException { IndexedSparseVector s = (IndexedSparseVector) s1.cloneMatrix (); IndexedSparseVector sPrime = (IndexedSparseVector) TestSerializable.cloneViaSerialization (s); assertEquals (s.numLocations (), sPrime.numLocations ()); assertTrue (Arrays.equals (s.getIndices (), sPrime.getIndices ())); assertTrue (Arrays.equals (s.getValues (), sPrime.getValues ())); }
public void testSetValue () { IndexedSparseVector s = (IndexedSparseVector) 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 () { IndexedSparseVector s = (IndexedSparseVector) 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 () { IndexedSparseVector s = (IndexedSparseVector) 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 () { IndexedSparseVector s = (IndexedSparseVector) 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]); } }