Fixed #141. make f77blas.h compatible with compilers which lack C99 complex number.
authorZhang Xianyi <traits.zhang@gmail.com>
Mon, 8 Oct 2012 04:48:20 +0000 (12:48 +0800)
committerZhang Xianyi <traits.zhang@gmail.com>
Mon, 8 Oct 2012 04:48:20 +0000 (12:48 +0800)
Apply the patch from Tony @tonyhill. Thank you.

common.h
common_interface.h
openblas_config_template.h

index 3718cdee49b39d923b0dae074fb826145fc97905..b4dc5debaf4f5056d84beec3824a4bbabb2eed58 100644 (file)
--- a/common.h
+++ b/common.h
@@ -389,10 +389,12 @@ typedef int blasint;
   #define OPENBLAS_COMPLEX_C99
   typedef float _Complex openblas_complex_float;
   typedef double _Complex openblas_complex_double;
+  typedef xdouble _Complex openblas_complex_xdouble;
 #else
   #define OPENBLAS_COMPLEX_STRUCT
   typedef struct { float real, imag; } openblas_complex_float;
   typedef struct { double real, imag; } openblas_complex_double;
+  typedef struct { xdouble real, imag; } openblas_complex_xdouble;
 #endif
 #endif  // ASSEMBLER
 
index bff1a85a113b6b7bdc4d9b0dc60b7cf2ac5f7dd9..14c2cf7a4536c1884ade6fd5cfdd3f6ed918772a 100644 (file)
@@ -76,19 +76,19 @@ myxcomplex_t    BLASFUNC(xdotu)  (blasint *, xdouble  *, blasint *, xdouble  *,
 myxcomplex_t    BLASFUNC(xdotc)  (blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
 
 #elif defined RETURN_BY_STACK
-void  BLASFUNC(cdotu)  (float   _Complex *,  blasint *, float  * , blasint *, float  *,  blasint *);
-void  BLASFUNC(cdotc)  (float   _Complex *,  blasint *, float  *,  blasint *, float  *,  blasint *);
-void  BLASFUNC(zdotu)  (double  _Complex *, blasint *, double  *, blasint *, double  *, blasint *);
-void  BLASFUNC(zdotc)  (double  _Complex *, blasint *, double  *, blasint *, double  *, blasint *);
-void  BLASFUNC(xdotu)  (xdouble _Complex *, blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
-void  BLASFUNC(xdotc)  (xdouble _Complex *, blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
+void  BLASFUNC(cdotu)  (openblas_complex_float   *,  blasint *, float  * , blasint *, float  *,  blasint *);
+void  BLASFUNC(cdotc)  (openblas_complex_float   *,  blasint *, float  *,  blasint *, float  *,  blasint *);
+void  BLASFUNC(zdotu)  (openblas_complex_double  *, blasint *, double  *, blasint *, double  *, blasint *);
+void  BLASFUNC(zdotc)  (openblas_complex_double  *, blasint *, double  *, blasint *, double  *, blasint *);
+void  BLASFUNC(xdotu)  (openblas_complex_xdouble *, blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
+void  BLASFUNC(xdotc)  (openblas_complex_xdouble *, blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
 #else
-float   _Complex BLASFUNC(cdotu)  (blasint *, float  *, blasint *, float  *, blasint *);
-float   _Complex BLASFUNC(cdotc)  (blasint *, float  *, blasint *, float  *, blasint *);
-double  _Complex BLASFUNC(zdotu)  (blasint *, double  *, blasint *, double  *, blasint *);
-double  _Complex BLASFUNC(zdotc)  (blasint *, double  *, blasint *, double  *, blasint *);
-xdouble _Complex BLASFUNC(xdotu)  (blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
-xdouble _Complex BLASFUNC(xdotc)  (blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
+openblas_complex_float   BLASFUNC(cdotu)  (blasint *, float  *, blasint *, float  *, blasint *);
+openblas_complex_float   BLASFUNC(cdotc)  (blasint *, float  *, blasint *, float  *, blasint *);
+openblas_complex_double  BLASFUNC(zdotu)  (blasint *, double  *, blasint *, double  *, blasint *);
+openblas_complex_double  BLASFUNC(zdotc)  (blasint *, double  *, blasint *, double  *, blasint *);
+openblas_complex_xdouble BLASFUNC(xdotu)  (blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
+openblas_complex_xdouble BLASFUNC(xdotc)  (blasint *, xdouble  *, blasint *, xdouble  *, blasint *);
 #endif
 
 void    BLASFUNC(saxpy) (blasint *, float  *, float  *, blasint *, float  *, blasint *);
index caeccf0265a2777f5a66e114adda44a24c9d5578..a2b05696f0bb0ac2f23d580a09d595e882c8de53 100644 (file)
@@ -53,20 +53,28 @@ typedef int blasint;
   #include <complex.h>
   typedef float _Complex openblas_complex_float;
   typedef double _Complex openblas_complex_double;
-  #define openblas_make_complex_float(real, imag)   ((real) + ((imag) * _Complex_I))
-  #define openblas_make_complex_double(real, imag)  ((real) + ((imag) * _Complex_I))
-  #define openblas_complex_float_real(z)            (creal(z))
-  #define openblas_complex_float_imag(z)            (cimag(z))
-  #define openblas_complex_double_real(z)           (creal(z))
-  #define openblas_complex_double_imag(z)           (cimag(z))
+  typedef xdouble _Complex openblas_complex_xdouble;
+  #define openblas_make_complex_float(real, imag)    ((real) + ((imag) * _Complex_I))
+  #define openblas_make_complex_double(real, imag)   ((real) + ((imag) * _Complex_I))
+  #define openblas_make_complex_xdouble(real, imag)  ((real) + ((imag) * _Complex_I))
+  #define openblas_complex_float_real(z)             (creal(z))
+  #define openblas_complex_float_imag(z)             (cimag(z))
+  #define openblas_complex_double_real(z)            (creal(z))
+  #define openblas_complex_double_imag(z)            (cimag(z))
+  #define openblas_complex_xdouble_real(z)           (creal(z))
+  #define openblas_complex_xdouble_imag(z)           (cimag(z))
 #else
   #define OPENBLAS_COMPLEX_STRUCT
   typedef struct { float real, imag; } openblas_complex_float;
   typedef struct { double real, imag; } openblas_complex_double;
-  #define openblas_make_complex_float(real, imag)   {(real), (imag)}
-  #define openblas_make_complex_double(real, imag)  {(real), (imag)}
-  #define openblas_complex_float_real(z)            ((z).real)
-  #define openblas_complex_float_imag(z)            ((z).imag)
-  #define openblas_complex_double_real(z)           ((z).real)
-  #define openblas_complex_double_imag(z)           ((z).imag)
+  typedef struct { xdouble real, imag; } openblas_complex_xdouble;
+  #define openblas_make_complex_float(real, imag)    {(real), (imag)}
+  #define openblas_make_complex_double(real, imag)   {(real), (imag)}
+  #define openblas_make_complex_xdouble(real, imag)  {(real), (imag)}
+  #define openblas_complex_float_real(z)             ((z).real)
+  #define openblas_complex_float_imag(z)             ((z).imag)
+  #define openblas_complex_double_real(z)            ((z).real)
+  #define openblas_complex_double_imag(z)            ((z).imag)
+  #define openblas_complex_xdouble_real(z)           ((z).real)
+  #define openblas_complex_xdouble_imag(z)           ((z).imag)
 #endif