[PYTHON MATRIX-SIG] max_element array method

Carlos Maltzahn carlosm@anchor.cs.colorado.edu
Sat, 30 Mar 1996 19:30:11 -0700 (MST)


I don't know whether this has been discussed before because I have yet
to find the matrix-sig archive. I'm currently implementing some clustering 
algorithms and came across two features that would be very helpful to
me:

1. A space-efficient implementation of a symmetric matrix object, and

2. a max_elem() and min_elem() method that would return the tuple
   (max_elem, index). For example:

   > from Numeric import *
   > m == zeros(3, 3, 2)
   > m[2, 0, 1] = 12.04
   > m.max_elem()
   > (12.04, (2, 0, 1))
   > m.min_elem()
   > (0.0, (2, 2, 1))
   > m[2, 0].max_elem()
   > (12.04, (1,))

Currently, I'm using a Python class that does just that. But a C-level 
implementation would be probably faster and more space-efficient.

Comments?

Carlos

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================