class MatMul { public static void main (String [] argv) { for (int n = 8; n <= 128; n*=2) { double [][] a = new double [n][]; double [][] b = new double [n][]; double [][] c = new double [n][]; for (int i = 0; i < n; i++) { a[i] = new double [n]; b[i] = new double [n]; c[i] = new double [n]; } long ms = System.currentTimeMillis(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { c[i][j] += a[i][k] * b[k][j]; } } } ms = System.currentTimeMillis() - ms; // System.out.println("N = " + n + ", Mflops = " + // ((double) 2*n*n*n)/((double) ms*1000)); System.out.println("ok"); } } }