C++ 用gnuplot绘制Boost多阵列

C++ 用gnuplot绘制Boost多阵列,c++,arrays,boost,gnuplot,C++,Arrays,Boost,Gnuplot,我想绘制一个使用Boost库创建的多阵列。我一直被困在我的gnuplot第三方库中(为了绘图而添加)。我想我无法从我的多数组发送正确的引用。这是我的密码: //Vector with linspace vector<double> points; points = linspace(start_x, diff_x, 21); //Pointer type and pointer typedef vector<double> * point_ptr; point_ptr

我想绘制一个使用Boost库创建的多阵列。我一直被困在我的gnuplot第三方库中(为了绘图而添加)。我想我无法从我的多数组发送正确的引用。这是我的密码:

//Vector with linspace 
vector<double> points;
points = linspace(start_x, diff_x, 21);
//Pointer type and pointer
typedef vector<double> * point_ptr;
point_ptr p; //Pointer of type point_ptr.

p = &points; //Connect pointer to array


// Create a 2D array that is equal to meshgrid
typedef boost::multi_array<double, 2> array_type;
typedef array_type::index index;
array_type U(boost::extents[21][21]);
typedef boost::multi_array_types::index_range range;
array_type::array_view<2>::type myview = U[boost::indices[range()][range()]];

// Assign values to the elements
for (index i = 0; i != 21; ++i)
    for (index j = 0; j != 21; ++j)
        U[i][j] = (*p)[i]; 

gp << "set xrange [0:21]\nset yrange [0:21]\n";
gp << "set pm3d\n";
gp << "splot";
gp.send2d(myview); 
//带linspace的向量
矢量点;
点=linspace(起点x,差值x,21);
//指针类型和指针
typedef向量*point_ptr;
点p//类型为point_ptr的指针。
p=&点//将指针连接到数组
//创建与meshgrid相等的二维阵列
typedef boost::multi_array_type;
typedef数组_type::index索引;
数组类型U(boost::extensts[21][21]);
typedef boost::多数组类型::索引范围;
数组类型::数组视图::类型myview=U[boost::index[range()][range()];
//为元素指定值
对于(索引i=0;i!=21;++i)
对于(索引j=0;j!=21;++j)
U[i][j]=(*p)[i];
全科医生