Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Strange Eigen compilation issue #35

Open
athas opened this issue May 27, 2019 · 0 comments
Open

Strange Eigen compilation issue #35

athas opened this issue May 27, 2019 · 0 comments
Labels

Comments

@athas
Copy link
Contributor

athas commented May 27, 2019

After setting up cmake and running make I get strange compiler errors in gmm_eigen.h:

In file included from /home/athas/repos/ADBench/tools/Manual/gmm_d.cpp:176:
/home/athas/repos/ADBench/tools/Manual/../cpp-common/gmm_eigen.h: In function ‘void gmm_objective_no_priors(int, int, int, const Eigen::Map<const Eigen::Array<T, -1, 1> >&, const std::vector<Eigen::Map<const Eigen::Matrix<Scalar, -1, 1> > >&, ArrayX<T>&, const std::vector<Eigen::Matrix<LhsScalar, -1, -1, 0> >&, const double*, Wishart, T*)’:
/home/athas/repos/ADBench/tools/Manual/../cpp-common/gmm_eigen.h:165:68: error: expected primary-expression before ‘)’ token
         Qxcentered.noalias() = Qs[ik].triangularView<Eigen::Lower>()*xcentered;
                                                                    ^
/home/athas/repos/ADBench/tools/Manual/../cpp-common/gmm_eigen.h:174:61: error: expected primary-expression before ‘)’ token
         lse(ik) = -0.5*(Qs[ik].triangularView<Eigen::Lower>() * (curr_x - mus[ik])).squaredNorm();
                                                             ^
tools/Manual/CMakeFiles/Tools-Manual-GMM-Eigen.dir/build.make:86: recipe for target 'tools/Manual/CMakeFiles/Tools-Manual-GMM-Eigen.dir/gmm_d.cpp.o' failed
make[2]: *** [tools/Manual/CMakeFiles/Tools-Manual-GMM-Eigen.dir/gmm_d.cpp.o] Error 1
CMakeFiles/Makefile2:442: recipe for target 'tools/Manual/CMakeFiles/Tools-Manual-GMM-Eigen.dir/all' failed
make[1]: *** [tools/Manual/CMakeFiles/Tools-Manual-GMM-Eigen.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

From all the Eigen documentation I can find, this should work. It fails with both GCC 8.3 and Clang 6.0, with similar error messages.

Playing around, either of the following changes make it build:

  • Removing the template instantiation, i.e: Qs[ik].triangularView()*xcentered
  • Explicitly passing an argument of any type (!!!): Qs[ik].triangularView<Eigen::Lower>("hello")*xcentered

I think my C++ skills are too rusty to figure out how these appease the compiler spirits. I also haven't gotten to running the code yet, so it may not actually work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants