diff options
Diffstat (limited to 'numpy/core')
| -rw-r--r-- | numpy/core/src/common/cblasfuncs.c | 10 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_cblas.h | 30 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_cblas64_.h | 31 | ||||
| -rw-r--r-- | numpy/core/src/common/python_xerbla.c | 19 |
4 files changed, 31 insertions, 59 deletions
diff --git a/numpy/core/src/common/cblasfuncs.c b/numpy/core/src/common/cblasfuncs.c index 14d13a6c7..e78587de0 100644 --- a/numpy/core/src/common/cblasfuncs.c +++ b/numpy/core/src/common/cblasfuncs.c @@ -10,20 +10,10 @@ #include <assert.h> #include <numpy/arrayobject.h> #include "npy_cblas.h" -#include "npy_cblas64_.h" #include "arraytypes.h" #include "common.h" -/* - * If 64-bit CBLAS with symbol suffix '64_' is available, use it. - */ -#ifdef HAVE_CBLAS64_ -#define CBLAS_FUNC(name) name ## 64_ -#else -#define CBLAS_FUNC(name) name -#endif - static const double oneD[2] = {1.0, 0.0}, zeroD[2] = {0.0, 0.0}; static const float oneF[2] = {1.0, 0.0}, zeroF[2] = {0.0, 0.0}; diff --git a/numpy/core/src/common/npy_cblas.h b/numpy/core/src/common/npy_cblas.h index 12db55bde..97308238a 100644 --- a/numpy/core/src/common/npy_cblas.h +++ b/numpy/core/src/common/npy_cblas.h @@ -25,8 +25,34 @@ enum CBLAS_SIDE {CblasLeft=141, CblasRight=142}; #define CBLAS_INDEX size_t /* this may vary between platforms */ -#define BLASINT int -#define BLASNAME(name) name +#ifdef NO_APPEND_FORTRAN +#define BLAS_FORTRAN_SUFFIX +#else +#define BLAS_FORTRAN_SUFFIX _ +#endif + +#ifndef BLAS_SYMBOL_PREFIX +#define BLAS_SYMBOL_PREFIX +#endif + +#ifndef BLAS_SYMBOL_SUFFIX +#define BLAS_SYMBOL_SUFFIX +#endif + +#define BLAS_FUNC_CONCAT(name,prefix,suffix,suffix2) prefix ## name ## suffix ## suffix2 +#define BLAS_FUNC_EXPAND(name,prefix,suffix,suffix2) BLAS_FUNC_CONCAT(name,prefix,suffix,suffix2) + +#define CBLAS_FUNC(name) BLAS_FUNC_EXPAND(name,BLAS_SYMBOL_PREFIX,,BLAS_SYMBOL_SUFFIX) +#define BLAS_FUNC(name) BLAS_FUNC_EXPAND(name,BLAS_SYMBOL_PREFIX,BLAS_FORTRAN_SUFFIX,BLAS_SYMBOL_SUFFIX) + +#ifdef HAVE_BLAS_ILP64 +#define CBLAS_INT npy_int64 +#else +#define CBLAS_INT int +#endif + +#define BLASNAME(name) CBLAS_FUNC(name) +#define BLASINT CBLAS_INT #include "npy_cblas_base.h" diff --git a/numpy/core/src/common/npy_cblas64_.h b/numpy/core/src/common/npy_cblas64_.h deleted file mode 100644 index bbc4b3559..000000000 --- a/numpy/core/src/common/npy_cblas64_.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This header provides numpy a consistent interface to CBLAS code. It is needed - * because not all providers of cblas provide cblas.h. For instance, MKL provides - * mkl_cblas.h and also typedefs the CBLAS_XXX enums. - */ -#ifndef _NPY_CBLAS64__H_ -#define _NPY_CBLAS64__H_ - -#include <stddef.h> - -#include "npy_cblas.h" - -/* Allow the use in C++ code. */ -#ifdef __cplusplus -extern "C" -{ -#endif - -#define BLASINT npy_int64 -#define BLASNAME(name) name##64_ - -#include "npy_cblas_base.h" - -#undef BLASINT -#undef BLASNAME - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/numpy/core/src/common/python_xerbla.c b/numpy/core/src/common/python_xerbla.c index d88562b7a..fe2f718b2 100644 --- a/numpy/core/src/common/python_xerbla.c +++ b/numpy/core/src/common/python_xerbla.c @@ -1,11 +1,6 @@ #include "Python.h" #include "numpy/npy_common.h" - -/* - * From f2c.h, this should be safe unless fortran is set to use 64 - * bit integers. We don't seem to have any good way to detect that. - */ -typedef int integer; +#include "npy_cblas.h" /* From the original manpage: @@ -24,7 +19,7 @@ typedef int integer; info: Number of the invalid parameter. */ -int xerbla_(char *srname, integer *info) +CBLAS_INT BLAS_FUNC(xerbla)(char *srname, CBLAS_INT *info) { static const char format[] = "On entry to %.*s" \ " parameter number %d had an illegal value"; @@ -42,7 +37,7 @@ int xerbla_(char *srname, integer *info) #ifdef WITH_THREAD save = PyGILState_Ensure(); #endif - PyOS_snprintf(buf, sizeof(buf), format, len, srname, *info); + PyOS_snprintf(buf, sizeof(buf), format, len, srname, (int)*info); PyErr_SetString(PyExc_ValueError, buf); #ifdef WITH_THREAD PyGILState_Release(save); @@ -50,11 +45,3 @@ int xerbla_(char *srname, integer *info) return 0; } - - -/* Same for LAPACK64_ */ -npy_int64 xerbla_64_(char *srname, npy_int64 *info) -{ - integer info_int = (integer)*info; - return xerbla_(srname, &info_int); -} |
