Java Matrix Sum sumCols(boolean[][] inputMatrix)

Here you can find the source of sumCols(boolean[][] inputMatrix)

Description

sum Cols

License

Open Source License

Declaration

static public int[] sumCols(boolean[][] inputMatrix) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static public int[] sumCols(boolean[][] inputMatrix) {
        int g = inputMatrix.length;
        int m = inputMatrix[0].length;
        int[] sumMatrix = new int[m];

        int i;/*from   ww w . jav  a 2  s  . com*/
        for (int j = 0; j < m; j++) {
            sumMatrix[j] = 0;
            for (i = 0; i < g; i++) {
                if (inputMatrix[i][j])
                    sumMatrix[j]++;
            }
        }
        return sumMatrix;
    }
}

Related

  1. sum(int M[][])
  2. sum(int[][][] X, int[] coords)
  3. sumArrayDim(double[][] array, int dimToSummarize)
  4. sumArrays(double a[][], double b[][], String sign)
  5. sumAxis1(double[][] X)
  6. sumDimension(double[][] matrix, int dim)
  7. SumIntegrateHistogram_25(float[][][] histo_array)
  8. sumLines(double a[][])
  9. sumMetrix(double[][] total, double[][] element)