public void testCrossProduct() { Matrix result = test.cross(test); assertEquals("row size", test.size(), result.size()[0]); assertEquals("col size", test.size(), result.size()[1]); for (int row = 0; row < result.size()[0]; row++) { for (int col = 0; col < result.size()[1]; col++) { assertEquals( "cross[" + row + "][" + col + ']', test.getQuick(row) * test.getQuick(col), result.getQuick(row, col)); } } }
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 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)); } }