Changeset 7166ef8


Ignore:
Timestamp:
Sep 5, 2015, 11:05:43 AM (9 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:
8982328
Parents:
6c8ef58
Message:

src/fvec.{c,h}: add fvec_weighted_copy

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/fvec.c

    r6c8ef58 r7166ef8  
    122122}
    123123
     124void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out) {
     125#ifndef HAVE_ACCELERATE
     126  uint_t j;
     127  uint_t length = MIN(s->length, weight->length);
     128  for (j=0; j< length; j++) {
     129    out->data[j] = in->data[j] * weight->data[j];
     130  }
     131#else
     132  aubio_vDSP_vmul(in->data, 1, weight->data, 1, out->data, 1, out->length);
     133#endif /* HAVE_ACCELERATE */
     134}
     135
    124136void fvec_copy(fvec_t *s, fvec_t *t) {
    125137  if (s->length != t->length) {
  • src/fvec.h

    r6c8ef58 r7166ef8  
    163163void fvec_copy(fvec_t *s, fvec_t *t);
    164164
     165/** make a copy of a vector, applying weights to each element
     166
     167  \param in input vector
     168  \param weight weights vector
     169  \param out output vector
     170
     171*/
     172void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out);
     173
    165174#ifdef __cplusplus
    166175}
Note: See TracChangeset for help on using the changeset viewer.