News for hackers. Stuff that matters.
Re:Writing a small ray tracer in Rust and Zig by geokon on Tuesday July 02, 2019 @10:25AM (#20335458)
Yeah, I feel you on that and I started out writing in a similar style b/c it's terse and easy to digest. To be clear, this is mostly a hobby things for me so I'm not speaking from a position of authority, but in my limited experience once the problem gets bigger and you worry about performance/caching/recursion/etc. the math and equation start to diverge from the code substantially.

For instance over the last few months I've been playing with BLAS and the BLAS operators just don't really map cleanly to equations - and the way you structure efficient solutions just ends up being more nuanced and complicated than the simple clean "theoretical" on-paper solution. All the nuances need to be captured in the variable names to have any chance of making the code understandable

Re:Writing a small ray tracer in Rust and Zig by Fronzie on Tuesday July 02, 2019 @11:40AM (#20336168)
the distance between BLAS and mathematics is quite big. Have you had a look at, for example, the Eigen library?

Although it's still more verbose than math notation, it stays much closer and, in my experience, does allow for nearly all the optimization-wiggle-room one could want.