diff options
Diffstat (limited to 'lib/Numeric/GSL/gsl-aux.c')
-rw-r--r-- | lib/Numeric/GSL/gsl-aux.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c index fe33766..3f9eeba 100644 --- a/lib/Numeric/GSL/gsl-aux.c +++ b/lib/Numeric/GSL/gsl-aux.c | |||
@@ -234,6 +234,35 @@ int toScalarF(int code, KFVEC(x), FVEC(r)) { | |||
234 | } | 234 | } |
235 | 235 | ||
236 | 236 | ||
237 | int toScalarC(int code, KCVEC(x), RVEC(r)) { | ||
238 | REQUIRES(rn==1,BAD_SIZE); | ||
239 | DEBUGMSG("toScalarC"); | ||
240 | KCVVIEW(x); | ||
241 | double res; | ||
242 | switch(code) { | ||
243 | case 0: { res = gsl_blas_dznrm2(V(x)); break; } | ||
244 | case 1: { res = gsl_blas_dzasum(V(x)); break; } | ||
245 | default: ERROR(BAD_CODE); | ||
246 | } | ||
247 | rp[0] = res; | ||
248 | OK | ||
249 | } | ||
250 | |||
251 | int toScalarQ(int code, KQVEC(x), FVEC(r)) { | ||
252 | REQUIRES(rn==1,BAD_SIZE); | ||
253 | DEBUGMSG("toScalarQ"); | ||
254 | KQVVIEW(x); | ||
255 | float res; | ||
256 | switch(code) { | ||
257 | case 0: { res = gsl_blas_scnrm2(V(x)); break; } | ||
258 | case 1: { res = gsl_blas_scasum(V(x)); break; } | ||
259 | default: ERROR(BAD_CODE); | ||
260 | } | ||
261 | rp[0] = res; | ||
262 | OK | ||
263 | } | ||
264 | |||
265 | |||
237 | inline double sign(double x) { | 266 | inline double sign(double x) { |
238 | if(x>0) { | 267 | if(x>0) { |
239 | return +1.0; | 268 | return +1.0; |