Go to the documentation of this file.00001
00002 #ifndef vnl_operators_h_
00003 #define vnl_operators_h_
00004
00005
00006
00007
00008
00009 #include <vnl/vnl_vector.h>
00010 #include <vnl/vnl_vector_fixed.h>
00011 #include <vnl/vnl_matrix.h>
00012 #include <vnl/vnl_matrix_fixed.h>
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 template<class T>
00023 bool operator<(vnl_vector<T> const& lhs, vnl_vector<T> const& rhs)
00024 {
00025 if (&lhs == &rhs) return false;
00026
00027 if (lhs.size() < rhs.size()) return true;
00028 else if (lhs.size() > rhs.size()) return false;
00029
00030 for (unsigned i = 0; i < lhs.size(); i++)
00031 {
00032 if (lhs(i) < rhs(i)) return true;
00033 else if (lhs(i) > rhs(i)) return false;
00034 }
00035 return false;
00036 }
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 template<class T>
00047 bool operator<(vnl_matrix<T> const& lhs, vnl_matrix<T> const& rhs)
00048 {
00049 if (&lhs == &rhs) return false;
00050
00051 if (lhs.rows() < rhs.rows()) return true;
00052 else if (lhs.rows() > rhs.rows()) return false;
00053 else if (lhs.cols() < rhs.cols()) return true;
00054 else if (lhs.cols() > rhs.cols()) return false;
00055
00056 for (unsigned i = 0; i < lhs.size(); i++)
00057 {
00058 if (lhs.data_block()[i] < rhs.data_block()[i]) return true;
00059 else if (lhs.data_block()[i] > rhs.data_block()[i]) return false;
00060 }
00061 return false;
00062 }
00063
00064
00065
00066
00067
00068
00069 template<class T, unsigned int n>
00070 bool operator<(vnl_vector_fixed<T,n> const& lhs, vnl_vector_fixed<T,n> const& rhs)
00071 {
00072 return lhs.as_ref() < rhs.as_ref();
00073 }
00074
00075
00076
00077
00078
00079
00080 template<class T, unsigned int n, unsigned int m>
00081 bool operator<(vnl_matrix_fixed<T,n,m> const& lhs, vnl_matrix_fixed<T,n,m> const& rhs)
00082 {
00083 return lhs.as_ref() < rhs.as_ref();
00084 }
00085
00086 #endif // vnl_operators_h_