00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __CORRELATIONS_H__
00025 #define __CORRELATIONS_H__
00026
00033 #include <iterator>
00034 #include <functional>
00035 #include <Sequence/ensureFloating.hpp>
00036 #include <Sequence/Portability/random_shuffle.hpp>
00037 namespace Sequence
00038 {
00039 struct ProductMoment
00046 {
00047 template<typename iter1, typename iter2>
00048 typename ensureFloating<typename std::iterator_traits<iter1>::value_type,
00049 typename std::iterator_traits<iter2>::value_type>::type
00050 operator()(iter1 beg_x,iter1 end_x, iter2 beg_y) const;
00051 };
00052
00053 struct SpearmansRank
00059 {
00060 template<typename iter1,typename iter2>
00061 typename ensureFloating<typename std::iterator_traits<iter1>::value_type,
00062 typename std::iterator_traits<iter2>::value_type>::type
00063 operator()(iter1 beg_x,iter1 end_x, iter2 beg_y) const;
00064 };
00065
00066 template<typename iter1, typename iter2,
00067 typename correlation_type,
00068 typename comparison_function,
00069 typename UniformIntGenerator>
00070 typename ensureFloating<typename std::iterator_traits<iter1>::value_type,
00071 typename std::iterator_traits<iter2>::value_type>::type
00072 PermuteCorrelation(iter1 beg_x, iter1 end_x, iter2 beg_y,
00073 const correlation_type & c,
00074 const comparison_function & comp,
00075 UniformIntGenerator & rand,
00076 const unsigned & NPERM=10000);
00077
00078 template<typename iter1, typename iter2,
00079 typename correlation_type,
00080 typename comparison_function,
00081 typename UniformIntGenerator>
00082 typename ensureFloating<typename std::iterator_traits<iter1>::value_type,
00083 typename std::iterator_traits<iter2>::value_type>::type
00084 PermuteCorrelation(iter1 beg_x, iter1 end_x, iter2 beg_y,
00085 const correlation_type & c,
00086 const comparison_function & comp,
00087 const UniformIntGenerator & rand,
00088 const unsigned & NPERM=10000);
00089
00090 }
00091 #include <Sequence/bits/Correlations.tcc>
00092 #endif