我想知道为什么这对Eigen不起作用:
MatrixXd A = MatrixXd::Random(3, 10);
Array<double, 1, Dynamic> x = Array<double, 1, Dynamic>::Random(10);
MatrixXd y = x.matrix() * A.transpose();
虽然这有效:
MatrixXd A = MatrixXd::Random(3, 10);
Array<double, 1, Dynamic> x = Array<double, 1, Dynamic>::Random(10);
MatrixXd y = MatrixXd(x) * A.transpose();
这也有效:
MatrixXd A = MatrixXd::Random(3, 10);
ArrayXXd x = Array<double, 1, Dynamic>::Random(10);
MatrixXd y = x.matrix() * A.transpose();
我的编译器为第一个示例(clang-500.2.79)提供了以下错误消息:
code / Eigen / src / Core / ArrayWrapper.h:178:56:错误:无法初始化类型&#39; ScalarWithConstIfNotLvalue *&#39;的返回对象(又名&#39; double *&#39;),其右值为&#39; const Scalar *&#39; (又名&#39; const double *&#39;)内联ScalarWithConstIfNotLvalue * data(){return m_expression.data(); }