[PYTHON MATRIX-SIG] First experiences

Hinsen Konrad hinsenk@ere.umontreal.ca
Tue, 30 Jan 1996 15:43:22 -0500


   Actually, reshape is now an array method, and the old reshape function
   is only around for "historical reasons".  I should probably remove it.

One or the other. I am not sure that "everything as a method" is the
right strategy. For example, operations that have two symmetric
operands look a bit odd as methods. There's also a difference in
behaviour, since array functions accept nested lists instead of
arrays, but methods can be called only on previously existing array
objects. In the case of the "copying reshape", the array argument
would often be a constant and it would make perfect sense to allow
nested lists there.

A useful way to make use of the function/method distinction would be
to use methods for operations that modify an array and functions for
operations that don't. The modified array would then be the one on
which the method is called, and it makes sense to require that this
actually is an array. There are not too many in-place operations right
now, but there will be once topics like linear algebra are dealt
with. For example, it would be nice to have
  m.invert()
for an in-place inversion and
  inverse(m)
for a function that returns the inverse without changing m.

   This can easily be added to the standard set of functions and
   implemented on top of the existing transpose and concat methods.  You
   might want to do this as an exercise ;).  

No problem, but that would certainly be slow!

   I was actually asking for a new name for the method that will do a
   reshape allowing you to make copies of the array in the process.  I'm

I see. Now that's difficult. I have been calling this operation
"reshape" since my high school days, so it is not easy to come
up with something else! Give me some time...

-------------------------------------------------------------------------------
Konrad Hinsen                     | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie             | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal            | Fax:  +1-514-343-7586
C.P. 6128, succ. Centre-Ville     | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7             | Francais (phase experimentale)
-------------------------------------------------------------------------------

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

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