[eigen] An insistent plea for an input operator |

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

Hi,
I know, I've asked for this feature several month, ago,
but I'm obstinate to ask for it again and again.
Background: I'm teaching C++ for beginners (mathematicians) and
there should be an easy input operator for matrices and vectors.
Currently, I have to patch Eigen (2 or 3) by adding
namespace Eigen {
template<typename Derived>
std::istream & operator >>(std::istream & Inp, MatrixBase<Derived> & m)
{
for (int i = 0; i < m.rows(); ++i)
for (int j = 0; j < m.cols(); j++)
Inp >> m(i,j);
return Inp;
}
}
to make the following simple program run
int main() {
Eigen::MatrixXi A(2,3);
std::cerr << "intput 2x3 matrix:\n";
std::cin >> A;
std::cout << "I've got:\n" << A << std::endl;
}
I've never understood the objections against adding this.
Pardon for being such obstinate,
Helmut.
My problem is, that students download Eigen themselves and forget about
adding these few lines.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany