toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN/internal operators.hh


From: Gerhard Reitmayr
Subject: [Toon-members] TooN/internal operators.hh
Date: Thu, 02 Apr 2009 13:15:28 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Gerhard Reitmayr <gerhard>      09/04/02 13:15:28

Modified files:
        internal       : operators.hh 

Log message:
        fixed a template parameter passing bug in s op v, istream for vector 
and matrices

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/operators.hh?cvsroot=toon&r1=1.30&r2=1.31

Patches:
Index: operators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/operators.hh,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- operators.hh        1 Apr 2009 17:51:41 -0000       1.30
+++ operators.hh        2 Apr 2009 13:15:28 -0000       1.31
@@ -404,7 +404,6 @@
        return Operator<Internal::ApplyScalarV<Size,P1,B1,P2,Internal::Divide> 
> (v,s);
 }
 
-
 template<int Size, typename P1, typename B1, typename P2, typename Op>
 struct Operator<Internal::ApplyScalarVL<Size,P1,B1,P2,Op> > {
        const P2& lhs;
@@ -415,7 +414,7 @@
        template<int S0, typename P0, typename B0>
        void eval(Vector<S0,P0,B0>& v) const {
                for(int i=0; i<v.size(); i++){
-                       v[i]= Op::template op<P0,P1,P2> (lhs,rhs[i]);
+                       v[i]= Op::template op<P0,P2,P1> (lhs,rhs[i]);
                }
        }
 
@@ -545,6 +544,14 @@
   return os;
 }
 
+// operator istream& >>
+template <int Size, typename Precision, typename Base>
+std::istream& operator >> (std::istream& is, Vector<Size, Precision, Base>& v){
+       for (int i=0; i<v.size(); i++){
+               is >>  v[i];
+       }
+       return is;
+}
 
 template<int Rows, int Cols, typename Precision, class Base>
 inline std::ostream& operator<< (std::ostream& os, const Matrix<Rows, Cols, 
Precision, Base>& m){
@@ -561,5 +568,13 @@
        return os;
 }
 
-
-
+// operator istream& >>
+template <int Rows, int Cols, typename Precision, typename Base>
+std::istream& operator >> (std::istream& is, Matrix<Rows, Cols, Precision, 
Base>& m){
+       for(int r=0; r<m.num_rows(); r++){
+               for(int c=0; c < m.num_cols(); c++){
+                       is >> m(r,c);
+               }
+       }
+       return is;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]