From 012466b44a87cb98da5a4352afbffad746e290fa Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 26 Sep 2009 04:44:00 +0200 Subject: [PATCH] src/cvec.{c,h}: add cvec_set, cvec_zeros and cvec_ones --- src/cvec.c | 17 +++++++++++++++++ src/cvec.h | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) 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 -- 2.26.2