Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* oln/transforms/shapelets.hh: Optimize Hermite polynomials
computation.
Index: olena/oln/transforms/shapelets.hh
--- olena/oln/transforms/shapelets.hh Sat, 26 Jun 2004 23:19:24 +0200 thivol_d
(oln/r/10_shapelets. 1.4 600)
+++ olena/oln/transforms/shapelets.hh Sat, 11 Sep 2004 01:29:25 +0200 thivol_d
(oln/r/10_shapelets. 1.4 600)
@@ -18,12 +18,23 @@
{
T operator()(unsigned n, T x)
{
+ T a;
+ T b;
+ T c;
if (n == 0)
- return 1;
+ return 1.;
if (n == 1)
return 2. * x;
- return 2. * x * (*this)(n - 1, x) - 2. * T(n - 1) * (*this)(n - 2, x);
+ a = 1.;
+ b = 2. * x;
+ for (unsigned i = 2; i <= n; i++)
+ {
+ c = b;
+ b = 2. * x * b - 2. * T(i - 1) * a;
+ a = c;
+ }
+ return b;
}
};
Ben ca va plus vite.
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
Show replies by date