3 ms·
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.
by adamtj 13y ago
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)