From: Paul Brossier Date: Mon, 7 Jan 2019 21:19:48 +0000 (+0100) Subject: [fvec] add fvec_vecadd X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=567727d67ea242a3a040c8debbb573255a1d3de2;p=aubio.git [fvec] add fvec_vecadd --- diff --git a/src/fvec.c b/src/fvec.c index 3bb0b173..60c37178 100644 --- a/src/fvec.c +++ b/src/fvec.c @@ -98,6 +98,14 @@ void fvec_rev(fvec_t *s) { } } +void fvec_vecadd(fvec_t *s, const fvec_t *bias) { + uint_t j; + uint_t length = MIN(s->length, bias->length); + for (j = 0; j < length; j++) { + s->data[j] += bias->data[j]; + } +} + void fvec_weight(fvec_t *s, const fvec_t *weight) { uint_t length = MIN(s->length, weight->length); #if defined(HAVE_INTEL_IPP) diff --git a/src/fvec.h b/src/fvec.h index bd8c5a60..1586e3fe 100644 --- a/src/fvec.h +++ b/src/fvec.h @@ -143,6 +143,16 @@ void fvec_ones(fvec_t *s); */ void fvec_rev(fvec_t *s); +/** add a vector b to vector a, modifying a + + \param a input vector to add b to + \param b input vector of the values to be added to a + + Upon return, he content of a[i] will be set to a[i] + b[i]. + +*/ +void fvec_vecadd(fvec_t *a, const fvec_t *b); + /** apply weight to vector If the weight vector is longer than s, only the first elements are used. If