src/aubio_priv.h: split BLAS and ATLAS support
authorPaul Brossier <piem@piem.org>
Fri, 21 Sep 2018 15:50:03 +0000 (17:50 +0200)
committerPaul Brossier <piem@piem.org>
Fri, 21 Sep 2018 15:50:03 +0000 (17:50 +0200)
src/aubio_priv.h
src/fmat.c
src/fvec.c
src/mathutils.c

index 5bb10bf..589c47a 100644 (file)
 #include <stdarg.h>
 #endif
 
-#ifdef HAVE_ACCELERATE
+#if defined(HAVE_ACCELERATE)
 #define HAVE_ATLAS 1
+#define HAVE_BLAS 1
 #include <Accelerate/Accelerate.h>
 #elif defined(HAVE_ATLAS_CBLAS_H)
+#elif defined(HAVE_BLAS)
+#if defined(HAVE_ATLAS_CBLAS_H)
 #define HAVE_ATLAS 1
 #include <atlas/cblas.h>
+#elif defined(HAVE_OPENBLAS_CBLAS_H)
+#include <openblas/cblas.h>
+#elif defined(HAVE_CBLAS_H)
+#include <cblas.h>
+#endif
 #endif
 
 #ifdef HAVE_ACCELERATE
 #endif /* HAVE_AUBIO_DOUBLE */
 #endif /* HAVE_ACCELERATE */
 
-#ifdef HAVE_ATLAS
+#if defined(HAVE_BLAS)
 #ifndef HAVE_AUBIO_DOUBLE
+#ifdef HAVE_ATLAS
 #define aubio_catlas_set      catlas_sset
+#endif /* HAVE_ATLAS */
 #define aubio_cblas_copy      cblas_scopy
 #define aubio_cblas_swap      cblas_sswap
 #define aubio_cblas_dot       cblas_sdot
 #else /* HAVE_AUBIO_DOUBLE */
+#ifdef HAVE_ATLAS
 #define aubio_catlas_set      catlas_dset
+#endif /* HAVE_ATLAS */
 #define aubio_cblas_copy      cblas_dcopy
 #define aubio_cblas_swap      cblas_dswap
 #define aubio_cblas_dot       cblas_ddot
 #endif /* HAVE_AUBIO_DOUBLE */
-#endif /* HAVE_ATLAS */
+#endif /* HAVE_BLAS */
 
 #if defined HAVE_INTEL_IPP
 #include <ippcore.h>
index c8541a5..307b073 100644 (file)
@@ -160,7 +160,7 @@ void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output) {
   assert(s->height == output->length);
   assert(s->length == scale->length);
 #endif
-#if !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS)
+#if !defined(HAVE_ACCELERATE) && !defined(HAVE_BLAS)
   uint_t j;
   fvec_zeros(output);
   for (j = 0; j < s->length; j++) {
index d356f81..3bb0b17 100644 (file)
@@ -134,7 +134,7 @@ void fvec_copy(const fvec_t *s, fvec_t *t) {
   }
 #if defined(HAVE_INTEL_IPP)
   aubio_ippsCopy(s->data, t->data, (int)s->length);
-#elif defined(HAVE_ATLAS)
+#elif defined(HAVE_BLAS)
   aubio_cblas_copy(s->length, s->data, 1, t->data, 1);
 #elif defined(HAVE_ACCELERATE)
   aubio_vDSP_mmov(s->data, t->data, 1, s->length, 1, 1);
index ef7b0de..a40900c 100644 (file)
@@ -271,7 +271,7 @@ fvec_shift (fvec_t * s)
   uint_t half = s->length / 2, start = half, j;
   // if length is odd, middle element is moved to the end
   if (2 * half < s->length) start ++;
-#ifndef HAVE_ATLAS
+#ifndef HAVE_BLAS
   for (j = 0; j < half; j++) {
     ELEM_SWAP (s->data[j], s->data[j + start]);
   }
@@ -291,7 +291,7 @@ fvec_ishift (fvec_t * s)
   uint_t half = s->length / 2, start = half, j;
   // if length is odd, middle element is moved to the beginning
   if (2 * half < s->length) start ++;
-#ifndef HAVE_ATLAS
+#ifndef HAVE_BLAS
   for (j = 0; j < half; j++) {
     ELEM_SWAP (s->data[j], s->data[j + start]);
   }
@@ -328,7 +328,7 @@ smpl_t
 aubio_level_lin (const fvec_t * f)
 {
   smpl_t energy = 0.;
-#ifndef HAVE_ATLAS
+#ifndef HAVE_BLAS
   uint_t j;
   for (j = 0; j < f->length; j++) {
     energy += SQR (f->data[j]);