簡體   English   中英

linux上的英特爾編譯器的特征庫編譯錯誤

[英]Eigen library compilation error with intel compiler on linux

我能夠使用 mingw 編譯器成功地在 cygwin 上編譯 Eigen。

在 linux 上使用 intel C++ 編譯器進行編譯時,出現以下錯誤。

我正在使用 Eigen 庫來解決 AX=B。

我正在使用 Eigen3.3-rc1。

知道如何解決這個問題嗎?

謝謝。

./Eigen/src/Core/CoreEvaluators.h(491):錯誤:調用類類型的對象沒有適當的 operator() 或轉換函數到函數指針類型return m_wrapper(m_functor,index); 在以下過程中檢測到:“Eigen::CwiseNullaryOp::CoeffReturnType Eigen::internal::evaluator>::coeff(IndexType) const [with NullaryOp=Eigen::internal::scalar_constant_op,PlainObjectType=Eigen::Matrix,IndexType=long ]" 在 "./Eigen/src/Core/AssignEvaluator.h" 的第 637 行。 . . 錯誤繼續

編輯:較大的錯誤消息如下。

./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"

這是使用 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;
}

典型的 C++ 問題。 C++ 允許使用允許調用它們的重載“()”運算符來定義“函數對象”。 它還允許使用模板。 在運算符解析和模板的交互中,編譯器或代碼中出現了錯誤。 現在將是一個難以解開的問題。 整個事情將如此包裹在面向對象和通用編程結構中,以至於很難隔離問題。 然而,從產生錯誤的那一行開始,並嘗試查看代碼嘗試為該對象定義 () 運算符的位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM