On Thu, Dec 16, 2010 at 10:16, Armin Rigo <[email protected]> wrote: > Hi,
>> have you seen numpy/scipy? > Of course you are then going to hit the same problems that Ademan > tries to solve for numpy/scipy, notably how to implement at least the > basic linear algebra operations in such a way that the JIT can improve > them. There are various goals there, e.g. to turn Python (or Matlab) > code like A+B+C, adding three matrices together, into one matrix > operation instead of two (as it is now: (A+B)+C). This is all a bit > experimental so far. [More about numpy/scipy]: How about the ideas from C++ expression templates? Or even better, some sort of lazy evaluation? With C++ expression templates [1], (A+B) returns something like PlusMatrix(A, B). When finally assigning to a variable, the copy constructor converts this into a real matrix; in the following line: D = (A+B) + C PlusMatrix(PlusMatrix(A, B), C) is built, and D gets the result. What they could further do, but they don't (see FAQ of uBlas [1]), is to cache the result of evaluating a template when requested; that could be cached (as in lazy evaluation - expressions like PlusMatrix are not very different from thunks, in that case) or maybe JIT compilation can recognize the constantness of this. Best regards [1] One library using them is Boost::uBlas, but the idea is much older: http://www.boost.org/doc/libs/1_45_0/libs/numeric/ublas/doc/index.htm -- Paolo Giarrusso - Ph.D. Student http://www.informatik.uni-marburg.de/~pgiarrusso/ _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
