Bug 515 - compile error eigenvalues() for dense matrix with dynamic size using qd_real
: compile error eigenvalues() for dense matrix with dynamic size using qd_real
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Eigenvalues
: 3.1
: All All
: Normal normal
Assigned To: Nobody
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-09-26 17:03 UTC by Ralf Denzer
Modified: 2012-09-27 00:24 UTC (History)
4 users (show)



Attachments

Description Ralf Denzer 2012-09-26 17:03:15 UTC
Hello, 

the calculation of eigenvalues using qd_real
(quad-double package: qd-2.3.13.tar.gz from
http://crd-legacy.lbl.gov/~dhbailey/mpdist/ combined with Eigen 3.1.1)
for a dense matrix with dynamic size leads to a compile error (g++ 4.7.1,
debian testing) 

My testcase is (for a statically allocated matrix (Astatic), the compiler is
fine!)

//-----
#include <iostream>
#include "qd/qd_real.h"
#include "Eigen3_1_1/Eigen/Dense"

//typedef double FLOAT;
typedef qd_real FLOAT;

int main(int argc, char **argv)
{
    // set a static 3x3 matrix A
    Eigen::Matrix<FLOAT, 3, 3> Astatic;
    Astatic.setZero();
    Astatic(0,0) = 1.0;
    Astatic(1,1) = 2.0;
    Astatic(2,2) = 3.0;

    Eigen::EigenSolver<Eigen::Matrix<FLOAT, 3, 3>> eigensolverStatic(Astatic);
    if (eigensolverStatic.info() != Eigen::Success) abort();

    Eigen::Matrix<std::complex<FLOAT>, 3, 1> evalStatic;
    evalStatic = eigensolverStatic.eigenvalues();

    std::cout << "eval= ";
    for (int i = 0; i < evalStatic.size(); ++i)
        std::cout << evalStatic(i) << " ";
    std::cout << std::endl;

    // set a Dynamic 3x3 matrix A
    Eigen::Matrix<FLOAT, Eigen::Dynamic, Eigen::Dynamic> ADynamic;
    ADynamic.resize(3,3);
    ADynamic.setZero();
    ADynamic(0,0) = 1.0;
    ADynamic(1,1) = 2.0;
    ADynamic(2,2) = 3.0;

    Eigen::EigenSolver<Eigen::Matrix<FLOAT, Eigen::Dynamic, Eigen::Dynamic>>
eigensolverDynamic(ADynamic);
    if (eigensolverDynamic.info() != Eigen::Success) abort();

    Eigen::Matrix<std::complex<FLOAT>, 3, 1> evalDynamic;
    evalDynamic = eigensolverStatic.eigenvalues();

    std::cout << "eval= ";
    for (int i = 0; i < evalDynamic.size(); ++i)
        std::cout << evalDynamic(i) << " ";
    std::cout << std::endl;

    return 0;
}
//-----

The compiler error message is 

//-----
/home/denzer/projects/eigen_qd_real_test/debug_build> make
[100%] Building CXX object CMakeFiles/eigen_qd_real_test.dir/main.o
In file included from /home/denzer/local/include/Eigen3_1_1/Eigen/Core:315:0,
                 from /home/denzer/local/include/Eigen3_1_1/Eigen/Dense:1,
                 from /home/denzer/projects/eigen_qd_real_test/main.cpp:41:
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h: In
instantiation of ‘static void
Eigen::internal::triangular_assignment_selector<Derived1, Derived2, 10u, -1,
ClearOpposite>::run(Derived1&, const Derived2&) [with Derived1 =
Eigen::Matrix<qd_real, -1, -1>; Derived2 =
Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<qd_real>,
Eigen::Matrix<qd_real, -1, -1> >; bool ClearOpposite = false]’:
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:618:3: 
 required from ‘void Eigen::TriangularView<MatrixType, Mode>::lazyAssign(const
Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<qd_real>,
Eigen::Matrix<qd_real, -1, -1> >; _MatrixType = Eigen::Matrix<qd_real, -1, -1>;
unsigned int _Mode = 10u]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:598:5: 
 required from ‘Eigen::TriangularView<MatrixType, _Mode>&
Eigen::TriangularView<MatrixType, Mode>::operator=(const
Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<qd_real>,
Eigen::Matrix<qd_real, -1, -1> >; _MatrixType = Eigen::Matrix<qd_real, -1, -1>;
unsigned int _Mode = 10u]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:213:64:
  required from ‘Eigen::TriangularView<MatrixType, Mode>&
Eigen::TriangularView<MatrixType, Mode>::setConstant(const Scalar&) [with
_MatrixType = Eigen::Matrix<qd_real, -1, -1>; unsigned int _Mode = 10u;
Eigen::TriangularView<MatrixType, Mode> =
Eigen::TriangularView<Eigen::Matrix<qd_real, -1, -1>, 10u>;
Eigen::TriangularView<MatrixType, Mode>::Scalar = qd_real]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:215:61:
  required from ‘Eigen::TriangularView<MatrixType, Mode>&
Eigen::TriangularView<MatrixType, Mode>::setZero() [with _MatrixType =
Eigen::Matrix<qd_real, -1, -1>; unsigned int _Mode = 10u;
Eigen::TriangularView<MatrixType, Mode> =
Eigen::TriangularView<Eigen::Matrix<qd_real, -1, -1>, 10u>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Householder/HouseholderSequence.h:245:9:
  required from ‘void Eigen::HouseholderSequence<VectorsType, CoeffsType,
Side>::evalTo(Dest&, Workspace&) const [with Dest = Eigen::Matrix<qd_real, -1,
-1>; Workspace = Eigen::Matrix<qd_real, -1, 1, 0, -1, 1>; VectorsType =
Eigen::Matrix<qd_real, -1, -1>; CoeffsType = Eigen::Matrix<qd_real, -1, 1, 0,
-1, 1>; int Side = 1]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Householder/HouseholderSequence.h:231:7:
  [ skipping 2 instantiation contexts ]
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/PlainObjectBase.h:432:7:  
required from ‘Derived& Eigen::PlainObjectBase<Derived>::operator=(const
Eigen::EigenBase<OtherDerived>&) [with OtherDerived =
Eigen::HouseholderSequence<Eigen::Matrix<qd_real, -1, -1>,
Eigen::Matrix<qd_real, -1, 1, 0, -1, 1>, 1>; Derived = Eigen::Matrix<qd_real,
-1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/Matrix.h:184:35:  
required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows,
_MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows,
_MaxCols>::operator=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived
= Eigen::HouseholderSequence<Eigen::Matrix<qd_real, -1, -1>,
Eigen::Matrix<qd_real, -1, 1, 0, -1, 1>, 1>; _Scalar = qd_real; int _Rows = -1;
int _Cols = -1; int _Options = 0; int _MaxRows = -1; int _MaxCols = -1;
Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> =
Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Eigenvalues/RealSchur.h:212:5: 
 required from ‘Eigen::RealSchur<MatrixType>&
Eigen::RealSchur<_MatrixType>::compute(const MatrixType&, bool) [with
_MatrixType = Eigen::Matrix<qd_real, -1, -1>;
Eigen::RealSchur<_MatrixType>::MatrixType = Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Eigenvalues/EigenSolver.h:356:3:
  required from ‘Eigen::EigenSolver<MatrixType>&
Eigen::EigenSolver<_MatrixType>::compute(const MatrixType&, bool) [with
_MatrixType = Eigen::Matrix<qd_real, -1, -1>;
Eigen::EigenSolver<_MatrixType>::MatrixType = Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Eigenvalues/EigenSolver.h:155:7:
  required from ‘Eigen::EigenSolver<_MatrixType>::EigenSolver(const
MatrixType&, bool) [with _MatrixType = Eigen::Matrix<qd_real, -1, -1>;
Eigen::EigenSolver<_MatrixType>::MatrixType = Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/projects/eigen_qd_real_test/main.cpp:74:105:   required from here
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:523:11:
error: ambiguous overload for ‘operator=’ in ‘(& dst)->Eigen::Matrix<qd_real,
-1,
-1>::<anonymous>.Eigen::PlainObjectBase<Derived>::coeffRef<Eigen::Matrix<qd_real,
-1, -1> >(i, j) = 0’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:523:11:
note: candidates are:
In file included from /home/denzer/local/include/qd/qd_real.h:289:0,
                 from /home/denzer/projects/eigen_qd_real_test/main.cpp:40:
/home/denzer/local/include/qd/qd_inline.h:808:17: note: qd_real&
qd_real::operator=(double)
/home/denzer/local/include/qd/qd_inline.h:815:17: note: qd_real&
qd_real::operator=(const dd_real&)
In file included from /home/denzer/projects/eigen_qd_real_test/main.cpp:40:0:
/home/denzer/local/include/qd/qd_real.h:113:12: note: qd_real&
qd_real::operator=(const char*)
/home/denzer/local/include/qd/qd_real.h:32:15: note: qd_real&
qd_real::operator=(const qd_real&)
/home/denzer/local/include/qd/qd_real.h:32:15: note: qd_real&
qd_real::operator=(qd_real&&)
In file included from /home/denzer/local/include/Eigen3_1_1/Eigen/Core:315:0,
                 from /home/denzer/local/include/Eigen3_1_1/Eigen/Dense:1,
                 from /home/denzer/projects/eigen_qd_real_test/main.cpp:41:
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h: In
instantiation of ‘static void
Eigen::internal::triangular_assignment_selector<Derived1, Derived2, 10u, -1,
ClearOpposite>::run(Derived1&, const Derived2&) [with Derived1 =
Eigen::Matrix<qd_real, -1, -1>; Derived2 = Eigen::Matrix<qd_real, -1, -1>; bool
ClearOpposite = false]’:
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:618:3: 
 required from ‘void Eigen::TriangularView<MatrixType, Mode>::lazyAssign(const
Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<qd_real,
-1, -1>; _MatrixType = Eigen::Matrix<qd_real, -1, -1>; unsigned int _Mode =
10u]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:599:5: 
 required from ‘Eigen::TriangularView<MatrixType, _Mode>&
Eigen::TriangularView<MatrixType, Mode>::operator=(const
Eigen::MatrixBase<OtherDerived>&) [with OtherDerived =
Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<qd_real>,
Eigen::Matrix<qd_real, -1, -1> >; _MatrixType = Eigen::Matrix<qd_real, -1, -1>;
unsigned int _Mode = 10u]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:213:64:
  required from ‘Eigen::TriangularView<MatrixType, Mode>&
Eigen::TriangularView<MatrixType, Mode>::setConstant(const Scalar&) [with
_MatrixType = Eigen::Matrix<qd_real, -1, -1>; unsigned int _Mode = 10u;
Eigen::TriangularView<MatrixType, Mode> =
Eigen::TriangularView<Eigen::Matrix<qd_real, -1, -1>, 10u>;
Eigen::TriangularView<MatrixType, Mode>::Scalar = qd_real]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:215:61:
  required from ‘Eigen::TriangularView<MatrixType, Mode>&
Eigen::TriangularView<MatrixType, Mode>::setZero() [with _MatrixType =
Eigen::Matrix<qd_real, -1, -1>; unsigned int _Mode = 10u;
Eigen::TriangularView<MatrixType, Mode> =
Eigen::TriangularView<Eigen::Matrix<qd_real, -1, -1>, 10u>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Householder/HouseholderSequence.h:245:9:
  required from ‘void Eigen::HouseholderSequence<VectorsType, CoeffsType,
Side>::evalTo(Dest&, Workspace&) const [with Dest = Eigen::Matrix<qd_real, -1,
-1>; Workspace = Eigen::Matrix<qd_real, -1, 1, 0, -1, 1>; VectorsType =
Eigen::Matrix<qd_real, -1, -1>; CoeffsType = Eigen::Matrix<qd_real, -1, 1, 0,
-1, 1>; int Side = 1]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Householder/HouseholderSequence.h:231:7:
  [ skipping 2 instantiation contexts ]
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/PlainObjectBase.h:432:7:  
required from ‘Derived& Eigen::PlainObjectBase<Derived>::operator=(const
Eigen::EigenBase<OtherDerived>&) [with OtherDerived =
Eigen::HouseholderSequence<Eigen::Matrix<qd_real, -1, -1>,
Eigen::Matrix<qd_real, -1, 1, 0, -1, 1>, 1>; Derived = Eigen::Matrix<qd_real,
-1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/Matrix.h:184:35:  
required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows,
_MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows,
_MaxCols>::operator=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived
= Eigen::HouseholderSequence<Eigen::Matrix<qd_real, -1, -1>,
Eigen::Matrix<qd_real, -1, 1, 0, -1, 1>, 1>; _Scalar = qd_real; int _Rows = -1;
int _Cols = -1; int _Options = 0; int _MaxRows = -1; int _MaxCols = -1;
Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> =
Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Eigenvalues/RealSchur.h:212:5: 
 required from ‘Eigen::RealSchur<MatrixType>&
Eigen::RealSchur<_MatrixType>::compute(const MatrixType&, bool) [with
_MatrixType = Eigen::Matrix<qd_real, -1, -1>;
Eigen::RealSchur<_MatrixType>::MatrixType = Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Eigenvalues/EigenSolver.h:356:3:
  required from ‘Eigen::EigenSolver<MatrixType>&
Eigen::EigenSolver<_MatrixType>::compute(const MatrixType&, bool) [with
_MatrixType = Eigen::Matrix<qd_real, -1, -1>;
Eigen::EigenSolver<_MatrixType>::MatrixType = Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Eigenvalues/EigenSolver.h:155:7:
  required from ‘Eigen::EigenSolver<_MatrixType>::EigenSolver(const
MatrixType&, bool) [with _MatrixType = Eigen::Matrix<qd_real, -1, -1>;
Eigen::EigenSolver<_MatrixType>::MatrixType = Eigen::Matrix<qd_real, -1, -1>]’
/home/denzer/projects/eigen_qd_real_test/main.cpp:74:105:   required from here
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:523:11:
error: ambiguous overload for ‘operator=’ in ‘(& dst)->Eigen::Matrix<qd_real,
-1,
-1>::<anonymous>.Eigen::PlainObjectBase<Derived>::coeffRef<Eigen::Matrix<qd_real,
-1, -1> >(i, j) = 0’
/home/denzer/local/include/Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h:523:11:
note: candidates are:
In file included from /home/denzer/local/include/qd/qd_real.h:289:0,
                 from /home/denzer/projects/eigen_qd_real_test/main.cpp:40:
/home/denzer/local/include/qd/qd_inline.h:808:17: note: qd_real&
qd_real::operator=(double)
/home/denzer/local/include/qd/qd_inline.h:815:17: note: qd_real&
qd_real::operator=(const dd_real&)
In file included from /home/denzer/projects/eigen_qd_real_test/main.cpp:40:0:
/home/denzer/local/include/qd/qd_real.h:113:12: note: qd_real&
qd_real::operator=(const char*)
/home/denzer/local/include/qd/qd_real.h:32:15: note: qd_real&
qd_real::operator=(const qd_real&)
/home/denzer/local/include/qd/qd_real.h:32:15: note: qd_real&
qd_real::operator=(qd_real&&)
make[2]: *** [CMakeFiles/eigen_qd_real_test.dir/main.o] Error 1
make[1]: *** [CMakeFiles/eigen_qd_real_test.dir/all] Error 2
make: *** [all] Error 2
*** Failed ***
//-----

Maybe line 523 in file Eigen3_1_1/Eigen/src/Core/TriangularMatrix.h

dst.coeffRef(i, j) = 0;

needs a cast operator? Something like in line 541 
dst.coeffRef(i, j) = static_cast<typename Derived1::Scalar>(0);

Bye 

Ralf
Comment 1 Gael Guennebaud 2012-09-27 00:24:41 UTC
https://bitbucket.org/eigen/eigen/changeset/7e81114cbfa5/
changeset:   7e81114cbfa5
branch:      3.1
user:        ggael
date:        2012-09-27 00:23:19
summary:     fix bug 515: missing explicit scalar conversion

https://bitbucket.org/eigen/eigen/changeset/be0f62b24a30/
changeset:   be0f62b24a30
user:        ggael
date:        2012-09-27 00:23:19
summary:     fix bug 515: missing explicit scalar conversion
(transplanted from 7e81114cbfa584a09292d14619c22245df88c442)

Note You need to log in before you can comment on or make changes to this bug.