I can sum all the elements along a specific axis, using numpy.sum, that is
>>> a = numpy.array([[1,2], [3,4]])
>>> numpy.sum(a, 1)
array([3, 7])
That is sum along row, which add elements of each column one by one.
If there are only 2 or 3 axes, I could implement it using if...elif or swith...case in C/C++, but what if there are 100 axes? How to implement it?