[Scipy-svn] r3387 - trunk/scipy/lib/blas

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Oct 2 03:40:39 EDT 2007


Author: pearu
Date: 2007-10-02 02:40:02 -0500 (Tue, 02 Oct 2007)
New Revision: 3387

Added:
   trunk/scipy/lib/blas/fblaswrap_veclib_c.c.src
Modified:
   trunk/scipy/lib/blas/setup.py
Log:
Ported veclib support from linalg to lib.blas.

Added: trunk/scipy/lib/blas/fblaswrap_veclib_c.c.src
===================================================================
--- trunk/scipy/lib/blas/fblaswrap_veclib_c.c.src	2007-10-02 06:38:43 UTC (rev 3386)
+++ trunk/scipy/lib/blas/fblaswrap_veclib_c.c.src	2007-10-02 07:40:02 UTC (rev 3387)
@@ -0,0 +1,18 @@
+#include <vecLib/vecLib.h>
+
+//#define WRAP_F77(a) wcblas_##a##_
+#define WRAP_F77(a) w##a##_
+
+/**begin repeat
+#p2=c,z,c,z#
+#s2=u,u,c,c#
+#ctype2=complex,double complex,complex,double complex#
+*/
+
+void WRAP_F77(@p2 at dot@s2@)(@ctype2@ *dot at s2@, const int *N, const @ctype2@ *X, const int *incX, const @ctype2@ *Y, const int *incY)
+{
+    cblas_ at p2@dot at s2@_sub(*N, X, *incX, Y, *incY, dot at s2@);
+}
+
+/**end repeat**/
+

Modified: trunk/scipy/lib/blas/setup.py
===================================================================
--- trunk/scipy/lib/blas/setup.py	2007-10-02 06:38:43 UTC (rev 3386)
+++ trunk/scipy/lib/blas/setup.py	2007-10-02 07:40:02 UTC (rev 3387)
@@ -21,6 +21,22 @@
 
 #--------------------
 
+def needs_cblas_wrapper(info):
+    """Returns true if needs c wrapper around cblas for calling from
+    fortran."""
+    r_accel = re.compile("Accelerate")
+    r_vec = re.compile("vecLib")
+    res = False
+    try:
+        tmpstr = info['extra_link_args']
+        for i in tmpstr:
+            if r_accel.search(i) or r_vec.search(i):
+                res = True
+    except KeyError:
+        pass
+
+    return res
+
 tmpl_empty_cblas_pyf = '''
 python module cblas
   usercode void empty_module(void) {}
@@ -62,14 +78,19 @@
         skip_names['fblas'].extend(\
             'drotmg srotmg drotm srotm'.split())
 
+    depends = [__file__, 'fblas_l?.pyf.src', 'fblas.pyf.src','fblaswrap.f.src',
+               'fblaswrap_veclib_c.c.src']
     # fblas:
+    if needs_cblas_wrapper(blas_opt):
+        sources = ['fblas.pyf.src', 'fblaswrap_veclib_c.c.src'],
+    else:
+        sources = ['fblas.pyf.src','fblaswrap.f.src']
     config.add_extension('fblas',
-                         sources = ['fblas.pyf.src','fblaswrap.f.src'],
-                         depends = [__file__,'fblas_l?.pyf.src'],
+                         sources = sources,
+                         depends = depends,
                          f2py_options = ['skip:']+skip_names['fblas']+[':'],
                          extra_info = blas_opt
                          )
-
     # cblas:
     def get_cblas_source(ext, build_dir):
         name = ext.name.split('.')[-1]




More information about the Scipy-svn mailing list