我第一次练习c ++并使用boost库。 我有这个程序来解决微分方程:
double rk2(double(*)[2], double, double, double, double(*)[2], double);
int main()
{// Create a 2D array that is n X 2
typedef boost::multi_array<double, 2> array_type;
typedef array_type::index index;
array_type a(boost::extents[n][2]);
// Create a 2D array that is n X 2
typedef boost::multi_array<double, 2> array_type;
typedef array_type::index index;
array_type v(boost::extents[n][2]);
然后我有一些条件,然后是..
while
{ (....some condition...)
tf = ti + dt;
vf = rk2(a,ti,vi,tf, v, xi);
xi = vf*dt+xi;
}
return 0;
}
然后我定义我的功能
double rk2(double a[10000][2], double ti, double vi, double tf, double v[10000][2], double xi)
{ ....lines..
return vf;
}
我收到一条错误消息:
error: cannot convert ‘array_type {aka boost::multi_array<double,>}’ to ‘double (*)[2]’ for argument ‘1’ to ‘double rk2(double (*)[2], double, double, double, double (*)[2], double)’
请帮帮我!
-TY -