URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-19 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Review arith subdirectory and add tests.
* mln/arith/min.hh,
* mln/arith/revert.hh,
* mln/arith/times.hh: Add tracing, and remove specializations.
* mln/arith/min.spe.hh,
* mln/arith/revert.spe.hh,
* mln/arith/times.spe.hh: New specializations file for arith
algorithms.
* tests/Makefile.am,
* tests/arith/Makefile.am: New Makefile for checking tests.
* tests/arith: New subdirectory for arith tests.
* tests/arith_plus.cc: Remove ...
* tests/arith/plus.cc: ... and replace here.
* tests/arith/minus.cc,
* tests/arith/revert.cc,
* tests/arith/times.cc: New tests for arith.
---
mln/arith/min.hh | 39 ++++++----------
mln/arith/min.spe.hh | 112 +++++++++++++++++++++++++++++++++++++++++++++++
mln/arith/revert.hh | 24 +++++-----
mln/arith/revert.spe.hh | 86 ++++++++++++++++++++++++++++++++++++
mln/arith/times.hh | 41 ++++++-----------
mln/arith/times.spe.hh | 114 ++++++++++++++++++++++++++++++++++++++++++++++++
tests/Makefile.am | 1
tests/arith/Makefile.am | 16 ++++++
tests/arith/minus.cc | 60 +++++++++++++++++++++++++
tests/arith/plus.cc | 104 +++++++++++++++++++++++++++++++++++++++++++
tests/arith/revert.cc | 62 ++++++++++++++++++++++++++
tests/arith/times.cc | 60 +++++++++++++++++++++++++
12 files changed, 659 insertions(+), 60 deletions(-)
Index: trunk/milena/tests/arith_plus.cc (deleted)
===================================================================
Index: trunk/milena/tests/arith/minus.cc
===================================================================
--- trunk/milena/tests/arith/minus.cc (revision 0)
+++ trunk/milena/tests/arith/minus.cc (revision 1498)
@@ -0,0 +1,60 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/arith/minus.cc
+ *
+ * \brief Tests on mln::arith::minus.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/arith/minus.hh>
+#include <mln/level/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ // trace::quiet = false;
+
+ {
+ image2d<int> ima(3,3);
+ debug::iota(ima);
+
+ int vs[3][3] = {
+ {0, 1, 2},
+ {3, 4, 5},
+ {6, 7, 8}
+ };
+
+ image2d<int> ref(make::image2d(vs));
+
+ mln_assertion (ima - 1 == ref);
+ }
+
+}
+
Index: trunk/milena/tests/arith/times.cc
===================================================================
--- trunk/milena/tests/arith/times.cc (revision 0)
+++ trunk/milena/tests/arith/times.cc (revision 1498)
@@ -0,0 +1,60 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/arith/times.cc
+ *
+ * \brief Tests on mln::arith::times.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/arith/times.hh>
+#include <mln/level/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ // trace::quiet = false;
+
+ {
+ image2d<int> ima(3,3);
+ debug::iota(ima);
+
+ int vs[3][3] = {
+ { 2, 4, 6},
+ { 8, 10, 12},
+ {14, 16, 18}
+ };
+
+ image2d<int> ref(make::image2d(vs));
+
+ mln_assertion (ima * 2 == ref);
+ }
+
+}
+
Index: trunk/milena/tests/arith/plus.cc
===================================================================
--- trunk/milena/tests/arith/plus.cc (revision 0)
+++ trunk/milena/tests/arith/plus.cc (revision 1498)
@@ -0,0 +1,104 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/arith/plus.cc
+ *
+ * \brief Tests on mln::arith::plus.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/clone.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/arith/plus.hh>
+#include <mln/arith/times.hh>
+#include <mln/level/compare.hh>
+#include <mln/fun/v2v/cast.hh>
+
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ // trace::quiet = false;
+
+ {
+ image2d<int> ref(3,3);
+ debug::iota(ref);
+
+ image2d<int> ima_i = clone(ref);
+ ima_i += ima_i;
+ mln_assertion(ima_i == 2 * ref);
+
+ debug::println(ima_i);
+ ima_i += 1;
+ debug::println(ima_i);
+
+ image2d<float> ima_f(3,3);
+ debug::iota(ima_f);
+ debug::println(ima_i + ima_f);
+
+ point2d p(0, 0);
+ std::cout << arith::plus<float>(ima_i, ima_i)(p) / 5 << std::endl;
+ }
+
+}
+
+
+
+// Bench:
+
+// {
+// unsigned size = 5000;
+// image2d<unsigned char> ima_uc(size, size);
+// image2d<unsigned> ima_u;
+// ima_u = 2u + ima_uc;
+// }
+// {
+// unsigned size = 5000;
+// image2d<value::int_u8> ima_uc(size, size);
+// image2d<unsigned> ima_u;
+// ima_u = 2u + ima_uc;
+// }
+
+// {
+// unsigned size = 5000;
+// image2d<unsigned char> ima_uc(size, size);
+// image2d<unsigned> ima_u;
+// ima_u = ima_uc + ima_uc;
+// }
+// {
+// unsigned size = 5000;
+// image2d<value::int_u8> ima_u8(size, size);
+// image2d<unsigned> ima_u;
+// ima_u = ima_u8 + ima_u8;
+// }
+
Index: trunk/milena/tests/arith/Makefile.am
===================================================================
--- trunk/milena/tests/arith/Makefile.am (revision 0)
+++ trunk/milena/tests/arith/Makefile.am (revision 1498)
@@ -0,0 +1,16 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ minus \
+ plus \
+ revert \
+ times
+
+minus_SOURCES = minus.cc
+plus_SOURCES = plus.cc
+revert_SOURCES = revert.cc
+times_SOURCES = times.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/arith/revert.cc
===================================================================
--- trunk/milena/tests/arith/revert.cc (revision 0)
+++ trunk/milena/tests/arith/revert.cc (revision 1498)
@@ -0,0 +1,62 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/arith/revert.cc
+ *
+ * \brief Tests on mln::arith::revert.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/arith/revert.hh>
+#include <mln/level/compare.hh>
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ // trace::quiet = false;
+
+ {
+ image2d<int> ima(3,3);
+ debug::iota(ima);
+
+ int vs[3][3] = {
+ { -2, -3, -4},
+ { -5, -6, -7},
+ { -8, -9, -10}
+ };
+
+ image2d<int> ref(make::image2d(vs));
+ arith::revert_inplace(ima);
+
+ mln_assertion (ima == ref);
+ }
+
+}
+
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1497)
+++ trunk/milena/tests/Makefile.am (revision 1498)
@@ -4,6 +4,7 @@
SUBDIRS = norm \
level \
+ arith \
border
check_PROGRAMS = \
Index: trunk/milena/mln/arith/times.hh
===================================================================
--- trunk/milena/mln/arith/times.hh (revision 1497)
+++ trunk/milena/mln/arith/times.hh (revision 1498)
@@ -38,6 +38,9 @@
# include <mln/arith/includes.hh>
+// Specializations are in:
+# include <mln/arith/times.spe.hh>
+
namespace mln
{
@@ -181,47 +184,35 @@
namespace impl
{
+ namespace generic
+ {
+
template <typename L, typename R, typename O>
- void times_(trait::image::speed::any, const L& lhs,
- trait::image::speed::any, const R& rhs,
- trait::image::speed::any, O& output)
+ void times_(const L& lhs, const R& rhs, O& output)
{
+ trace::entering("arith::impl::generic::times_");
+
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) * rhs(p);
- }
- template <typename L, typename R, typename O>
- void times_(trait::image::speed::fastest, const L& lhs,
- trait::image::speed::fastest, const R& rhs,
- trait::image::speed::fastest, O& output)
- {
- mln_pixter(const L) lp(lhs);
- mln_pixter(const R) rp(rhs);
- mln_pixter(O) op(output);
- for_all_3(lp, rp, op)
- op.val() = lp.val() * rp.val();
+ trace::exiting("arith::impl::generic::times_");
}
template <typename L, typename R>
- void times_inplace_(trait::image::speed::any, L& lhs,
- trait::image::speed::any, const R& rhs)
+ void times_inplace_(L& lhs, const R& rhs)
{
+ trace::entering("arith::impl::generic::times_inplace_");
+
mln_piter(R) p(rhs.domain());
for_all(p)
lhs(p) *= rhs(p);
- }
- template <typename L, typename R>
- void times_inplace_(trait::image::speed::fastest, L& lhs,
- trait::image::speed::fastest, const R& rhs)
- {
- mln_pixter(L) lp(lhs);
- mln_pixter(const R) rp(rhs);
- for_all_2(rp, lp)
- lp.val() *= rp.val();
+ trace::exiting("arith::impl::generic::times_inplace_");
}
+ } // end of namespace mln::arith::impl::generic
+
} // end of namespace mln::arith::impl
Index: trunk/milena/mln/arith/min.hh
===================================================================
--- trunk/milena/mln/arith/min.hh (revision 1497)
+++ trunk/milena/mln/arith/min.hh (revision 1498)
@@ -36,6 +36,9 @@
# include <mln/core/concept/image.hh>
+// Specializations are in:
+# include <mln/arith/min.spe.hh>
+
namespace mln
{
@@ -71,47 +74,35 @@
namespace impl
{
+ namespace generic
+ {
template <typename L, typename R, typename O>
- void min_(trait::image::speed::any, const L& lhs,
- trait::image::speed::any, const R& rhs, O& output)
+ void min_(const L& lhs, const R& rhs, O& output)
{
+ trace::entering("level::arith::generic::min_");
+
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) < rhs(p) ? lhs(p) : rhs(p);
- }
- template <typename L, typename R, typename O>
- void min_(trait::image::speed::fastest, const L& lhs,
- trait::image::speed::fastest, const R& rhs, O& output)
- {
- mln_pixter(const L) lp(lhs);
- mln_pixter(const R) rp(rhs);
- mln_pixter(O) op(output);
- for_all_3(lp, rp, op)
- op.val() = lp.val() < rp.val() ? lp.val() : rp.val();
+ trace::entering("level::arith::generic::min_");
}
template <typename L, typename R>
- void min_inplace_(trait::image::speed::any, L& lhs,
- trait::image::speed::any, const R& rhs)
+ void min_inplace_(L& lhs, const R& rhs)
{
+ trace::entering("level::arith::generic::min_inplace_");
+
mln_piter(L) p(lhs.domain());
for_all(p)
if (rhs(p) < lhs(p))
lhs(p) = rhs(p);
- }
- template <typename L, typename R>
- void min_inplace_(trait::image::speed::fastest, L& lhs,
- trait::image::speed::fastest, const R& rhs)
- {
- mln_pixter(L) lp(lhs);
- mln_pixter(const R) rp(rhs);
- for_all_2(lp, rp)
- if (rp.val() < lp.val())
- lp.val() = rp.val();
+ trace::exiting("level::arith::generic::min_inplace_");
}
+ } // end of namespace mln::arith::impl::generic
+
} // end of namespace mln::arith::impl
Index: trunk/milena/mln/arith/times.spe.hh
===================================================================
--- trunk/milena/mln/arith/times.spe.hh (revision 0)
+++ trunk/milena/mln/arith/times.spe.hh (revision 1498)
@@ -0,0 +1,114 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ARITH_TIMES_SPE_HH
+# define MLN_ARITH_TIMES_SPE_HH
+
+/*! \file mln/arith/times.spe.hh
+ *
+ * \brief Specializations for mln::arith::times.
+ *
+ */
+
+# include <mln/arith/includes.hh>
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace arith
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename L, typename R, typename O>
+ void times_(const L& lhs, const R& rhs, O& output);
+
+ template <typename L, typename R>
+ void times_inplace_(L& lhs, const R& rhs);
+
+ }
+
+ template <typename L, typename R, typename O>
+ void times_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs,
+ trait::image::speed::any, O& output)
+ {
+ generic::times_(lhs, rhs, output);
+ }
+
+ template <typename L, typename R, typename O>
+ void times_(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs,
+ trait::image::speed::fastest, O& output)
+ {
+ trace::entering("arith::impl::times_");
+
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
+ for_all_3(lp, rp, op)
+ op.val() = lp.val() * rp.val();
+
+ trace::exiting("arith::impl::times_");
+ }
+
+ template <typename L, typename R>
+ void times_inplace_(trait::image::speed::any, L& lhs,
+ trait::image::speed::any, const R& rhs)
+ {
+ generic::times_inplace_(lhs, rhs);
+ }
+
+ template <typename L, typename R>
+ void times_inplace_(trait::image::speed::fastest, L& lhs,
+ trait::image::speed::fastest, const R& rhs)
+ {
+ trace::entering("arith::impl::times_inplace_");
+
+ mln_pixter(L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ for_all_2(rp, lp)
+ lp.val() *= rp.val();
+
+ trace::exiting("arith::impl::times_inplace_");
+ }
+
+ } // end of namespace mln::arith::impl
+
+ } // end of namespace mln::arith
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // ! MLN_ARITH_TIMES_SPE_HH
Index: trunk/milena/mln/arith/revert.hh
===================================================================
--- trunk/milena/mln/arith/revert.hh (revision 1497)
+++ trunk/milena/mln/arith/revert.hh (revision 1498)
@@ -38,11 +38,14 @@
# include <mln/core/concept/image.hh>
# include <mln/value/props.hh>
+// Specializations are in:
+# include <mln/arith/revert.spe.hh>
+
+
// FIXME: Rely instead on mln/fun/v2v/revert.hh.
// FIXME: Revert on int value 0 does not give 0 (since min != - max; idem for float
etc.)
-
namespace mln
{
@@ -83,25 +86,24 @@
namespace impl
{
+ namespace generic
+ {
+
template <typename I, typename O>
- void revert_(trait::image::speed::any, const I& input, O& output)
+ void revert_(const I& input, O& output)
{
+ trace::entering("arith::impl::generic::revert_");
+
typedef mln_value(I) V;
mln_piter(I) p(input.domain());
for_all(p)
output(p) = mln_min(V) + (mln_max(V) - input(p));
- }
- template <typename I, typename O>
- void revert_(trait::image::speed::fastest, const I& input, O& output)
- {
- typedef mln_value(I) V;
- mln_pixter(const I) ip(input);
- mln_pixter(O) op(output);
- for_all_2(ip, op)
- op.val() = mln_min(V) + (mln_max(V) - ip.val());
+ trace::exiting("arith::impl::generic::revert_");
}
+ } // end of namespace mln::arith::impl::generic
+
} // end of namespace mln::arith::impl
Index: trunk/milena/mln/arith/min.spe.hh
===================================================================
--- trunk/milena/mln/arith/min.spe.hh (revision 0)
+++ trunk/milena/mln/arith/min.spe.hh (revision 1498)
@@ -0,0 +1,112 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ARITH_MIN_SPE_HH
+# define MLN_ARITH_MIN_SPE_HH
+
+/*! \file mln/arith/min.spe.hh
+ *
+ * \brief Specializations for mln::arith::min.
+ */
+
+# include <mln/core/concept/image.hh>
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace arith
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename L, typename R, typename O>
+ void min_(const L& lhs, const R& rhs, O& output);
+
+ template <typename L, typename R>
+ void min_inplace_(L& lhs, const R& rhs);
+
+ }
+
+ template <typename L, typename R, typename O>
+ void min_(trait::image::speed::any, const L& lhs,
+ trait::image::speed::any, const R& rhs, O& output)
+ {
+ generic::min_(lhs, rhs, output);
+ }
+
+
+ template <typename L, typename R, typename O>
+ void min_(trait::image::speed::fastest, const L& lhs,
+ trait::image::speed::fastest, const R& rhs, O& output)
+ {
+ trace::entering("level::arith::min_");
+
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
+ for_all_3(lp, rp, op)
+ op.val() = lp.val() < rp.val() ? lp.val() : rp.val();
+
+ trace::exiting("level::arith::min_");
+ }
+
+ template <typename L, typename R>
+ void min_inplace_(trait::image::speed::any, L& lhs,
+ trait::image::speed::any, const R& rhs)
+ {
+ generic::min_inplace_(lhs, rhs);
+ }
+
+ template <typename L, typename R>
+ void min_inplace_(trait::image::speed::fastest, L& lhs,
+ trait::image::speed::fastest, const R& rhs)
+ {
+ trace::entering("level::arith::min_inplace_");
+
+ mln_pixter(L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ for_all_2(lp, rp)
+ if (rp.val() < lp.val())
+ lp.val() = rp.val();
+
+ trace::exiting("level::arith::min_inplace_");
+ }
+
+ } // end of namespace mln::arith::impl
+
+ } // end of namespace mln::arith
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // ! MLN_ARITH_MIN_SPE_HH
Index: trunk/milena/mln/arith/revert.spe.hh
===================================================================
--- trunk/milena/mln/arith/revert.spe.hh (revision 0)
+++ trunk/milena/mln/arith/revert.spe.hh (revision 1498)
@@ -0,0 +1,86 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ARITH_REVERT_SPE_HH
+# define MLN_ARITH_REVERT_SPE_HH
+
+/*! \file mln/arith/revert.spe.hh
+ *
+ * \brief Specializations for mln::arith::revert.
+ *
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/value/props.hh>
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace arith
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename I, typename O>
+ void revert_(const I& input, O& output);
+ }
+
+ template <typename I, typename O>
+ void revert_(trait::image::speed::any, const I& input, O& output)
+ {
+ generic::revert_(input, output);
+ }
+
+ template <typename I, typename O>
+ void revert_(trait::image::speed::fastest, const I& input, O& output)
+ {
+ trace::entering("arith::impl::revert_");
+
+ typedef mln_value(I) V;
+ mln_pixter(const I) ip(input);
+ mln_pixter(O) op(output);
+ for_all_2(ip, op)
+ op.val() = mln_min(V) + (mln_max(V) - ip.val());
+
+ trace::entering("arith::impl::revert_");
+ }
+
+ } // end of namespace mln::arith::impl
+
+ } // end of namespace mln::arith
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // ! MLN_ARITH_REVERT_SPE_HH