}
@Test
public void testVectorAdd() {
// The default value should be 0
DoubleDenseVector vec1 = new DoubleDenseVector(10);
assertEquals(0.0, vec1.get(0), E);
// Basic get/set
vec1.set(0, 0.1);
vec1.set(6, 1.4);
assertEquals(0.1, vec1.get(0), E);
assertEquals(0.0, vec1.get(4), E);
assertEquals(1.4, vec1.get(6), E);
assertEquals(0.0, vec1.get(15), E);
// Add another vector
DoubleDenseVector vec2 = new DoubleDenseVector(20);
vec2.set(0, 0.5);
vec2.set(5, 1.7);
vec1.add(vec2);
assertEquals(0.6, vec1.get(0), E);
assertEquals(1.7, vec1.get(5), E);
assertEquals(1.4, vec1.get(6), E);