Changeset b849106


Ignore:
Timestamp:
Oct 19, 2009, 2:58:31 PM (15 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
3f99693
Parents:
b01bd4a
Message:

src/lvec.{c,h}: add some utils

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/lvec.c

    rb01bd4a rb849106  
    7575}
    7676
     77void lvec_set(lvec_t *s, smpl_t val) {
     78  uint_t i,j;
     79  for (i=0; i< s->channels; i++) {
     80    for (j=0; j< s->length; j++) {
     81      s->data[i][j] = val;
     82    }
     83  }
     84}
     85
     86void lvec_zeros(lvec_t *s) {
     87  lvec_set(s, 0.);
     88}
     89
     90void lvec_ones(lvec_t *s) {
     91  lvec_set(s, 1.);
     92}
     93
  • src/lvec.h

    rb01bd4a rb849106  
    123123void lvec_print(lvec_t *s);
    124124
     125/** set all elements to a given value
     126
     127  \param s vector to modify
     128  \param val value to set elements to
     129
     130*/
     131void lvec_set(lvec_t *s, smpl_t val);
     132
     133/** set all elements to zero
     134
     135  \param s vector to modify
     136
     137*/
     138void lvec_zeros(lvec_t *s);
     139
     140/** set all elements to ones
     141
     142  \param s vector to modify
     143
     144*/
     145void lvec_ones(lvec_t *s);
     146
    125147#ifdef __cplusplus
    126148}
Note: See TracChangeset for help on using the changeset viewer.