How do I convert a arma::cx_mat to an array of arrays?
The motivation for the conversion is to use libmatio, which takes a C array.
So far I have created a function to convert from arma:cx_mat to a vector of vectors:
std::vector<std::vector<double>> mat_to_vv(arma::cx_mat &M)
{
std::vector<std::vector<double>> vv(M.n_rows);
for(size_t i=0; i<M.n_rows; ++i)
{
vv[i] = arma::conv_to<std::vector<double>>::from(M.row(i));
};
return vv;
}
Aucun commentaire:
Enregistrer un commentaire