4 ms·
1. in Julia you can't write "vecotrize-styled" code by using `@.` without manually adding the dots everywhere and the result will be as fast in numpy "classic u
by moelf 5y ago
1. in Julia you can't write "vecotrize-styled" code by using `@.` without manually adding the dots everywhere and the result will be as fast in numpy "classic use case"
2. Have not-slow for-loops is invaluable precisely because sometimes your workload is not (either too hard, or impossible/bad in terms of RAM usage) suitable for vectorzie-styled code.
- cycomanic 5y ago1. I know and pretty much every line of code I have would need to be preceded with a @. I should also add that julia did not follow the matlab insanity of regarding 1D vectors as arrays, but instead throwing errors helps catch errors before they cause weird issues. 2. I agree that this is one of the nice things about Julia.
- adgjlsfhk1 5y agoIn general, what you want to do instead of having `@.` in front of every line is write scalar functions and `@.` their application. For example, instead of writing ``` function f1(A,B,C) tmp = A.+B return tmp1 .* C end f1(::Vector,::Vector,::Vector) ``` You can write ``` function f2(a,b,c) tmp = a + b return tmp1 *c end f2.(::Vector,::Vector,::Vector) ```