* milena/mln/core/image/attribute_image.hh: add explicit
constructor.
* milena/mln/morpho/tree/leaf_last.hh: energy minimization instead
of maximization.
* milena/mln/util/ctree/ctree.hh: bug fix.Minor
---
milena/ChangeLog | 10 ++++++++++
milena/mln/core/image/attribute_image.hh | 2 +-
milena/mln/morpho/tree/leaf_last.hh | 4 +++-
milena/mln/util/ctree/ctree.hh | 8 +++++++-
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c50015e..af4f536 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -5384,6 +5384,16 @@
* mln/convert/impl/from_unsigned_to_value.hh,
* mln/value/label.hh: Here.
+2011-03-02 edwin carlinet <carlinet(a)lrde.epita.fr>
+ Minor updates to make things compile.
+
+ * milena/mln/core/image/attribute_image.hh: add explicit
+ constructor.
+ * milena/mln/morpho/tree/leaf_last.hh: energy minimization instead
+ of maximization.
+ * milena/mln/util/ctree/ctree.hh: Copy the domain instead of
+ taking a reference that can be dangling.
+
2011-03-01 Guillaume Lazzara <z(a)lrde.epita.fr>
* mln/labeling/fill_holes.hh: Improve speed.
diff --git a/milena/mln/core/image/attribute_image.hh
b/milena/mln/core/image/attribute_image.hh
index 1331a6f..cc2d760 100644
--- a/milena/mln/core/image/attribute_image.hh
+++ b/milena/mln/core/image/attribute_image.hh
@@ -160,7 +160,7 @@ namespace mln
/// Constructor without argument.
attribute_image();
/// Allocate an attribute image respecting the size of the tree.
- attribute_image(const Tree<T>& tree);
+ explicit attribute_image(const Tree<T>& tree);
/// \}
/// Initialize an empty image.
diff --git a/milena/mln/morpho/tree/leaf_last.hh b/milena/mln/morpho/tree/leaf_last.hh
index 2f283d5..07ad8a1 100644
--- a/milena/mln/morpho/tree/leaf_last.hh
+++ b/milena/mln/morpho/tree/leaf_last.hh
@@ -61,7 +61,7 @@ namespace mln
bool operator() (const node_t& lhs, const node_t& rhs)
{
- return f_(lhs) > f_(rhs);
+ return f_(lhs) < f_(rhs);
}
private:
@@ -77,6 +77,8 @@ namespace mln
typedef typename T::node_t node_t;
p_array<node_t> sorted_sites = convert::to_p_array(ima);
+ mln_invariant(sorted_sites.nsites() == ima.nsites());
+
std::vector<node_t>& hook = sorted_sites.hook_std_vector_();
std::sort(hook.begin(), hook.end(), internal::less_<T, V> (ima));
diff --git a/milena/mln/util/ctree/ctree.hh b/milena/mln/util/ctree/ctree.hh
index e1c7148..39e7170 100644
--- a/milena/mln/util/ctree/ctree.hh
+++ b/milena/mln/util/ctree/ctree.hh
@@ -39,9 +39,11 @@
# include <mln/core/concept/site_set.hh>
# include <mln/util/ctree/internal/tree_base.hh>
# include <mln/util/array.hh>
+# include <mln/data/fill.hh>
# include <mln/core/image/attribute_image.hh>
# include <algorithm>
+
# define mln_node(T) typename T::node_t
namespace mln
@@ -101,7 +103,7 @@ namespace mln
std::vector<unsigned> length_;
std::vector<mln_value(I)> values_;
- const mln_domain(I)& domain_;
+ mln_domain(I) domain_;
int nnodes;
};
@@ -244,10 +246,13 @@ namespace mln
/// Equivalent to desc(tree.node_at(i)).nsites().
unsigned length_at_(index_t i) const;
unsigned& length_at_(index_t i);
+
rvalue f_at_(index_t i) const;
lvalue f_at_(index_t i);
+
index_t parent_at_(index_t i) const;
index_t& parent_at_(index_t i);
+
index_t node_at_(const psite& p) const;
index_t& node_at_(const psite& p);
/// \}
@@ -342,6 +347,7 @@ namespace mln
this->data_ = new mln::internal::data< ctree<I> >(f);
initialize(this->data_->map_, f);
+ this->data_->domain_ = f.domain();
this->data_->parent_.resize(nnodes);
this->data_->length_.resize(nnodes);
this->data_->values_.resize(nnodes);
--
1.7.10.4