[Numpy-discussion] documentation error

Alan G Isaac aisaac at american.edu
Sun Oct 10 15:57:18 CDT 2004

In the Numeric manual, there are  two different defintions of the
'diagonal' function.  The second definition appears to be incorrect.

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.

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.

Alan Isaac

More information about the Numpy-discussion mailing list