double[][] data = new double[][] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
double[][] res1 = new double[][] { { 5, 7, 9 }, { 4, 5, 6 }, { 7, 8, 9 } };
double[][] res2 =
new double[][] { { 5, 7, 9 }, { 18, 21, 24 }, { 7, 8, 9 } };
Matrix m = new Matrix(data);
m.addRows(0, 1);
for (int c = 0; c < m.getColumns(); c++) {
for (int r = 0; r < m.getRows(); r++) {
assertEquals(res1[r][c], m.getElement(r, c));
}
}
m.addRows(1, 2, 2);
for (int c = 0; c < m.getColumns(); c++) {
for (int r = 0; r < m.getRows(); r++) {
assertEquals(res2[r][c], m.getElement(r, c));
}
}
}