From: Paul Brossier Date: Sat, 26 Sep 2009 02:44:00 +0000 (+0200) Subject: src/cvec.{c,h}: add cvec_set, cvec_zeros and cvec_ones X-Git-Tag: bzr2git~283 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=012466b44a87cb98da5a4352afbffad746e290fa;p=aubio.git src/cvec.{c,h}: add cvec_set, cvec_zeros and cvec_ones --- diff --git a/src/cvec.c b/src/cvec.c index 3ba8104a..877cca31 100644 --- a/src/cvec.c +++ b/src/cvec.c @@ -99,3 +99,20 @@ void cvec_print(cvec_t *s) { } } +void cvec_set(cvec_t *s, smpl_t val) { + uint_t i,j; + for (i=0; i< s->channels; i++) { + for (j=0; j< s->length; j++) { + s->norm[i][j] = val; + } + } +} + +void cvec_zeros(cvec_t *s) { + cvec_set(s, 0.); +} + +void cvec_ones(cvec_t *s) { + cvec_set(s, 1.); +} + diff --git a/src/cvec.h b/src/cvec.h index 8709d8b6..9ff948bc 100644 --- a/src/cvec.h +++ b/src/cvec.h @@ -188,6 +188,28 @@ smpl_t ** cvec_get_phas(cvec_t *s); */ void cvec_print(cvec_t *s); +/** set all elements to a given value + + \param s vector to modify + \param val value to set elements to + +*/ +void cvec_set(cvec_t *s, smpl_t val); + +/** set all elements to zero + + \param s vector to modify + +*/ +void cvec_zeros(cvec_t *s); + +/** set all elements to ones + + \param s vector to modify + +*/ +void cvec_ones(cvec_t *s); + #ifdef __cplusplus } #endif