简体   繁体   中英

Eigen library compilation error with intel compiler on linux

I am successfully able to compile Eigen on cygwin with mingw compilers.

When compiling on linux with intel C++ compiler, I get the following error.

I am using the Eigen library to solve AX=B.

I am using Eigen3.3-rc1.

any idea how to fix this?

Thanks.

./Eigen/src/Core/CoreEvaluators.h(491): error: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type return m_wrapper(m_functor,index); detected during: instantiation of "Eigen::CwiseNullaryOp::CoeffReturnType Eigen::internal::evaluator>::coeff(IndexType) const [with NullaryOp=Eigen::internal::scalar_constant_op, PlainObjectType=Eigen::Matrix, IndexType=long]" at line 637 of "./Eigen/src/Core/AssignEvaluator.h" . . . error continues

Edit: Larger error message is as follows.

./Eigen/src/Core/CoreEvaluators.h(491): error: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type
  return m_wrapper(m_functor,index);
         ^
      detected during:
        instantiation of "Eigen::CwiseNullaryOp<NullaryOp, PlainObjectType>::CoeffReturnType Eigen::internal::evaluator<Eigen::CwiseNullaryOp<NullaryOp, PlainObjectType>>::coeff(IndexType) const [with NullaryOp=Eigen::internal::scalar_constant_op<double>, PlainObjectType=Eigen::Matrix<double, -1, 1, 0, -1, 1>, IndexType=long]" at line 637 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>::assignCoeff(Eigen::Index={ptrdiff_t={long}}) [with DstEvaluatorTypeT=Eigen::internal::evaluator<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>>,
                  SrcEvaluatorTypeT=Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>>, Functor=Eigen::internal::div_assign_op<double, double>, Version=0]" at line 390 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::unaligned_dense_assignment_loop<false>::run(Kernel &, Eigen::Index={ptrdiff_t={long}}, Eigen::Index={ptrdiff_t={long}}) [with Kernel=Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>>,
                  Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>>, Eigen::internal::div_assign_op<double, double>, 0>]" at line 413 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::dense_assignment_loop<Kernel, 3, 0>::run(Kernel &) [with Kernel=Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>>, Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>>,
                  Eigen::internal::div_assign_op<double, double>, 0>]" at line 713 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::call_dense_assignment_loop(const DstXprType &, const SrcXprType &, const Functor &) [with DstXprType=Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>, SrcXprType=Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>, Functor=Eigen::internal::div_assign_op<double, double>]" at line
                  862 of "./Eigen/src/Core/AssignEvaluator.h"
        [ 6 instantiation contexts not shown ]
        instantiation of "void Eigen::internal::partial_lu_inplace(MatrixType &, TranspositionType &, TranspositionType::StorageIndex &) [with MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>, TranspositionType=Eigen::Transpositions<-1, -1, int>]" at line 530 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "void Eigen::PartialPivLU<_MatrixType>::compute() [with _MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 131 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "Eigen::PartialPivLU<_MatrixType> &Eigen::PartialPivLU<_MatrixType>::compute(const Eigen::EigenBase<OtherDerived> &) [with _MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>, InputType=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 323 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "Eigen::PartialPivLU<_MatrixType>::PartialPivLU(const Eigen::EigenBase<OtherDerived> &) [with _MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>, InputType=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 606 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "const Eigen::PartialPivLU<Eigen::DenseBase<Derived>::PlainObject> Eigen::MatrixBase<Derived>::lu() const [with Derived=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 245 of "Matrix.cpp"

Here is the relevant code that uses Eigen

#include <Eigen/Eigen>
using Eigen::MatrixXd;
using Eigen::VectorXd;

int solveAXBEigen(double *a, double *b, double *x, int n) {
    MatrixXd A(n, n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            A(i, j) = a[n * i + j];
        }
    }
    VectorXd B(n);
    for (int i = 0; i < n; i++) {
        B(i) = b[i];
    }
    VectorXd X = A.lu().solve(B);
    for (int i = 0; i < n; i++) {
        x[i] = X(i);
    }
    return 0;
}

Typical C++ problem. C++ allows the definition of "function objects" with overloaded "()" operators that permit them to be called. it also allows templates. Somewhere in the interaction of operator resolution and templates, something has gone wrong, either in the compiler or the code. It's now going to be a difficult one to disentangle. The whole thing will be so wrapped up in object-orientation and generic programming constructs that it will be hard to isolate the problem. However start with the line where the error is generated, and try to see where the code attempts to define the () operator for that object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM