@Test
public void testFunctionalView() {

  Matrix m = Matrices.functionalMatrixView(5, 6, new IntIntFunction() {
    @Override
    public double apply(int row, int col) {
      assertTrue(row < 5);
      assertTrue(col < 6);
      return row + col;
    }
  });
  // row-wise sums are 15, 15+ 6, 15 +12, 15+18, 15+24
  // so total sum is 1/2*(15+15+24)*5 =27*5 = 135
  assertEquals(135, m.aggregate(Functions.PLUS, Functions.IDENTITY), 1e-10);
}