76 #ifndef SLIP_COMPARE_HPP
77 #define SLIP_COMPARE_HPP
145 template<
typename Real,
146 typename InputIterator1,
147 typename InputIterator2,
148 typename BinaryFunctor>
151 InputIterator1 last1,
152 InputIterator2 first2,
155 assert(first1 != last1);
157 for (; first1 != last1; ++first1, ++first2)
205 template<
typename Real,
206 typename InputIterator1,
207 typename InputIterator2,
208 typename BinaryFunctor,
209 typename MaskIterator>
212 InputIterator1 last1,
213 MaskIterator mask_first,
214 InputIterator2 first2,
216 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1)
219 assert(first1 != last1);
221 for (; first1 != last1; ++first1, ++first2,++mask_first)
223 if(*mask_first == value)
274 template<
typename Real,
275 typename InputIterator1,
276 typename InputIterator2,
277 typename BinaryFunctor,
281 InputIterator2 first2,
282 BinaryFunctor distance,
285 assert(first1 != last1);
287 for (; first1 != last1; ++first1, ++first2)
337 template<
typename InputIterator1,
338 typename InputIterator2,
339 typename OutputIterator,
340 typename BinaryFunctor>
343 InputIterator1 last1,
344 InputIterator2 first2,
345 OutputIterator result,
346 BinaryFunctor distance)
348 assert(first1 != last1);
349 std::transform(first1,last1,first2,result,distance);
396 template<
typename InputIterator1,
397 typename InputIterator2,
398 typename MaskIterator,
399 typename OutputIterator,
400 typename BinaryFunctor>
403 InputIterator1 last1,
404 MaskIterator mask_first,
405 InputIterator2 first2,
406 OutputIterator result,
407 BinaryFunctor distance,
408 typename std::iterator_traits<MaskIterator>::value_type
409 value=
typename std::iterator_traits<MaskIterator>::value_type(1))
411 assert(first1 != last1);
461 template<
typename _InputIterator1,
462 typename _InputIterator2,
463 typename _OutputIterator,
464 typename _BinaryOperation,
469 _InputIterator2 first2,
470 _OutputIterator result,
471 _BinaryOperation distance,
474 assert(first1 != last1);
505 template<
typename Value_T,
typename InputIterator1,
typename InputIterator2>
508 InputIterator1 last1,
509 InputIterator2 first2)
511 assert(first1 != last1);
512 Value_T init = Value_T(0);
513 Value_T count = Value_T(0);
514 for (; first1 != last1; ++first1, ++first2)
516 init = init + (*first1 - *first2) * (*first1 - *first2);
550 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
554 InputIterator1 last1,
555 MaskIterator mask_first,
556 InputIterator2 first2,
557 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
560 assert(first1 != last1);
562 Real count = Real(0);
563 for (; first1 != last1; ++first1, ++first2,++mask_first)
565 if(*mask_first == value)
567 init = init + (*first1 - *first2) * (*first1 - *first2);
605 template<
typename Real,
606 typename InputIterator1,
607 typename InputIterator2,
611 InputIterator2 first2,
614 assert(first1 != last1);
616 Real count = Real(0);
617 for (; first1 != last1; ++first1, ++first2)
621 init = init + (*first1 - *first2) * (*first1 - *first2);
651 template<
typename Value_T,
typename InputIterator1,
typename InputIterator2>
654 InputIterator1 last1,
655 InputIterator2 first2)
657 assert(first1 != last1);
658 Value_T init = Value_T(0);
659 Value_T count = Value_T(0);
660 for (; first1 != last1; ++first1, ++first2)
662 init = init +
std::abs(*first1 - *first2);
696 template<
typename Value_T,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
699 InputIterator1 last1,
700 MaskIterator mask_first,
701 InputIterator2 first2,
702 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
705 assert(first1 != last1);
706 Value_T init = Value_T(0);
707 Value_T count = Value_T(0);
708 for (; first1 != last1; ++first1, ++first2,++mask_first)
710 if(*mask_first == value)
712 init = init +
std::abs(*first1 - *first2);
751 template<
typename Real,
752 typename InputIterator1,
753 typename InputIterator2,
757 InputIterator2 first2,
760 assert(first1 != last1);
762 Real count = Real(0);
763 for (; first1 != last1; ++first1, ++first2)
767 init = init +
std::abs(*first1 - *first2);
797 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
799 Real
snr(InputIterator1 first1,
800 InputIterator1 last1,
801 InputIterator2 first2)
803 assert(first1 != last1);
805 Real s_variance = Real(0);
806 Real sb_variance = Real(0);
808 for (; first1 != last1; ++first1, ++first2)
810 s_variance = s_variance + ((*first1) * (*first1));
811 sb_variance = sb_variance + (*first1 - *first2) * (*first1 - *first2);
813 return (s_variance / sb_variance);
843 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
846 InputIterator1 last1,
847 MaskIterator mask_first,
848 InputIterator2 first2,
849 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
852 assert(first1 != last1);
854 Real s_variance = Real(0);
855 Real sb_variance = Real(0);
857 for (; first1 != last1; ++first1, ++first2,++mask_first)
859 if(*mask_first == value)
861 s_variance = s_variance + ((*first1) * (*first1));
862 sb_variance = sb_variance + (*first1 - *first2) * (*first1 - *first2);
865 return (s_variance / sb_variance);
898 template<
typename Real,
899 typename InputIterator1,
900 typename InputIterator2,
903 Real
snr_if(InputIterator1 first1, InputIterator1 last1,
904 InputIterator2 first2,
907 assert(first1 != last1);
909 Real s_variance = Real(0);
910 Real sb_variance = Real(0);
912 for (; first1 != last1; ++first1, ++first2)
916 s_variance = s_variance + ((*first1) * (*first1));
917 sb_variance = sb_variance + (*first1 - *first2) * (*first1 - *first2);
920 return (s_variance / sb_variance);
946 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
949 InputIterator1 last1,
950 InputIterator2 first2)
952 return 20.0 *
std::log10(slip::snr<Real>(first1,last1,first2));
982 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
985 InputIterator1 last1,
986 MaskIterator mask_first,
987 InputIterator2 first2,
988 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
990 return 20.0 *
std::log10(slip::snr_mask<Real>(first1,last1,mask_first,first2,value));
1022 template<
typename Real,
1023 typename InputIterator1,
1024 typename InputIterator2,
1028 InputIterator2 first2,
1031 return 20.0 *
std::log10(slip::snr_if<Real>(first1,last1,first2,pred));
1057 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1060 InputIterator1 last1,
1061 InputIterator2 first2)
1063 assert(first1 != last1);
1064 Real init = Real(0);
1065 for (; first1 != last1; ++first1, ++first2)
1067 init += (*first1 - *first2) * (*first1 - *first2);
1099 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1102 InputIterator1 last1,
1103 MaskIterator mask_first,
1104 InputIterator2 first2,
1105 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1)
1108 assert(first1 != last1);
1109 Real init = Real(0);
1110 for (; first1 != last1; ++first1, ++first2,++mask_first)
1112 if(*mask_first == value)
1114 init += (*first1 - *first2) * (*first1 - *first2);
1151 template<
typename Real,
1152 typename InputIterator1,
1153 typename InputIterator2,
1157 InputIterator2 first2,
1160 assert(first1 != last1);
1161 Real init = Real(0);
1162 for (; first1 != last1; ++first1, ++first2)
1166 init += (*first1 - *first2) * (*first1 - *first2);
1195 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1198 InputIterator1 last1,
1199 InputIterator2 first2)
1201 return std::sqrt(slip::L22_distance<Real>(first1,last1,first2));
1232 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1235 InputIterator1 last1,
1236 MaskIterator mask_first,
1237 InputIterator2 first2,
1239 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
1241 return std::sqrt(slip::L22_distance_mask<Real>(first1,last1,mask_first,first2,value));
1276 template<
typename Real,
1277 typename InputIterator1,
1278 typename InputIterator2,
1282 InputIterator2 first2,
1285 return std::sqrt(slip::L22_distance_if<Real>(first1,last1,first2,pred));
1311 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1314 InputIterator1 last1,
1315 InputIterator2 first2)
1317 assert(first1 != last1);
1318 Real init = Real(0);
1319 for (; first1 != last1; ++first1, ++first2)
1321 init +=
std::abs(*first1 - *first2) ;
1353 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1356 InputIterator1 last1,
1357 MaskIterator mask_first,
1358 InputIterator2 first2,
1359 typename std::iterator_traits<MaskIterator>::value_type value=
typename
1360 std::iterator_traits<MaskIterator>::value_type(1))
1362 assert(first1 != last1);
1363 Real init = Real(0);
1364 for (; first1 != last1; ++first1, ++first2,++mask_first)
1366 if(*mask_first == value)
1368 init +=
std::abs(*first1 - *first2) ;
1407 template<
typename Real,
1408 typename InputIterator1,
1409 typename InputIterator2,
1413 InputIterator2 first2,
1416 assert(first1 != last1);
1417 Real init = Real(0);
1418 for (; first1 != last1; ++first1, ++first2)
1422 init +=
std::abs(*first1 - *first2) ;
1455 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1458 InputIterator1 first1,
1459 InputIterator1 last1,
1460 InputIterator2 first2)
1462 assert(first1 != last1);
1464 Real init = Real(0);
1466 Real tmp2 = Real(1);
1468 for (; first1 != last1; ++first1, ++first2)
1472 for (std::size_t i = 0; i < n; ++i){
1478 return std::pow(init,1/Real(n));
1510 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1513 InputIterator1 first1,
1514 InputIterator1 last1,
1515 MaskIterator mask_first,
1516 InputIterator2 first2,
1517 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
1520 assert(first1 != last1);
1522 Real init = Real(0);
1524 Real tmp2 = Real(1);
1526 for (; first1 != last1; ++first1, ++first2,++mask_first)
1528 if(*mask_first == value)
1532 for (std::size_t i = 0; i < n; ++i)
1540 return std::pow(init,1/Real(n));
1576 template<
typename Real,
1577 typename InputIterator1,
1578 typename InputIterator2,
1582 InputIterator1 first1,
1583 InputIterator1 last1,
1584 InputIterator2 first2,
1587 assert(first1 != last1);
1589 Real init = Real(0);
1591 Real tmp2 = Real(1);
1593 for (; first1 != last1; ++first1, ++first2)
1599 for (std::size_t i = 0; i < n; ++i)
1607 return std::pow(init,1/Real(n));
1634 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1637 InputIterator1 last1,
1638 InputIterator2 first2)
1640 assert(first1 != last1);
1641 Real init = Real(0);
1643 for (; first1 != last1; ++first1, ++first2)
1646 if (tmp > init) init = tmp;
1677 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1680 InputIterator1 last1,
1681 MaskIterator mask_first,
1682 InputIterator2 first2,
1684 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
1686 assert(first1 != last1);
1687 Real init = Real(0);
1689 for (; first1 != last1; ++first1, ++first2,++mask_first)
1691 if(*mask_first == value)
1694 if (tmp > init) init = tmp;
1730 template<
typename Real,
1731 typename InputIterator1,
1732 typename InputIterator2,
1736 InputIterator2 first2,
1739 assert(first1 != last1);
1740 Real init = Real(0);
1742 for (; first1 != last1; ++first1, ++first2)
1778 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1781 InputIterator1 last1,
1782 InputIterator2 first2)
1784 assert(first1 != last1);
1785 Real init = Real(0);
1786 for (; first1 != last1; ++first1, ++first2)
1788 init += (*first1) *
log2((*first1) / (*first2));
1821 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1824 InputIterator1 last1,
1825 MaskIterator mask_first,
1826 InputIterator2 first2,
1827 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
1829 assert(first1 != last1);
1830 Real init = Real(0);
1831 for (; first1 != last1; ++first1, ++first2,++mask_first)
1833 if(*mask_first == value)
1835 init += (*first1) *
log2((*first1) / (*first2));
1873 template<
typename Real,
1874 typename InputIterator1,
1875 typename InputIterator2,
1879 InputIterator1 last1,
1880 InputIterator2 first2,
1883 assert(first1 != last1);
1884 Real init = Real(0);
1885 for (; first1 != last1; ++first1, ++first2)
1889 init += (*first1) *
log2((*first1) / (*first2));
1919 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1922 InputIterator1 last1,
1923 InputIterator2 first2)
1925 assert(first1 != last1);
1926 Real init = Real(0);
1927 for (; first1 != last1; ++first1, ++first2)
1929 init += (*first1 - *first2) * (*first1 - *first2) / (*first1);
1962 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator>
1965 InputIterator1 last1,
1966 MaskIterator mask_first,
1967 InputIterator2 first2,
1968 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1))
1971 assert(first1 != last1);
1972 Real init = Real(0);
1973 for (; first1 != last1; ++first1, ++first2,++mask_first)
1975 if(*mask_first == value)
1977 init += (*first1 - *first2) * (*first1 - *first2) / (*first1);
2015 template<
typename Real,
2016 typename InputIterator1,
2017 typename InputIterator2,
2021 InputIterator1 last1,
2022 InputIterator2 first2,
2025 assert(first1 != last1);
2026 Real init = Real(0);
2027 for (; first1 != last1; ++first1, ++first2)
2031 init += (*first1 - *first2) * (*first1 - *first2) / (*first1);
2063 template<
typename Value_T,
2064 typename InputIterator1,
2065 typename InputIterator2>
2067 Value_T
psnr(InputIterator1 first1,
2068 InputIterator1 last1,
2069 InputIterator2 first2,
2070 Value_T d = static_cast<Value_T>(255))
2073 Value_T d_carre = d*d;
2074 Value_T EQM = slip::mean_square_diff<Value_T>(first1, last1, first2);
2075 Value_T result =
static_cast<Value_T
>(10) *
std::log10(d_carre/EQM);
2107 template<
typename Value_T,
2108 typename InputIterator1,
2109 typename InputIterator2,
2110 typename MaskIterator>
2113 InputIterator1 last1,
2115 InputIterator2 first2,
2116 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1),
2117 Value_T d = static_cast<Value_T>(255))
2119 Value_T d_carre = d*d;
2121 Value_T EQM = slip::mean_square_diff_mask<Value_T>(first1, last1, mask1,first2, value);
2123 Value_T result =
static_cast<Value_T
>(10) *
std::log10(d_carre/EQM);
2158 template<
typename Value_T,
2159 typename InputIterator1,
2160 typename InputIterator2,
2163 Value_T
psnr_if(InputIterator1 first1, InputIterator1 last1,
2164 InputIterator2 first2,
2166 Value_T d = static_cast<Value_T>(255))
2169 Value_T d_carre = d*d;
2171 Value_T EQM = slip::mean_square_diff_if<Value_T>(first1, last1, first2, pred);
2173 Value_T result =
static_cast<Value_T
>(10) *
std::log10(d_carre/EQM);
2218 template<
typename Real,
2219 typename InputIterator1,
2220 typename InputIterator2>
2223 InputIterator1 last1,
2224 InputIterator2 first2,
2225 Real d = static_cast<Real>(255))
2227 Real c1 = d*
static_cast<Real
>(0.01) * d*
static_cast<Real
>(0.01);
2228 Real c2 = d*
static_cast<Real
>(0.03) * d*
static_cast<Real
>(0.03);
2229 Real meanFirst1 = slip::mean<Real>(first1, last1);
2230 Real meanFirst2 = slip::mean<Real>(first2, first2 + (last1 - first1));
2232 Real varFirst2 =
slip::variance(first2, first2 + (last1 - first1), meanFirst2);
2233 Real cov =
slip::covariance(first1, last1, first2, meanFirst1, meanFirst2);
2235 return ((static_cast<Real>(2) * meanFirst1 * meanFirst2 + c1) * (static_cast<Real>(2) * cov + c2)) / (( meanFirst1 * meanFirst1 + meanFirst2 * meanFirst2 + c1) * (varFirst1 * varFirst1 + varFirst2 * varFirst2 + c2));
2283 template<
typename Real,
2284 typename InputIterator1,
2285 typename InputIterator2,
2286 typename MaskIterator>
2289 InputIterator1 last1,
2290 MaskIterator maskFirst,
2291 InputIterator2 first2,
2292 typename std::iterator_traits<MaskIterator>::value_type value=
typename std::iterator_traits<MaskIterator>::value_type(1),
2293 Real d = static_cast<Real>(255) )
2298 Real c1 = d*
static_cast<Real
>(0.01) * d*
static_cast<Real
>(0.01);
2299 Real c2 = d*
static_cast<Real
>(0.03) * d*
static_cast<Real
>(0.03);
2301 Real meanFirst1 = slip::mean_mask<Real>(first1, last1, maskFirst, value);
2302 Real meanFirst2 = slip::mean_mask<Real>(first2, first2 + (last1 - first1), maskFirst, value);
2304 maskFirst, meanFirst1, value);
2306 maskFirst, meanFirst2, value);
2310 meanFirst1, meanFirst2, value);
2312 return ((static_cast<Real>(2) * meanFirst1 * meanFirst2 + c1) * (static_cast<Real>(2) * cov + c2)) / (( meanFirst1 * meanFirst1 + meanFirst2 * meanFirst2 + c1) * (varFirst1 * varFirst1 + varFirst2 * varFirst2 + c2));
2362 template<
typename Real,
2363 typename InputIterator1,
2364 typename InputIterator2,
2368 InputIterator1 last1,
2369 InputIterator2 first2,
2374 Real c1 = d*
static_cast<Real
>(0.01) * d*
static_cast<Real
>(0.01);
2375 Real c2 = d*
static_cast<Real
>(0.03) * d*
static_cast<Real
>(0.03);
2377 Real meanFirst1 = slip::mean_if<Real>(first1, last1, pred);
2378 Real meanFirst2 = slip::mean_if<Real>(first2,first2 + (last1 - first1), pred);
2380 Real varFirst2 =
slip::variance_if(first2, first2 + (last1 - first1), meanFirst2, pred);
2383 return ((2 * meanFirst1 * meanFirst2 + c1) * (2 * cov + c2)) / (( meanFirst1 * meanFirst1 + meanFirst2 * meanFirst2 + c1) * (varFirst1 * varFirst1 + varFirst2 * varFirst2 + c2));
2404 template <
class _Rp,
class _Tp>
2405 struct L1_dist :
public std::binary_function<_Rp, _Tp, _Tp>
2424 template <
class _Rp,
class _Tp>
2425 struct L2_dist :
public std::binary_function<_Rp, _Tp, _Tp>
2445 template <
typename _Rp,
typename _Tp>
2446 struct L22_dist :
public std::binary_function<_Rp, _Tp, _Tp>
2453 return (diff * diff);
2468 template <
typename _Rp,
typename _Tp>
2496 template <
typename _Rp,
typename _Tp>
2526 template <
typename _Rp,
typename _Tp>
2536 return (diff * diff) / (x*x);
2554 template <
typename Vector>
2555 struct L1_dist_vect:
public std::binary_function<typename Vector::value_type, Vector, Vector>
2577 template <
typename Vector>
2578 struct L2_dist_vect:
public std::binary_function<typename Vector::value_type, Vector, Vector>
2600 template <
typename Vector>
2601 struct L22_dist_vect:
public std::binary_function<typename Vector::value_type, Vector, Vector>
2620 #endif //SLIP_COMPARE_HPP
Vector::value_type operator()(const Vector &x, const Vector &y) const
Provides a class to manipulate 2d dynamic and generic arrays.
Real KullbackLeibler_distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the Kullback-Leibler "distance" of two ranges according to a mask sequence : ...
Real L2_distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the eucludian distance of two ranges according to a mask sequence : .
T covariance_mask(InputIterator first, InputIterator last, InputIterator2 first2, MaskIterator mask_first, T mean1, T mean2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the covariance of a two sequences over a mask .
Real KullbackLeibler_distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the Kullback-Leibler "distance" of two ranges according to a Predicate.
Real distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryFunctor distance)
Computes the sum of the pointwise distances of two ranges: according to the distance d...
Real Minkowski_distance(const std::size_t n, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the Minkowski order n distance of two ranges : Use L1 and L2 distance for n=1 or 2...
Real L22_distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the square eucludian distance of two ranges according to a mask sequence : ...
Real snr_dB_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the decibel signal to noise ration (snr) of two ranges according to a predicate: ...
T variance_mask(InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the variance of a range over a mask .
Real Chi2_distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the Chi2 "distance" of two ranges : .
Value_T psnr(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Value_T d=static_cast< Value_T >(255))
Real Minkowski_distance_mask(const std::size_t n, InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the Minkowski order n distance of two ranges according to a mask sequence : ...
_OutputIterator transform_if(_InputIterator first, _InputIterator last, _OutputIterator result, _UnaryOperation unary_op, _Predicate pred)
Perform an operation on a sequence according to a Predicate.
Computes the L1 distance between two Vectors x and y: .
iterator end()
Returns a read/write iterator that points one past the last element in the Vector. Iteration is done in ordinary element order.
Real mean_abs_diff_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the mean absolute difference of two ranges according to a Predicate.
Real L2_distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the Euclidian distance of two ranges : .
Real L1_distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the L1 distance of two ranges according to a mask sequence : .
_OutputIterator transform_mask_bin(_InputIterator1 first1, _InputIterator1 last1, _MaskIterator mask_first, _InputIterator2 first2, _OutputIterator result, _BinaryOperation binary_op, typename std::iterator_traits< _MaskIterator >::value_type value=typename std::iterator_traits< _MaskIterator >::value_type(1))
Perform an operation on corresponding elements of two sequences according to a mask sequence...
Real snr_dB(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the decibel signal to noise ration (snr) of two ranges : .
Real distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, BinaryFunctor distance, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the sum of the pointwise distances of two ranges: according to the distance d and the given...
Computes the L22 distance between two values x and y: .
Real Minkowski_distance_if(const std::size_t n, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the Minkowski order n distance of two ranges according to a Predicate.
Vector::value_type operator()(const Vector &x, const Vector &y) const
Value_T psnr_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask1, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1), Value_T d=static_cast< Value_T >(255))
_Rp operator()(const _Tp &x, const _Tp &y) const
Real snr_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the signal to noise ration (snr) of two ranges according to a Predicate. ...
Value_T psnr_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, Value_T d=static_cast< Value_T >(255))
Real L1_distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the L1 distance of two ranges according to a Predicate.
Real Linf_distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the Linfinite distance of two ranges : .
Real L2_distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the eucludian distance of two ranges according to a Predicate.
HyperVolume< T > abs(const HyperVolume< T > &M)
Provides a class to manipulate 1d dynamic and generic arrays.
Real mean_square_diff_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the mean square of the pointwise difference of two ranges according to a Predicate : ...
unsigned int log2(unsigned int x)
Calculates the log2 of an integer.
Real snr(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the signal to noise ration (snr) of two ranges : .
T variance(InputIterator first, InputIterator last, T mean)
Computes the variance of a range .
Value_T mean_abs_diff(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the mean absolute difference of two range of size N: .
T variance_if(InputIterator first, InputIterator last, T mean, Predicate pred)
Computes the variance of a range using a predicate .
Real snr_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the signal to noise ration (snr) of two ranges according to a mask sequence : ...
Provides some statistics algorithms.
Computes the Relative L22 error between two values x and y: .
Real L22_distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the square eucludian distance of two ranges according to a Predicate.
Value_T mean_abs_diff_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the mean absolute difference of two ranges of size N according to a mask sequence : ...
Numerical Vector class. This container statisfies the RandomAccessContainer concepts of the Standard ...
_Rp operator()(const _Tp &x, const _Tp &y) const
HyperVolume< T > sqrt(const HyperVolume< T > &M)
Provides some extension to STL algorithms.
Real snr_dB_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the decibel signal to noise ration (snr) of two ranges according to a mask sequence : ...
Computes the L1 distance between two values x and y: .
Real Linf_distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the Linfinite distance of two ranges according to a Predicate.
Value_T mean_square_diff(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the mean square of the pointwise difference of two ranges of size N: .
Real SSIM_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator maskFirst, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1), Real d=static_cast< Real >(255))
Computes the structural similarity beetween two data ranges according to a mask range where...
Computes the L1 relative error between two values x and y: .
T covariance_if(InputIterator first, InputIterator last, InputIterator2 first2, T mean1, T mean2, Predicate pred)
Computes the covariance of a two sequences using a predicate on the first one .
HyperVolume< T > log10(const HyperVolume< T > &M)
Computes the L2 distance between two Vectors x and y: .
_Rp operator()(const _Tp &x, const _Tp &y) const
T covariance(InputIterator first, InputIterator last, InputIterator2 first2, T mean1, T mean2)
Computes the covariance of a two sequences .
Real L22_distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the square euclidian distance of two ranges: .
Vector::value_type operator()(const Vector &x, const Vector &y) const
Real Linf_distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the Linfinite distance of two ranges according to a mask sequence : .
Computes the L2 distance between two values x and y: .
Real Chi2_distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the Chi2 "distance" of two ranges according to a Predicate.
Real mean_square_diff_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the mean square of the pointwise difference of two ranges of size N according to a mask sequ...
_Rp operator()(const _Tp &x, const _Tp &y) const
Real distance_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryFunctor distance, Predicate pred)
Computes the sum of the pointwise distances of two ranges: according to the distance d and the given...
Real SSIM_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, Real d=255)
Computes the Sructural SIMilarity (SSIM) beetween two data ranges according to a predicate where...
Real SSIM(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Real d=static_cast< Real >(255))
Computes the Structural SIMilarity (SSIM) beetween two data ranges where.
Real Chi2_distance_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the Chi2 "distance" of two ranges according to a mask sequence : .
Computes the L2 relative error between two values x and y: .
Computes the L22 distance between two Vectors x and y: .
_Rp operator()(const _Tp &x, const _Tp &y) const
_Rp operator()(const _Tp &x, const _Tp &y) const
Real L1_distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the L1 distance of two ranges : .
Provides a class to manipulate numerical vectors.
iterator begin()
Returns a read/write iterator that points to the first element in the Vector. Iteration is done in or...
Real KullbackLeibler_distance(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
Computes the Kullback-Leibler "distance" of two ranges : .