public void testGetDistanceSquared() {
   Vector other = new RandomAccessSparseVector(test.size());
   other.set(1, -2);
   other.set(2, -5);
   other.set(3, -9);
   other.set(4, 1);
   double expected = test.minus(other).getLengthSquared();
   assertTrue(
       "a.getDistanceSquared(b) != a.minus(b).getLengthSquared",
       Math.abs(expected - test.getDistanceSquared(other)) < 10.0E-7);
 }
 public void testNormalize() throws Exception {
   Vector val = test.normalize();
   double mag = Math.sqrt(1.1 * 1.1 + 2.2 * 2.2 + 3.3 * 3.3);
   for (int i = 0; i < test.size(); i++) {
     if (i % 2 == 0) {
       assertEquals("get [" + i + ']', 0.0, val.get(i));
     } else {
       assertEquals("dot", values[i / 2] / mag, val.get(i));
     }
   }
 }