When should I use broadcasting in Julia instead of a loop?
Julia Programming Language
When should I use broadcasting in Julia instead of a loop?
I’m still getting used to Julia’s broadcasting syntax, especially the use of . with functions and operators. For simple cases, something like: y = sin.(x) .+ 1 is very convenient. But once the expression gets a little more complicated, I sometimes find an explicit loop easier to read. So I’m wondering: in normal Julia code, when do you personally prefer broadcasting, and when would you switch to a loop? Is this mostly a readability choice, or are there performance differences I should keep...
0 comments
No comments yet.