Re: [eigen] How do you link multiple versions (e.g. AVX vs SSE) of the same Eigen code?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Unfortunately that doesn't work. The first problems come from the fact that Eigen headers #include standard library headers, which are totally confused when included into a namespace. More problems would come from Eigen defining a few things in namespace std, if standard headers were previously included before Eigen was included.

Furthermore this would suffer from the same problem as the #define Eigen EigenAVX approach: types would be different, e.g. Eigen::Vector4f != avx_code_path::Eigen::Vector4f.

Benoit

2015-01-27 16:49 GMT-05:00 Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx>:
Am 27.01.2015 um 22:29 schrieb Benoit Jacob:
Any better approach?

It's also a hack, but maybe also putting the #include inside your custom namespace works:

// depending on compile-flags:
#define CURRENT_CODE_PATH avx_code_path

namespace CURRENT_CODE_PATH {

#include <Eigen/Core>

void foo(Eigen::Vector4f& v)
{
     v += v;
}

}


Christoph

--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/