# [PYTHON MATRIX-SIG] Re: Are we talking about one thing or two?

Chris Chase S1A chris.chase@jhuapl.edu
Wed, 13 Sep 1995 18:34:08 -0400

```Hinsen> Why specialise? That only limits the flexibility of the whole
Hinsen> package. Why shouldn't it be possible to have "inverse" invert
Hinsen> each two-dimensional slice of a three-dimensional array? There
Hinsen> are applications for it, it doesn't cost any extra effort to
Hinsen> do it, so why not do it? Why invent artificial restrictions?

I did not mean that this could not be done.  Inverse() in this context
is an operation on square matrices (R^NxN).  It is not a concept that
I have experience generalizing to higher dimensions.  Your example
maps the inverse() function onto the two-dimensional slices.  I think
of this as a mapping operator that is applied to an indexed set of
projections followed by application of inverse().

In general, you could apply any matrix function in this manner.  You
could do this for spectral factorization, diagonalization, etc.  There
you use a projection mapping/iterator (rank selector or whatever you
want to call it) to apply the matrix function to each two-dimensional
slice.  This would seem the natural way to implement it.  Many matrix
functions such as inverse() would be best implemented by a call to an
already existing and efficient C or FORTRAN library function.

Perhaps it would be more elegant (and like APL) if the rank selection
was a part of the inverse() parameter list but it can just as easily
be a part of a projection mapping function that does the rank
selection and then applies inverse(), i.e., a variation of the builtin
map():

map(function, array, rank selection parameters)

This avoids having to recode the same mechanism for each matrix
function.  It also provides a method for applying already coded lower
dimensional operators (1D, 2D, 3D, whatever) to higher dimensional
arrays without having to recode.

reduction operations are generalizations that can be implemented in
Python with calls to the appropriate external matrix-based function
(or whatever the lower dimensional function is).

Chris Chase

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

send messages to: matrix-sig@python.org