odeint简单的一维颂示例不编译 [英] odeint simple 1d ode example does not compile
本文介绍了odeint简单的一维颂示例不编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试运行 odeint例子boost_1_54_0 的Debian的挤压G ++ 4.4
I try to run odeint examples in boost_1_54_0 on Debian Squeeze g++4.4
Lorenz系统工作正常,但简单1D颂歌
#include <iostream>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
/* we solve the simple ODE x' = 3/(2t^2) + x/(2t)
* with initial condition x(1) = 0.
* Analytic solution is x(t) = sqrt(t) - 1/t
*/
void rhs( const double x , double &dxdt , const double t )
{
dxdt = 3.0/(2.0*t*t) + x/(2.0*t);
}
void write_cout( const double &x , const double t )
{
cout << t << '\t' << x << endl;
}
// state_type = double
typedef runge_kutta_dopri5< double > stepper_type;
int main()
{
double x = 0.0;
//with the following line commented the program compiles
integrate_adaptive( make_controlled( 1E-12 , 1E-12 , stepper_type() ) ,
rhs , x , 1.0 , 10.0 , 0.1 , write_cout );
}
不能编译。有192行的错误与结尾:
doesn't compile. There are 192 lines of errors that end with:
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘end(double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(const double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(const double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(double&)’
/usr/local/include/boost/numeric/odeint/algebra/range_algebra.hpp:76: error: no matching function for call to ‘begin(double&)’
这是什么问题?
推荐答案
网页上的例子只是用odeint GitHub的版本上运行。如果你改变了步进类型
The example on the webpage is only running with the github version of odeint. If you change the stepper type to
typedef runge_kutta_dopri5< double , double , double , double , vector_space_algebra > stepper_type;
它应该运行。我们已经包括了自动代数检测机制是不是在正式版本提振但将很快包括在内。
it should run. We have included a automatic algebra detection mechanism which is not in the official boost version but which will be included very soon.
这篇关于odeint简单的一维颂示例不编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文