ref: 012466b44a87cb98da5a4352afbffad746e290fa
parent: 9e0dd58355074f82df1c04e430a02ace1ad6034a
author: Paul Brossier <piem@piem.org>
date: Sat Sep 26 00:44:00 EDT 2009
src/cvec.{c,h}: add cvec_set, cvec_zeros and cvec_ones
--- a/src/cvec.c
+++ b/src/cvec.c
@@ -99,3 +99,20 @@
}
}
+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.);
+}
+
--- a/src/cvec.h
+++ b/src/cvec.h
@@ -188,6 +188,28 @@
*/
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