[eigen] why does the result of the col member function behave so different? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hi,
I was surprised to find out that the following (marked) statements do
not work with Eigen 3.0 .
Many thanks for a comment,
Helmut
#include <iostream>
#include <Eigen/Core>
using Eigen::MatrixXd; using Eigen::VectorXd;
#include <sstream>
template<typename Derived>
std::istream & operator >>(std::istream & s,
Eigen::MatrixBase<Derived> & m)
{
for (int i = 0; i < m.rows(); ++i)
for (int j = 0; j < m.cols(); j++)
s >> m(i,j);
return s;
}
int main() {
MatrixXd A(2,2);
std::istringstream Inp("1 2");
A << 1,2,3,4;
// Inp >> A.col(0); // DOES NOT WORK - why?
// A.col(1)= A.col(0).square(); // DOES NOT WORK - why?
std::cout << A << std::endl;
}
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany