- Timestamp:
- Dec 29, 2021, 5:51:47 PM (3 years ago)
- Branches:
- feature/cnn, feature/crepe
- Children:
- a33c395
- Parents:
- 70afae1
- git-author:
- Paul Brossier <piem@piem.org> (01/07/19 23:11:28)
- git-committer:
- Paul Brossier <piem@piem.org> (12/29/21 17:51:47)
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fmat.c
r70afae1 r1f13e29 187 187 #endif 188 188 #endif 189 } 190 #endif 191 #endif 192 } 189 } 190 191 void fvec_matmul(const fvec_t *scale, const fmat_t *s, fvec_t *output) { 192 AUBIO_ASSERT(s->height == scale->length); 193 AUBIO_ASSERT(s->length == output->length); 194 #if !defined(HAVE_ACCELERATE) && !defined(HAVE_BLAS) 195 uint_t j, k; 196 fvec_zeros(output); 197 for (k = 0; k < s->height; k++) { 198 for (j = 0; j < s->length; j++) { 199 output->data[j] += s->data[k][j] * scale->data[k]; 200 } 201 } 202 #elif defined(HAVE_BLAS) 203 #if 0 204 for (k = 0; k < s->length; k++) { 205 output->data[k] = aubio_cblas_dot( scale->length, scale->data, 1, 206 &s->data[0][0] + k, s->length); 207 } 208 #else 209 aubio_cblas__gemv(CblasColMajor, CblasNoTrans, 210 s->length, s->height, 1., 211 s->data[0], s->length, 212 scale->data, 1, 0., 213 output->data, 1); 214 #endif 215 #elif defined(HAVE_ACCELERATE) 216 #if 0 217 // seems slower and less precise (and dangerous?) 218 vDSP_mmul (s->data[0], 1, scale->data, 1, output->data, 1, s->height, 1, s->length); 219 #else 220 uint_t k; 221 for (k = 0; k < s->height; k++) { 222 aubio_vDSP_dotpr( scale->data, 1, s->data[k], 1, &(output->data[k]), scale->length); 223 } 224 #endif 225 #endif 226 } -
src/fmat.h
r70afae1 r1f13e29 161 161 \param s matrix to compute product with 162 162 \param scale vector to compute product with 163 \param output vector to store restults in 163 \param output vector of results 164 164 165 165 166 */ 166 167 void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output); 168 169 /** compute the product of a vector by a matrix 170 171 \param s matrix to compute product with 172 \param scale input to compute product with 173 \param output vector of results 174 175 */ 176 void fvec_matmul(const fvec_t *scale, const fmat_t *s, fvec_t *output); 167 177 168 178 #ifdef __cplusplus
Note: See TracChangeset
for help on using the changeset viewer.