News for hackers. Stuff that matters.
Re:Rust const generics MVP hits beta by SuperFluffy on Friday February 26, 2021 @01:36PM (#26278116)
Having const generics will also permit much more elegant implementations of low level linear algebra.

For example, when writing a `GEMM` (general matrix multiplication) routine, the core building block is a so called kernel, which gets moved over the matrices like a stencil. The size of the kernel however depends on a) the numerical precision (float, double), b) the available SIMD intrinsics, and c) the architecture the code is executed on (haswell, skylake or zen have different latency and throughput for different intrinsics).

Right now it's surprisingly painful to write an optimal kernel and buffer, which is different for every architecture and which you need to kind of hardcode. With const generics this should become much easier.

Re:Rust const generics MVP hits beta by mhh__ on Friday February 26, 2021 @07:39PM (#26281558)
I do this in D all the time, and the system is actually so flexible you can even use things like simulated annealing to optimize (if you are completely mad) to optimize the parameters.

    struct DiscardPastN(uint len)
    {
        int[len] buffer;
        uint state = 0;
        void put(int x)
        {
         buffer[++state % len] = x;
            //mwuhahahaha
            static if(len == 4)
                asm {
                        ud2;
                }
        }
        int[len] get() const 
        {
         return buffer;
        }
    }
So extremely useful all over the place let alone linear algebra, I'm glad Rust now has it too
Re:Rust const generics MVP hits beta by tinco on Saturday February 27, 2021 @05:32AM (#26283907)
Why undefined when Len is 4? Is it just an intentional sort of heisenbug?
Re:Rust const generics MVP hits beta by mhh__ on Saturday February 27, 2021 @06:09AM (#26284063)
Yes - it's quicker than doing something clever but is meant to show you can specialise the asm or intrinsics etc.
Re:Rust const generics MVP hits beta by porphyra on Friday February 26, 2021 @03:14PM (#26279345)
Yes!!! Linear algebra!

I am a huge fan of nalgebra and having const generics would make the API and implementation much nicer.

Hopefully the robotics industry can move towards implementing stuff in Rust. Having low level robotics algorithms like state estimation and SLAM in Rust makes perfect sense.

Re:Rust const generics MVP hits beta by gfaure on Saturday February 27, 2021 @12:29AM (#26282899)
Have you tried working with rust-ndarray (the closest thing to NumPy in Rust)? While I love Rust for general work, unfortunately for numeric programming, compared to NumPy itself, it's like pulling teeth. There's a lot which is completely missing: the main thing for me is (boolean) masks, which means there's no element-wise comparison of ndarrays.
Re:Rust const generics MVP hits beta by yodelshady on Monday March 01, 2021 @10:56AM (#26303988)
It's a cliche for open-source libraries, but ndarray could use more documentation.

A lot more.

A really whole lot more.

"Pulling teeth" is how I'd describe ndarray currently.