package jalview.math;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.util.Arrays;
@Test(groups = "Functional")
public void testPreMultiply()
{
- MatrixI m1 = new Matrix(new double[][] { { 2, 3, 4 } }); // 1x3
- MatrixI m2 = new Matrix(new double[][] { { 5 }, { 6 }, { 7 } }); // 3x1
+ Matrix m1 = new Matrix(new double[][] { { 2, 3, 4 } }); // 1x3
+ Matrix m2 = new Matrix(new double[][] { { 5 }, { 6 }, { 7 } }); // 3x1
/*
* 1x3 times 3x1 is 1x1
assertEquals(m3.getRow(0)[1], 25d);
}
+ @Test(groups = "Functional")
+ public void testCopy()
+ {
+ Random r = new Random();
+ int rows = 5;
+ int cols = 11;
+ double[][] in = new double[rows][cols];
+
+ for (int i = 0; i < rows; i++)
+ {
+ for (int j = 0; j < cols; j++)
+ {
+ in[i][j] = r.nextDouble();
+ }
+ }
+ Matrix m1 = new Matrix(in);
+ Matrix m2 = (Matrix) m1.copy();
+ assertTrue(matrixEquals(m1, m2));
+ }
+
/**
* main method extracted from Matrix
*