Medusa  1.1
Coordinate Free Mehless Method implementation
ScaleFunction.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_APPROXIMATIONS_SCALEFUNCTION_HPP_
2 #define MEDUSA_BITS_APPROXIMATIONS_SCALEFUNCTION_HPP_
3 
11 #include <medusa/Config.hpp>
13 #include <iosfwd>
14 
15 namespace mm {
16 
24  public:
26  template<typename vec_t>
27  static inline typename vec_t::scalar_t scale(const vec_t& p,
28  const std::vector<vec_t>& support) {
29  return (p - support[1]).norm();
30  }
32  inline friend std::ostream& operator<<(std::ostream& os, const ScaleToClosest& /* scale */) {
33  return os << "ScaleToClosest";
34  }
35 };
36 
44  public:
46  template<typename vec_t>
47  static inline typename vec_t::scalar_t scale(const vec_t& p,
48  const std::vector<vec_t>& support) {
49  return (p - support.back()).norm();
50  }
52  inline friend std::ostream& operator<<(std::ostream& os, const ScaleToFarthest& /* scale */) {
53  return os << "ScaleToFarthest";
54  }
55 };
56 
63 class NoScale {
64  public:
65  template<typename vec_t>
67  static inline typename vec_t::scalar_t scale(
68  const vec_t& /* p */, const std::vector<vec_t>& /* support */) { return 1.0; }
70  inline friend std::ostream& operator<<(std::ostream& os, const NoScale& /* scale */) {
71  return os << "NoScale";
72  }
73 };
74 
75 } // namespace mm
76 
77 #endif // MEDUSA_BITS_APPROXIMATIONS_SCALEFUNCTION_HPP_
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::ScaleToFarthest::scale
static vec_t::scalar_t scale(const vec_t &p, const std::vector< vec_t > &support)
Returns local scale of given point and its support.
Definition: ScaleFunction.hpp:47
scalar_t
Scalar scalar_t
Type of the elements, alias of Scalar.
Definition: MatrixBaseAddons.hpp:16
mm::ScaleToClosest::operator<<
friend std::ostream & operator<<(std::ostream &os, const ScaleToClosest &)
Print information about this scale function.
Definition: ScaleFunction.hpp:32
mm::ScaleToClosest
Scale function that scales to the closest neighbor.
Definition: ScaleFunction.hpp:23
mm::NoScale::operator<<
friend std::ostream & operator<<(std::ostream &os, const NoScale &)
Print information about this scale function.
Definition: ScaleFunction.hpp:70
mm::ScaleToFarthest::operator<<
friend std::ostream & operator<<(std::ostream &os, const ScaleToFarthest &)
Print information about this scale function.
Definition: ScaleFunction.hpp:52
mm::ScaleToFarthest
Scale function that scales to the farthest neighbor.
Definition: ScaleFunction.hpp:43
Config.hpp
mm::NoScale
Scale function that indicates no scaling is performed.
Definition: ScaleFunction.hpp:63
mm::ScaleToClosest::scale
static vec_t::scalar_t scale(const vec_t &p, const std::vector< vec_t > &support)
Returns local scale of given point and its support.
Definition: ScaleFunction.hpp:27
Range.hpp
mm::NoScale::scale
static vec_t::scalar_t scale(const vec_t &, const std::vector< vec_t > &)
Returns local scale of given point and its support.
Definition: ScaleFunction.hpp:67