aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/kann/kautodiff.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-27 21:12:31 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-27 21:12:31 +0100
commit969e2584dbd7a45531eac6b31159f84a9d97ca72 (patch)
treef57a20958ac6f59c2c0ef1f11c1fd0958c3ff884 /contrib/kann/kautodiff.c
parent1438514d3bf8de013aa311a6b0c6173de63c75e5 (diff)
downloadrspamd-969e2584dbd7a45531eac6b31159f84a9d97ca72.tar.gz
rspamd-969e2584dbd7a45531eac6b31159f84a9d97ca72.zip
[Minor] Sigh, another workaround for broken blas
Diffstat (limited to 'contrib/kann/kautodiff.c')
-rw-r--r--contrib/kann/kautodiff.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/kann/kautodiff.c b/contrib/kann/kautodiff.c
index 439485a0a..a8af6796b 100644
--- a/contrib/kann/kautodiff.c
+++ b/contrib/kann/kautodiff.c
@@ -899,16 +899,21 @@ void kad_vec_mul_sum(int n, float *a, const float *b, const float *c)
void kad_saxpy(int n, float a, const float *x, float *y) { kad_saxpy_inlined(n, a, x, y); }
+/* This is actually lapack not cblas, but this definition is used */
#ifdef HAVE_CBLAS
#ifndef __APPLE__
/* As gfortran mangles names */
#define ssyev ssyev_
#endif
extern void ssyev(const char* jobz, const char* uplo, int* n, float* a, int* lda, float* w, float* work, int* lwork, int* info);
+#endif
+
+#ifdef HAVE_CBLAS_SGEMM
+
#ifdef HAVE_CBLAS_H
#include "cblas.h"
#else
-/* Poor man approach */
+/* Poor man approach, thanks for that Apple */
enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102 };
enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112 };
extern void cblas_sgemm(const enum CBLAS_ORDER Order,
@@ -919,6 +924,7 @@ extern void cblas_sgemm(const enum CBLAS_ORDER Order,
const float *B, const int ldb, const float beta,
float *C, const int ldc);
#endif
+
void kad_sgemm_simple(int trans_A, int trans_B, int M, int N, int K, const float *A, const float *B, float *C)
{
cblas_sgemm(CblasRowMajor, trans_A? CblasTrans : CblasNoTrans, trans_B? CblasTrans : CblasNoTrans, M, N, K, 1.0f, A, trans_A? M : K, B, trans_B? K : N, 1.0f, C, N);