00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef MLN_FUN_V2V_NORM_HH
00027 # define MLN_FUN_V2V_NORM_HH
00028
00034
00035
00036
00037 # include <mln/core/concept/function.hh>
00038
00039 # include <mln/norm/all.hh>
00040
00041
00042 namespace mln
00043 {
00044
00045 namespace fun
00046 {
00047
00048 namespace v2v
00049 {
00050
00056 template <typename V, typename R>
00057 struct l1_norm : public Function_v2v< l1_norm<V, R> >
00058 {
00059 typedef R result;
00060 R operator()(const V& v) const;
00061 };
00062
00068 template <typename V, typename R>
00069 struct l2_norm : public Function_v2v< l2_norm<V, R> >
00070 {
00071 typedef R result;
00072 R operator()(const V& v) const;
00073 };
00074
00080 template <typename V, typename R>
00081 struct linfty_norm : public Function_v2v< linfty_norm<V, R> >
00082 {
00083 typedef R result;
00084 R operator()(const V& v) const;
00085 };
00086
00087
00088 # ifndef MLN_INCLUDE_ONLY
00089
00090 template <typename V, typename R>
00091 inline
00092 R
00093 l1_norm<V, R>::operator()(const V& v) const
00094 {
00095 return mln::norm::l1 (v);
00096 }
00097
00098 template <typename V, typename R>
00099 inline
00100 R
00101 l2_norm<V, R>::operator()(const V& v) const
00102 {
00103 return mln::norm::l2 (v);
00104 }
00105
00106 template <typename V, typename R>
00107 inline
00108 R
00109 linfty_norm<V, R>::operator()(const V& v) const
00110 {
00111 return mln::norm::linfty (v);
00112 }
00113
00114 # endif // ! MLN_INCLUDE_ONLY
00115
00116 }
00117
00118 }
00119
00120 }
00121
00122
00123 #endif // ! MLN_FUN_V2V_NORM_HH