# [PYTHON MATRIX-SIG] Empty matrix implementation references

Carlos Fonseca fonseca@gaivota.demon.co.uk
Mon, 12 Aug 1996 20:47:55 +0100 (BST)

```I mentioned these in a previous message, so here they are:

The relevant Octave documentation page is on the www:

http://www.che.wisc.edu/cgi-bin/info2www?(octave)Empty%20Matrices

The papers cited are

Carl de Boor, `An Empty Exercise', SIGNUM, Volume 25, pages 2-6, 1990

Realization of the Empty Matrix Concept', IEEE Transactions on
Automatic Control, Volume 38, Number 5, May 1993.

>From the URL above:
>	Briefly, given a scalar `s', and an M by N matrix `M(mxn)', and
>	an M by N empty matrix `[](mxn)' (with either one or both
>	dimensions equal to zero), the following are true:
>
>	     s * [](mxn) = [](mxn) * s = [](mxn)
>
>		 [](mxn) + [](mxn) = [](mxn)
>
>		 [](0xm) * M(mxn) = [](0xn)
>
>		 M(mxn) * [](nx0) = [](mx0)
>
>		 [](mx0) * [](0xn) = 0(mxn)

This covers 2d arrays only, but it should be possible to extend it to
n-dimensional arrays, n>=1, by adding missing dimensions to arrays as
usual. For example, if a.shape=(0,n), it should probably behave as if
a.shape=(1,1,0,n), when involved in an operation with a (possibly
empty) 4-d array. This doesn't seem to conflict with the present
handling of 0-d arrays (scalars), either.

It would be nice if all functions and operators in the standard
distribution could handle empty matrices as a special case, and do the
right thing (whatever that may be in each case). Again, the aim would be
to eliminate having to test for empty matrices explicitly in python code.
Empty matrices do occur reasonably often in state-space descriptions of
systems.

Whether this is important enough at this stage is another matter...

Carlos

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

send messages to: matrix-sig@python.org