Consider the following (working) snippet:
Eigen::ArrayXd x (8);
x << 1, 2, 3, 4, 5, 6, 7, 8;
Eigen::TensorMap<Eigen::Tensor<double, 2>> y (x.data(), 2, 4);
This is also works:
const Eigen::ArrayXd const_x = x;
const Eigen::Map<const Eigen::ArrayXXd> z (const_x.data(), 2, 4);
I'm trying to figure out why I can't do this though:
const Eigen::TensorMap<const Eigen::Tensor<double, 2>> const_y (const_x.data(), 2, 4);
I'm using Eigen 3.3.3 (also tried 3.3.4)
TensorMap
, instead ofMap<Tensor>
andMap<const Tensor>
). – Margy