[Scipy-svn] r6915 - trunk/scipy/linalg

scipy-svn at scipy.org scipy-svn at scipy.org
Sat Nov 20 01:33:31 EST 2010


Author: warren.weckesser
Date: 2010-11-20 00:33:31 -0600 (Sat, 20 Nov 2010)
New Revision: 6915

Modified:
   trunk/scipy/linalg/basic.py
   trunk/scipy/linalg/decomp.py
   trunk/scipy/linalg/decomp_lu.py
   trunk/scipy/linalg/decomp_qr.py
   trunk/scipy/linalg/decomp_schur.py
   trunk/scipy/linalg/matfuncs.py
   trunk/scipy/linalg/setup.py
   trunk/scipy/linalg/setup_atlas_version.py
Log:
ENH: linalg: update 'raise' statements

Modified: trunk/scipy/linalg/basic.py
===================================================================
--- trunk/scipy/linalg/basic.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/basic.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -46,9 +46,9 @@
     """
     a1, b1 = map(asarray_chkfinite,(a,b))
     if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]:
-        raise ValueError, 'expected square matrix'
+        raise ValueError('expected square matrix')
     if a1.shape[0] != b1.shape[0]:
-        raise ValueError, 'incompatible dimensions'
+        raise ValueError('incompatible dimensions')
     overwrite_a = overwrite_a or (a1 is not a and not hasattr(a,'__array__'))
     overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__'))
     if debug:
@@ -114,9 +114,9 @@
 
     a1, b1 = map(asarray_chkfinite,(a,b))
     if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]:
-        raise ValueError, 'expected square matrix'
+        raise ValueError('expected square matrix')
     if a1.shape[0] != b1.shape[0]:
-        raise ValueError, 'incompatible dimensions'
+        raise ValueError('incompatible dimensions')
     overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__'))
     if debug:
         print 'solve:overwrite_b=',overwrite_b
@@ -408,7 +408,7 @@
     """
     a1, b1 = map(asarray_chkfinite, (a, b))
     if len(a1.shape) != 2:
-        raise ValueError, 'expected matrix'
+        raise ValueError('expected matrix')
     m, n = a1.shape
     if len(b1.shape) == 2:
         nrhs = b1.shape[1]

Modified: trunk/scipy/linalg/decomp.py
===================================================================
--- trunk/scipy/linalg/decomp.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/decomp.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -492,7 +492,7 @@
             select = 2
             vl, vu, il, iu = 0.0, 0.0, min(select_range), max(select_range)
             if min(il, iu) < 0 or max(il, iu) >= a1.shape[1]:
-                raise ValueError, 'select_range out of bounds'
+                raise ValueError('select_range out of bounds')
             max_ev = iu - il + 1
         else:  # 1, 'v', 'value'
             select = 1

Modified: trunk/scipy/linalg/decomp_lu.py
===================================================================
--- trunk/scipy/linalg/decomp_lu.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/decomp_lu.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -47,7 +47,7 @@
     """
     a1 = asarray(a)
     if len(a1.shape) != 2 or (a1.shape[0] != a1.shape[1]):
-        raise ValueError, 'expected square matrix'
+        raise ValueError('expected square matrix')
     overwrite_a = overwrite_a or (_datanotshared(a1, a))
     getrf, = get_lapack_funcs(('getrf',), (a1,))
     lu, piv, info = getrf(a, overwrite_a=overwrite_a)

Modified: trunk/scipy/linalg/decomp_qr.py
===================================================================
--- trunk/scipy/linalg/decomp_qr.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/decomp_qr.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -159,7 +159,7 @@
     """
     a1 = asarray_chkfinite(a)
     if len(a1.shape) != 2:
-        raise ValueError, 'expected matrix'
+        raise ValueError('expected matrix')
     M,N = a1.shape
     overwrite_a = overwrite_a or (_datanotshared(a1, a))
     geqrf, = get_lapack_funcs(('geqrf',), (a1,))

Modified: trunk/scipy/linalg/decomp_schur.py
===================================================================
--- trunk/scipy/linalg/decomp_schur.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/decomp_schur.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -51,10 +51,10 @@
 
     """
     if not output in ['real','complex','r','c']:
-        raise ValueError, "argument must be 'real', or 'complex'"
+        raise ValueError("argument must be 'real', or 'complex'")
     a1 = asarray_chkfinite(a)
     if len(a1.shape) != 2 or (a1.shape[0] != a1.shape[1]):
-        raise ValueError, 'expected square matrix'
+        raise ValueError('expected square matrix')
     typ = a1.dtype.char
     if output in ['complex','c'] and typ not in ['F','D']:
         if typ in _double_precision:

Modified: trunk/scipy/linalg/matfuncs.py
===================================================================
--- trunk/scipy/linalg/matfuncs.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/matfuncs.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -302,7 +302,7 @@
     # Perform Shur decomposition (lapack ?gees)
     A = asarray(A)
     if len(A.shape)!=2:
-        raise ValueError, "Non-matrix input to matrix function."
+        raise ValueError("Non-matrix input to matrix function.")
     if A.dtype.char in ['F', 'D', 'G']:
         cmplx_type = 1
     else:
@@ -502,7 +502,7 @@
     """
     A = asarray(A)
     if len(A.shape)!=2:
-        raise ValueError, "Non-matrix input to matrix function."
+        raise ValueError("Non-matrix input to matrix function.")
     T, Z = schur(A)
     T, Z = rsf2csf(T,Z)
     n,n = T.shape

Modified: trunk/scipy/linalg/setup.py
===================================================================
--- trunk/scipy/linalg/setup.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/setup.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -49,7 +49,7 @@
     lapack_opt = get_info('lapack_opt')
 
     if not lapack_opt:
-        raise NotFoundError,'no lapack/blas resources found'
+        raise NotFoundError('no lapack/blas resources found')
 
     atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \
                       if k=='ATLAS_INFO']+[None])[0]

Modified: trunk/scipy/linalg/setup_atlas_version.py
===================================================================
--- trunk/scipy/linalg/setup_atlas_version.py	2010-11-20 06:25:29 UTC (rev 6914)
+++ trunk/scipy/linalg/setup_atlas_version.py	2010-11-20 06:33:31 UTC (rev 6915)
@@ -14,7 +14,7 @@
     if not atlas_info:
         atlas_info = get_info('atlas')
     if not atlas_info:
-        raise AtlasNotFoundError,AtlasNotFoundError.__doc__
+        raise AtlasNotFoundError(AtlasNotFoundError.__doc__)
     ext = Extension('atlas_version',
                     sources=[os.path.join(local_path,'atlas_version.c')],
                     libraries=[atlas_info['libraries'][-1]],




More information about the Scipy-svn mailing list