In a 2-dimensional matrix, summing up all values in a given column yields the column's column sum.
Having a 2-dimensional matrix with r
rows and c
columns, the formula for the column sum of column c_x
is colSum(c_x) = matrix[0, c_x] + matrix[1, col_x] + ... + matrix[r-1, c_x]
.