- Timestamp:
- Jan 18, 2008, 11:13:13 PM (15 years ago)
- Location:
- trunk/yat
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/Makefile.am
r1000 r1003 6 6 # Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson 7 7 # Copyright (C) 2007 Jari Häkkinen, Peter Johansson 8 # Copyright (C) 2008 Peter Johansson 8 9 # 9 10 # This file is part of the yat library, http://trac.thep.lu.se/yat … … 29 30 libstatistics_la_SOURCES = AUC.cc Averager.cc AveragerPair.cc \ 30 31 AveragerWeighted.cc AveragerPairWeighted.cc \ 31 Fisher.cc FoldChange.cc Histogram.cc Pearson.cc \ 32 Fisher.cc FoldChange.cc Histogram.cc \ 33 KolmogorovSmirnov.cc Pearson.cc \ 32 34 PearsonCorrelation.cc ROC.cc \ 33 35 SAMScore.cc Score.cc SNRScore.cc tScore.cc tTest.cc \ … … 39 41 AveragerWeighted.h AveragerPairWeighted.h \ 40 42 euclidean_vector_distance.h Fisher.h \ 41 FoldChange.h Histogram.h Pearson.h PearsonCorrelation.h \ 43 FoldChange.h Histogram.h \ 44 KolmogorovSmirnov.h \ 45 Pearson.h PearsonCorrelation.h \ 42 46 pearson_vector_distance.h ROC.h \ 43 47 SAMScore.h Score.h SNRScore.h tScore.h tTest.h \ -
trunk/yat/utility/stl_utility.h
r1000 r1003 36 36 37 37 #include <algorithm> 38 #include <functional> 38 39 #include <ostream> 39 40 #include <string> … … 56 57 namespace yat { 57 58 namespace utility { 59 60 /** 61 Functor class taking absolute value 62 */ 63 template<typename T> 64 struct abs : std::unary_function<T, T> 65 { 66 /** 67 \return absolute value 68 */ 69 inline T operator()(T x) const 70 { return std::abs(x); } 71 }; 72 73 /** 74 See The C++ Standard Library - A Tutorial and Reference by 75 Nicolai M. Josuttis 76 77 If f is a binary functor, both g and h are unary functors, and 78 return type of g (and h) is convertible to F's argument type, 79 then compose_f_gx_hy can be used to create a functor equivalent 80 to \f$ f(g(x), h(y)) \f$ 81 */ 82 template<class F, class G, class H> 83 class compose_f_gx_hy 84 { 85 public: 86 /** 87 \brief Constructor 88 */ 89 compose_f_gx_hy(F f, G g, H h) 90 : f_(f), g_(g), h_(h) {} 91 92 /** 93 \brief Does the work 94 */ 95 bool 96 operator()(double x, 97 double y) const 98 { 99 return f_(g_(x), h_(y)); 100 } 101 102 private: 103 F f_; 104 G g_; 105 H h_; 106 }; 107 108 /** 109 Convenient function to create a compose_f_gx_hy. 110 111 \see std::make_pair 112 */ 113 template<class F, class G, class H> 114 compose_f_gx_hy<F, G, H> make_compose_f_gx_hy(F f, G g, H h) 115 { 116 return compose_f_gx_hy<F,G,H>(f,g,h); 117 } 58 118 59 119 /**
Note: See TracChangeset
for help on using the changeset viewer.