[eigen] Is it really impossible to modify a column of a matrix with in function?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

the following program does not compile with Eigen (SVN version from 
today)


#include <iostream>
#include <Eigen/Core>

using Eigen::MatrixXi;  using Eigen::VectorXi;

void set_Col(VectorXi& V) {
  V[0]=1;
}

int main() {
  MatrixXi A(2,3);
  A << 1,2,3,
       4,5,6;
  set_Col(A.col(1));
  std::cout << "A=\n" << A << std::endl;

}


It looks as if a column cannot be passed by a non-const reference.
Why doesn't  the col-method return a non-const reference for a non-
const object (the col-method could be overloaded with/without the 
const attribute)?

Many thanks for a hint,
Helmut.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/