[arrayfire] 351/408: Use xGESVD instead of xGESDD for ARM platforms
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:28 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 8bcbf98c87b87dbc981213952f8440f27fcb4c22
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Tue Aug 25 15:27:47 2015 -0400
Use xGESVD instead of xGESDD for ARM platforms
- complex versions of GESDD were segfaulting
---
src/backend/cpu/svd.cpp | 53 +++++++++++++++++++++++++++++++++++++------------
1 file changed, 40 insertions(+), 13 deletions(-)
diff --git a/src/backend/cpu/svd.cpp b/src/backend/cpu/svd.cpp
index 4b74c7f..b34781a 100644
--- a/src/backend/cpu/svd.cpp
+++ b/src/backend/cpu/svd.cpp
@@ -20,21 +20,40 @@
namespace cpu
{
-#define SVD_FUNC_DEF( FUNC ) \
- template<typename T,typename Tr> FUNC##_func_def<T, Tr> FUNC##_func();
+#define SVD_FUNC_DEF( FUNC ) \
+ template<typename T,typename Tr> svd_func_def<T, Tr> svd_func();
-#define SVD_FUNC( FUNC, T, Tr, PREFIX ) \
- template<> FUNC##_func_def<T, Tr> FUNC##_func<T, Tr>() \
+#define SVD_FUNC( FUNC, T, Tr, PREFIX ) \
+ template<> svd_func_def<T, Tr> svd_func<T, Tr>() \
{ return & LAPACK_NAME(PREFIX##FUNC); }
+#ifdef ARM_ARCH
template<typename T, typename Tr>
- using gesdd_func_def = int (*)(ORDER_TYPE,
- char jobz,
- int m, int n,
- T* in, int ldin,
- Tr* s,
- T* u, int ldu,
- T* vt, int ldvt);
+ using svd_func_def = int (*)(ORDER_TYPE,
+ char jobu, char jobvt,
+ int m, int n,
+ T* in, int ldin,
+ Tr* s,
+ T* u, int ldu,
+ T* vt, int ldvt,
+ Tr *superb);
+
+ SVD_FUNC_DEF( gesvd )
+ SVD_FUNC(gesvd, float , float , s)
+ SVD_FUNC(gesvd, double , double, d)
+ SVD_FUNC(gesvd, cfloat , float , c)
+ SVD_FUNC(gesvd, cdouble, double, z)
+
+#else
+
+ template<typename T, typename Tr>
+ using svd_func_def = int (*)(ORDER_TYPE,
+ char jobz,
+ int m, int n,
+ T* in, int ldin,
+ Tr* s,
+ T* u, int ldu,
+ T* vt, int ldvt);
SVD_FUNC_DEF( gesdd )
SVD_FUNC(gesdd, float , float , s)
@@ -42,6 +61,8 @@ namespace cpu
SVD_FUNC(gesdd, cfloat , float , c)
SVD_FUNC(gesdd, cdouble, double, z)
+#endif
+
template <typename T, typename Tr>
void svdInPlace(Array<Tr> &s, Array<T> &u, Array<T> &vt, Array<T> &in)
{
@@ -49,8 +70,14 @@ namespace cpu
int M = iDims[0];
int N = iDims[1];
- gesdd_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]);
+#ifdef ARM_ARCH
+ 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
}
template <typename T, typename Tr>
--
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