Changeset a7348ca5 for src/fmat.c


Ignore:
Timestamp:
Feb 16, 2016, 9:47:46 PM (4 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
fc2d7fb
Parents:
4bf3731
Message:

src/fmat.c: add optimized fmat_vecmul

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/fmat.c

    r4bf3731 ra7348ca5  
    155155}
    156156
     157void fmat_vecmul(fmat_t *s, fvec_t *scale, fvec_t *output) {
     158  uint_t k;
     159  assert(s->height == output->length);
     160  assert(s->length == scale->length);
     161#if !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS)
     162  uint_t j;
     163  fvec_zeros(output);
     164  for (j = 0; j < s->length; j++) {
     165    for (k = 0; k < s->height; k++) {
     166      output->data[k] += scale->data[j]
     167          * s->data[k][j];
     168    }
     169  }
     170#elif defined(HAVE_ATLAS)
     171  for (k = 0; k < s->height; k++) {
     172    output->data[k] = aubio_cblas_dot( s->length, scale->data, 1, s->data[k], 1);
     173  }
     174#elif defined(HAVE_ACCELERATE)
     175#if 0
     176  // seems slower and less precise (and dangerous?)
     177  vDSP_mmul (s->data[0], 1, scale->data, 1, output->data, 1, s->height, 1, s->length);
     178#else
     179  for (k = 0; k < s->height; k++) {
     180    aubio_vDSP_dotpr( scale->data, 1, s->data[k], 1, &(output->data[k]), s->length);
     181  }
     182#endif
     183#endif
     184}
Note: See TracChangeset for help on using the changeset viewer.