aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/kann/kautodiff.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-01 12:41:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-01 12:41:09 +0100
commitf031b11ddb8b74b82983b634fc910926ffc58600 (patch)
tree380c08da5067dda12332ca1b93bdc768bf8b38c0 /contrib/kann/kautodiff.c
parentedaf251d9e2e0a3e8ffc200c904dd6a90284442c (diff)
downloadrspamd-f031b11ddb8b74b82983b634fc910926ffc58600.tar.gz
rspamd-f031b11ddb8b74b82983b634fc910926ffc58600.zip
[Minor] Use cblas_saxpy where possible
Diffstat (limited to 'contrib/kann/kautodiff.c')
-rw-r--r--contrib/kann/kautodiff.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/kann/kautodiff.c b/contrib/kann/kautodiff.c
index a8af6796b..f336c958b 100644
--- a/contrib/kann/kautodiff.c
+++ b/contrib/kann/kautodiff.c
@@ -897,8 +897,6 @@ void kad_vec_mul_sum(int n, float *a, const float *b, const float *c)
for (i = 0; i < n; ++i) a[i] += b[i] * c[i];
}
-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__
@@ -958,6 +956,17 @@ void kad_sgemm_simple(int trans_A, int trans_B, int M, int N, int K, const float
}
#endif
+#ifdef HAVE_CBLAS_SAXPY
+#ifndef HAVE_CBLAS_H
+extern void cblas_saxpy(const int __N,
+ const float __alpha, const float *__X, const int __incX, float *__Y, const int __incY);
+#endif
+
+void kad_saxpy(int n, float a, const float *x, float *y) { cblas_saxpy(n, a, x, 1, y, 1); }
+#else
+void kad_saxpy(int n, float a, const float *x, float *y) { kad_saxpy_inlined(n, a, x, y); }
+#endif
+
bool kad_ssyev_simple(int N, float *A, float *eigenvals)
{
#ifndef HAVE_CBLAS