27 #ifndef MLN_ARITH_MIN_HH
28 # define MLN_ARITH_MIN_HH
34 # include <mln/core/concept/image.hh>
38 # include <mln/arith/min.spe.hh>
54 template <
typename L,
typename R>
56 min(const Image<L>& lhs, const Image<R>&
rhs);
66 template <typename L, typename R>
67 void min_inplace(Image<L>& lhs, const Image<R>& rhs);
70 # ifndef MLN_INCLUDE_ONLY
77 template <
typename L,
typename R,
typename O>
79 void min_(
const L& lhs,
const R& rhs, O& output)
81 mln_trace(
"data::arith::generic::min_");
83 mln_piter(L)
p(lhs.domain());
85 output(
p) = lhs(
p) < rhs(
p) ? lhs(
p) : rhs(
p);
88 template <typename L, typename R>
90 void min_inplace_(L& lhs, const R& rhs)
92 mln_trace(
"data::arith::generic::min_inplace_");
94 mln_piter(L) p(lhs.domain());
108 template <typename L, typename R>
110 mln_concrete(L)
min(const Image<L>& lhs, const Image<R>& rhs)
112 mln_trace(
"arith::min");
113 mln_precondition(
exact(rhs).domain() ==
exact(lhs).domain());
115 mln_concrete(L) output;
117 impl::min_(mln_trait_image_speed(L)(),
exact(lhs),
118 mln_trait_image_speed(R)(),
exact(rhs), output);
123 template <typename L, typename R>
125 void min_inplace(Image<L>& lhs, const Image<R>& rhs)
127 mln_trace(
"arith::min_inplace");
129 mln_precondition(
exact(rhs).domain() ==
exact(lhs).domain());
130 impl::min_inplace_(mln_trait_image_speed(L)(),
exact(lhs),
131 mln_trait_image_speed(R)(),
exact(rhs));
135 # endif // ! MLN_INCLUDE_ONLY
142 #endif // ! MLN_ARITH_MIN_HH