In the Numeric manual, there are two different defintions of the
'diagonal' function. The second definition appears to be incorrect.
p.39:
diagonal(a, k=0, axis1=0, axis2 = 1)
returns the entries along the k th diagonal of a (k is an
offset from the main diagonal). This is designed for 2d
arrays. For larger arrays, it will return the diagonal of
each 2d sub-array.
p.44
diagonal(a, offset=0, axis1=0, axis2=1)
The diagonal function takes an array a, and returns an array
of rank 1 containing all of the elements of a such that the
difference between their indices along the specified axes is
equal to the specified offset. With the default values, this
corresponds to all of the elements of the diagonal of a
along the last two axes.
fwiw,
Alan Isaac