[api] add fvec_mul
authorPaul Brossier <piem@piem.org>
Sat, 17 Nov 2018 14:15:15 +0000 (15:15 +0100)
committerPaul Brossier <piem@piem.org>
Sat, 17 Nov 2018 14:15:15 +0000 (15:15 +0100)
src/mathutils.c
src/mathutils.h

index b9de9e5..35755fe 100644 (file)
@@ -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;
 void fvec_adapt_thres(fvec_t * vec, fvec_t * tmp,
     uint_t post, uint_t pre) {
   uint_t length = vec->length, j;
index 56e52ea..4336d7e 100644 (file)
@@ -193,6 +193,14 @@ void fvec_alpha_normalise (fvec_t * v, smpl_t p);
 */
 void fvec_add (fvec_t * v, smpl_t c);
 
 */
 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
 /** remove the minimum value of the vector to each elements
 
   \param v vector to remove minimum from