Registered Member
|
I get the following error when trying to compile the following code:
MatrixXd a(3,3); MatrixXd b(1,3); a << -1,1,2, -2,3,1, 4,0,3; b << 3, 4, 5; cout << (a.col(0) - b(0)) << endl; error: no match for ‘operator-’ in ‘((Eigen::DenseBase<Eigen::Matrix<double, -0x000000001, -0x000000001, 0, -0x000000001, -0x000000001> >*)(& a))->Eigen::DenseBase<Derived>::col [with Derived = Eigen::Matrix<double, -0x000000001, -0x000000001, 0, -0x000000001, -0x000000001>](1) - ((Eigen::DenseCoeffsBase<Eigen::Matrix<double, -0x000000001, -0x000000001, 0, -0x000000001, -0x000000001>, 1>*)(& b))->Eigen::DenseCoeffsBase<Derived, 1>::operator() [with Derived = Eigen::Matrix<double, -0x000000001, -0x000000001, 0, -0x000000001, -0x000000001>](1)’ In short, i want to substract a scalar from coefficients for a certain column. I'm quite new to this, so any help would be appreciated. Thanks. Eric |
Registered Member
|
figured it out. Need to convert to arrays before doing the substration
cout << a.col(0).array() - b(0) << endl; |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]