March 2003
Intermediate to advanced
656 pages
39h 30m
English
reduce
u.reduce(a,axis=0)Returns an array r with the same type code
as a and rank one less than
a’s rank. Each element of
r is the reduction of the elements of
a, along the given
axis, with the function or operator
underlying u. The functionality of
u
.reduce is therefore
close to that of Python’s built-in
reduce function, covered in Chapter 8. For example, since
0+1+2+...+9 is 45,
add.reduce(range(10)) is 45.
This is just like, when using built-in reduce and
import
operator,
reduce(operator.add,range(10)) is also
45.