vkirangoud / cusp-library

Automatically exported from code.google.com/p/cusp-library
Apache License 2.0
0 stars 0 forks source link

Make cusp::complex compatible with thrust in openmp mode #87

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm planning on doing the following changes to make complex compatible with 
thrust in openmp mode.

diff -r e05e965d8e66 cusp/complex.h
--- a/cusp/complex.h    Thu Mar 08 13:57:10 2012 -0500
+++ b/cusp/complex.h    Wed Mar 28 14:29:17 2012 -0700
@@ -62,6 +62,8 @@

 #include <cusp/detail/config.h>

+#if (defined THRUST_DEVICE_BACKEND && THRUST_DEVICE_BACKEND == 
THRUST_DEVICE_BACKEND_CUDA) || (defined THRUST_DEVICE_SYSTEM && 
THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA)
+
 #ifdef _WIN32
 #define _USE_MATH_DEFINES 1  // make sure M_PI is defined
 #endif
@@ -1035,3 +1037,24 @@
   }

 } // end namespace cusp
+
+#else
+#include <complex>
+
+namespace cusp
+{
+  using std::complex;
+  using std::conj;
+  using std::abs;
+
+  template <typename T>
+    struct norm_type {
+      typedef T type; 
+    };
+  
+  template <typename T>
+    struct norm_type< complex<T> > { 
+    typedef T type;
+  };
+}
+#endif

It checks for the thrust backend and then defines things appropriately. I just 
need to complete the missing functions.

Any objections?

Original issue reported on code.google.com by filipe.c...@gmail.com on 28 Mar 2012 at 9:34

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 1b598d9568e4.

Original comment by filipe.c...@gmail.com on 3 Apr 2012 at 7:54