26 #ifndef MLN_ARITH_MIN_HH
27 # define MLN_ARITH_MIN_HH
33 # include <mln/core/concept/image.hh>
37 # include <mln/arith/min.spe.hh>
53 template <
typename L,
typename R>
55 min(const Image<L>& lhs, const Image<R>& rhs);
65 template <typename L, typename R>
66 void min_inplace(Image<L>& lhs, const Image<R>& rhs);
69 # ifndef MLN_INCLUDE_ONLY
76 template <
typename L,
typename R,
typename O>
78 void min_(
const L& lhs,
const R& rhs, O& output)
80 trace::entering(
"data::arith::generic::min_");
82 mln_piter(L) p(lhs.domain());
84 output(p) = lhs(p) < rhs(p) ? lhs(p) : rhs(p);
86 trace::entering("
data::arith::generic::min_");
89 template <typename L, typename R>
91 void min_inplace_(L& lhs, const R& rhs)
93 trace::entering(
"data::arith::generic::min_inplace_");
95 mln_piter(L) p(lhs.domain());
100 trace::exiting("
data::arith::generic::min_inplace_");
110 template <typename L, typename R>
114 trace::entering(
"arith::min");
115 mln_precondition(exact(rhs).domain() == exact(lhs).domain());
117 mln_concrete(L) output;
119 impl::min_(mln_trait_image_speed(L)(), exact(lhs),
120 mln_trait_image_speed(R)(), exact(rhs), output);
122 trace::exiting(
"arith::min");
126 template <
typename L,
typename R>
130 trace::entering(
"arith::min_inplace");
132 mln_precondition(exact(rhs).domain() == exact(lhs).domain());
133 impl::min_inplace_(mln_trait_image_speed(L)(), exact(lhs),
134 mln_trait_image_speed(R)(), exact(rhs));
136 trace::exiting(
"arith::min_inplace");
139 # endif // ! MLN_INCLUDE_ONLY
146 #endif // ! MLN_ARITH_MIN_HH