Created
September 13, 2012 21:53
-
-
Save anonymous/3717979 to your computer and use it in GitHub Desktop.
Patch to make f77blas.h compatible with compilers which lack C99 complex number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/common.h b/common.h | |
index 3718cde..b4dc5de 100644 | |
--- 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 | |
diff --git a/common_interface.h b/common_interface.h | |
index cc5771d..14c2cf7 100644 | |
--- a/common_interface.h | |
+++ b/common_interface.h | |
@@ -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 *); | |
diff --git a/openblas_config_template.h b/openblas_config_template.h | |
index caeccf0..a2b0569 100644 | |
--- a/openblas_config_template.h | |
+++ b/openblas_config_template.h | |
@@ -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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment