It looks like i'm the only one not do be able to recognize 'the' algorithm in all 3 examples?
On Monday, August 25, 2014 8:22:07 PM UTC+2, Stefan Karpinski wrote: > > This is a classic case of the need for vectorization in Python and Matlab > making the algorithm completely incomprehensible. You're often much better > off porting to Julia from simple for-loop based C or Java codes instead. > I cannot really make reasonable statements about python for numerics or linalg because in the domain where i use python the data processing effort is low (most of it copying from a to b) and the major impact comes from interfacing things like cairo, gtk, web- or IP-interfaces. In Matlab it's very clear: If your algorithm is in a vectorized form and surpisingly a lot of the algorithms in numberics or linalg are, then you can implement them in just a few lines. And short code is good code. If the algorithm needs access to every single element of a data structure independently and in a certain sequence and in long if/else trees, then (based on experience) it might be worth to look at the data structure and give it a 'better' form. I have seen to many times, people trying to formulate with large sparse matrices and matrix multiplication where two vectors and elementwise multiplication would have been easier. And then there are the cases, where explicit loops are inevitible. There is a reason why there is the term 'mat' in matlab.
