4 ms·
Some matrix math libraries like Eigen[1] support vectorization via SSE, AVX, NEON, etc. and also use cache friendly algorithms for larger matrices. Highly recom
by chuckcode 6y ago
Some matrix math libraries like Eigen[1] support vectorization via SSE, AVX, NEON, etc. and also use cache friendly algorithms for larger matrices. Highly recommended when you don't need to go quite as low level as individual instructions.
[1] http://eigen.tuxfamily.org http://eigen.tuxfamily.org
- corysama 6y agoIf you need to work on large matrices, Eigen is highly recommended. If you need to do a stream of custom processing in small steps, Eigen is not a good fit. Eigen is a super complicated, template-heavy library that can compile very heavyweight tasks into very efficient code (eventually). For custom work, https://github.com/VcDevel/std-simd https://github.com/VcDevel/std-simd is working it's way into the C++ standard.
- Const-me 6y ago> Eigen is a super complicated, template-heavy library I agree, but that feature allows to apply optimizations by specializing these templates. Works for both micro-optimizations (in their pbroadcast4<__m256d> they do 4 loads, on many CPUs AVX2 can do better with a single load + shuffles) and replacing large parts of Eigen (I was able to improve performance of conjugate gradient solver by moving the sparse matrix into a SIMD-optimized structure).