[PYTHON MATRIX-SIG] Changes to diagonal and trace functions
Jim Hugunin
hugunin@mit.edu
Mon, 3 Mar 1997 13:53:05 -0500
> I also still think that the generalized version of diagonal() and trace()
> that I posted a while ago would be more suitable than the current
> version that works only on rank-2 arrays. Here's my version again:
> <Real code removed>
I've always felt that these functions should be generalized to higher
dimensions, but just never got around to it. I am making the following
changes to Konrad's implementation, best summarized by the new function
prototypes.
def diagonal(a, offset=0, axis1=-2, axis2=-1):
def trace(a, offset=0, axis1=-2, axis2=-1):
This version has the advantage of being compatible with the current version
of diagonal and trace, and also of behaving as I would normally expect for
arrays of greater than two dimensions.
-Jim
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________