Commit 9730fe8a authored by Morten Welinder's avatar Morten Welinder

Gamma: simplify code a tiny bit.

parent b99c3ec4
2013-12-17 Morten Welinder <terra@gnome.org>
* src/sf-gamma.c (complex_gamma): Turn a complex division into a
multiplication.
2013-12-14 Morten Welinder <terra@gnome.org>
* src/sf-gamma.c (complex_igamma): New function.
......
......@@ -1196,7 +1196,7 @@ complex_gamma (complex_t *dst, complex_t const *src)
complex_div (dst, &b, &a);
} else {
complex_t zmh, zmhd2, zmhpg, f, g, p, q, pq;
complex_t zmh, zmhd2, zmhpg, f, f2, p, q, pq;
int i;
i = G_N_ELEMENTS(lanczos_num) - 1;
......@@ -1215,11 +1215,12 @@ complex_gamma (complex_t *dst, complex_t const *src)
complex_init (&zmhd2, zmh.re * 0.5, zmh.im * 0.5);
complex_pow (&f, &zmhpg, &zmhd2);
complex_exp (&g, &zmh);
complex_div (&g, &f, &g);
complex_mul (&g, &g, &f);
zmh.re = -zmh.re; zmh.im = -zmh.im;
complex_exp (&f2, &zmh);
complex_mul (&f2, &f, &f2);
complex_mul (&f2, &f2, &f);
complex_mul (dst, &g, &pq);
complex_mul (dst, &f2, &pq);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment