* mln/accu/convolve.hh,
* mln/algebra/mat.hh,
* mln/algebra/vec.hh,
* mln/fun/v2v/norm.hh,
* mln/linear/ch_convolve.hh,
* mln/metal/array1d.hh,
* mln/metal/array2d.hh,
* mln/metal/array3d.hh,
* mln/metal/mat.hh,
* mln/metal/vec.hh,
* mln/value/ops.hh: rename mln_sum_x to mln_sum_product.
* mln/norm/l1.hh,
* mln/norm/l2.hh: use mln_sum_product instead of mln_sum according to
the fixme.
---
milena/ChangeLog | 20 +++++++++++++++
milena/mln/accu/convolve.hh | 7 +++--
milena/mln/algebra/mat.hh | 20 ++++++++--------
milena/mln/algebra/vec.hh | 15 ++++++-----
milena/mln/fun/v2v/norm.hh | 48 +++++++++++++++++--------------------
milena/mln/linear/ch_convolve.hh | 4 +-
milena/mln/metal/array1d.hh | 2 +-
milena/mln/metal/array2d.hh | 2 +-
milena/mln/metal/array3d.hh | 2 +-
milena/mln/metal/mat.hh | 20 ++++++++--------
milena/mln/metal/vec.hh | 8 +++---
milena/mln/norm/l1.hh | 31 +++++++++++-------------
milena/mln/norm/l2.hh | 42 +++++++++++++++-----------------
milena/mln/value/ops.hh | 4 +-
14 files changed, 119 insertions(+), 106 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 681224f..f5bebd3 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,23 @@
+2008-12-30 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Rename mln_sum_x to mln_sum_product.
+
+ * mln/accu/convolve.hh,
+ * mln/algebra/mat.hh,
+ * mln/algebra/vec.hh,
+ * mln/fun/v2v/norm.hh,
+ * mln/linear/ch_convolve.hh,
+ * mln/metal/array1d.hh,
+ * mln/metal/array2d.hh,
+ * mln/metal/array3d.hh,
+ * mln/metal/mat.hh,
+ * mln/metal/vec.hh,
+ * mln/value/ops.hh: rename mln_sum_x to mln_sum_product.
+
+ * mln/norm/l1.hh,
+ * mln/norm/l2.hh: use mln_sum_product instead of mln_sum according to
+ the fixme.
+
2008-12-30 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix warnings due to g++ -Wconversion option.
diff --git a/milena/mln/accu/convolve.hh b/milena/mln/accu/convolve.hh
index de20998..0769f1a 100644
--- a/milena/mln/accu/convolve.hh
+++ b/milena/mln/accu/convolve.hh
@@ -50,9 +50,10 @@ namespace mln
/// convolved. Parameter \c R is the result type.
///
template <typename T1, typename T2,
- typename R = mln_sum_x(T1, T2)>
+ typename R = mln_sum_product(T1, T2)>
struct convolve : public mln::accu::internal::base< R, convolve<T1,T2,R>
>,
- private metal::converts_to< mln_sum_x(T1, T2), R >::check_t
+ private metal::converts_to< mln_sum_product(T1, T2),
+ R >::check_t
{
typedef std::pair<T1,T2> argument;
@@ -75,7 +76,7 @@ namespace mln
protected:
- typedef mln_sum_x(T1, T2) S;
+ typedef mln_sum_product(T1, T2) S;
S s_;
};
diff --git a/milena/mln/algebra/mat.hh b/milena/mln/algebra/mat.hh
index 9fd5931..08b8ee2 100644
--- a/milena/mln/algebra/mat.hh
+++ b/milena/mln/algebra/mat.hh
@@ -152,13 +152,13 @@ namespace mln
unsigned m, typename U >
struct set_precise_binary_< op::times, algebra::mat<n,o,T>,
algebra::mat<o,m,U> >
{
- typedef algebra::mat<n, m, mln_sum_x(T, U)> ret;
+ typedef algebra::mat<n, m, mln_sum_product(T, U)> ret;
};
template < unsigned n, typename T, typename U >
struct set_precise_binary_< op::times, algebra::mat<n,n,T>,
algebra::mat<n,n,U> >
{ // Disambiguate between both previous defs.
- typedef algebra::mat<n, n, mln_sum_x(T, U)> ret;
+ typedef algebra::mat<n, n, mln_sum_product(T, U)> ret;
};
// mat * vec
@@ -167,7 +167,7 @@ namespace mln
typename U >
struct set_precise_binary_< op::times, algebra::mat<n,m,T>,
algebra::vec<m,U> >
{
- typedef algebra::vec<n, mln_sum_x(T, U)> ret;
+ typedef algebra::vec<n, mln_sum_product(T, U)> ret;
};
// mat * s
@@ -226,14 +226,14 @@ namespace mln
template <unsigned n, unsigned o, typename T,
unsigned m, typename U>
- mat<n, m, mln_sum_x(T,U)>
+ mat<n, m, mln_sum_product(T,U)>
operator*(const mat<n,o,T>& lhs, const mat<o,m,U>& rhs);
// mat * vec
template <unsigned n, unsigned m, typename T,
typename U>
- vec<n, mln_sum_x(T,U)>
+ vec<n, mln_sum_product(T,U)>
operator*(const mat<n,m,T>& lhs, const vec<m,U>& rhs);
// mat * s
@@ -424,10 +424,10 @@ namespace mln
template <unsigned n, unsigned o, typename T,
unsigned m, typename U>
inline
- mat<n, m, mln_sum_x(T,U)>
+ mat<n, m, mln_sum_product(T,U)>
operator*(const mat<n,o,T>& lhs, const mat<o,m,U>& rhs)
{
- mat<n,m, mln_sum_x(T,U)> tmp;
+ mat<n,m, mln_sum_product(T,U)> tmp;
for (unsigned i = 0; i < n; ++i)
for (unsigned j = 0; j < m; ++j)
{
@@ -441,13 +441,13 @@ namespace mln
template <unsigned n, unsigned m, typename T,
typename U>
inline
- vec<n, mln_sum_x(T,U)>
+ vec<n, mln_sum_product(T,U)>
operator*(const mat<n,m,T>& lhs, const vec<m,U>& rhs)
{
- vec<n, mln_sum_x(T,U)> tmp;
+ vec<n, mln_sum_product(T,U)> tmp;
for (unsigned i = 0; i < n; ++i)
{
- mln_sum_x(T,U) sum(literal::zero);
+ mln_sum_product(T,U) sum(literal::zero);
for (unsigned j = 0; j < m; ++j)
sum += lhs(i, j) * rhs[j];
tmp[i] = sum;
diff --git a/milena/mln/algebra/vec.hh b/milena/mln/algebra/vec.hh
index 1434930..da2541c 100644
--- a/milena/mln/algebra/vec.hh
+++ b/milena/mln/algebra/vec.hh
@@ -48,7 +48,6 @@
# include <mln/value/ops.hh>
-
// FIXME: Document.
@@ -67,7 +66,7 @@ namespace mln
namespace norm {
template <unsigned n, typename C>
- mln_sum(C) l2(const algebra::vec<n,C>& vec);
+ mln_sum_product(C,C) l2(const algebra::vec<n,C>& vec);
}
@@ -273,7 +272,7 @@ namespace mln
struct set_precise_binary_< op::times,
algebra::vec<n, T>, algebra::vec<n, U> >
{
- typedef mln_sum_x(T,U) ret;
+ typedef mln_sum_product(T,U) ret;
};
template < template <class, class> class Name,
@@ -325,7 +324,7 @@ namespace mln
/// Scalar product (dot product).
template <unsigned n, typename T, typename U>
- mln_sum_x(T,U)
+ mln_sum_product(T,U)
operator*(const vec<n,T>& lhs, const vec<n,U>& rhs);
// vec * s
@@ -400,6 +399,7 @@ namespace mln
vec<n,T>::vec(const vec<n, U>& rhs)
: super_()
{
+ mlc_converts_to(U, T)::check();
for (unsigned i = 0; i < n; ++i)
data_[i] = static_cast<T>(rhs[i]);
}
@@ -409,6 +409,7 @@ namespace mln
inline
vec<n,T>& vec<n,T>::operator=(const vec<n, U>& rhs)
{
+ mlc_converts_to(U, T)::check();
for (unsigned i = 0; i < n; ++i)
data_[i] = static_cast<T>(rhs[i]);
return *this;
@@ -515,11 +516,11 @@ namespace mln
template <unsigned n, typename T, typename U>
inline
- mln_sum_x(T,U)
+ mln_sum_product(T,U)
operator*(const vec<n,T>& lhs, const vec<n,U>& rhs)
{
- typedef mln_sum_x(T,U) R;
- mln_sum_x(T,U) tmp(literal::zero);
+ typedef mln_sum_product(T,U) R;
+ mln_sum_product(T,U) tmp(literal::zero);
for (unsigned i = 0; i < n; ++i)
tmp += lhs[i] * rhs[i];
return tmp;
diff --git a/milena/mln/fun/v2v/norm.hh b/milena/mln/fun/v2v/norm.hh
index 43a3f58..2dc4f2a 100644
--- a/milena/mln/fun/v2v/norm.hh
+++ b/milena/mln/fun/v2v/norm.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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,17 +29,15 @@
#ifndef MLN_FUN_V2V_NORM_HH
# define MLN_FUN_V2V_NORM_HH
-/*! \file mln/fun/v2v/norm.hh
- *
- * \brief Norm functors.
- *
- * \see mln/norm/.
- */
+/// \file mln/fun/v2v/norm.hh
+///
+/// Norm functors.
+///
+/// \see mln/norm/.
// FIXME: Move to mln/fun/x2v/?
# include <mln/core/concept/function.hh>
-# include <mln/trait/value_.hh>
# include <mln/norm/all.hh>
@@ -52,12 +51,11 @@ namespace mln
namespace v2v
{
- /*! \brief L1-norm.
- *
- * \c V is the type of input values; \c R is the result type.
- *
- * \see mln::norm::l1.
- */
+ /// L1-norm.
+ ///
+ /// \c V is the type of input values; \c R is the result type.
+ ///
+ /// \see mln::norm::l1.
template <typename V, typename R>
struct l1_norm : public Function_v2v< l1_norm<V, R> >
{
@@ -65,12 +63,11 @@ namespace mln
R operator()(const V& v) const;
};
- /*! \brief L2-norm.
- *
- * \c V is the type of input values; \c R is the result type.
- *
- * \see mln::norm::l2.
- */
+ /// L2-norm.
+ ///
+ /// \c V is the type of input values; \c R is the result type.
+ ///
+ /// \see mln::norm::l2.
template <typename V, typename R>
struct l2_norm : public Function_v2v< l2_norm<V, R> >
{
@@ -78,12 +75,11 @@ namespace mln
R operator()(const V& v) const;
};
- /*! \brief L-infty norm.
- *
- * \c V is the type of input values; \c R is the result type.
- *
- * \see mln::norm::linfty.
- */
+ /// L-infty norm.
+ ///
+ /// \c V is the type of input values; \c R is the result type.
+ ///
+ /// \see mln::norm::linfty.
template <typename V, typename R>
struct linfty_norm : public Function_v2v< linfty_norm<V, R> >
{
diff --git a/milena/mln/linear/ch_convolve.hh b/milena/mln/linear/ch_convolve.hh
index 59fb7e0..cb14372 100644
--- a/milena/mln/linear/ch_convolve.hh
+++ b/milena/mln/linear/ch_convolve.hh
@@ -64,14 +64,14 @@ namespace mln
typename I, typename W>
struct ch_convolve_helper
{
- typedef mln_sum_x(mln_value(I), mln_weight(W)) V;
+ typedef mln_sum_product(mln_value(I), mln_weight(W)) V;
typedef mln_ch_value(I, V) ret;
};
template <typename I, typename W>
struct ch_convolve_helper<false, I, W>
{
- typedef mln_sum_x(mln_value(I), W) V;
+ typedef mln_sum_product(mln_value(I), W) V;
typedef mln_ch_value(I, V) ret;
};
diff --git a/milena/mln/metal/array1d.hh b/milena/mln/metal/array1d.hh
index 7f441d8..d06f523 100644
--- a/milena/mln/metal/array1d.hh
+++ b/milena/mln/metal/array1d.hh
@@ -164,7 +164,7 @@ namespace mln
struct set_precise_binary_< op::times,
metal::array1d<T, n>, metal::array1d<U, n> >
{
- typedef mln_sum_x(T,U) ret;
+ typedef mln_sum_product(T,U) ret;
};
template < template <class, class> class Name,
diff --git a/milena/mln/metal/array2d.hh b/milena/mln/metal/array2d.hh
index 4f3992a..66f0cb9 100644
--- a/milena/mln/metal/array2d.hh
+++ b/milena/mln/metal/array2d.hh
@@ -175,7 +175,7 @@ namespace mln
struct set_precise_binary_< op::times,
metal::array2d<T, r, c>, metal::array2d<U, r, c> >
{
- typedef mln_sum_x(T,U) ret;
+ typedef mln_sum_product(T,U) ret;
};
template < template <class, class> class Name,
diff --git a/milena/mln/metal/array3d.hh b/milena/mln/metal/array3d.hh
index 574d2a6..9df11fe 100644
--- a/milena/mln/metal/array3d.hh
+++ b/milena/mln/metal/array3d.hh
@@ -176,7 +176,7 @@ namespace mln
struct set_precise_binary_< op::times,
metal::array3d<T, s, r, c>, metal::array3d<U, s, r, c> >
{
- typedef mln_sum_x(T,U) ret;
+ typedef mln_sum_product(T,U) ret;
};
template < template <class, class> class Name,
diff --git a/milena/mln/metal/mat.hh b/milena/mln/metal/mat.hh
index 1affc19..9690891 100644
--- a/milena/mln/metal/mat.hh
+++ b/milena/mln/metal/mat.hh
@@ -153,13 +153,13 @@ namespace mln
unsigned m, typename U >
struct set_precise_binary_< op::times, metal::mat<n,o,T>,
metal::mat<o,m,U> >
{
- typedef metal::mat<n, m, mln_sum_x(T, U)> ret;
+ typedef metal::mat<n, m, mln_sum_product(T, U)> ret;
};
template < unsigned n, typename T, typename U >
struct set_precise_binary_< op::times, metal::mat<n,n,T>,
metal::mat<n,n,U> >
{ // Disambiguate between both previous defs.
- typedef metal::mat<n, n, mln_sum_x(T, U)> ret;
+ typedef metal::mat<n, n, mln_sum_product(T, U)> ret;
};
// mat * vec
@@ -168,7 +168,7 @@ namespace mln
typename U >
struct set_precise_binary_< op::times, metal::mat<n,m,T>,
metal::vec<m,U> >
{
- typedef metal::vec<n, mln_sum_x(T, U)> ret;
+ typedef metal::vec<n, mln_sum_product(T, U)> ret;
};
// mat * s
@@ -226,14 +226,14 @@ namespace mln
template <unsigned n, unsigned o, typename T,
unsigned m, typename U>
- mat<n, m, mln_sum_x(T,U)>
+ mat<n, m, mln_sum_product(T,U)>
operator*(const mat<n,o,T>& lhs, const mat<o,m,U>& rhs);
// mat * vec
template <unsigned n, unsigned m, typename T,
typename U>
- vec<n, mln_sum_x(T,U)>
+ vec<n, mln_sum_product(T,U)>
operator*(const mat<n,m,T>& lhs, const vec<m,U>& rhs);
// mat * s
@@ -401,10 +401,10 @@ namespace mln
template <unsigned n, unsigned o, typename T,
unsigned m, typename U>
inline
- mat<n, m, mln_sum_x(T,U)>
+ mat<n, m, mln_sum_product(T,U)>
operator*(const mat<n,o,T>& lhs, const mat<o,m,U>& rhs)
{
- mat<n,m, mln_sum_x(T,U)> tmp;
+ mat<n,m, mln_sum_product(T,U)> tmp;
for (unsigned i = 0; i < n; ++i)
for (unsigned j = 0; j < m; ++j)
{
@@ -418,13 +418,13 @@ namespace mln
template <unsigned n, unsigned m, typename T,
typename U>
inline
- vec<n, mln_sum_x(T,U)>
+ vec<n, mln_sum_product(T,U)>
operator*(const mat<n,m,T>& lhs, const vec<m,U>& rhs)
{
- vec<n, mln_sum_x(T,U)> tmp;
+ vec<n, mln_sum_product(T,U)> tmp;
for (unsigned i = 0; i < n; ++i)
{
- mln_sum_x(T,U) sum(literal::zero);
+ mln_sum_product(T,U) sum(literal::zero);
for (unsigned j = 0; j < m; ++j)
sum += lhs(i, j) * rhs[j];
tmp[i] = sum;
diff --git a/milena/mln/metal/vec.hh b/milena/mln/metal/vec.hh
index 36f00ab..840eda6 100644
--- a/milena/mln/metal/vec.hh
+++ b/milena/mln/metal/vec.hh
@@ -248,7 +248,7 @@ namespace mln
struct set_precise_binary_< op::times,
metal::vec<n, T>, metal::vec<n, U> >
{
- typedef mln_sum_x(T,U) ret;
+ typedef mln_sum_product(T,U) ret;
};
template < template <class, class> class Name,
@@ -299,7 +299,7 @@ namespace mln
// vec * vec
template <unsigned n, typename T, typename U>
- mln_sum_x(T,U)
+ mln_sum_product(T,U)
operator*(const vec<n,T>& lhs, const vec<n,U>& rhs);
// vec * s
@@ -481,10 +481,10 @@ namespace mln
template <unsigned n, typename T, typename U>
inline
- mln_sum_x(T,U)
+ mln_sum_product(T,U)
operator*(const vec<n,T>& lhs, const vec<n,U>& rhs)
{
- mln_sum_x(T,U) tmp(literal::zero);
+ mln_sum_product(T,U) tmp(literal::zero);
for (unsigned i = 0; i < n; ++i)
tmp += lhs[i] * rhs[i];
return tmp;
diff --git a/milena/mln/norm/l1.hh b/milena/mln/norm/l1.hh
index c400eb6..e702d7a 100644
--- a/milena/mln/norm/l1.hh
+++ b/milena/mln/norm/l1.hh
@@ -31,15 +31,12 @@
/// \file mln/norm/l1.hh
///
-/// \brief Define some L1-norm related routines.
-/// \see
http://mathworld.wolfram.com/L1-Norm.html for more information.
+/// Define some L1-norm related routines.
+/// \see
http://mathworld.wolfram.com/L1-Norm.html for more information.
# include <mln/math/abs.hh>
# include <mln/algebra/vec.hh>
-// FIXME: Use mln_sum_x (to be renamed as mln_sum_product) instead of
-// mln_sum.
-
namespace mln
{
@@ -50,19 +47,19 @@ namespace mln
/// L1-norm of a vector \a vec.
/// \{
template <unsigned n, typename C>
- mln_sum(C) l1(const C (&vec)[n]);
+ mln_sum_product(C,C) l1(const C (&vec)[n]);
template <unsigned n, typename C>
- mln_sum(C) l1(const algebra::vec<n,C>& vec);
+ mln_sum_product(C,C) l1(const algebra::vec<n,C>& vec);
/// \}
/// L1-norm distance between vectors \a vec1 and \a vec2.
/// \{
template <unsigned n, typename C>
- mln_sum(C) l1_distance(const C (&vec1)[n], const C (&vec2)[n]);
+ mln_sum_product(C,C) l1_distance(const C (&vec1)[n], const C (&vec2)[n]);
template <unsigned n, typename C>
- mln_sum(C) l1_distance(const algebra::vec<n,C>& vec1,
+ mln_sum_product(C,C) l1_distance(const algebra::vec<n,C>& vec1,
const algebra::vec<n,C>& vec2);
/// \}
@@ -73,10 +70,10 @@ namespace mln
{
template <unsigned n, typename C, typename V>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l1_(const V& vec)
{
- typedef mln_sum(C) M;
+ typedef mln_sum_product(C,C) M;
M m = 0;
for (unsigned i = 0; i < n; ++i)
{
@@ -88,10 +85,10 @@ namespace mln
template <unsigned n, typename C, typename V>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l1_distance_(const V& vec1, const V& vec2)
{
- typedef mln_sum(C) D;
+ typedef mln_sum_product(C,C) D;
D d = 0;
for (unsigned i = 0; i < n; ++i)
{
@@ -110,7 +107,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l1(const C (&vec)[n])
{
return impl::l1_<n, C>(vec);
@@ -118,7 +115,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l1(const algebra::vec<n,C>& vec)
{
return impl::l1_<n, C>(vec);
@@ -126,7 +123,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l1_distance(const C (&vec1)[n], const C (&vec2)[n])
{
return impl::l1_distance_<n, C>(vec1, vec2);
@@ -134,7 +131,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l1_distance(const algebra::vec<n,C>& vec1, const
algebra::vec<n,C>& vec2)
{
return impl::l1_distance_<n, C>(vec1, vec2);
diff --git a/milena/mln/norm/l2.hh b/milena/mln/norm/l2.hh
index 03e1142..420a1f0 100644
--- a/milena/mln/norm/l2.hh
+++ b/milena/mln/norm/l2.hh
@@ -38,11 +38,9 @@
# include <mln/math/sqr.hh>
# include <mln/math/sqrt.hh>
# include <mln/algebra/vec.hh>
+# include <mln/value/ops.hh>
-// FIXME: Use mln_sum_x (to be renamed as mln_sum_product) instead of
-// mln_sum.
-
namespace mln
{
@@ -59,28 +57,28 @@ namespace mln
/// L2-norm of a vector \a vec.
/// \{
template <unsigned n, typename C>
- mln_sum(C) l2(const C (&vec)[n]);
+ mln_sum_product(C,C) l2(const C (&vec)[n]);
template <unsigned n, typename C>
- mln_sum(C) l2(const algebra::vec<n,C>& vec);
+ mln_sum_product(C,C) l2(const algebra::vec<n,C>& vec);
/// \}
/// Squared L2-norm of a vector \a vec.
/// \{
template <unsigned n, typename C>
- mln_sum(C) sqr_l2(const C (&vec)[n]);
+ mln_sum_product(C,C) sqr_l2(const C (&vec)[n]);
template <unsigned n, typename C>
- mln_sum(C) sqr_l2(const algebra::vec<n,C>& vec);
+ mln_sum_product(C,C) sqr_l2(const algebra::vec<n,C>& vec);
/// \}
/// L2-norm distance between vectors \a vec1 and \p vec2.
/// \{
template <unsigned n, typename C>
- mln_sum(C) l2_distance(const C (&vec1)[n], const C (&vec2)[n]);
+ mln_sum_product(C,C) l2_distance(const C (&vec1)[n], const C (&vec2)[n]);
template <unsigned n, typename C>
- mln_sum(C) l2_distance(const algebra::vec<n,C>& vec1,
+ mln_sum_product(C,C) l2_distance(const algebra::vec<n,C>& vec1,
const algebra::vec<n,C>& vec2);
/// \}
@@ -89,13 +87,13 @@ namespace mln
namespace impl
{
-
+
template <unsigned n, typename C, typename V>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l2_(const V& vec)
{
- typedef mln_sum(C) M;
+ typedef mln_sum_product(C,C) M;
M m = 0;
for (unsigned i = 0; i < n; ++i)
{
@@ -107,10 +105,10 @@ namespace mln
template <unsigned n, typename C, typename V>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
sqr_l2_(const V& vec)
{
- mln_sum(C) m = 0;
+ mln_sum_product(C,C) m = 0;
for (unsigned i = 0; i < n; ++i)
m += mln::math::sqr(vec[i]);
return m;
@@ -118,10 +116,10 @@ namespace mln
template <unsigned n, typename C, typename V>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l2_distance_(const V& vec1, const V& vec2)
{
- typedef mln_sum(C) D;
+ typedef mln_sum_product(C,C) D;
D d = 0;
for (unsigned i = 0; i < n; ++i)
{
@@ -140,7 +138,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l2(const C (&vec)[n])
{
return impl::l2_<n, C>(vec);
@@ -148,7 +146,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l2(const algebra::vec<n,C>& vec)
{
return impl::l2_<n, C>(vec);
@@ -157,7 +155,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
sqr_l2(const C (&vec)[n])
{
return impl::sqr_l2_<n, C>(vec);
@@ -165,7 +163,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
sqr_l2(const algebra::vec<n,C>& vec)
{
return impl::sqr_l2_<n, C>(vec);
@@ -174,7 +172,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l2_distance(const C (&vec1)[n], const C (&vec2)[n])
{
return impl::l2_distance_<n, C>(vec1, vec2);
@@ -182,7 +180,7 @@ namespace mln
template <unsigned n, typename C>
inline
- mln_sum(C)
+ mln_sum_product(C,C)
l2_distance(const algebra::vec<n,C>& vec1, const
algebra::vec<n,C>& vec2)
{
return impl::l2_distance_<n, C>(vec1, vec2);
diff --git a/milena/mln/value/ops.hh b/milena/mln/value/ops.hh
index 0bb7fe3..37f8a6b 100644
--- a/milena/mln/value/ops.hh
+++ b/milena/mln/value/ops.hh
@@ -44,11 +44,11 @@
# include <mln/metal/ret.hh>
/// Type trait for value sum.
-# define mln_trait_value_sum_x(T, U) \
+# define mln_trait_value_sum_product(T, U) \
typename mln::trait::value_< mln_trait_op_times(T,U) >::sum
/// Shortcut for type trait for value sum.
-# define mln_sum_x(T, U) mln_trait_value_sum_x(T, U)
+# define mln_sum_product(T, U) mln_trait_value_sum_product(T, U)
// FIXME: In the definitions below, is that equiv or interop?
--
1.5.6.5