From 9d9b1274a522e1bf0c5dea210765a0368ebb74a5 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 17 Oct 2008 21:21:39 +0000 Subject: acknowledgement to Dylan Simon, updated readme and fixed mapCAux --- lib/Numeric/GSL/gsl-aux.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lib/Numeric/GSL/gsl-aux.c') diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c index 052cafd..77e793e 100644 --- a/lib/Numeric/GSL/gsl-aux.c +++ b/lib/Numeric/GSL/gsl-aux.c @@ -95,6 +95,26 @@ inline double sign(double x) { } } +inline gsl_complex complex_abs(gsl_complex z) { + gsl_complex r; + r.dat[0] = gsl_complex_abs(z); + r.dat[1] = 0; + return r; +} + +inline gsl_complex complex_signum(gsl_complex z) { + gsl_complex r; + double mag; + if (z.dat[0] == 0 && z.dat[1] == 0) { + r.dat[0] = 0; + r.dat[1] = 0; + } else { + mag = gsl_complex_abs(z); + r.dat[0] = z.dat[0]/mag; + r.dat[1] = z.dat[1]/mag; + } + return r; +} #define OP(C,F) case C: { for(k=0;k