コード例 #1
0
 public void testTimesVectorCardinality() {
   try {
     test.times(new DenseVector(test.size() + 1));
     fail("expected exception");
   } catch (CardinalityException e) {
   }
 }
コード例 #2
0
 public void testTimesVector() throws Exception {
   Vector val = test.times(test);
   assertEquals("size", test.size(), val.size());
   for (int i = 0; i < test.size(); i++) {
     if (i % 2 == 0) {
       assertEquals("get [" + i + ']', 0.0, val.get(i));
     } else {
       assertEquals("get [" + i + ']', values[i / 2] * values[i / 2], val.get(i));
     }
   }
 }