[arrayfire] 356/408: Version guards for complex operators

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 7f8799d0a35352e7a7bb6c14c3d6c826229df291
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Tue Aug 25 18:12:16 2015 -0400

    Version guards for complex operators
---
 include/af/complex.h    | 51 ++++++++++++++++++++++++++++++++++++++++---------
 src/backend/cpu/svd.cpp |  8 ++++----
 2 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/include/af/complex.h b/include/af/complex.h
index 52210e7..052f60b 100644
--- a/include/af/complex.h
+++ b/include/af/complex.h
@@ -50,15 +50,10 @@ AFAPI double real(af_cdouble val);
 AFAPI float imag(af_cfloat val);
 AFAPI double imag(af_cdouble val);
 
-#define DEFINE_OP(OP)                                                   \
-    AFAPI af::cfloat  operator OP(const af::cfloat  &lhs, const af::cfloat  &rhs); \
-    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const af::cdouble &rhs); \
-    AFAPI af::cfloat  operator OP(const af::cfloat  &lhs, const     double  &rhs); \
-    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const     double  &rhs); \
-    AFAPI af::cfloat  operator OP(const double      &rhs, const af::cfloat  &lhs); \
-    AFAPI af::cdouble operator OP(const double      &rhs, const af::cdouble &lhs); \
-    AFAPI af::cdouble operator OP(const af::cfloat  &lhs, const af::cdouble &rhs); \
-    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const af::cfloat  &rhs); \
+// +,-,*,/ for (cfloat, cfloat) and (cdouble, cdouble)
+#define DEFINE_OP(OP)                                                               \
+    AFAPI af::cfloat  operator OP(const af::cfloat  &lhs, const af::cfloat  &rhs);  \
+    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const af::cdouble &rhs);  \
 
 DEFINE_OP(+)
 DEFINE_OP(-)
@@ -67,6 +62,44 @@ DEFINE_OP(/)
 
 #undef DEFINE_OP
 
+// +,/ for (cfloat, double) and (cdouble, double)
+#define DEFINE_OP(OP)                                                               \
+    AFAPI af::cfloat  operator OP(const af::cfloat  &lhs, const     double  &rhs);  \
+    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const     double  &rhs);  \
+
+DEFINE_OP(+)
+DEFINE_OP(/)
+
+#undef DEFINE_OP
+
+#if AF_API_VERSION >= 31
+// -,* for (cfloat, double) and (cdouble, double)
+#define DEFINE_OP(OP)                                                               \
+    AFAPI af::cfloat  operator OP(const af::cfloat  &lhs, const     double  &rhs);  \
+    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const     double  &rhs);  \
+
+DEFINE_OP(-)
+DEFINE_OP(*)
+
+#undef DEFINE_OP
+#endif  // AF_API_VERSION
+
+#if AF_API_VERSION >= 31
+// +, -, *, / for (double, cfloat/cdouble) and (cfloat/cdouble, cdouble/cfloat)
+#define DEFINE_OP(OP)                                                               \
+    AFAPI af::cfloat  operator OP(const double      &rhs, const af::cfloat  &lhs);  \
+    AFAPI af::cdouble operator OP(const double      &rhs, const af::cdouble &lhs);  \
+    AFAPI af::cdouble operator OP(const af::cfloat  &lhs, const af::cdouble &rhs);  \
+    AFAPI af::cdouble operator OP(const af::cdouble &lhs, const af::cfloat  &rhs);  \
+
+DEFINE_OP(+)
+DEFINE_OP(-)
+DEFINE_OP(*)
+DEFINE_OP(/)
+
+#undef DEFINE_OP
+#endif  // AF_API_VERSION
+
 AFAPI bool operator==(const cfloat &lhs, const cfloat &rhs);
 AFAPI bool operator==(const cdouble &lhs, const cdouble &rhs);
 
diff --git a/src/backend/cpu/svd.cpp b/src/backend/cpu/svd.cpp
index 50db1f6..c7124bd 100644
--- a/src/backend/cpu/svd.cpp
+++ b/src/backend/cpu/svd.cpp
@@ -71,13 +71,13 @@ namespace cpu
         int M = iDims[0];
         int N = iDims[1];
 
-#ifdef ARM_ARCH
+#ifdef USE_MKL
+        svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', M, N, in.get(), in.strides()[1],
+                          s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1]);
+#else
         std::vector<Tr> superb(std::min(M, N));
         svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', 'A', M, N, in.get(), in.strides()[1],
                           s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1], &superb[0]);
-#else
-        svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', M, N, in.get(), in.strides()[1],
-                          s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1]);
 #endif
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list