コード例 #1
0
 public void testIteratorSet() throws CloneNotSupportedException {
   Vector clone = test.clone();
   Iterator<Vector.Element> it = clone.iterateNonZero();
   while (it.hasNext()) {
     Vector.Element e = it.next();
     e.set(e.get() * 2.0);
   }
   it = clone.iterateNonZero();
   while (it.hasNext()) {
     Vector.Element e = it.next();
     assertEquals(test.get(e.index()) * 2.0, e.get());
   }
   clone = test.clone();
   it = clone.iterator();
   while (it.hasNext()) {
     Vector.Element e = it.next();
     e.set(e.get() * 2.0);
   }
   it = clone.iterator();
   while (it.hasNext()) {
     Vector.Element e = it.next();
     assertEquals(test.get(e.index()) * 2.0, e.get());
   }
 }
コード例 #2
0
 public void testDot2() throws CloneNotSupportedException {
   Vector test2 = test.clone();
   test2.set(1, 0.0);
   test2.set(3, 0.0);
   assertEquals(3.3 * 3.3, test2.dot(test), EPSILON);
 }
コード例 #3
0
 public void testCopy() throws Exception {
   Vector copy = test.clone();
   for (int i = 0; i < test.size(); i++) {
     assertEquals("copy [" + i + ']', test.get(i), copy.get(i));
   }
 }