News for hackers. Stuff that matters.
Re:Python 3.5 to Ship with Matrix Multiplication Operator by adamtj on Tuesday April 08, 2014 @08:07PM (#7556872)
Speaking of the obvious, I'm somewhat surprised that the PEP didn't discuss dropping the "dot" function and using the existing function call operator directly. It seems like a natural idea to me. After all, a matrix represents a linear transformation, and a linear transformation is ... a function.

If you add some whitespace and squint just right, it even kinda sorta looks like math. If you further wrap all matrices and vectors in parentheses, you can pretend it's a whole new operator that lets you do matrix multiplication by juxtaposition.

  S = ((H) (beta) - r).T (inv((H) (V) (H.T))) ((H) (beta) - r)
Still, I think this is more readable:

  S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)

There are no comments on this comment yet.