Discussion: Introducing new operators for matrix computation

Huaiyu Zhu hzhu at localhost.localdomain
Thu Jul 13 23:40:19 EDT 2000


On Thu, 13 Jul 2000 21:14:41 -0500, Paul Prescod <paul at prescod.net> wrote:
>> 
>> Point 1.  We _can_ assign a universal meaning to dot operators, as
>> "componentwise operators".  For example
>
>There is another proposal for allowing these types of operatoins:
>
>> [1, 2] .+ [3, 4]            # [4, 6]
>
>[x+y; for x in [1,2], y in [3,4]]

How about [x+y: x in [1,2], y in [3,4]]?  

But this has nothing to do with matrices, because one of their main virtue
is that you do not need to consider the indices.  How would you possibly
write A*B in this notation anyway?  Just a random line from my code, like

    s = tanh(A0*x+b0); y = A1*s + b1;

would take a dozen lines to do in the above way.

>Note that this feature is more general than a fixed list of operators:

That might be true, but mathematicians have spent hundreds of years to
distill the concepts to a very small list of operators that are extremely
useful.  Would you say that add(a,b) and mul(a,b) are more general type of
expressions than some special symbols like a+b and a*b?  Writing in asembly
may be even more general than any high level language.

Learn some linear algebra and you'll find that you could do some incredible
things with it.  It is not difficult (if the syntax is simple).  For
starters, just download the current version of MatPy from
http://MatPy.sourceforge.net/, untar, and type make install, and see the
graphics flow across your screen.

Huaiyu



More information about the Python-list mailing list