
Index: olena/ChangeLog from Giovanni Palma <giovanni@lrde.epita.fr> * oln/utils/qsort.hh: Correct comparison operators. * tests/morpho/tests/md5_morpho_attribute_closing_opening_hh3: Correct test. * tests/morpho/tests/md5_morpho_attribute_closing_opening_hh2: Likewise. * tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh2: Remove file. * tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh3: Likewise. * oln/morpho/attributes.hh: Make code use ntg macros. * oln/morpho/attribute_union_find.hh: Add a static if for sort choice. * oln/morpho/attribute_closing_opening.hh: Add prototypes. * oln/morpho/attribute_closing_opening_map.hh: Likewise. * oln/utils/histogram.hh: Correct prototypes. Index: olena/oln/utils/histogram.hh --- olena/oln/utils/histogram.hh Sat, 26 Jun 2004 23:19:24 +0200 thivol_d (oln/10_histogram. 1.6.1.14.1.15 640) +++ olena/oln/utils/histogram.hh Fri, 09 Jul 2004 17:11:15 +0200 palma_g (oln/10_histogram. 1.6.1.14.1.15 640) @@ -673,14 +673,11 @@ */ template<class I> void - distrib_sort(const oln::abstract::image<I>& im, + distrib_sort(const oln::abstract::non_vectorial_image<I>& im, std::vector<oln_point_type(I)> &v) { typedef oln_value_type(I) val; - typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type - ensure_type; - // check the size precondition(v.size() == im.npoints()); @@ -716,14 +713,11 @@ */ template<class I> void - distrib_sort_inv(const oln::abstract::image<I>& im, + distrib_sort_inv(const oln::abstract::non_vectorial_image<I>& im, std::vector<oln_point_type(I)> &v) { typedef oln_value_type(I) val; - typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type - ensure_type; - precondition(v.size() == im.npoints()); utils::histogram<val> histo(im); @@ -750,19 +744,23 @@ { template <class I> void - operator ()(const oln::abstract::image<I>& im, + operator ()(const oln::abstract::non_vectorial_image<I>& im, std::vector<oln_point_type(I)> &v) { distrib_sort_inv(im, v); } }; + /*! Select statically the good distrib_sort. + ** + ** Specialisation. + */ template <> struct select_distrib_sort<true> { template <class I> void - operator ()(const oln::abstract::image<I>& im, + operator ()(const oln::abstract::non_vectorial_image<I>& im, std::vector<oln_point_type(I)> &v) { distrib_sort(im, v); Index: olena/oln/morpho/attribute_closing_opening.hh --- olena/oln/morpho/attribute_closing_opening.hh Sat, 26 Jun 2004 23:19:24 +0200 thivol_d (oln/q/49_attribute_ 1.24 640) +++ olena/oln/morpho/attribute_closing_opening.hh Wed, 07 Jul 2004 14:54:47 +0200 palma_g (oln/q/49_attribute_ 1.24 640) @@ -138,6 +138,29 @@ return tarjan::internal::attr_closing_<I, N, attr::T##_type<I> >(input, Ng, lambda); \ } + // same as previous, but for attribute based on image types with environment +# define xxx_opening_im_env_decl(T) \ + template<class I, class N> \ + oln_concrete_type(I) \ + T##_opening(const abstract::non_vectorial_image<I>& input, \ + const abstract::neighborhood<N>& Ng, \ + const attr_lambda_type(attr::T##_type<I>) &lambda, \ + const attr_env_type(attr::T##_type<I>) &env) \ + { \ + return tarjan::internal::attr_opening_<I, N, attr::T##_type<I> >(input, Ng, lambda, env); \ + } + +# define xxx_closing_im_env_decl(T) \ + template<class I, class N> \ + oln_concrete_type(I) \ + T##_closing(const abstract::non_vectorial_image<I>& input, \ + const abstract::neighborhood<N>& Ng, \ + const attr_lambda_type(attr::T##_type<I>) &lambda, \ + const attr_env_type(attr::T##_type<I>) &env) \ + { \ + return tarjan::internal::attr_closing_<I, N, attr::T##_type<I> >(input, Ng, lambda, env); \ + } + /*! ** \brief Perform a cardinal closing. ** @@ -247,6 +270,62 @@ xxx_opening_decl(integral) /*! + ** \brief Perform an integral closing. + ** + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/morpho/attribute_closing_opening.hh> + ** #include <oln/level/compare.hh> + ** #include <ntg/all.hh> + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> im_type; + ** + ** im_type im1(oln::load(IMG_IN "lena128.pgm")); + ** oln::morpho::env::OtherImageEnv<im_type> env(im1); + ** im1 = oln::morpho::fast::integral_closing(im1, oln::neighb_c4(), 200, env); + ** oln::save(im1, IMG_OUT "oln_morpho_fast_volume_closing.ppm"); + ** return 0; + ** } + ** \endcode + ** \image html lena128_pgm.png + ** \image latex lena128_pgm.png + ** => + ** \image html oln_morpho_fast_integral_closing.png + ** \image latex oln_morpho_fast_integral_closing.png + ** + */ + xxx_closing_im_env_decl(volume) + + + /*! + ** \brief Perform an integral opening. + ** + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/morpho/attribute_closing_opening.hh> + ** #include <oln/level/compare.hh> + ** #include <ntg/all.hh> + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> im_type; + ** + ** im_type im1(oln::load(IMG_IN "lena128.pgm")); + ** im1 = oln::morpho::fast::integral_opening(im1, oln::neighb_c4(), 200); + ** oln::save(im1, IMG_OUT "oln_morpho_fast_integral_opening.ppm"); + ** return 0; + ** } + ** \endcode + ** \image html lena128_pgm.png + ** \image latex lena128_pgm.png + ** => + ** \image html oln_morpho_fast_integral_opening.png + ** \image latex oln_morpho_fast_integral_opening.png + ** + */ + xxx_opening_im_env_decl(volume) + + /*! ** \brief Perform a height closing. ** ** \code Index: olena/oln/morpho/attribute_union_find.hh --- olena/oln/morpho/attribute_union_find.hh Sun, 23 May 2004 12:21:34 +0200 palma_g (oln/q/50_attribute_ 1.19 640) +++ olena/oln/morpho/attribute_union_find.hh Fri, 09 Jul 2004 17:21:04 +0200 palma_g (oln/q/50_attribute_ 1.19 640) @@ -92,11 +92,10 @@ std::vector<point_type> I;//(/*input_.npoints()*/); + // FIXME: make both version avialble: qsort and dsort // oln::utils::select_distrib_sort<closing>()(input_, I); - if (closing) - oln::utils::qsort_inv(input_, I); - else - oln::utils::qsort(input_, I); + oln::utils::select_q_sort<closing>()(input_, I); + level::fill(aux_data_, ntg_sup_val(lambda_type)); aux_data_.border_adapt_assign(Ng.delta(), ntg_sup_val(lambda_type)); Index: olena/oln/morpho/attributes.hh --- olena/oln/morpho/attributes.hh Sat, 26 Jun 2004 23:19:24 +0200 thivol_d (oln/j/45_attributes 1.13.1.4 644) +++ olena/oln/morpho/attributes.hh Fri, 09 Jul 2004 15:57:43 +0200 palma_g (oln/j/45_attributes 1.13.1.4 644) @@ -386,9 +386,10 @@ volume_type(const abstract::image<J> &, const oln_point_type(J) &p, const env_type &e) : + // reflevel_(e.getImage()[p]), reflevel_(e.getImage()[p]), - area_(1), - value_(1) + area_(ntg_unit_val(value_type)), + value_(ntg_unit_val(value_type)) { } Index: olena/oln/morpho/attribute_closing_opening_map.hh --- olena/oln/morpho/attribute_closing_opening_map.hh Sat, 26 Jun 2004 23:19:24 +0200 thivol_d (oln/j/49_attribute_ 1.12 600) +++ olena/oln/morpho/attribute_closing_opening_map.hh Wed, 07 Jul 2004 16:05:19 +0200 palma_g (oln/j/49_attribute_ 1.12 600) @@ -231,6 +231,19 @@ attr_env_type(attr::T##_type<I>)()); \ } + // same but attribute take care of the image type +# define xxx_opening_im_env_map_decl(T) \ +template <class I, class N> \ +oln_concrete_type(I) \ +T##_opening(const abstract::non_vectorial_image<I>& input, \ + const abstract::neighborhood<N>& ng, \ + const attr_lambda_type(attr::T##_type<I>)& lambda, \ + const attr_env_type(attr::T##_type<I>) &env) \ + { \ + return tarjan_map<attr::T##_type<I>, I, N>(false, input, ng, lambda, \ + env); \ + } + //return input; // return tarjan_map<T##_type, I, N>(false, input, ng, lambda, // attr_env_type(T##_type<>)()); @@ -257,6 +270,18 @@ attr_env_type(attr::T##_type<I>)());\ } +# define xxx_closing_im_env_map_decl(T) \ +template <class I, class N> \ +oln_concrete_type(I) \ +T##_closing(const abstract::non_vectorial_image<I>& input, \ + const abstract::neighborhood<N>& ng, \ + const attr_lambda_type(attr::T##_type<I>)& lambda, \ + const attr_env_type(attr::T##_type<I>) &env) \ + { \ + return tarjan_map<attr::T##_type<I>, I, N>(true, input, ng, lambda, \ + env); \ + } + /*! ** \brief Perform a cardinal closing. ** @@ -364,6 +389,62 @@ xxx_opening_map_decl(integral) /*! + ** \brief Perform an integral closing. + ** + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/morpho/attribute_closing_opening_map.hh> + ** #include <oln/level/compare.hh> + ** #include <ntg/all.hh> + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> im_type; + ** + ** im_type im1(oln::load(IMG_IN "lena128.pgm")); + ** oln::morpho::env::OtherImageEnv<im_type> env(im1); + ** im1 = oln::morpho::slow::volume_closing(im1, oln::neighb_c4(), + ** 200, env); + ** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_closing.ppm"); + ** } + ** \endcode + ** \image html lena128_pgm.png + ** \image latex lena128_pgm.png + ** => + ** \image html oln_morpho_slow_integral_closing.png + ** \image latex oln_morpho_slow_integral_closing.png + ** + */ + xxx_closing_im_env_map_decl(volume) + + /*! + ** \brief Perform an integral opening. + ** + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/morpho/attribute_closing_opening_map.hh> + ** #include <oln/level/compare.hh> + ** #include <ntg/all.hh> + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> im_type; + ** + ** im_type im1(oln::load(IMG_IN "lena128.pgm")); + ** oln::morpho::env::OtherImageEnv<im_type> env(im1); + ** im1 = oln::morpho::slow::volume_opening(im1, oln::neighb_c4(), + ** 200, env); + ** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_opening.ppm"); + ** } + ** \endcode + ** \image html lena128_pgm.png + ** \image latex lena128_pgm.png + ** => + ** \image html oln_morpho_slow_integral_opening.png + ** \image latex oln_morpho_slow_integral_opening.png + ** + */ + xxx_opening_im_env_map_decl(volume) + + /*! ** \brief Perform a height closing. ** ** \code Index: olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_hh3 --- olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_hh3 Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/m/0_md5_morpho 1.2 644) +++ olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_hh3 Fri, 09 Jul 2004 17:15:03 +0200 palma_g (oln/m/0_md5_morpho 1.2 644) @@ -32,26 +32,43 @@ #include "check.hh" #include <oln/basics2d.hh> #include <oln/morpho/attribute_closing_opening.hh> +#include <oln/morpho/attribute_closing_opening_map.hh> #include <oln/level/compare.hh> #include <ntg/all.hh> int main() { -oln::utils::key::value_type data_key[16] = {0x9d, 0xa, 0x87, 0x3b, 0x92, 0xde, 0x8a, 0xb0, 0x84, 0xf8, 0xe6, 0x5e, 0x6c, 0xdf, 0x5e, 0x76}; + oln::utils::key::value_type data_key[16] = {0x9d, 0xa, 0x87, 0x3b, 0x92, + 0xde, 0x8a, 0xb0, 0x84, 0xf8, + 0xe6, 0x5e, 0x6c, 0xdf, 0x5e, + 0x76}; oln::utils::key key(data_key); + bool res(false); + typedef oln::image2d<ntg::int_u8> im_type; + + im_type im(oln::load(rdata("lena128.pgm"))); + im_type im1; + im_type im2; + oln::morpho::env::OtherImageEnv<im_type> env(im); + + im1 = oln::morpho::fast::volume_opening(im, oln::neighb_c4(), 200, env); + im2 = oln::morpho::slow::volume_opening(im, oln::neighb_c4(), 200, env); - typedef oln::image2d<ntg:: -int_u8> im_type; - im_type im1(oln::load(rdata("lena128.pgm"))); - im1 = oln::morpho::fast:: -integral_opening(im1, oln::neighb_c4(), 200); if (oln::utils::md5(im1) == key) - std::cout << "OK" << std::endl; + std::cout << "fast: OK" << std::endl; + else + { + std::cout << "fast: FAIL" << std::endl; + res = true; + } + if (oln::utils::md5(im2) == key) + std::cout << "slow: OK" << std::endl; else { - std::cout << "FAIL" << std::endl; - return true; + std::cout << "slow: FAIL" << std::endl; + res = true; } - return 0; + + return res; } Index: olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_hh2 --- olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_hh2 Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/m/1_md5_morpho 1.2 644) +++ olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_hh2 Fri, 09 Jul 2004 17:15:06 +0200 palma_g (oln/m/1_md5_morpho 1.2 644) @@ -32,26 +32,43 @@ #include "check.hh" #include <oln/basics2d.hh> #include <oln/morpho/attribute_closing_opening.hh> +#include <oln/morpho/attribute_closing_opening_map.hh> #include <oln/level/compare.hh> #include <ntg/all.hh> int main() { -oln::utils::key::value_type data_key[16] = {0xf6, 0x87, 0xb9, 0xf, 0xde, 0x31, 0x62, 0xfd, 0xd7, 0xb, 0xa4, 0x19, 0x26, 0x3, 0x7, 0xa4}; + oln::utils::key::value_type data_key[16] = {0xf6, 0x87, 0xb9, 0xf, 0xde, + 0x31, 0x62, 0xfd, 0xd7, 0xb, + 0xa4, 0x19, 0x26, 0x3, 0x7, + 0xa4}; oln::utils::key key(data_key); + bool res(false); + typedef oln::image2d<ntg::int_u8> im_type; + + im_type im(oln::load(rdata("lena128.pgm"))); + im_type im1; + im_type im2; + oln::morpho::env::OtherImageEnv<im_type> env(im); + + im1 = oln::morpho::fast::volume_closing(im, oln::neighb_c4(), 200, env); + im2 = oln::morpho::slow::volume_closing(im, oln::neighb_c4(), 200, env); - typedef oln::image2d<ntg:: -int_u8> im_type; - im_type im1(oln::load(rdata("lena128.pgm"))); - im1 = oln::morpho::fast:: -integral_closing(im1, oln::neighb_c4(), 200); if (oln::utils::md5(im1) == key) - std::cout << "OK" << std::endl; + std::cout << "fast: OK" << std::endl; + else + { + std::cout << "fast: FAIL" << std::endl; + res = true; + } + if (oln::utils::md5(im2) == key) + std::cout << "slow: OK" << std::endl; else { - std::cout << "FAIL" << std::endl; - return true; + std::cout << "slow: FAIL" << std::endl; + res = true; } - return 0; + + return res; } Index: olena/oln/utils/qsort.hh --- olena/oln/utils/qsort.hh Sat, 26 Jun 2004 23:19:24 +0200 thivol_d (oln/r/9_qsort.hh 1.2 644) +++ olena/oln/utils/qsort.hh Fri, 09 Jul 2004 17:19:02 +0200 palma_g (oln/r/9_qsort.hh 1.2 644) @@ -65,10 +65,17 @@ ** \arg i The first point. ** \arg j The second point. ** \return im[i] < im[j] + ** \warning In the case where im_[j] = im_[i] the comparison + ** is done on the point type components (for compatibility + ** purpose with distributed sort). */ bool operator()(const point_type &i, const point_type &j) { - return im_[j] < im_[i]; + if (im_[i] == im_[j]) + for (unsigned t(0); t < point_type::dim; ++t) + if (i.nth(t) != j.nth(t)) + return i.nth(t) < j.nth(t); + return im_[j] > im_[i]; } protected: @@ -101,10 +108,17 @@ ** \arg i The first point. ** \arg j The second point. ** \return im[i] > im[j] + ** \warning In the case where im_[j] = im_[i] the comparison + ** is done on the point type components (for compatibility + ** purpose with distributed sort). */ bool operator()(const point_type &i, const point_type &j) { - return im_[i] < im_[j]; + if (im_[i] == im_[j]) + for (unsigned t(0); t < point_type::dim; ++t) + if (i.nth(t) != j.nth(t)) + return i.nth(t) < j.nth(t); + return im_[i] > im_[j]; } protected: @@ -156,6 +170,38 @@ std::sort(v.begin(), v.end(), c); } + + /*! Select statically the good qsort. + ** + ** \param reverse If the sort should be reverted or not. + */ + template <bool reverse> + struct select_q_sort + { + template <class I> + void + operator ()(const oln::abstract::non_vectorial_image<I>& im, + std::vector<oln_point_type(I)> &v) + { + qsort_inv(im, v); + } + }; + + /*! Select statically the good qsort. + ** + ** Specialisation. + */ + template <> + struct select_q_sort<true> + { + template <class I> + void + operator ()(const oln::abstract::non_vectorial_image<I>& im, + std::vector<oln_point_type(I)> &v) + { + qsort(im, v); + } + }; } // !utils } // !oln Index: olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh3 --- olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh3 Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/l/28_md5_morpho 1.2 644) +++ olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh3 Fri, 09 Jul 2004 17:34:27 +0200 palma_g () @@ -1,56 +0,0 @@ -// -*- c++ -*- -// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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. - -#include "data.hh" -#include <oln/utils/md5.hh> - -#include "check.hh" -#include <oln/basics2d.hh> -#include <oln/morpho/attribute_closing_opening_map.hh> -#include <oln/level/compare.hh> -#include <ntg/all.hh> - -int main() -{ -oln::utils::key::value_type data_key[16] = {0x9d, 0xa, 0x87, 0x3b, 0x92, 0xde, 0x8a, 0xb0, 0x84, 0xf8, 0xe6, 0x5e, 0x6c, 0xdf, 0x5e, 0x76}; - -oln::utils::key key(data_key); - - typedef oln::image2d<ntg:: -int_u8> im_type; - im_type im1(oln::load(rdata("lena128.pgm"))); - im1 = oln::morpho::slow:: -integral_opening(im1, oln::neighb_c4(), 200); - if (oln::utils::md5(im1) == key) - std::cout << "OK" << std::endl; -else - { - std::cout << "FAIL" << std::endl; - return true; - } - } Index: olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh2 --- olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh2 Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/l/29_md5_morpho 1.2 644) +++ olena/tests/morpho/tests/md5_morpho_attribute_closing_opening_map_hh2 Fri, 09 Jul 2004 17:34:27 +0200 palma_g () @@ -1,56 +0,0 @@ -// -*- c++ -*- -// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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. - -#include "data.hh" -#include <oln/utils/md5.hh> - -#include "check.hh" -#include <oln/basics2d.hh> -#include <oln/morpho/attribute_closing_opening_map.hh> -#include <oln/level/compare.hh> -#include <ntg/all.hh> - -int main() -{ -oln::utils::key::value_type data_key[16] = {0xf6, 0x87, 0xb9, 0xf, 0xde, 0x31, 0x62, 0xfd, 0xd7, 0xb, 0xa4, 0x19, 0x26, 0x3, 0x7, 0xa4}; - -oln::utils::key key(data_key); - - typedef oln::image2d<ntg:: -int_u8> im_type; - im_type im1(oln::load(rdata("lena128.pgm"))); - im1 = oln::morpho::slow:: -integral_closing(im1, oln::neighb_c4(), 200); - if (oln::utils::md5(im1) == key) - std::cout << "OK" << std::endl; -else - { - std::cout << "FAIL" << std::endl; - return true; - } - } -- Giovanni Palma EPITA - promo 2005 - membre d'EpX - LRDE Mob. : +33 (0)6 60 97 31 74

--- olena/oln/utils/qsort.hh
@@ -65,10 +65,17 @@ + ** \warning In the case where im_[j] = im_[i] the comparison + ** is done on the point type components (for compatibility + ** purpose with distributed sort). */ bool operator()(const point_type &i, const point_type &j) { - return im_[j] < im_[i]; + if (im_[i] == im_[j]) + for (unsigned t(0); t < point_type::dim; ++t) + if (i.nth(t) != j.nth(t)) + return i.nth(t) < j.nth(t); + return im_[j] > im_[i]; }
Il y a un bug dans les openings ou quelque part, le cas (im_[i] == im_[j]) n'est pas nécessaire dans la théorie. -- Niels

Niels van Vliet <van-vl_n@lrde.epita.fr> writes:
--- olena/oln/utils/qsort.hh
@@ -65,10 +65,17 @@ + ** \warning In the case where im_[j] = im_[i] the comparison + ** is done on the point type components (for compatibility + ** purpose with distributed sort). */ bool operator()(const point_type &i, const point_type &j) { - return im_[j] < im_[i]; + if (im_[i] == im_[j]) + for (unsigned t(0); t < point_type::dim; ++t) + if (i.nth(t) != j.nth(t)) + return i.nth(t) < j.nth(t); + return im_[j] > im_[i]; }
Il y a un bug dans les openings ou quelque part, le cas (im_[i] == im_[j]) n'est pas nécessaire dans la théorie.
T'as gforgifie la chose ? -- Giovanni Palma EPITA - promo 2005 - membre d'EpX - LRDE Mob. : +33 (0)6 60 97 31 74
participants (2)
-
Giovanni Palma
-
Niels van Vliet