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: Tom Drummond
Subject: [Toon-members] TooN/internal operators.hh
Date: Tue, 10 Mar 2009 15:09:50 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Tom Drummond <twd20>    09/03/10 15:09:50

Modified files:
        internal       : operators.hh 

Log message:
        scalar op left and right unmuddled
        the side now refers to the side on which the scalar resides

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

Patches:
Index: operators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/operators.hh,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- operators.hh        10 Mar 2009 15:06:30 -0000      1.15
+++ operators.hh        10 Mar 2009 15:09:50 -0000      1.16
@@ -223,7 +223,8 @@
 //
 // Except <scalar> / <matrix> does not exist
 
-#define TOON_MAKE_SCALAR_OP_LEFT(OPNAME, OP) \
+// scalar on the right
+#define TOON_MAKE_SCALAR_OP_RIGHT(OPNAME, OP) \
 template<int R, int C, typename P1, typename B1, typename P2> \
 Matrix<R, C, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
Matrix<R, C, P1, B1>& m, const P2& s)\
 {      \
@@ -231,14 +232,15 @@
        return Matrix<R, C,restype>(m, s, 
Operator<Internal::ApplyScalar<restype, Internal::OPNAME> >(), m.num_rows(), 
m.num_cols());\
 }\
 \
-template<int S, typename P1, typename P2, typename B2> \
-Vector<S, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
P1& s, const Vector<S, P2, B2>& v)\
+template<int S, typename P1, typename B1, typename P2> \
+Vector<S, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
Vector<S, P1, B1>& v, const P2& s)\
 {      \
        typedef typename Internal::OPNAME##Type<P1, P2>::type restype;\
-       return Vector<S,restype>(s, v, 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >(), v.size());\
+       return Vector<S,restype>(v, s, Operator<Internal::ApplyScalar<restype, 
Internal::OPNAME> >(), v.size());\
 }
 
-#define TOON_MAKE_SCALAR_OP_RIGHT(OPNAME, OP) \
+// scalar on the left
+#define TOON_MAKE_SCALAR_OP_LEFT(OPNAME, OP) \
 template<int R, int C, typename P1, typename P2, typename B2> \
 Matrix<R, C, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
P1& s, const Matrix<R, C, P2, B2>& m)\
 {      \
@@ -246,13 +248,16 @@
        return Matrix<R, C,restype>(s, m, 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >(), 
m.num_rows(), m.num_cols());\
 } \
 \
-template<int S, typename P1, typename B1, typename P2> \
-Vector<S, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
Vector<S, P1, B1>& v, const P2& s)\
+template<int S, typename P1, typename P2, typename B2> \
+Vector<S, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
P1& s, const Vector<S, P2, B2>& v)\
 {      \
        typedef typename Internal::OPNAME##Type<P1, P2>::type restype;\
-       return Vector<S,restype>(v, s, Operator<Internal::ApplyScalar<restype, 
Internal::OPNAME> >(), v.size());\
+       return Vector<S,restype>(s, v, 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >(), v.size());\
 }
 
+
+
+
 #define TOON_MAKE_SCALAR_OPS(OPNAME, OP)\
 TOON_MAKE_SCALAR_OP_LEFT(OPNAME, OP)\
 TOON_MAKE_SCALAR_OP_RIGHT(OPNAME, OP)
@@ -261,7 +266,7 @@
 TOON_MAKE_SCALAR_OPS(Subtract, -)
 TOON_MAKE_SCALAR_OPS(Multiply, *)
 
-TOON_MAKE_SCALAR_OP_LEFT(Divide, /)
+TOON_MAKE_SCALAR_OP_RIGHT(Divide, /)
 
 #undef TOON_MAKE_SCALAR_OPS
 #undef TOON_MAKE_SCALAR_OP_LEFT




reply via email to

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