Here you can find the source of sum(double[][] error)
public static double sum(double[][] error)
//package com.java2s; //License from project: Open Source License public class Main { public static double sum(double[][] error) { int m = error.length; int n = error[0].length; double sum = 0.0; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { sum += error[i][j];//from w ww. j av a 2 s . com } } return sum; } public static double[][] sum(double[][][][] errors, int j) { int m = errors[0][j].length; int n = errors[0][j][0].length; double[][] result = new double[m][n]; for (int mi = 0; mi < m; mi++) { for (int nj = 0; nj < n; nj++) { double sum = 0; for (int i = 0; i < errors.length; i++) sum += errors[i][j][mi][nj]; result[mi][nj] = sum; } } return result; } }