diff options
author | Matti Picus <matti.picus@gmail.com> | 2019-05-19 09:34:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-19 09:34:58 +0300 |
commit | ecb402499dba2d105b2714a55259352c31a62bd5 (patch) | |
tree | bcf388f945fc2eb9d4c151f776e030a65fb7fed7 /numpy/linalg | |
parent | db595a0c4064956d2f2f904ed4a76443322bb7e9 (diff) | |
parent | 7495de475c8c578a0c39b09bc55a88a93aa1985a (diff) | |
download | numpy-ecb402499dba2d105b2714a55259352c31a62bd5.tar.gz |
Merge branch 'master' into npy-2.1
Diffstat (limited to 'numpy/linalg')
-rw-r--r-- | numpy/linalg/lapack_lite/clapack_scrub.py | 5 | ||||
-rw-r--r-- | numpy/linalg/lapack_lite/fortran.py | 17 | ||||
-rw-r--r-- | numpy/linalg/linalg.py | 6 |
3 files changed, 13 insertions, 15 deletions
diff --git a/numpy/linalg/lapack_lite/clapack_scrub.py b/numpy/linalg/lapack_lite/clapack_scrub.py index e72a39e64..434586113 100644 --- a/numpy/linalg/lapack_lite/clapack_scrub.py +++ b/numpy/linalg/lapack_lite/clapack_scrub.py @@ -294,9 +294,8 @@ def scrubSource(source, nsteps=None, verbose=False): if __name__ == '__main__': filename = sys.argv[1] outfilename = os.path.join(sys.argv[2], os.path.basename(filename)) - fo = open(filename, 'r') - source = fo.read() - fo.close() + with open(filename, 'r') as fo: + source = fo.read() if len(sys.argv) > 3: nsteps = int(sys.argv[3]) diff --git a/numpy/linalg/lapack_lite/fortran.py b/numpy/linalg/lapack_lite/fortran.py index 3b6ac70f0..87c27aab9 100644 --- a/numpy/linalg/lapack_lite/fortran.py +++ b/numpy/linalg/lapack_lite/fortran.py @@ -110,15 +110,14 @@ def getDependencies(filename): """For a Fortran source file, return a list of routines declared as EXTERNAL in it. """ - fo = open(filename) external_pat = re.compile(r'^\s*EXTERNAL\s', re.I) routines = [] - for lineno, line in fortranSourceLines(fo): - m = external_pat.match(line) - if m: - names = line = line[m.end():].strip().split(',') - names = [n.strip().lower() for n in names] - names = [n for n in names if n] - routines.extend(names) - fo.close() + with open(filename) as fo: + for lineno, line in fortranSourceLines(fo): + m = external_pat.match(line) + if m: + names = line = line[m.end():].strip().split(',') + names = [n.strip().lower() for n in names] + names = [n for n in names if n] + routines.extend(names) return routines diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 29da77655..0aa8d5ca9 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -1900,9 +1900,9 @@ def pinv(a, rcond=1e-15, hermitian=False): Matrix or stack of matrices to be pseudo-inverted. rcond : (...) array_like of float Cutoff for small singular values. - Singular values smaller (in modulus) than - `rcond` * largest_singular_value (again, in modulus) - are set to zero. Broadcasts against the stack of matrices + Singular values less than or equal to + ``rcond * largest_singular_value`` are set to zero. + Broadcasts against the stack of matrices. hermitian : bool, optional If True, `a` is assumed to be Hermitian (symmetric if real-valued), enabling a more efficient method for finding singular values. |