#Statistics libraries for Zig?
1 messages · Page 1 of 1 (latest)
I'm not sure if this exists, mostly because these are pretty easy functions to implement yourself, and there are many, many possible ways to store your data
So a library wouldn't be able to cover all the possible datastructures you might want to operate on
Figured, I searched around but couldn't find anything. You're not wrong but sometimes it's nice not having to reinvent the wheel 😄
I was only considering operating on simple f64 slices, but you're right that that's not always the case.
You could go far by abstracting over an iterator with a next function, but that still probably wouldn't cover everything, and it's just a bit cumbersome
i think median can get somewhat involved, there are special algorithms for that
and tbh these functions are like, less than 5 lines each
median is just std.sort :)
no, you can do it in O(N)
oh, interesting
https://cppcon.org/
Evolution of a Median Algorithm in C++ - Pete Isensee - CppCon 2023
https://github.com/CppCon/CppCon2023
You won’t find std::median in <algorithm>. Should it be? Come on a journey to explore various implementations of median(), starting from specific use cases to progressively more generic versions. We’ll tune for perfo...
holy crap abstraction hell 
why are c++ people like this
it was a pretty nice looking function like half way through, then it all went to hell lmao
neat alg tho, though I'm pretty sure you can do better than introselect (also apparently C++'s "introselect" is actually normally not introselect??? weird)
Might have a play around
having thought a bit more and realised I am very silly, introselect probably is the best way to do this yeah :)
would be a nice alg to have added to std.sort
std::nth_element, right?
yes, i learned abt it from the video i linked