From da01353b1a810e4b4858e8a485d75c26a525d488 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 17 Nov 2018 15:15:15 +0100 Subject: [PATCH] [api] add fvec_mul --- src/mathutils.c | 9 +++++++++ src/mathutils.h | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/mathutils.c b/src/mathutils.c index b9de9e55..35755fe4 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -387,6 +387,15 @@ fvec_add (fvec_t * o, smpl_t val) } } +void +fvec_mul (fvec_t *o, smpl_t val) +{ + uint_t j; + for (j = 0; j < o->length; j++) { + o->data[j] *= val; + } +} + void fvec_adapt_thres(fvec_t * vec, fvec_t * tmp, uint_t post, uint_t pre) { uint_t length = vec->length, j; diff --git a/src/mathutils.h b/src/mathutils.h index 56e52ea3..4336d7ec 100644 --- a/src/mathutils.h +++ b/src/mathutils.h @@ -193,6 +193,14 @@ void fvec_alpha_normalise (fvec_t * v, smpl_t p); */ void fvec_add (fvec_t * v, smpl_t c); +/** multiply each elements of a vector by a scalar + + \param v vector to add constant to + \param s constant to scale v with + +*/ +void fvec_mul (fvec_t * v, smpl_t s); + /** remove the minimum value of the vector to each elements \param v vector to remove minimum from -- 2.11.0