Changeset 7048b56


Ignore:
Timestamp:
Jan 29, 2019, 3:32:04 AM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe_org
Children:
e18c30e
Parents:
d9a5466
Message:

[fmat] add matmul with blas implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/fmat.c

    rd9a5466 r7048b56  
    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.