31 template<
typename InputIterator,
typename T = value_type_i<InputIterator>>
32 T
norm(InputIterator first, InputIterator last, T init = T{})
34 const auto max_abs = [](
const T left,
const T right) -> T
36 return std::max(left, std::abs(right));
38 return std::accumulate(first, last, init, max_abs);
44 template<
typename Container,
typename T = value_type<Container>>
45 T
norm(
const Container& a, T init = T{})
49 return norm(begin(a), end(a), init);
55 template<
typename InputIterator,
typename T = value_type_i<InputIterator>>
56 T
squared_norm(InputIterator first, InputIterator last, T init = T{})
58 const auto n =
norm(first, last, init);
65 template<
typename Container,
typename T = value_type<Container>>
76 template<
typename InputIterator1,
typename InputIterator2,
typename T = value_type_i<InputIterator1>>
77 T
distance(InputIterator1 first_left, InputIterator1 last_left, InputIterator2 first_right, T init = T{})
79 auto op1 = [](
const T left,
const T right) -> T
81 return std::max(left, right);
83 auto op2 = [](
const auto left,
const auto right) -> T
85 return std::abs(left - right);
87 return std::inner_product(first_left, last_left, first_right, init, op1, op2);
94 template<
typename Container1,
typename Container2,
typename T = value_type<Container1>>
95 T
distance(
const Container1& left,
const Container2& right, T init = T{})
97 assert(left.size() == right.size());
100 return distance(begin(left), end(left), begin(right), init);
106 template<
typename InputIterator1,
typename InputIterator2,
typename T = value_type_i<InputIterator1>>
107 T
squared_distance(InputIterator1 first_left, InputIterator1 last_left, InputIterator2 first_right, T init = T{})
109 const auto d =
distance(first_left, last_left, first_right, init);
117 template<
typename Container1,
typename Container2,
typename T = value_type<Container1>>
120 assert(left.size() == right.size());
T squared_norm(const Container &a, T init=T{})
Definition: maximum_space.hpp:66
T norm(const Container &a, T init=T{})
Definition: maximum_space.hpp:45
T squared_distance(const Container1 &left, const Container2 &right, T init=T{})
Definition: maximum_space.hpp:118
T distance(const Container1 &left, const Container2 &right, T init=T{})
Definition: maximum_space.hpp:95