2014-04-08 12:23 GMT+02:00 Sturla Molden <sturla.mol...@gmail.com>: > Björn Lindqvist <bjou...@gmail.com> wrote: > >> import numpy as np >> from numpy.linalg import inv, solve >> >> # Using dot function: >> S = np.dot((np.dot(H, beta) - r).T, >> np.dot(inv(np.dot(np.dot(H, V), H.T)), np.dot(H, beta) - r)) >> >> # Using dot method: >> S = (H.dot(beta) - r).T.dot(inv(H.dot(V).dot(H.T))).dot(H.dot(beta) - r) >> >> Don't keep your reader hanging! Tell us what the magical variables H, >> beta, r and V are. And why import solve when you aren't using it? >> Curious readers that aren't very good at matrix math, like me, should >> still be able to follow your logic. Even if it is just random data, >> it's better than nothing! > > Perhaps. But you don't need to know matrix multiplication to see that those > expressions are not readable. And by extension, you can still imagine that > bugs can easily hide in unreadable code. > > Matrix multiplications are used extensively in anything from engineering to > statistics to computer graphics (2D and 3D). This operator will be a good > thing for a lot of us.
All I ask for is to be able to see that with my own eyes. Maybe there is some drastic improvement I can invent to make the algorithm much more readable? Then the PEP:s motivation falls down. I don't want to have to believe that the code the pep author came up with is the most optimal. I want to prove that for myself. -- mvh/best regards Björn Lindqvist _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com