Discussion: Introducing new operators for matrix computation

John Lull lull at acm.org
Thu Jul 13 22:36:02 EDT 2000


At the dawn of the third millenium (by the common reckoning),
hzhu at localhost.localdomain (Huaiyu Zhu) wrote (with possible
deletions):

> I think cleanness is one of the main virtue of python, but it is lacking in
> numerical computation.  To give an example of the difference it makes, I'll
> quote from my original post asking for matrix in python (with corrections)
> 
> [in octave we write]
> > b = X\y                  # LMS solution of a linear equation y = X*b
> > b = (X'*X)\(X'*y)        # or written out in more details
> > b = inv(X'*X)*(X'*y)     # or in a less efficient form.
> > 
> > but the corresponding Python notation is horrendous:
> > 
> > b = matrixmultiply(inverse(matrixmultiply(transpose(X), X)), 
> >     (matrixmultiply(transpose(X), y[:,NewAxis])))

I'm don't think this is quite fair.  You could just as easily write:
    b = rDiv(X, y)
if you simply had an appropriate rDiv() function.  It's not nearly as
pretty as octave's notation, but it doesn't have to be nearly as
hideous as your example.

Regards,
John



More information about the Python-list mailing list