public void testProgrammatic() throws Exception {
//<start id="vec.examples.programmatic"/>
double[] vals = new double[]{0.3, 1.8, 200.228};
Vector dense = new DenseVector(vals);//<co id="vec.exam.dense"/>
assertTrue(dense.size() == 3);
Vector sparseSame = new SequentialAccessSparseVector(3);//<co id="vec.exam.sparse.same"/>
Vector sparse = new SequentialAccessSparseVector(3000);//<co id="vec.exam.sparse"/>
for (int i = 0; i < vals.length; i++) {//<co id="vec.exam.assign.sparse"/>
sparseSame.set(i, vals[i]);
sparse.set(i, vals[i]);
}
assertFalse(dense.equals(sparse));//<co id="vec.exam.notequals.d.s"/>
assertEquals(dense, sparseSame);//<co id="vec.exam.equals.d.s"/>
assertFalse(sparse.equals(sparseSame));
/*
<calloutlist>
<callout arearefs="vec.exam.dense"><para>Create a <classname>DenseVector</classname> with a label of "my-dense" and 3 values. The cardinality of this vector is 3 </para></callout>
<callout arearefs="vec.exam.sparse.same"><para>Create a <classname>SparseVector</classname> with a label of my-sparse-same that has cardinality of 3</para></callout>