* headers.mk: add new headers to distribution.
* mln/io/all.hh: include new headers.
* mln/io/cloud/all.hh,
* mln/io/cloud/load.hh,
* mln/io/cloud/save.hh: load and save a cloud of points.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_io_cloud_load.cc,
* tests/unit_test/mln_io_cloud_save.cc: add new unit tests.
---
milena/ChangeLog | 16 ++++
milena/headers.mk | 2 +
milena/mln/io/all.hh | 16 ++--
milena/mln/io/{ => cloud}/all.hh | 30 +++-----
milena/mln/io/cloud/load.hh | 118 +++++++++++++++++++++++++++
milena/mln/io/cloud/save.hh | 110 +++++++++++++++++++++++++
milena/tests/unit_test/Makefile.am | 2 +
milena/tests/unit_test/mln_io_cloud_load.cc | 11 +++
milena/tests/unit_test/mln_io_cloud_save.cc | 11 +++
9 files changed, 290 insertions(+), 26 deletions(-)
copy milena/mln/io/{ => cloud}/all.hh (70%)
create mode 100644 milena/mln/io/cloud/load.hh
create mode 100644 milena/mln/io/cloud/save.hh
create mode 100644 milena/tests/unit_test/mln_io_cloud_load.cc
create mode 100644 milena/tests/unit_test/mln_io_cloud_save.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f2defdd..9e9189d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,21 @@
2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add io::cloud.
+
+ * headers.mk: add new headers to distribution.
+
+ * mln/io/all.hh: include new headers.
+
+ * mln/io/cloud/all.hh,
+ * mln/io/cloud/load.hh,
+ * mln/io/cloud/save.hh: load and save a cloud of points.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_io_cloud_load.cc,
+ * tests/unit_test/mln_io_cloud_save.cc: add new unit tests.
+
+2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add accu::rms.
* headers.mk: add new header to distribution.
diff --git a/milena/headers.mk b/milena/headers.mk
index 6a937c5..28e24e7 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -993,6 +993,8 @@ mln/io/pfm/save.hh \
mln/io/raw/load.hh \
mln/io/raw/all.hh \
mln/io/raw/save.hh \
+mln/io/cloud/load.hh \
+mln/io/cloud/save.hh \
mln/io/all.hh \
mln/io/pbm/load.hh \
mln/io/pbm/all.hh \
diff --git a/milena/mln/io/all.hh b/milena/mln/io/all.hh
index bb6f7d3..777ffb7 100644
--- a/milena/mln/io/all.hh
+++ b/milena/mln/io/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +28,10 @@
#ifndef MLN_IO_ALL_HH
# define MLN_IO_ALL_HH
-/*! \file mln/io/all.hh
- *
- * \brief File that includes all io materials.
- */
+/// \file mln/io/all.hh
+///
+/// File that includes all io materials.
+
namespace mln
@@ -46,13 +46,15 @@ namespace mln
}
-//# include <mln/io/fits/all.hh>
-//# include <mln/io/off/all.hh>
+# include <mln/io/cloud/all.hh>
# include <mln/io/pbm/all.hh>
# include <mln/io/pfm/all.hh>
# include <mln/io/pgm/all.hh>
# include <mln/io/pnm/all.hh>
# include <mln/io/ppm/all.hh>
+# include <mln/io/raw/all.hh>
# include <mln/io/txt/all.hh>
+//# include <mln/io/fits/all.hh>
+//# include <mln/io/off/all.hh>
#endif // ! MLN_IO_ALL_HH
diff --git a/milena/mln/io/all.hh b/milena/mln/io/cloud/all.hh
similarity index 70%
copy from milena/mln/io/all.hh
copy to milena/mln/io/cloud/all.hh
index bb6f7d3..f3bceb4 100644
--- a/milena/mln/io/all.hh
+++ b/milena/mln/io/cloud/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,34 +25,26 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_IO_ALL_HH
-# define MLN_IO_ALL_HH
+#ifndef MLN_IO_CLOUD_ALL_HH
+# define MLN_IO_CLOUD_ALL_HH
-/*! \file mln/io/all.hh
- *
- * \brief File that includes all io materials.
- */
+/// \file mln/io/cloud/all.hh
+///
+/// File that includes all cloud io materials.
namespace mln
{
- /// Namespace of input/output handling.
namespace io
{
- /// Internal namespace of io namespace.
- namespace internal {}
+ /// Namespace of cloud input/output handling.
+ namespace cloud {}
}
}
-//# include <mln/io/fits/all.hh>
-//# include <mln/io/off/all.hh>
-# include <mln/io/pbm/all.hh>
-# include <mln/io/pfm/all.hh>
-# include <mln/io/pgm/all.hh>
-# include <mln/io/pnm/all.hh>
-# include <mln/io/ppm/all.hh>
-# include <mln/io/txt/all.hh>
+# include <mln/io/cloud/load.hh>
+# include <mln/io/cloud/save.hh>
-#endif // ! MLN_IO_ALL_HH
+#endif // ! MLN_IO_CLOUD_ALL_HH
diff --git a/milena/mln/io/cloud/load.hh b/milena/mln/io/cloud/load.hh
new file mode 100644
index 0000000..83f1e85
--- /dev/null
+++ b/milena/mln/io/cloud/load.hh
@@ -0,0 +1,118 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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_IO_CLOUD_LOAD_HH
+# define MLN_IO_CLOUD_LOAD_HH
+
+/// \file mln/io/cloud/load.hh
+///
+/// Load a cloud of points.
+/// A cloud file must contain one point per line.
+/// For a list of 3d points, a line would looks like the following:
+///
+/// 35 4 5
+///
+///
+/// \todo Support 1 and 2d images.
+/// \todo Make it generic?
+
+# include <iostream>
+# include <fstream>
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/site_set/p_array.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace cloud
+ {
+
+ /// Load a cloud of points.
+ ///
+ /// \param[in,out] arr the site set where to load the data.
+ /// \param[in] filename file to load.
+ template <typename P>
+ void load(p_array<P>& arr, const std::string& filename);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ template <typename P>
+ inline
+ void load_data(p_array<P>& arr, std::ifstream& file)
+ {
+ std::string line;
+ while (std::getline(file, line))
+ {
+ algebra::vec<P::dim,float> v;
+ std::istringstream sline(line);
+ sline >> v[0] >> v[1] >> v[2];
+ arr.append(v);
+ }
+ }
+
+ } // end of namespace mln::io::cloud::internal
+
+
+
+ template <typename P>
+ void load(p_array<P>& arr, const std::string& filename)
+ {
+ trace::entering("mln::io::cloud::load");
+
+ /// FIXME: do we really want this?
+ mln_precondition(P::dim == 3u);
+
+ std::ifstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: cannot open file '" << filename << "'!";
+ abort();
+ }
+
+ internal::load_data(arr, file);
+
+ trace::exiting("mln::io::cloud::load");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::cloud
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_CLOUD_LOAD_HH
diff --git a/milena/mln/io/cloud/save.hh b/milena/mln/io/cloud/save.hh
new file mode 100644
index 0000000..fc42228
--- /dev/null
+++ b/milena/mln/io/cloud/save.hh
@@ -0,0 +1,110 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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_IO_CLOUD_SAVE_HH
+# define MLN_IO_CLOUD_SAVE_HH
+
+/// \file mln/io/cloud/save.hh
+///
+/// Save an image as a cloud of points.
+
+# include <iostream>
+# include <fstream>
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/site_set/p_array.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace cloud
+ {
+
+ /// Load a cloud of points
+ ///
+ /// \param[in] arr the cloud of points to save.
+ /// \param[in] filename the destination.
+ template <typename P>
+ void save(const p_array<P>& arr, const std::string& filename);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ template <typename P>
+ inline
+ void save_data(const p_array<P>& arr, std::ofstream& file)
+ {
+ std::ostringstream sline;
+ mln_piter(p_array<P>) p(arr);
+ for_all(p)
+ {
+ algebra::vec<P::dim,float> v = p.to_site().to_vec();
+ sline << v[0];
+ for (unsigned i = 1; i < P::dim; ++i)
+ sline << ' ' << v[i];
+ sline << std::endl;
+ file << sline.str();
+ }
+ }
+
+ } // end of namespace mln::io::cloud::internal
+
+
+
+ template <typename P>
+ void save(const p_array<P>& arr, const std::string& filename)
+ {
+ trace::entering("mln::io::cloud::save");
+
+ std::ofstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: cannot open file '" << filename << "'!";
+ abort();
+ }
+
+ internal::save_data(arr, file);
+
+ trace::exiting("mln::io::cloud::save");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::cloud
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_CLOUD_SAVE_HH
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index b31efec..7139e44 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -959,6 +959,8 @@ mln_io_pfm_save \
mln_io_raw_load \
mln_io_raw_all \
mln_io_raw_save \
+mln_io_cloud_load \
+mln_io_cloud_save \
mln_io_all \
mln_io_pbm_load \
mln_io_pbm_all \
diff --git a/milena/tests/unit_test/mln_io_cloud_load.cc b/milena/tests/unit_test/mln_io_cloud_load.cc
new file mode 100644
index 0000000..8edc601
--- /dev/null
+++ b/milena/tests/unit_test/mln_io_cloud_load.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/io/cloud/load.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/io/cloud/load.hh>
+#include <mln/io/cloud/load.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_io_cloud_save.cc b/milena/tests/unit_test/mln_io_cloud_save.cc
new file mode 100644
index 0000000..8d27cc9
--- /dev/null
+++ b/milena/tests/unit_test/mln_io_cloud_save.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/io/cloud/save.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/io/cloud/save.hh>
+#include <mln/io/cloud/save.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5
* headers.mk: add new header to distribution.
* mln/accu/all.hh: include new header.
* mln/accu/rms.hh: Compute the root mean square.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_accu_rms.cc: add unit test.
---
milena/ChangeLog | 15 +++-
milena/headers.mk | 1 +
milena/mln/accu/all.hh | 1 +
milena/mln/accu/rms.hh | 165 ++++++++++++++++++++++++++++++++
milena/tests/unit_test/Makefile.am | 1 +
milena/tests/unit_test/mln_accu_rms.cc | 11 ++
6 files changed, 193 insertions(+), 1 deletions(-)
create mode 100644 milena/mln/accu/rms.hh
create mode 100644 milena/tests/unit_test/mln_accu_rms.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 58b16ad..f2defdd 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,18 @@
2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add accu::rms.
+
+ * headers.mk: add new header to distribution.
+
+ * mln/accu/all.hh: include new header.
+
+ * mln/accu/rms.hh: Compute the root mean square.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_accu_rms.cc: add unit test.
+
+2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add make::h_mat.
* headers.mk: add new header to distribution.
@@ -49,7 +62,7 @@
2009-02-02 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Activate fastest version of algebraic union-find.
-
+
* mln/morpho/closing_attribute.hh
(closing_attribute_dispatch): Activate for fastest images.
* mln/canvas/morpho/algebraic_union_find.hh: Likewise.
diff --git a/milena/headers.mk b/milena/headers.mk
index 04bef51..6a937c5 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -366,6 +366,7 @@ mln/accu/transform_snake.hh \
mln/accu/rank_high_quant.hh \
mln/accu/count.hh \
mln/accu/median_h.hh \
+mln/accu/rms.hh \
mln/accu/all.hh \
mln/accu/land_basic.hh \
mln/accu/p.hh \
diff --git a/milena/mln/accu/all.hh b/milena/mln/accu/all.hh
index 273d4d2..0181b9a 100644
--- a/milena/mln/accu/all.hh
+++ b/milena/mln/accu/all.hh
@@ -77,6 +77,7 @@ namespace mln
# include <mln/accu/nil.hh>
# include <mln/accu/pair.hh>
# include <mln/accu/rank.hh>
+# include <mln/accu/rms.hh>
# include <mln/accu/sum.hh>
# include <mln/accu/tuple.hh>
# include <mln/accu/volume.hh>
diff --git a/milena/mln/accu/rms.hh b/milena/mln/accu/rms.hh
new file mode 100644
index 0000000..c873686
--- /dev/null
+++ b/milena/mln/accu/rms.hh
@@ -0,0 +1,165 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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_ACCU_RMS_HH
+# define MLN_ACCU_RMS_HH
+
+/// \file mln/accu/rms.hh
+///
+/// Define an accumulator that computes the Root Mean Square.
+
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/accu/internal/base.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+
+ /// Generic rms accumulator class.
+ ///
+ /// The parameter \c T is the type of the root mean square value.
+ ///
+ template <typename T, typename V>
+ struct rms : public mln::accu::internal::base<V, rms<T,V> >
+ {
+ typedef T argument;
+
+ rms();
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init(const T& p);
+ void take(const T& p);
+ void take(const rms<T,V>& other);
+ /// \}
+
+ /// Get the value of the accumulator.
+ V to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ V t_;
+ unsigned count_;
+ };
+
+
+ namespace meta
+ {
+
+ /// Meta accumulator for rms.
+ struct rms : public Meta_Accumulator< rms >
+ {
+ template <typename T, typename V>
+ struct with
+ {
+ typedef accu::rms<T,V> ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T, typename V>
+ inline
+ rms<T,V>::rms()
+ {
+ init();
+ }
+
+ template <typename T, typename V>
+ inline
+ void
+ rms<T,V>::init()
+ {
+ t_ = literal::zero;
+ count_ = 0;
+ }
+
+ template <typename T, typename V>
+ inline
+ void
+ rms<T,V>::take_as_init(const T& t)
+ {
+ t_ += t * t;
+ ++count_;
+ }
+
+ template <typename T, typename V>
+ inline
+ void
+ rms<T,V>::take(const T& t)
+ {
+ t_ += t * t;
+ ++count_;
+ }
+
+ template <typename T, typename V>
+ inline
+ void
+ rms<T,V>::take(const rms<T,V>& other)
+ {
+ t_ += other.t_;
+ count_ += other.count_;
+ }
+
+ template <typename T, typename V>
+ inline
+ V
+ rms<T,V>::to_result() const
+ {
+ if (count_ == 0)
+ return literal::zero;
+ return math::sqrt<V>(t_ / count_);
+ }
+
+ template <typename T, typename V>
+ inline
+ bool
+ rms<T,V>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_RMS_HH
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index a6b6b26..b31efec 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -362,6 +362,7 @@ mln_accu_transform_snake \
mln_accu_rank_high_quant \
mln_accu_count \
mln_accu_median_h \
+mln_accu_rms \
mln_accu_all \
mln_accu_land_basic \
mln_accu_p \
diff --git a/milena/tests/unit_test/mln_accu_rms.cc b/milena/tests/unit_test/mln_accu_rms.cc
new file mode 100644
index 0000000..0dd83bd
--- /dev/null
+++ b/milena/tests/unit_test/mln_accu_rms.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/accu/rms.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/accu/rms.hh>
+#include <mln/accu/rms.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5
* headers.mk: add new header to distribution.
* mln/make/h_mat.hh: create a h_mat from a C-style array.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_make_h_mat.cc: add unit test.
---
milena/ChangeLog | 38 +++++++++
milena/headers.mk | 1 +
milena/mln/make/h_mat.hh | 121 ++++++++++++++++++++++++++++++
milena/tests/unit_test/Makefile.am | 1 +
milena/tests/unit_test/mln_make_h_mat.cc | 11 +++
5 files changed, 172 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/make/h_mat.hh
create mode 100644 milena/tests/unit_test/mln_make_h_mat.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index eb424b1..58b16ad 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,43 @@
2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add make::h_mat.
+
+ * headers.mk: add new header to distribution.
+
+ * mln/make/h_mat.hh: create a h_mat from a C-style array.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_make_h_mat.cc: add unit test.
+
+2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add core/alias/all.hh and alias/vec3d.hh.
+
+ * doc/tutorial/examples/examples.mk
+ * doc/tutorial/figures/figures.mk
+ * doc/tutorial/outputs/outputs.mk
+ * doc/tutorial/samples/samples.mk: Update generated files.
+
+ * headers.mk: add new header to distribution.
+
+ * mln/core/alias/all.hh: new header.
+
+ * mln/core/alias/vec3d.hh: new aliases for 3d algebra::vec.
+
+ * mln/core/alias/box2d.hh,
+ * mln/core/alias/box3d.hh: update comments.
+
+ * mln/core/all.hh: include alias/all.hh.
+
+ * mln/essential/3d.hh: add image3d.hh and vec3d.hh.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_core_alias_all.cc,
+ * tests/unit_test/mln_core_alias_vec3d.cc,
+ * tests/unit_test/mln_make_image3d.cc: add new unit test files.
+
+2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Fix tutorial generation.
* doc/tutorial/generate_dist_files.sh: dot not include current
diff --git a/milena/headers.mk b/milena/headers.mk
index 037b5cc..04bef51 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -148,6 +148,7 @@ mln/make/w_window2d_int.hh \
mln/make/box1d.hh \
mln/make/voronoi.hh \
mln/make/box2d.hh \
+mln/make/h_mat.hh \
mln/make/w_window2d.hh \
mln/make/box3d.hh \
mln/make/relabelfun.hh \
diff --git a/milena/mln/make/h_mat.hh b/milena/mln/make/h_mat.hh
new file mode 100644
index 0000000..930c133
--- /dev/null
+++ b/milena/mln/make/h_mat.hh
@@ -0,0 +1,121 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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_MAKE_H_MAT_HH
+# define MLN_MAKE_H_MAT_HH
+
+/// \file mln/make/h_mat.hh
+///
+/// Routine to construct an mln::algebra::h_mat.
+
+# include <mln/algebra/h_mat.hh>
+# include <mln/metal/math/sqrt.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ /// Create an mln::algebra::h_mat<d,T>.
+ /*
+ * \param[in] tab Array of values.
+ *
+ * \pre The array dimension has to be d * d.
+ */
+ template <typename T, unsigned d>
+ algebra::h_mat<d,T> h_mat(const T (&tab)[(d+1)*(d+1)]);
+
+
+ /// Create an mln::algebra::h_mat<d,T>.
+ /*
+ * \param[in] tab Array of values.
+ *
+ * \pre The array dimension has to be d * d.
+ */
+ template <typename T, unsigned d>
+ algebra::h_mat<d,T> h_mat(const T (&tab)[d+1][d+1]);
+
+
+ /// reate an mln::algebra::mat<n,n,T>.
+ /*
+ * \param[in] tab C-array of values.
+ *
+ * \pre The array dimension N has to be square (N = n * n).
+ */
+ template <typename T, unsigned N>
+ algebra::h_mat<mlc_sqrt_int(N), T> h_mat(const T (&tab)[N]);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T, unsigned d>
+ inline
+ algebra::h_mat<d,T>
+ h_mat(const T (&tab)[(d+1)*(d+1)])
+ {
+ algebra::h_mat<d,T> tmp;
+ for (unsigned i = 0; i <= d; ++i)
+ tmp(i / (d+1), i % (d+1)) = tab[i];
+ return tmp;
+ }
+
+
+ template <typename T, unsigned d>
+ algebra::h_mat<d,T>
+ h_mat(const T (&tab)[d+1][d+1])
+ {
+ algebra::h_mat<d,T> tmp;
+ for (unsigned i = 0; i <= d; ++i)
+ for (unsigned j = 0; j <= d; ++j)
+ tmp(i, j) = tab[i][j];
+ return tmp;
+ }
+
+
+ template <typename T, unsigned N>
+ inline
+ algebra::h_mat<mlc_sqrt_int(N), T>
+ h_mat(const T (&tab)[N])
+ {
+ enum { n = mlc_sqrt_int(N) };
+ mlc_bool(N == n * n)::check();
+ algebra::h_mat<n,T> tmp;
+ for (unsigned i = 0; i < N; ++i)
+ tmp(i / n, i % n) = tab[i];
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+#endif // ! MLN_MAKE_H_MAT_HH
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 2653f23..a6b6b26 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -145,6 +145,7 @@ mln_make_w_window2d_int \
mln_make_box1d \
mln_make_voronoi \
mln_make_box2d \
+mln_make_h_mat \
mln_make_w_window2d \
mln_make_box3d \
mln_make_relabelfun \
diff --git a/milena/tests/unit_test/mln_make_h_mat.cc b/milena/tests/unit_test/mln_make_h_mat.cc
new file mode 100644
index 0000000..b572cb4
--- /dev/null
+++ b/milena/tests/unit_test/mln_make_h_mat.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/make/h_mat.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/make/h_mat.hh>
+#include <mln/make/h_mat.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5