Changeset c78f151


Ignore:
Timestamp:
Dec 29, 2021, 5:52:02 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe
Children:
636bc43
Parents:
57f8bc1
git-author:
Paul Brossier <piem@piem.org> (01/29/19 03:32:04)
git-committer:
Paul Brossier <piem@piem.org> (12/29/21 17:52:02)
Message:

[fmat] add matmul with blas implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/fmat.c

    r57f8bc1 rc78f151  
    227227#endif
    228228}
     229
     230void fmat_matmul(const fmat_t *a, const fmat_t *b, fmat_t *c)
     231{
     232  AUBIO_ASSERT (a->height == c->height);
     233  AUBIO_ASSERT (a->length == b->height);
     234  AUBIO_ASSERT (b->length == c->length);
     235#if !defined(HAVE_BLAS)
     236  uint_t i, j, k;
     237  for (i = 0; i < c->height; i++) {
     238    for (j = 0; j < c->length; j++) {
     239      smpl_t sum = 0.;
     240      for (k = 0; k < a->length; k++) {
     241          sum += a->data[0][i * a->length + k]
     242            * b->data[0][k * b->length + j];
     243      }
     244      c->data[0][i * c->length + j] = sum;
     245    }
     246  }
     247#else
     248  aubio_cblas__gemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, a->height,
     249      b->length, b->height, 1.F, a->data[0], a->length, b->data[0],
     250      b->length, 0.F, c->data[0], b->length);
     251#endif
     252}
Note: See TracChangeset for help on using the changeset viewer.