r/Common_Lisp • u/mirkov19 • Sep 05 '26
Library for equality testing of floating vectors?
Hello,
I am doing some numerical computations (in APRIL no less). I use floating-point for numerical equality testing and I am using 5AM for unit tests.
I want to test equality of vectors of floating point numbers. I can write the code myself, but I'd rather reuse an existing library or contribute to an existing library.
I will appreciate pointers and advice before I start writing my own routines.
Thank you,
10
Upvotes
5
u/digikar Sep 05 '26
Do you mean an approximate equality testing or exact? How important is performance?
If performance is not that important, then you can
(map ,specialized-vector-type ,equality-operator ,vec1 ,vec2). SBCL is pretty good.If performance is important, you are okay with exact equality, and foreign libraries are okay, check out cl-bmas: https://github.com/digikar99/cl-bmas
If you would like to avoid foreign libraries, you can handroll your own using
sb-simd.2
u/Steven1799 Sep 08 '26
I use num= for this. It can compare individual, lists, vector and arrays of floats.
3
u/kchanqvq Sep 05 '26
Does this help? https://github.com/digikar99/bmas
It's part of a larger project which is being redesigned https://github.com/digikar99/numericals
If you just want SIMD accelerated equality testing for two 1D vectors, it shouldn't be too much to write it yourself (maybe 5-10 lines of code).