C++Guns – RoboBlog

15.05.2018

C++ Guns: SIMDvalarray; std::valarray for SSE

Filed under: Allgemein — Tags: — Thomas @ 11:05

SIMDvalarray is the class for representing and manipulating arrays of values like std::valarray but it uses SIMD techniques like SSE, AVX ... and has no subscript operators like slicing.

Einfach SIMDarray mit Operatoren +, -, *, /, +=, -=, *=, /=

template<typename T, std::size_t N>
struct SIMDvalarray : acpl::SIMDarray<T,N> 
{ };

...

SIMDvalarray arr1 {1.0, 2.0};
SIMDvalarray arr2 {2.0, 4.0};
SIMDvalarray erg1 = arr1+arr2;

Erzeugt packed values SIMD Assember Code, wie gewünscht. Und mit C++17 Decudtion Guidelines muss man die nervigen, redundanten Template Parameter auch nicht mehr mit angeben.

https://sourceforge.net/p/acpl/code/ci/master/tree/acpl/acpllib/include/core/util/SIMDvalarray.hpp

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress