4 ms·
Code is easy to follow. I see no problem there. `pack_simd_row` is lambda: `|arguments: types| { body }` Arguments are: * `i` of type `usize` (unisgned size_t)
by brutt 7y ago
Code is easy to follow. I see no problem there.
`pack_simd_row` is lambda: `|arguments: types| { body }`
Arguments are:
* `i` of type `usize` (unisgned size_t),
* tuple (anonymous struct) with two fields: vd_stripe and vt_stripe, which are modified inside of lambda. They are references to fixed size array of 8 floats.
Inside function we have loop over result of iterator, which produces tuple with two fields: `jv` and tuple with two fields: `vx` and `vy`. `vx` and `vy` are elements from `vd_stripe` and `vt_stripe`. `jv` is their index.
Inside loop we create two temporary mutable variables: `vx_tmp` and `vy_tmp`, which are fixed size array of 8 floats, which are initialized with infinity.
Then we have next loop, which goes to modify these temporary arrays in place.
And so on.
- jml7c5 7y agoWhile the Rust version does flow logically, succinctness helps a lot more than people seem to appreciate. It's one of the reasons math notation is often so inconsistent: the brevity allows for easier manipulation and scanning. (Though I would not stretch the analogy too far, as inconsistent and overy brief notation can limit understanding while reading proofs.) Being able to fit part of a program clearly into 5 lines with fewer characters makes it easier to ensure correctness than an algorithm spread over 10 lines that is full of extra "noise". It's why there's so much syntactic sugar in so many languages.
- tluyben2 7y agoIt is easy to follow but I cannot say it's very pleasing to read.