3 ms·
Your point on vectors and array processing is not a good one: Some significant numerical algorithms can be easily expressed with nested loops, and are a pain to
by greglindahl 10y ago
Your point on vectors and array processing is not a good one: Some significant numerical algorithms can be easily expressed with nested loops, and are a pain to express with array operations. Fortran has both, and some of the best compilers turn array operations into loops, to ensure that they get both forms right.
Maybe you could spend more time understanding other points of view, rather than feeling marginalized or vilified?
- lisper 10y ago> Some significant numerical algorithms can be easily expressed with nested loops Like for example? Just to clarify, I'm (obviously) not suggesting that nested loops be eliminated from the language, or that common optimizations on nested loops be eliminated from compilers. But having specialized code to recognize a clever idiom for counting bits is IMHO going way too far. It's true that I'm not intimately familiar with numerical algorithms, so I could be wrong about this, but my impression is that the number of "significant numerical algorithms" that can be easily expressed as nested loops is not that large: dozens, not hundreds. Unless I'm wrong about that, I stand by my position that the best way to handle these is to enumerate them and then allow them to be expressed directly.
- greglindahl 10y agoSuch as any code that applies a 1D operator against each of 3 dimensions in turn. That's done in the commonly-used PPM hydrodynamics algorithm, which is used in astrophysics and nuclear weapon simulations.