This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Compile error for SelfAdjointEigenSolver with custom Scalar

Tags: None
(comma "," separated)
Irubataru
Registered Member
Posts
1
Karma
0
I am trying to compile some Eigen code using the gmp floats. When I create a SelfAdjointEigenSolver object I run into the following compiler error:

Code: Select all
In file included from /usr/include/eigen3/Eigen/Eigenvalues:28:0,
                 from /usr/include/eigen3/Eigen/Dense:7,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.cpp:11:
/usr/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h: In instantiation of ‘void Eigen::internal::tridiagonalization_inplace(MatrixType&, CoeffVectorType&) [with MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>; CoeffVectorType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, 1, 0, -1, 1>]’:
/usr/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h:446:31:   required from ‘static void Eigen::internal::tridiagonalization_inplace_selector<MatrixType, Size, IsComplex>::run(MatrixType&, DiagonalType&, SubDiagonalType&, bool) [with DiagonalType = Eigen::Matrix<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u>, -1, 1, 0, -1, 1>; SubDiagonalType = Eigen::Matrix<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u>, -1, 1, 0, -1, 1>; MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>; int Size = -1; bool IsComplex = true]’
/usr/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h:430:55:   required from ‘void Eigen::internal::tridiagonalization_inplace(MatrixType&, DiagonalType&, SubDiagonalType&, bool) [with MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>; DiagonalType = Eigen::Matrix<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u>, -1, 1, 0, -1, 1>; SubDiagonalType = Eigen::Matrix<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u>, -1, 1, 0, -1, 1>]’
/usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:426:39:   required from ‘Eigen::SelfAdjointEigenSolver<MatrixType>& Eigen::SelfAdjointEigenSolver<_MatrixType>::compute(const MatrixType&, int) [with _MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>; Eigen::SelfAdjointEigenSolver<_MatrixType>::MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>]’
/usr/include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:161:14:   required from ‘Eigen::SelfAdjointEigenSolver<_MatrixType>::SelfAdjointEigenSolver(const MatrixType&, int) [with _MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>; Eigen::SelfAdjointEigenSolver<_MatrixType>::MatrixType = Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>]’
<-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.cpp:31:85:   required from here
/usr/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h:372:5: error: no matching function for call to ‘Eigen::SelfAdjointView<Eigen::Block<Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>, -1, -1, false>, 1u>::rankUpdate(Eigen::DenseBase<Eigen::Block<Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>, -1, 1, true> >::SegmentReturnType, Eigen::DenseBase<Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, 1, 0, -1, 1> >::SegmentReturnType, int)’
     matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
     ^~~~
In file included from /usr/include/eigen3/Eigen/Core:325:0,
                 from <-redacted->/rmt_langevin/src/utilities/multiprecision_overloads.hpp:11,
                 from <-redacted->/rmt_langevin/src/number_type.hpp:11,
                 from <-redacted->/rmt_langevin/src/types.hpp:10,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.hpp:12,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.cpp:7:
/usr/include/eigen3/Eigen/src/Core/SelfAdjointView.h:135:22: note: candidate: template<class DerivedU, class DerivedV> Eigen::SelfAdjointView<MatrixType, UpLo>& Eigen::SelfAdjointView<MatrixType, Mode>::rankUpdate(const Eigen::MatrixBase<OtherDerived>&, const Eigen::MatrixBase<OtherDerived>&, const Scalar&) [with DerivedU = DerivedU; DerivedV = DerivedV; MatrixType = Eigen::Block<Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>, -1, -1, false>; unsigned int UpLo = 1u]
     SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha = Scalar(1));
                      ^~~~~~~~~~
/usr/include/eigen3/Eigen/src/Core/SelfAdjointView.h:135:22: note:   template argument deduction/substitution failed:
In file included from /usr/include/eigen3/Eigen/Eigenvalues:28:0,
                 from /usr/include/eigen3/Eigen/Dense:7,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.cpp:11:
/usr/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h:372:5: note:   cannot convert ‘-1’ (type ‘int’) to type ‘const Scalar& {aka const std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >&}’
     matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
     ^~~~
In file included from /usr/include/eigen3/Eigen/Core:325:0,
                 from <-redacted->/rmt_langevin/src/utilities/multiprecision_overloads.hpp:11,
                 from <-redacted->/rmt_langevin/src/number_type.hpp:11,
                 from <-redacted->/rmt_langevin/src/types.hpp:10,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.hpp:12,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.cpp:7:
/usr/include/eigen3/Eigen/src/Core/SelfAdjointView.h:148:22: note: candidate: template<class DerivedU> Eigen::SelfAdjointView<MatrixType, UpLo>& Eigen::SelfAdjointView<MatrixType, Mode>::rankUpdate(const Eigen::MatrixBase<OtherDerived>&, const Scalar&) [with DerivedU = DerivedU; MatrixType = Eigen::Block<Eigen::Matrix<std::complex<boost::multiprecision::number<boost::multiprecision::backends::gmp_float<500u>, (boost::multiprecision::expression_template_option)0u> >, -1, -1>, -1, -1, false>; unsigned int UpLo = 1u]
     SelfAdjointView& rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha = Scalar(1));
                      ^~~~~~~~~~
/usr/include/eigen3/Eigen/src/Core/SelfAdjointView.h:148:22: note:   template argument deduction/substitution failed:
In file included from /usr/include/eigen3/Eigen/Eigenvalues:28:0,
                 from /usr/include/eigen3/Eigen/Dense:7,
                 from <-redacted->/rmt_langevin/src/utilities/lowest_eigenvalues.cpp:11:
/usr/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h:372:5: note:   candidate expects 2 arguments, 3 provided
     matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
     ^~~~
Makefile:45: recipe for target '<-redacted->/rmt_langevin/src/utilities/obj/test24/lowest_eigenvalues.o' failed
make: *** [<-redacted->/rmt_langevin/src/utilities/obj/test24/lowest_eigenvalues.o] Error 1


It seems to me as if a construction has been forgotten in line 373 of src/Eigenvalues/Tridiagonalization.h, and changing the headers achieves this. I did overload the NumTraits for my class to have RequireInitialization = 1.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You're right. Fixed on devel and 3.2 branches.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]