Index: boost/numeric/bindings/traits/type.hpp
===================================================================
--- boost/numeric/bindings/traits/type.hpp	(Revision 4349)
+++ boost/numeric/bindings/traits/type.hpp	(Arbeitskopie)
@@ -8,8 +8,18 @@
 
 namespace boost { namespace numeric { namespace bindings { namespace traits {
 
+  /* The types for single and double precision complex numbers.
+   * You can use your own types if you define
+   * BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE.
+   * Note that these types must have the same memory layout as the
+   * corresponding FORTRAN types.
+   * For that reason you can even use a different type in each translation
+   * unit and the resulting binary will still work!
+   */
+#ifndef BOOST_NUMERIC_BINDINGS_USE_CUSTOM_COMPLEX_TYPE
   typedef std::complex< float >  complex_f ;
   typedef std::complex< double > complex_d ; 
+#endif
 
   template <typename T> 
   T real (std::complex<T> const& c) { return std::real (c); }
Index: boost/numeric/bindings/lapack/ormqr.hpp
===================================================================
--- boost/numeric/bindings/lapack/ormqr.hpp	(Revision 4349)
+++ boost/numeric/bindings/lapack/ormqr.hpp	(Arbeitskopie)
@@ -100,31 +100,31 @@ namespace boost { namespace numeric { na
 
       inline 
       void ormqr (char const side, char const trans, int const m, int const n,
-		 int const k, const std::complex<float>* a, int const lda,
-		 const std::complex<float>* tau, std::complex<float>* c,
-		 int const ldc, std::complex<float>* work, int const lwork,
+		 int const k, const traits::complex_f* a, int const lda,
+		 const traits::complex_f* tau, traits::complex_f* c,
+		 int const ldc, traits::complex_f* work, int const lwork,
                  int& info) 
       {
         LAPACK_CUNMQR (&side, &trans, &m, &n, &k,
-		      reinterpret_cast<const fcomplex_t*>(a), &lda,
-		      reinterpret_cast<const fcomplex_t*>(tau),
-		      reinterpret_cast<fcomplex_t*>(c), &ldc,
-		      reinterpret_cast<fcomplex_t*>(work), &lwork,
+		      traits::complex_ptr(a), &lda,
+		      traits::complex_ptr(tau),
+		      traits::complex_ptr(c), &ldc,
+		      traits::complex_ptr(work), &lwork,
 		      &info);
       }
 
       inline 
       void ormqr (char const side, char const trans, int const m, int const n,
-		 int const k, const std::complex<double>* a, int const lda,
-		 const std::complex<double>* tau, std::complex<double>* c,
-		 int const ldc, std::complex<double>* work, int const lwork,
+		 int const k, const traits::complex_d* a, int const lda,
+		 const traits::complex_d* tau, traits::complex_d* c,
+		 int const ldc, traits::complex_d* work, int const lwork,
                  int& info) 
       {
         LAPACK_ZUNMQR (&side, &trans, &m, &n, &k,
-		      reinterpret_cast<const dcomplex_t*>(a), &lda,
-		      reinterpret_cast<const dcomplex_t*>(tau),
-		      reinterpret_cast<dcomplex_t*>(c), &ldc,
-		      reinterpret_cast<dcomplex_t*>(work), &lwork,
+		      traits::complex_ptr(a), &lda,
+		      traits::complex_ptr(tau),
+		      traits::complex_ptr(c), &ldc,
+		      traits::complex_ptr(work), &lwork,
 		      &info);
       }
 
Index: boost/numeric/bindings/lapack/geqrf.hpp
===================================================================
--- boost/numeric/bindings/lapack/geqrf.hpp	(Revision 4349)
+++ boost/numeric/bindings/lapack/geqrf.hpp	(Arbeitskopie)
@@ -73,27 +73,27 @@ namespace boost { namespace numeric { na
 
       inline 
       void geqrf (int const m, int const n,
-                  std::complex<float>* a, int const lda,
-                  std::complex<float>* tau, std::complex<float>* work,
+                  traits::complex_f* a, int const lda,
+                  traits::complex_f* tau, traits::complex_f* work,
 		  int const lwork, int& info) 
       {
         LAPACK_CGEQRF (&m, &n,
-                      reinterpret_cast<fcomplex_t*> (a), &lda,
-                      reinterpret_cast<fcomplex_t*> (tau),
-                      reinterpret_cast<fcomplex_t*> (work), &lwork, &info );
+                      traits::complex_ptr (a), &lda,
+                      traits::complex_ptr (tau),
+                      traits::complex_ptr (work), &lwork, &info );
       }
       
 
       inline 
       void geqrf (int const m, int const n,
-                  std::complex<double>* a, int const lda,
-                  std::complex<double>* tau, std::complex<double>* work,
+                  traits::complex_d* a, int const lda,
+                  traits::complex_d* tau, traits::complex_d* work,
 		  int const lwork, int& info) 
       {
         LAPACK_ZGEQRF (&m, &n,
-                      reinterpret_cast<dcomplex_t*> (a), &lda,
-                      reinterpret_cast<dcomplex_t*> (tau),
-                      reinterpret_cast<dcomplex_t*> (work), &lwork, &info );
+                      traits::complex_ptr (a), &lda,
+                      traits::complex_ptr (tau),
+                      traits::complex_ptr (work), &lwork, &info );
       }
       
     } 
Index: boost/numeric/bindings/lapack/trevc.hpp
===================================================================
--- boost/numeric/bindings/lapack/trevc.hpp	(Revision 4349)
+++ boost/numeric/bindings/lapack/trevc.hpp	(Arbeitskopie)
@@ -68,8 +68,8 @@ namespace boost { namespace numeric { na
 
       inline 
       void trevc (char const side, char const howmny, const logical_t* select, int const n,
-                 std::complex<float>* t, int const ldt, std::complex<float>* vl, int const ldvl, std::complex<float>* vr, int const ldvr,
-                 int const mm, int& m, std::complex<float>* work, int& info) 
+                 traits::complex_f* t, int const ldt, traits::complex_f* vl, int const ldvl, traits::complex_f* vr, int const ldvr,
+                 int const mm, int& m, traits::complex_f* work, int& info) 
       {
         LAPACK_CTREVC (&side, &howmny, select, &n, traits::complex_ptr(t), &ldt, traits::complex_ptr(vl), &ldvl,
 			traits::complex_ptr(vr), &ldvr, &mm, &m, traits::complex_ptr(work+n), traits::complex_ptr(work), &info);
@@ -77,8 +77,8 @@ namespace boost { namespace numeric { na
 
       inline 
       void trevc (char const side, char const howmny, const logical_t* select, int const n,
-                  std::complex<double>* t, int const ldt, std::complex<double>* vl, int const ldvl, std::complex<double>* vr, int const ldvr,
-		  int const mm, int& m, std::complex<double>* work, int& info) 
+                  traits::complex_d* t, int const ldt, traits::complex_d* vl, int const ldvl, traits::complex_d* vr, int const ldvr,
+		  int const mm, int& m, traits::complex_d* work, int& info)
       {
         LAPACK_ZTREVC (&side, &howmny, select, &n, traits::complex_ptr(t), &ldt,
       	               traits::complex_ptr(vl), &ldvl, traits::complex_ptr(vr), &ldvr,
Index: boost/numeric/bindings/lapack/trexc.hpp
===================================================================
--- boost/numeric/bindings/lapack/trexc.hpp	(Revision 4349)
+++ boost/numeric/bindings/lapack/trexc.hpp	(Arbeitskopie)
@@ -54,10 +54,10 @@ namespace boost { namespace numeric { na
       int trexc_work_size( int const n, double ) {return n;}
 
       inline 
-      int trexc_work_size( int const n, std::complex<float> ) {return 0;}
+      int trexc_work_size( int const n, traits::complex_f ) {return 0;}
 
       inline 
-      int trexc_work_size( int const n, std::complex<double> ) {return 0;}
+      int trexc_work_size( int const n, traits::complex_d ) {return 0;}
     }
 
     // Get the minimum size of the work array.
@@ -85,7 +85,7 @@ namespace boost { namespace numeric { na
 
       inline 
       void trexc (char const compq, int const n,
-                 std::complex<float>* t, int const ldt, std::complex<float>* q, int const ldq, int& ifst, int& ilst,
+                 traits::complex_f* t, int const ldt, traits::complex_f* q, int const ldq, int& ifst, int& ilst,
 		 float* work, int& info) 
       {
         LAPACK_CTREXC (&compq, &n, traits::complex_ptr(t), &ldt, traits::complex_ptr(q), &ldq, &ifst, &ilst, &info);
@@ -93,7 +93,7 @@ namespace boost { namespace numeric { na
 
       inline 
       void trexc (char const compq, int const n,
-                 std::complex<double>* t, int const ldt, std::complex<double>* q, int const ldq, int& ifst, int& ilst,
+                 traits::complex_d* t, int const ldt, traits::complex_d* q, int const ldq, int& ifst, int& ilst,
 		 double* work, int& info) 
       {
         LAPACK_ZTREXC (&compq, &n, traits::complex_ptr(t), &ldt, traits::complex_ptr(q), &ldq, &ifst, &ilst, &info);

