Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用Eigen 3.2.4来获取列向量中的居中数据。
Eigen::Matrix<double, 4, 1> a1, a2; a1 << 1, 2, 3, 4; a2 = a1 - a1.mean(); // error no match for operator -
但是gcc给出的错误是与运算符不匹配 - ...这里的错误是什么?
我纯粹从文档中回答,所以我可能错了。
本征不允许Matrix - scalar,但确实允许Array - scalar
Matrix - scalar
Array - scalar
尝试任何一个。
a2 = a1.array() - a1.mean();
或者
a2.array() = a1.array() - a1.mean();
即使这些都不起作用,也希望它们能够为您指明正确的方向。