toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN/internal matrix.hh operators.hh vector.hh


From: Tom Drummond
Subject: [Toon-members] TooN/internal matrix.hh operators.hh vector.hh
Date: Tue, 10 Mar 2009 15:30:26 +0000

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

Modified files:
        internal       : matrix.hh operators.hh vector.hh 

Log message:
        put the non-existent operator argument for vector and matrix 
constructors last
        and edited the operators to conform to this.  The (sometimes unused) 
size arguments
        now precede the always unused operator argument.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/matrix.hh?cvsroot=toon&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/operators.hh?cvsroot=toon&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vector.hh?cvsroot=toon&r1=1.21&r2=1.22

Patches:
Index: matrix.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/matrix.hh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- matrix.hh   10 Mar 2009 15:00:09 -0000      1.14
+++ matrix.hh   10 Mar 2009 15:30:22 -0000      1.15
@@ -31,7 +31,7 @@
        // constructors to allow return value optimisations
        // construction from 1-ary operator
        template <class T, class Op>
-       inline Matrix(const T& arg, const Operator<Op>&, int rows, int cols) 
+       inline Matrix(const T& arg, int rows, int cols, const Operator<Op>&) 
        :Layout::template Layout<Rows,Cols,Precision>(rows, cols) 
        {
            Op::eval(*this,arg);
@@ -39,7 +39,7 @@
 
        // constructor from 2-ary operator
        template <class LHS, class RHS, class Op>
-       inline Matrix(const LHS& lhs, const RHS& rhs, const Operator<Op>&, int 
rows, int cols)
+       inline Matrix(const LHS& lhs, const RHS& rhs, int rows, int cols, const 
Operator<Op>&)
        :Layout::template Layout<Rows,Cols,Precision>(rows, cols)
        {
            Op::eval(*this,lhs,rhs);

Index: operators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/operators.hh,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- operators.hh        10 Mar 2009 15:13:11 -0000      1.17
+++ operators.hh        10 Mar 2009 15:30:23 -0000      1.18
@@ -140,7 +140,7 @@
 {
        typedef typename Internal::AddType<P1, P2>::type restype;
        SizeMismatch<S1, S2>:: test(v1.size(),v2.size());
-       return Vector<Internal::Sizer<S1,S2>::size,restype>(v1, v2, 
Operator<Internal::Pairwise<restype, Internal::Add> >(), v1.size());
+       return Vector<Internal::Sizer<S1,S2>::size,restype>(v1, v2, v1.size(), 
Operator<Internal::Pairwise<restype, Internal::Add> >());
 }
 
 // Addition Vector - Vector
@@ -149,7 +149,7 @@
 {
        typedef typename Internal::SubtractType<P1, P2>::type restype;
        SizeMismatch<S1, S2>:: test(v1.size(),v2.size());
-       return Vector<Internal::Sizer<S1,S2>::size,restype>(v1, v2, 
Operator<Internal::Pairwise<restype, Internal::Subtract> >(), v1.size());
+       return Vector<Internal::Sizer<S1,S2>::size,restype>(v1, v2, v1.size(), 
Operator<Internal::Pairwise<restype, Internal::Subtract> >());
 }
 
 // Dot product Vector * Vector
@@ -176,7 +176,7 @@
        typedef typename Internal::AddType<P1, P2>::type restype;
        SizeMismatch<R1, R2>:: test(m1.num_rows(),m2.num_rows());
        SizeMismatch<C1, C2>:: test(m1.num_cols(),m2.num_cols());
-       return Matrix<Internal::Sizer<R1,R2>::size, 
Internal::Sizer<C1,C2>::size,restype>(m1, m2, 
Operator<Internal::Pairwise<restype, Internal::Add> >(), m1.num_rows(), 
m1.num_cols());
+       return Matrix<Internal::Sizer<R1,R2>::size, 
Internal::Sizer<C1,C2>::size,restype>(m1, m2, m1.num_rows(), m1.num_cols(), 
Operator<Internal::Pairwise<restype, Internal::Add> >());
 }
 
 // Addition Matrix - Matrix
@@ -186,7 +186,7 @@
        typedef typename Internal::SubtractType<P1, P2>::type restype;
        SizeMismatch<R1, R2>:: test(m1.num_rows(),m2.num_rows());
        SizeMismatch<C1, C2>:: test(m1.num_cols(),m2.num_cols());
-       return Matrix<Internal::Sizer<R1,R2>::size, 
Internal::Sizer<C1,C2>::size,restype>(m1, m2, 
Operator<Internal::Pairwise<restype, Internal::Subtract> >(), m1.num_rows(), 
m1.num_cols());
+       return Matrix<Internal::Sizer<R1,R2>::size, 
Internal::Sizer<C1,C2>::size,restype>(m1, m2, m1.num_rows(), m1.num_cols(), 
Operator<Internal::Pairwise<restype, Internal::Subtract> >());
 }
 
 // Matrix multiplication Matrix * Matrix
@@ -196,7 +196,7 @@
 {
        SizeMismatch<R1, C2>:: test(m1.num_rows(),m2.num_cols());
        SizeMismatch<C1, R2>:: test(m1.num_cols(),m2.num_rows());
-       return Matrix<R1, C2, typename Internal::MultiplyType<P1, 
P2>::type>(m1, m2, Operator<Internal::MatrixMultiply>(), m1.num_rows(), 
m2.num_cols());
+       return Matrix<R1, C2, typename Internal::MultiplyType<P1, 
P2>::type>(m1, m2, m1.num_rows(), m2.num_cols(), 
Operator<Internal::MatrixMultiply>());
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -210,7 +210,7 @@
 Vector<R, typename Internal::MultiplyType<P1,P2>::type> operator*(const 
Matrix<R, C, P1, B1>& m, const Vector<Size, P2, B2>& v)
 {
        SizeMismatch<C,Size>::test(m.num_cols(), v.size());
-       return Vector<R, typename Internal::MultiplyType<P1,P2>::type> (m, v, 
Operator<Internal::MatrixVectorMultiply>(), m.num_rows() );
+       return Vector<R, typename Internal::MultiplyType<P1,P2>::type> (m, v, 
m.num_rows(), Operator<Internal::MatrixVectorMultiply>() );
 }
                                                                                
                                                        
 // Vector Matrix multiplication Vector * Matrix
@@ -219,7 +219,7 @@
 Vector<C, typename Internal::MultiplyType<P1,P2>::type> operator*(const 
Vector<Size, P1, B1>& v, const Matrix<R, C, P2, B2>& m)
 {
        SizeMismatch<R,Size>::test(m.num_rows(), v.size());
-       return Vector<C, typename Internal::MultiplyType<P1,P2>::type> (v, m, 
Operator<Internal::VectorMatrixMultiply>(), m.num_cols() );
+       return Vector<C, typename Internal::MultiplyType<P1,P2>::type> (v, m, 
m.num_cols(), Operator<Internal::VectorMatrixMultiply>() );
 }
 
 
@@ -238,14 +238,14 @@
 Matrix<R, C, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
Matrix<R, C, P1, B1>& m, const P2& s)\
 {      \
        typedef typename Internal::OPNAME##Type<P1, P2>::type restype;\
-       return Matrix<R, C,restype>(m, s, 
Operator<Internal::ApplyScalar<restype, Internal::OPNAME> >(), m.num_rows(), 
m.num_cols());\
+       return Matrix<R, C,restype>(m, s, m.num_rows(), m.num_cols(), 
Operator<Internal::ApplyScalar<restype, Internal::OPNAME> >()); \
 }\
 \
 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>(v, s, Operator<Internal::ApplyScalar<restype, 
Internal::OPNAME> >(), v.size());\
+       return Vector<S,restype>(v, s, v.size(), 
Operator<Internal::ApplyScalar<restype, Internal::OPNAME> >());\
 }
 
 // scalar on the left
@@ -254,14 +254,14 @@
 Matrix<R, C, typename Internal::OPNAME##Type<P1, P2>::type> operator OP (const 
P1& s, const Matrix<R, C, P2, B2>& m)\
 {      \
        typedef typename Internal::OPNAME##Type<P1, P2>::type restype;\
-       return Matrix<R, C,restype>(s, m, 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >(), 
m.num_rows(), m.num_cols());\
+       return Matrix<R, C,restype>(s, m, m.num_rows(), m.num_cols(), 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >());\
 } \
 \
 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>(s, v, 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >(), v.size());\
+       return Vector<S,restype>(s, v, v.size(), 
Operator<Internal::ApplyScalarLeft<restype, Internal::OPNAME> >());\
 }
 
 

Index: vector.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vector.hh,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- vector.hh   6 Mar 2009 15:34:33 -0000       1.21
+++ vector.hh   10 Mar 2009 15:30:24 -0000      1.22
@@ -16,13 +16,13 @@
        // constructors to allow return value optimisations
        // construction from 1-ary operator
        template <class T, class Op>
-       inline Vector(const T& arg, const Operator<Op>&, int size) : 
Base::template Layout<Size, Precision>(size) {
+       inline Vector(const T& arg, int size, const Operator<Op>&) : 
Base::template Layout<Size, Precision>(size) {
                Op::eval(*this,arg);
        }
 
        // constructor from 2-ary operator
        template <class LHS, class RHS, class Op>
-       inline Vector(const LHS& lhs, const RHS& rhs, const Operator<Op>&, int 
size)
+       inline Vector(const LHS& lhs, const RHS& rhs, int size, const 
Operator<Op>&)
                : Base::template Layout<Size, Precision>(size) {
                Op::eval(*this,lhs,rhs);
        }




reply via email to

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