在Odeint错误步进器中使用Eigen :: MatrixXd作为状态

时间:2016-06-17 08:25:53

标签: c++ eigen odeint

我是新来的,所以我希望以正确的方式提出我的问题! :)

我正在尝试用C ++中的odeint实现耗散lindblad方程的求解器,使用Eigen库来处理矩阵。

使用恒定的步长,一切正常,但是当我尝试添加错误估计时,编译器会呕吐50个错误。 我建议我在typedef中有一个错误,但我不知道在哪里。

这是求解器的调用:

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 );

这是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;
        }

    }

state_type是Eigen :: MatrixXd 这对你有帮助吗? 我查看了错误消息,它们长达26页,所以我无法在这里发帖,有没有机会上网?

我现在已经下载了boost 1.61,但它仍然无效,我的包括:

#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"

使用“boost / boost / numeric / odeint / external / eigen / eigen.hpp”我现在收到以下错误消息:

||=== 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’| 

如果我只包含“boost / boost / numeric / odeint / algebra / vector_space_algebra.hpp”,我会收到以下消息:

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

感谢您的帮助!

0 个答案:

没有答案