static double[][] mean(double[][] a,int type){
        double[][] result;
        int row=a.length;
        int col=a[0].length;
        if(type==1){
            result = new double[1][col];
            for(int i =0 ; i<col; i++){
                for(int j =0; j<row; j++){
                    result[0][i] += a[j][i];
                }
                result[0][i] /= row;
            }
            return result;
        }else if(type==2){
            result = new double[row][1];
            for(int i=0; i<row; i++){
                for(int j=0;j<col;j++){
                    result[i][0] += a[i][j];
                }
                result[i][0]/=col;
            }
            return result;
        }
        return null;
    }