有没有人可以帮我解决我正在尝试使用boost odeint库进行计算的集成问题?这就是我所拥有的:
double z0 = -1.6;
double z1 = -1.0;
double dz = (z1 - z0) / 100;
double P(0.);
size_t xx = boost::numeric::odeint::integrate(my_integrand, P, z0, z1, dz);其中my_integrand是定义为的函数(注意,目前我还没有完全定义函数计算,因为我希望它首先正确编译):
void my_integrand(const double& P, double& dPdz, double z) { dPdz = 0.; };我在编译时得到以下错误:
3>C:\boost\boost_1_61_0\boost/numeric/odeint/integrate/integrate.hpp(68):error C2780: 'size_t boost::numeric::odeint::integrate(System,State &,Time,Time,Time)' : expects 5 arguments - 6 provided
3>C:\boost\boost_1_61_0\boost/numeric/odeint/integrate/integrate.hpp(72) : see declaration of 'boost::numeric::odeint::integrate'
3>..\..\test.cpp(36) : see reference to function template instantiation 'size_t boost::numeric::odeint::integrate<void(__cdecl *)(const double &,double &,double),double,double>(System,State &,Time,Time,Time)' being compiled
3> with
3> [
3> System=void (__cdecl *)(const double &,double &,double)
3> , State=double
3> , Time=double
3> ]
3>C:\boost\boost_1_61_0\boost/numeric/odeint/integrate/integrate.hpp(66) : see declaration of 'boost::numeric::odeint::integrate'
3>C:\boost\boost_1_61_0\boost/numeric/odeint/integrate/integrate.hpp(68): error C2783: 'size_t boost::numeric::odeint::integrate(System,State &,Time,Time,Time,Observer)' : could not deduce template argument for 'Value'
3>C:\boost\boost_1_61_0\boost/numeric/odeint/integrate/integrate.hpp(53) : see declaration of 'boost::numeric::odeint::integrate'
3>C:\boost\boost_1_61_0\boost/numeric/odeint/integrate/integrate.hpp(68): error C2893: Failed to specialize function template 'boost::enable_if<has_value_type<State,boost::mpl::bool_<false>>::type,size_t>::type boost::numeric::odeint::integrate(System,State &,Time,Time,Time,Observer)'
3> With the following template arguments:
3> 'System=void (__cdecl *)(const double &,double &,double)'
3> 'State=double'
3> 'Time=double'
3> 'Observer=boost::numeric::odeint::null_observer'发布于 2017-03-24 14:06:26
您可以尝试将integrate行更改为
size_t xx = boost::numeric::odeint::integrate<double>my_integrand, P, z0, z1, dz);https://stackoverflow.com/questions/42908426
复制相似问题