gpt4 book ai didi

c++ - boost 软件集成

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:44:03 27 4
gpt4 key购买 nike

有人可以帮助我进行集成,我正在尝试使用 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'

最佳答案

你能否尝试将 integrate 行更改为

size_t xx = boost::numeric::odeint::integrate<double>my_integrand, P, z0, z1, dz);

关于c++ - boost 软件集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42908426/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com