27 #ifndef MLN_MAKE_RELABELFUN_HH
28 # define MLN_MAKE_RELABELFUN_HH
34 # include <mln/core/concept/function.hh>
35 # include <mln/fun/i2v/array.hh>
36 # include <mln/value/next.hh>
54 template <
typename V,
typename F>
71 template <
typename V,
typename F>
78 # ifndef MLN_INCLUDE_ONLY
80 template <
typename V,
typename F>
87 mln_trace(
"make::relabelfun");
89 const F& fv2b =
exact(fv2b_);
94 for (V i = 1; i < nlabels_i; ++i)
96 fi2v(i) = ++tmp_nlabels;
97 new_nlabels = tmp_nlabels;
102 template <
typename V,
typename F>
109 mln_trace(
"make::relabelfun");
111 const F& fv2v =
exact(fv2v_);
115 util::array<V> new_labels(nlabels_i, mln_max(V));
118 fun::i2v::array<V> fi2v(nlabels_i, mln_max(V));
121 for (V i = 1; i < nlabels_i; ++i)
123 mln_assertion(fv2v(i) <= nlabels);
124 if (new_labels(fv2v(i)) == mln_max(V))
126 new_labels(fv2v(i)) = ++tmp_nlabels;
127 fi2v(i) = tmp_nlabels;
130 fi2v(i) = new_labels(fv2v(i));
132 new_nlabels = tmp_nlabels;
136 # endif // ! MLN_INCLUDE_ONLY
143 #endif // ! MLN_MAKE_RELABELFUN_HH