[PYTHON MATRIX-SIG] ARRAY COMPARISONS

Geoffrey Furnish furnish@laura.llnl.gov
Fri, 25 Oct 1996 09:19:46 -0700


Alistair Mees writes:
 > tim@lassi.ece.uiuc.edu writes:
 >  > >ARRAY COMPARISONS
 >  > >
 >  > >There has been quite a bit of discussion of array comparisons
 >  > >recently.  I seem to have missed the early stages so perhaps
 >  > >this has all been dealt with, but just in case...
 >  > >
 >  > >
 >  > >Inequalities are often generalised to work for vectors and
 >  > >matrices.  For example, x>=0 where x is a vector means x[i]>=0
 >  > >for every i.  Unfortunately M>=0 where M is a matrix sometimes
 >  > >means the analogous thing to x>=0 and sometimes means M is
 >  > >positive semi-definite.  Either of these would presumably be
 >  > >implementable by defining suitable __cmp__ functions.
 >  > 
 >  > The problem is that __cmp__ can only validly return an
 >  > integer. Notice that for your first example that am array might
 >  > be neither >=0 nor <0 ([1,-1] comes to mind), so there's really
 >  > no valid value to return.
 > That is not a problem.  The answer to "is [1,-1]>=0" is "no" so you

I would expect in an array language that the answer to 
	"is [1,-1]>=0" 
would be
	"[1, -1]"

 > It seems to me that one of the reasons APL never made it was that it
 > insisted on talking its own language which was internally self-consistent
 > but had little to do with any language talked by others.  Conversely,
 > Matlab, with its horrid "bad Fortran" syntax, is very popular in part
 > because it never strays really far from standard notation.  If we are to
 > sell NumPy to users, shouldn't we try to make the operators mean what
 > typical users will expect them to mean, or will learn that they mean in
 > mathematics courses, rather than defining them to be something completely
 > different?

Well, if I'm the "typical Joe" in this example, your interpretation
certainly seems unfamiliar.  The "vector mask" analogy is more common
in my experience.  For reference: I've never used Matlab.

-- 
Geoffrey Furnish		email: furnish@llnl.gov
LLNL X/ICF			phone: 510-424-4227	fax: 510-423-6172

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

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