toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN linoperators.hh


From: Edward Rosten
Subject: [Toon-members] TooN linoperators.hh
Date: Thu, 14 Jun 2007 03:19:01 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        07/06/14 03:19:01

Modified files:
        .              : linoperators.hh 

Log message:
        == and != for Vector<>

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

Patches:
Index: linoperators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/linoperators.hh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- linoperators.hh     20 Mar 2007 18:57:23 -0000      1.14
+++ linoperators.hh     14 Jun 2007 03:19:00 -0000      1.15
@@ -77,6 +77,89 @@
 
 /////////////////////
 //                 //
+//   operator ==   //
+//   operator !=   //
+// Vector == Vector//
+/////////////////////
+
+
+template<int Size, class Accessor1, class Accessor2>
+inline bool operator==(const FixedVector<Size, Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
+  for(int i=0; i < Size; i++)
+       if(lhs[i] != rhs[i])
+               return 0;
+  return 1;
+}
+
+template<int Size, class Accessor1, class Accessor2>
+inline bool operator==(const FixedVector<Size, Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
+  assert(rhs.size() == Size);
+  for(int i=0; i < Size; i++)
+       if(lhs[i] != rhs[i])
+               return 0;
+  return 1;
+}
+
+template<class Accessor1, class Accessor2>
+inline bool operator==(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
+  assert(rhs.size() == lhs.size());
+  for(int i=0; i < rhs.size(); i++)
+       if(lhs[i] != rhs[i])
+               return 0;
+  return 1;
+}
+
+template<int Size, class Accessor1, class Accessor2>
+inline bool operator==(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
+  assert(Size == lhs.size());
+  for(int i=0; i < Size; i++)
+       if(lhs[i] != rhs[i])
+               return 0;
+  return 1;
+}
+
+
+
+template<int Size, class Accessor1, class Accessor2>
+inline bool operator!=(const FixedVector<Size, Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
+  for(int i=0; i < Size; i++)
+       if(lhs[i] == rhs[i])
+               return 0;
+  return 1;
+}
+
+template<int Size, class Accessor1, class Accessor2>
+inline bool operator!=(const FixedVector<Size, Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
+  assert(rhs.size() == Size);
+  for(int i=0; i < Size; i++)
+       if(lhs[i] == rhs[i])
+               return 0;
+  return 1;
+}
+
+template<class Accessor1, class Accessor2>
+inline bool operator!=(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
+  assert(rhs.size() == lhs.size());
+  for(int i=0; i < rhs.size(); i++)
+       if(lhs[i] == rhs[i])
+               return 0;
+  return 1;
+}
+
+template<int Size, class Accessor1, class Accessor2>
+inline bool operator!=(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
+  assert(Size == lhs.size());
+  for(int i=0; i < Size; i++)
+       if(lhs[i] == rhs[i])
+               return 0;
+  return 1;
+}
+
+
+
+
+/////////////////////
+//                 //
 //   operator +    //
 // Vector + Vector //
 /////////////////////




reply via email to

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