0

我正在练习 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-

4

0 回答 0