[MATRIX-SIG] Making pseudo-ufuncs?

Konrad Hinsen hinsen@ibs.ibs.fr
Fri, 12 Sep 1997 12:08:52 +0200


> First, is there a better way to do this?

Nothing I can think of.

> Second, is the method I use to detect the types of the arrays a good idea? 
> It would seem to fall apart for special Matrix and Vector classes.

You could try to check for general sequence objects, and then your
functions would even work in lists. But the tricky part is getting
a return value in the same object type. I am not sure this is worth
the effort.

> Third, is there a good way to implement outer, accumulate, and reduce for
> binary functions?

I'd define another class for binary functions and assign the
reduce/accumulate/outer version to an appropriate attribute. Then
you could use the same syntax as with ufuncs.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

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