shithub: aubio

Download patch

ref: da01353b1a810e4b4858e8a485d75c26a525d488
parent: 195e22e4bb706f47fe6f5f20b1dc2437ef8b0034
author: Paul Brossier <piem@piem.org>
date: Sat Nov 17 10:15:15 EST 2018

[api] add fvec_mul

--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -387,6 +387,15 @@
   }
 }
 
+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;
--- a/src/mathutils.h
+++ b/src/mathutils.h
@@ -193,6 +193,14 @@
 */
 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