75 #ifndef SLIP_NORMS_HPP
76 #define SLIP_NORMS_HPP
110 template<
typename Value_T,
typename InputIterator>
115 assert(first != last);
147 template<
typename Value_T,
typename InputIterator,
typename MaskIterator>
151 MaskIterator mask_first,
152 typename std::iterator_traits<MaskIterator>::value_type value=
typename
153 std::iterator_traits<MaskIterator>::value_type(1))
155 assert(first != last);
157 Value_T __init = Value_T();
158 for (; first != last; ++first,++mask_first)
160 if(*mask_first == value)
162 __init +=(*first)*(*first);
194 template<
typename Value_T,
195 typename InputIterator,
201 assert(first != last);
203 Value_T __init = Value_T();
204 for (; first != last; ++first)
208 __init +=(*first)*(*first);
240 template<
typename Value_T,
typename InputIterator>
245 return std::sqrt(slip::L22_norm<Value_T>(first,last));
272 template<
typename Value_T,
typename InputIterator,
typename MaskIterator>
276 MaskIterator mask_first,
277 typename std::iterator_traits<MaskIterator>::value_type value=
typename
278 std::iterator_traits<MaskIterator>::value_type(1))
280 return std::sqrt(slip::L22_norm_mask<Value_T>(first,last,mask_first,value));
309 template<
typename Value_T,
310 typename InputIterator,
317 return std::sqrt(slip::L22_norm_if<Value_T>(first,last,pred));
345 template<
typename Value_T,
typename InputIterator>
350 return slip::L2_norm<Value_T>(first,last);
378 template<
typename Value_T,
typename InputIterator,
typename MaskIterator>
382 MaskIterator mask_first,
383 typename std::iterator_traits<MaskIterator>::value_type value=
typename
384 std::iterator_traits<MaskIterator>::value_type(1))
386 return slip::L2_norm_mask<Value_T>(first,last,mask_first,value);
415 template<
typename Value_T,
typename InputIterator,
typename Predicate>
421 return slip::L2_norm_if<Value_T>(first,last,pred);
444 template<
typename Value_T,
typename InputIterator>
449 assert(first != last);
451 Value_T __init = Value_T(0);
452 for (; first != last; ++first)
481 template<
typename Value_T,
typename InputIterator,
typename MaskIterator>
485 MaskIterator mask_first,
486 typename std::iterator_traits<MaskIterator>::value_type value=
typename
487 std::iterator_traits<MaskIterator>::value_type(1))
489 assert(first != last);
491 Value_T __init = Value_T(0);
492 for (; first != last; ++first,++mask_first)
494 if(*mask_first == value)
527 template<
typename Value_T,
528 typename InputIterator,
534 assert(first != last);
536 Value_T __init = Value_T(0);
537 for (; first != last; ++first)
566 template<
typename Value_T,
typename InputIterator>
575 InputIterator result = first;
577 while (++first != last)
612 template<
typename Value_T,
typename InputIterator,
typename MaskIterator>
616 MaskIterator mask_first,
617 typename std::iterator_traits<MaskIterator>::value_type value=
typename
618 std::iterator_traits<MaskIterator>::value_type(1))
624 InputIterator result = first;
627 while (++first != last)
629 if(*mask_first==value)
669 template<
typename Value_T,
670 typename InputIterator,
680 InputIterator result = first;
683 while (++first != last)
703 #endif //SLIP_NORMS_HPP
Value_T Euclidean_norm(InputIterator first, InputIterator last)
Computes the Euclidean norm of a range.
Value_T Euclidean_norm_if(InputIterator first, InputIterator last, Predicate pred)
Computes the Euclidean norm a range according to a Predicate.
Value_T L22_norm(InputIterator first, InputIterator last)
Computes the L22 norm ( ) of a range.
Value_T L22_norm_mask(InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the L22 norm of a range according to a mask sequence.
Value_T L22_norm_if(InputIterator first, InputIterator last, Predicate pred)
Computes the L22 norm a range according to a Predicate.
Value_T infinite_norm_if(InputIterator first, InputIterator last, Predicate pred)
Computes the infinite norm a range according to a Predicate.
HyperVolume< T > abs(const HyperVolume< T > &M)
Value_T L1_norm_mask(InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the L1 norm of a range according to a mask sequence.
Value_T L2_norm_mask(InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the Euclidean norm of a range according to a mask sequence.
Value_T Euclidean_norm_mask(InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the Euclidean norm of a range according to a mask sequence.
Value_T infinite_norm(InputIterator first, InputIterator last)
Computes the infinite norm of a range.
Value_T L1_norm(InputIterator first, InputIterator last)
Computes the L1 norm of a range.
Provides some macros which are used for using complex as real.
HyperVolume< T > sqrt(const HyperVolume< T > &M)
Value_T infinite_norm_mask(InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the infinite norm of a range according to a mask sequence.
Value_T L1_norm_if(InputIterator first, InputIterator last, Predicate pred)
Computes the L1 norm a range according to a Predicate.
std::iterator_traits< RandomAccessIterator1 >::value_type inner_product(RandomAccessIterator1 first1, RandomAccessIterator1 last1, RandomAccessIterator2 first2, typename std::iterator_traits< RandomAccessIterator1 >::value_type init=typename std::iterator_traits< RandomAccessIterator1 >::value_type())
Computes the inner_product of two ranges X and Y: .
Value_T L2_norm_if(InputIterator first, InputIterator last, Predicate pred)
Computes the Euclidean norm a range according to a Predicate.
Value_T L2_norm(InputIterator first, InputIterator last)
Computes the L2 norm of a range.