To be perfectly clear about the actual behavior: if A is of size (m,n,p), then sum(A, (1,3)) has size (1,n,1). So it's summing over dimensions 1 and 3.
--Tim On Wednesday, August 27, 2014 03:02:09 PM Andrew Dabrowski wrote: > OK, thanks. I find the phrase "over the given dimensions" ambiguous - > isn't it actually summing over the dimensions _not_ given? > > On Wednesday, August 27, 2014 5:46:33 PM UTC-4, John Myles White wrote: > > sum(A, 1) works, as does sum(A, (1, )). > > > > More generally, sum(A, dims::Integer...) works, as does as sum(A, > > (dims::Integer...), ). > > > > -- John > > > > On Aug 27, 2014, at 2:44 PM, Andrew Dabrowski <[email protected] > > <javascript:>> wrote: > > > > In the doc for the Standard library I see: > > > > sum(*A*, *dims*) > > > > Sum elements of an array over the given dimensions. > > > > In exactly what form should "dims" be given?
