2

I'm new here, so i hope to ask my question in a proper way! :)

I'm trying to implement a solver for the dissipativ lindblad equation with odeint in C++ using the Eigen libary for handling matrices.

With constant steps size everything works fine, but when I try to add an error estimation, the compiler vomits 50 errors. I suggest I have an error in the typedefs, but I have no idea where.

Here ist the call of the solver:

typedef runge_kutta4<state_type, double, state_type, double,vector_space_algebra > stepper;
typedef runge_kutta_cash_karp54< state_type > error_stepper_type;
typedef controlled_runge_kutta< error_stepper_type > controlled_stepper_type;
controlled_stepper_type controlled_stepper;
integrate_adaptive( controlled_stepper , bath , rho_init , 0.0 , 10.0 , 0.01 );

Here ist the call of the class for the ODE:

    void qsys::operator() ( state_type &rho , 
state_type &drhodt , const double t )
    {
            state_type sum;
            sum.resize(rho.rows(),rho.cols());
            sum.setZero();
            super_op(lindblads,rho,sum);
            drhodt=-(H*rho-rho*H) + sum;

    }

    void qsys::super_op(const std::vector<lindblad_op*> lindblads,const state_type &rho, state_type &erg)
    {
        state_type a;
        state_type b;
        a.resize(rho.rows(),rho.cols());
        b.resize(rho.rows(),rho.cols());
        b.setZero();

        erg.setZero();
        for (unsigned int i=0;i<lindblads.size();i++){
            a.setZero();
            a= (lindblads[i]->m) * rho * (lindblads[i]->m.adjoint()) -
            0.5 * ((lindblads[i]->m.adjoint()) * (lindblads[i]->m) * rho + rho * (lindblads[i]->m.adjoint() * lindblads[i]->m));
            b=erg+a;
            erg=b;
        }

    }

And state_type is Eigen::MatrixXd Is this helpful for you? I looked at the error messages, they are 26 pages long, so I wasnt able to post ist here, is there any opportunity to get it online?

I've downloaded boost 1.61 now, but it still doesnt work, my includes:

#ifndef qsys_HPP
#define qsys_HPP

#include <Eigen/Core>
#include <vector>
#include <iostream>
#include <vector>
#include <iostream>
//#include "boost/boost/numeric/odeint/external/eigen/eigen.hpp"
#include "boost/boost/numeric/odeint/algebra/vector_space_algebra.hpp"
#include "boost/boost/numeric/odeint.hpp"
#include "boost/boost/program_options.hpp"
#include <fstream>
#include "lindblad_op.hpp"

With "boost/boost/numeric/odeint/external/eigen/eigen.hpp" I now get following error messages:

||=== Build: Debug in ProgPrak (compiler: GNU GCC Compiler) ===|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra.hpp|98|error: ‘vector_space_norm_inf’ is not a class template|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|28|error: ‘algebra_dispatcher_sfinae’ is not a class template|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|error: ‘enable_if’ in namespace ‘boost’ does not name a type|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|error: expected template-argument before ‘<’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|error: expected ‘>’ before ‘<’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|37|error: ‘enable_if’ in namespace ‘boost’ does not name a type|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|37|error: expected template-argument before ‘<’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|37|error: expected ‘>’ before ‘<’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|37|error: wrong number of template arguments (2, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|error: provided for ‘template<class Derived> struct boost::numeric::odeint::algebra_dispatcher_sfinae’|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|38|error: expected ‘::’ before ‘{’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|38|error: expected identifier before ‘{’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|38|error: qualified name does not name a class before ‘{’ token|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|38|error: ‘is_resizeable_sfinae’ is not a class template|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|48|error: wrong number of template arguments (2, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|39|error: provided for ‘template<class Derived> struct boost::numeric::odeint::is_resizeable_sfinae’|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|57|error: ‘same_size_impl_sfinae’ is not a class template|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|69|error: wrong number of template arguments (3, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|58|error: provided for ‘template<class Derived> struct boost::numeric::odeint::same_size_impl_sfinae’|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|81|error: ‘resize_impl_sfinae’ is not a class template|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|92|error: wrong number of template arguments (3, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|82|error: provided for ‘template<class Derived> struct boost::numeric::odeint::resize_impl_sfinae’|
/usr/include/boost/numeric/odeint/algebra/algebra_dispatcher.hpp|40|error: redeclared with 2 template parameters|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|note: previous declaration ‘template<class Derived> struct boost::numeric::odeint::algebra_dispatcher_sfinae’ used 1 template parameter|
/usr/include/boost/numeric/odeint/algebra/algebra_dispatcher.hpp|58|error: wrong number of template arguments (2, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|error: provided for ‘template<class Derived> struct boost::numeric::odeint::algebra_dispatcher_sfinae’|
/usr/include/boost/numeric/odeint/util/multi_array_adaption.hpp|70|error: wrong number of template arguments (2, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|39|error: provided for ‘template<class Derived> struct boost::numeric::odeint::is_resizeable_sfinae’|
/usr/include/boost/numeric/odeint/util/multi_array_adaption.hpp|88|error: wrong number of template arguments (3, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|58|error: provided for ‘template<class Derived> struct boost::numeric::odeint::same_size_impl_sfinae’|
/usr/include/boost/numeric/odeint/util/multi_array_adaption.hpp|110|error: wrong number of template arguments (3, should be 1)|
/usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|82|error: provided for ‘template<class Derived> struct boost::numeric::odeint::resize_impl_sfinae’| 

If I only include "boost/boost/numeric/odeint/algebra/vector_space_algebra.hpp" I get the following messages:

/usr/include/boost/numeric/odeint/util/multi_array_adaption.hpp|70|error: ‘is_resizeable_sfinae’ is not a class template|

/usr/include/boost/numeric/odeint/util/multi_array_adaption.hpp|81|error: ‘same_size_impl_sfinae’ is not a class template|

/usr/include/boost/numeric/odeint/util/multi_array_adaption.hpp|103|error: ‘resize_impl_sfinae’ is not a class template|

Thanks for your help!

runge_men
  • 21
  • 4
  • What is the error message? This may help. http://stackoverflow.com/help/mcve – kangshiyin Jun 17 '16 at 10:10
  • /usr/include/boost/range/begin.hpp|112| required by substitution of ‘template typename boost::range_iterator::type boost::range_adl_barrier::begin(const T&) [with T = Eigen::Matrix]’| The compiler throws this error 50 times and says there are more but he cant display them all – runge_men Jun 17 '16 at 11:44
  • /usr/include/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp|348| [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]| – runge_men Jun 17 '16 at 11:57
  • /usr/include/boost/mpl/eval_if.hpp|60|error: no type named ‘type’ in ‘boost::mpl::eval_if_c >, boost::range_mutable_iterator > >::f_ {aka struct boost::range_const_iterator >}’| – runge_men Jun 17 '16 at 11:57
  • these are just a few of the errors, I couldnt post them all... – runge_men Jun 17 '16 at 11:58
  • You could post the full error msg as code in your question, and you are far away from a MCVE code that can reproduce your problem. – kangshiyin Jun 17 '16 at 12:09
  • Have you tried to include `boost/numeric/odeint/external/eigen/eigen.hpp`? – headmyshoulder Jun 17 '16 at 13:19
  • Yes, but if I do i get many errors like: /usr/include/boost/numeric/odeint/external/eigen/eigen_algebra.hpp|98|error: ‘vector_space_norm_inf’ is not a class template| /usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|28|error: ‘algebra_dispatcher_sfinae’ is not a class template| /usr/include/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp|29|error: ‘enable_if’ in namespace ‘boost’ does not name a type| /usr/include/boost/numeric/odeint/external/eigen/eigen_resize.hpp|38|error: ‘is_resizeable_sfinae’ is not a class template| An much more.. – runge_men Jun 17 '16 at 13:24
  • Which boost version do you use? – headmyshoulder Jun 18 '16 at 01:26
  • I looked in Ubuntu Software Center, libboost-dev 1.54 – runge_men Jun 18 '16 at 04:30
  • I downloaded boost 1.61 now (I've added the includes in my original post) but I get error messages again) – runge_men Jun 18 '16 at 05:20
  • No one an idea? I would be really happy if someone could give me a hint, do you need further information to help me? – runge_men Jun 20 '16 at 14:32
  • @runge_men Reverting to Eigen version 3.2.10 might solve the problem. It is essential to include `boost/numeric/odeint/external/eigen/eigen.hpp`, but this header does not compile any more with the branch 3.3 of Eigen. See also https://stackoverflow.com/q/47039448/ – RHertel Dec 02 '17 at 11:10

0 Answers0