public void testAssignVector() throws Exception { Vector other = new DenseVector(test.size()); test.assign(other); for (int i = 0; i < values.length; i++) { assertEquals("value[" + i + ']', 0.0, test.getQuick(i)); } }
public void testAssignDoubleArray() throws Exception { double[] array = new double[test.size()]; test.assign(array); for (int i = 0; i < values.length; i++) { assertEquals("value[" + i + ']', 0.0, test.getQuick(i)); } }
public void testAssignVectorCardinality() { Vector other = new DenseVector(test.size() - 1); try { test.assign(other); fail("cardinality exception expected"); } catch (CardinalityException e) { } }
public void testAssignDoubleArrayCardinality() { double[] array = new double[test.size() + 1]; try { test.assign(array); fail("cardinality exception expected"); } catch (CardinalityException e) { } }
public void testAssignBinaryFunction3() throws Exception { test.assign(mult(4)); for (int i = 0; i < values.length; i++) { if (i % 2 == 0) { assertEquals("get [" + i + ']', 0.0, test.get(i)); } else { assertEquals("value[" + i + ']', values[i - 1] * 4, test.getQuick(i)); } } }
public void testAssignUnaryFunction() { test.assign(NEGATE); for (int i = 1; i < values.length; i += 2) { assertEquals("value[" + i + ']', -values[i], test.getQuick(i + 2)); } }
public void testAssignDouble() { test.assign(0); for (int i = 0; i < values.length; i++) { assertEquals("value[" + i + ']', 0.0, test.getQuick(i)); } }