Re: [eigen] An insistent plea for an input operator |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] An insistent plea for an input operator
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 20 Jul 2010 08:48:55 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=p6YrYKSjpw0KrzUTsf0Ih+yibQY4wS+wk6SI73refsc=; b=UHBZeA8RR2HDHWbO5CdcOzmdd2XvUDljM4pG0JEJ8HZ7VZWICGm8CIhS1EQPuFLAPC iTek2MB88LsT4WQgYhyXf2qiKp/tpNQp9rWw5JBTaEKvP1iLT5zk/dm0qr8skDATB2b1 alTfHwGlz+bNju92Hdu5KPb0SHNnFl5I5z388=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Z4rCEafyR+dXqKetEI+544JewEAajnJ9IRdXxFsJvTAVONRSMM/aAhppD8I1Gn7uPL KAm0orVL1IytIMKx54DzOXlxZM9igfOByZlHYCgESy1y7a45yMD0TNMLwy2TU+9ywb8e 2G4FJbMmWBVnmIfYPP+p+o1JxZkHByo9HpF5Y=
ok, my biggest objection was that getting general input right is hard,
and that we must then get the API right; but I can agree that in any
case we'll end up supporting the very simple stream format that your
operator>> is supporting. So, why not.
Others?
Benoit
2010/7/20 Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>:
> 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
>
>
>
>