-1

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;
}
Santosh Tiwari
  • 1,167
  • 2
  • 14
  • 26
  • 1
    All unit tests compile fine with ICC, so please show the line of code triggering this issue. – ggael Oct 01 '16 at 06:22
  • Question edited to include the relevant code and also a larger error message trail. – Santosh Tiwari Oct 03 '16 at 17:12
  • Here, your example compiles fine with ICC 16.0.2 and Eigen 3.3-rc1. – ggael Oct 03 '16 at 19:38
  • I am using icc (ICC) 11.1 20090827 for compilation. Not sure, if it makes a difference. I am struggling to find a way to compile successfully. – Santosh Tiwari Oct 03 '16 at 21:30
  • ICC 11 has not been tested for a while. This might explain the issue. Either update your compiler, user another compiler, or figure out a patch. My guess is that the problem comes from the helpers `has_nullary_operator`, `has_unary_operator`, and `has_binary_operator` in `Eigen/src/Core/util/Meta.h`. They try to detect whether a class has nullary, unary or binary `operator()` using SFINAE. – ggael Oct 04 '16 at 15:23
  • See also `test/nullary.cpp` for unitary tests of those helpers. – ggael Oct 04 '16 at 15:24
  • OK, I am at least able to successfully compile Eigen_3_2_10 with icc. So, I will just use this version, since I cannot update the intel compiler. – Santosh Tiwari Oct 04 '16 at 18:18
  • Since, I am able to successfully compile Eigen 3.2.10 with icc 11.1, I would go with that. Thanks ggael for your input. :) – Santosh Tiwari Oct 04 '16 at 18:34

1 Answers1

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.

Malcolm McLean
  • 6,258
  • 1
  • 17
  • 18
  • I am using an external library and am not familiar with the code, so it would be very difficult for me to identify the source of the problem. Still trying to figure out .. how to resolve the issue? – Santosh Tiwari Oct 03 '16 at 21:32