FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
euclidean_norm.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #ifndef MATHTOOLS_EUCLIDEAN_NORM_H
17 #define MATHTOOLS_EUCLIDEAN_NORM_H
18 
19 #include "sqr_euclidean_norm.h"
20 #include <cmath>
21 
22 namespace math {
23 namespace internal {
24 
25 struct EuclideanFunc
26 {
27  template<typename COORD_ITERATOR>
28  static auto fromRange(COORD_ITERATOR begin, COORD_ITERATOR end) -> decltype(typeHelper(*begin))
29  { return std::sqrt(SqrEuclideanFunc::fromRange(begin, end)); }
30 
31  template<std::size_t N, typename COORD_TYPE>
32  static typename NumTraits<COORD_TYPE>::Real fromPtr(const COORD_TYPE* coordPtr)
33  { return std::sqrt(SqrEuclideanFunc::fromPtr<N, COORD_TYPE>(coordPtr)); }
34 };
35 
36 template<> struct NormTraits<internal::EuclideanFunc>
37 {
38  typedef ArityNormSpecializationTag NormCategory;
39 };
40 
41 } // namespace internal
42 
51 
52 } // namespace math
53 
54 #endif // MATHTOOLS_EUCLIDEAN_NORM_H
Computation of norms in K-vector space.
Definition: norm.h:60
Definition: consts.h:18
Norm< math::internal::EuclideanFunc > EuclideanNorm
Provides computation of the euclidean norm
Definition: euclidean_norm.h:50