Beispiel #1
0
Array<double,1>* ObjToVector (const vector<double>& list)
{
    int len = list.size();/**< Get the list length */
    Array<double,1>* vector = new Array<double,1>(len);
    for (int i = 0; i < len; i++)
    {
        (*vector)(i) = list[i];
    }
    return vector;
}
Beispiel #2
0
Array<double,2>* ObjToArray(const vector<vector<double> >& list)
{
    int row = list.size();/**< Get the row length */
    int col = list[1].size();/**< Get the column length, all columns have the same size */
    Array<double,2>* tab = new Array<double,2>(row,col);
    for (int i = 0; i < row; i++)
    {
        for (int j = 0; j < col; j ++)
        {
            (*tab)(i,j) = list[i][j];
        }
    }
    return tab;
}