How do I sum the identical rows in a k-dimensional array? e.g If I have an array X[k,i,j]where X={}, 1<=k<=K, 1<=i,j<=N I want to sum
X[k,i,j]
X={}, 1<=k<=K, 1<=i,j<=N