oln 10.53: Minor changes on dpoint.

Index: olena/ChangeLog from Astrid Wang <astrid@lrde.epita.fr> * oln/core/abstract/dpoint.hh: Fix headers. Add member function sqr_norm2(). Index: olena/oln/core/abstract/dpoint.hh --- olena/oln/core/abstract/dpoint.hh Mon, 19 Jan 2004 18:35:23 +0100 astrid (oln/d/28_dpoint.hh 1.17 640) +++ olena/oln/core/abstract/dpoint.hh Fri, 23 Jan 2004 15:51:36 +0100 astrid (oln/d/28_dpoint.hh 1.17 640) @@ -30,7 +30,8 @@ # include <mlc/type.hh> # include <oln/core/coord.hh> -# include <ntg/real/builtin_float.hh> +# include <ntg/float.hh> +# include <cmath> namespace oln { @@ -146,6 +147,16 @@ return sqrt(norm); } + ntg::float_d + sqr_norm2(void) const + { + double norm = 0; + + for (unsigned i = 0; i < dim; ++i) + norm += nth(i) * nth(i); + return norm; + } + static std::string name() { -- astrid

Index: olena/ChangeLog from Astrid Wang <astrid@lrde.epita.fr>
* oln/core/abstract/dpoint.hh: Fix headers. Add member function sqr_norm2().
Index: olena/oln/core/abstract/dpoint.hh --- olena/oln/core/abstract/dpoint.hh Mon, 19 Jan 2004 18:35:23 +0100 astrid (oln/d/28_dpoint.hh 1.17 640) +++ olena/oln/core/abstract/dpoint.hh Fri, 23 Jan 2004 15:51:36 +0100 astrid (oln/d/28_dpoint.hh 1.17 640) @@ -30,7 +30,8 @@
# include <mlc/type.hh> # include <oln/core/coord.hh> -# include <ntg/real/builtin_float.hh> +# include <ntg/float.hh> +# include <cmath>
namespace oln {
@@ -146,6 +147,16 @@ return sqrt(norm); }
+ ntg::float_d + sqr_norm2(void) const + { + double norm = 0; + + for (unsigned i = 0; i < dim; ++i) + norm += nth(i) * nth(i); + return norm; + } +
Ne faudrait-il pas redéfinir norm2 en fn de sqr_norm2 ?
participants (2)
-
Akim Demaille
-
Astrid Wang