[Scipy-svn] r4730 - in trunk/scipy/linalg: . benchmarks tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Sep 18 15:35:17 EDT 2008
Author: alan.mcintyre
Date: 2008-09-18 14:34:57 -0500 (Thu, 18 Sep 2008)
New Revision: 4730
Modified:
trunk/scipy/linalg/benchmarks/bench_basic.py
trunk/scipy/linalg/benchmarks/bench_decom.py
trunk/scipy/linalg/matfuncs.py
trunk/scipy/linalg/tests/test_atlas_version.py
trunk/scipy/linalg/tests/test_basic.py
trunk/scipy/linalg/tests/test_blas.py
trunk/scipy/linalg/tests/test_decomp.py
trunk/scipy/linalg/tests/test_fblas.py
trunk/scipy/linalg/tests/test_lapack.py
trunk/scipy/linalg/tests/test_matfuncs.py
Log:
Removed unused/redundant imports.
Modified: trunk/scipy/linalg/benchmarks/bench_basic.py
===================================================================
--- trunk/scipy/linalg/benchmarks/bench_basic.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/benchmarks/bench_basic.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -1,19 +1,13 @@
import sys
-import numpy
-from numpy import arange, add, array, dot, zeros, identity, conjugate, transpose
-
from numpy.testing import *
+import numpy.linalg as linalg
-from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, \
- tril, pinv, pinv2, solve_banded
-
def random(size):
return rand(*size)
class TestSolve(TestCase):
def bench_random(self):
- import numpy.linalg as linalg
basic_solve = linalg.solve
print
print ' Solving system of linear equations'
@@ -53,7 +47,6 @@
class TestInv(TestCase):
def bench_random(self):
- import numpy.linalg as linalg
basic_inv = linalg.inv
print
print ' Finding matrix inverse'
@@ -92,7 +85,6 @@
class TestDet(TestCase):
def bench_random(self):
- import numpy.linalg as linalg
basic_det = linalg.det
print
print ' Finding matrix determinant'
Modified: trunk/scipy/linalg/benchmarks/bench_decom.py
===================================================================
--- trunk/scipy/linalg/benchmarks/bench_decom.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/benchmarks/bench_decom.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -3,10 +3,7 @@
"""
import sys
-import numpy
from numpy import linalg
-from scipy.linalg import eigvals
-
from numpy.testing import *
def random(size):
Modified: trunk/scipy/linalg/matfuncs.py
===================================================================
--- trunk/scipy/linalg/matfuncs.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/matfuncs.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -9,7 +9,7 @@
from numpy import asarray, Inf, dot, floor, eye, diag, exp, \
product, logical_not, ravel, transpose, conjugate, \
- cast, log, ogrid, isfinite, imag, real, absolute, amax, sign, \
+ cast, log, ogrid, imag, real, absolute, amax, sign, \
isfinite, sqrt, identity, single
from numpy import matrix as mat
import numpy as np
Modified: trunk/scipy/linalg/tests/test_atlas_version.py
===================================================================
--- trunk/scipy/linalg/tests/test_atlas_version.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_atlas_version.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -3,7 +3,6 @@
# Created by: Pearu Peterson, October 2003
#
-import sys
from numpy.testing import *
import scipy.linalg.atlas_version
Modified: trunk/scipy/linalg/tests/test_basic.py
===================================================================
--- trunk/scipy/linalg/tests/test_basic.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_basic.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -19,10 +19,9 @@
python tests/test_basic.py
"""
-import numpy
from numpy import arange, add, array, dot, zeros, identity, conjugate, transpose
+import numpy.linalg as linalg
-import sys
from numpy.testing import *
from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, \
@@ -50,33 +49,33 @@
for b in ([[1,0,0,0],[0,0,0,1],[0,1,0,0],[0,1,0,0]],
[[2,1],[-30,4],[2,3],[1,3]]):
x = solve_banded((l,u),ab,b)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
class TestSolve(TestCase):
def test_20Feb04_bug(self):
a = [[1,1],[1.0,0]] # ok
x0 = solve(a,[1,0j])
- assert_array_almost_equal(numpy.dot(a,x0),[1,0])
+ assert_array_almost_equal(dot(a,x0),[1,0])
a = [[1,1],[1.2,0]] # gives failure with clapack.zgesv(..,rowmajor=0)
b = [1,0j]
x0 = solve(a,b)
- assert_array_almost_equal(numpy.dot(a,x0),[1,0])
+ assert_array_almost_equal(dot(a,x0),[1,0])
def test_simple(self):
a = [[1,20],[-30,4]]
for b in ([[1,0],[0,1]],[1,0],
[[2,1],[-30,4]]):
x = solve(a,b)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_simple_sym(self):
a = [[2,3],[3,5]]
for lower in [0,1]:
for b in ([[1,0],[0,1]],[1,0]):
x = solve(a,b,sym_pos=1,lower=lower)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_simple_sym_complex(self):
a = [[5,2],[2,4]]
@@ -85,7 +84,7 @@
[0,2]],
]:
x = solve(a,b,sym_pos=1)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_simple_complex(self):
a = array([[5,2],[2j,4]],'D')
@@ -96,7 +95,7 @@
array([1,0],'D'),
]:
x = solve(a,b)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_nils_20Feb04(self):
n = 2
@@ -117,7 +116,7 @@
for i in range(4):
b = random([n,3])
x = solve(a,b)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_random_complex(self):
n = 20
@@ -126,7 +125,7 @@
for i in range(2):
b = random([n,3])
x = solve(a,b)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_random_sym(self):
n = 20
@@ -138,7 +137,7 @@
for i in range(4):
b = random([n])
x = solve(a,b,sym_pos=1)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_random_sym_complex(self):
n = 20
@@ -147,11 +146,11 @@
for i in range(n):
a[i,i] = abs(20*(.1+a[i,i]))
for j in range(i):
- a[i,j] = numpy.conjugate(a[j,i])
+ a[i,j] = conjugate(a[j,i])
b = random([n])+2j*random([n])
for i in range(2):
x = solve(a,b,sym_pos=1)
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
class TestInv(TestCase):
@@ -159,11 +158,11 @@
def test_simple(self):
a = [[1,2],[3,4]]
a_inv = inv(a)
- assert_array_almost_equal(numpy.dot(a,a_inv),
+ assert_array_almost_equal(dot(a,a_inv),
[[1,0],[0,1]])
a = [[1,2,3],[4,5,6],[7,8,10]]
a_inv = inv(a)
- assert_array_almost_equal(numpy.dot(a,a_inv),
+ assert_array_almost_equal(dot(a,a_inv),
[[1,0,0],[0,1,0],[0,0,1]])
def test_random(self):
@@ -172,12 +171,12 @@
a = random([n,n])
for i in range(n): a[i,i] = 20*(.1+a[i,i])
a_inv = inv(a)
- assert_array_almost_equal(numpy.dot(a,a_inv),
- numpy.identity(n))
+ assert_array_almost_equal(dot(a,a_inv),
+ identity(n))
def test_simple_complex(self):
a = [[1,2],[3,4j]]
a_inv = inv(a)
- assert_array_almost_equal(numpy.dot(a,a_inv),
+ assert_array_almost_equal(dot(a,a_inv),
[[1,0],[0,1]])
def test_random_complex(self):
@@ -186,8 +185,8 @@
a = random([n,n])+2j*random([n,n])
for i in range(n): a[i,i] = 20*(.1+a[i,i])
a_inv = inv(a)
- assert_array_almost_equal(numpy.dot(a,a_inv),
- numpy.identity(n))
+ assert_array_almost_equal(dot(a,a_inv),
+ identity(n))
class TestDet(TestCase):
@@ -203,7 +202,6 @@
assert_almost_equal(a_det,-6+4j)
def test_random(self):
- import numpy.linalg as linalg
basic_det = linalg.det
n = 20
for i in range(4):
@@ -213,7 +211,6 @@
assert_almost_equal(d1,d2)
def test_random_complex(self):
- import numpy.linalg as linalg
basic_det = linalg.det
n = 20
for i in range(4):
@@ -246,7 +243,7 @@
for b in ([[1,0],[0,1]],[1,0],
[[2,1],[-30,4]]):
x = lstsq(a,b)[0]
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_simple_overdet(self):
a = [[1,2],[4,5],[3,4]]
@@ -271,7 +268,7 @@
for i in range(4):
b = random([n,3])
x = lstsq(a,b)[0]
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_random_complex_exact(self):
n = 20
@@ -280,7 +277,7 @@
for i in range(2):
b = random([n,3])
x = lstsq(a,b)[0]
- assert_array_almost_equal(numpy.dot(a,x),b)
+ assert_array_almost_equal(dot(a,x),b)
def test_random_overdet(self):
n = 20
Modified: trunk/scipy/linalg/tests/test_blas.py
===================================================================
--- trunk/scipy/linalg/tests/test_blas.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_blas.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -12,13 +12,9 @@
python tests/test_blas.py [<level>]
"""
-import sys
import math
-from numpy import arange, add, array
-
from numpy.testing import *
-
from scipy.linalg import fblas, cblas
Modified: trunk/scipy/linalg/tests/test_decomp.py
===================================================================
--- trunk/scipy/linalg/tests/test_decomp.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_decomp.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -14,7 +14,6 @@
python tests/test_decomp.py
"""
-import sys
from numpy.testing import *
from scipy.linalg import eig,eigvals,lu,svd,svdvals,cholesky,qr, \
@@ -25,10 +24,9 @@
from numpy import array, transpose, sometrue, diag, ones, linalg, \
argsort, zeros, arange, float32, complex64, dot, conj, identity, \
- ravel, sqrt, iscomplex, shape, sort, sign, conjugate, sign, bmat, \
+ ravel, sqrt, iscomplex, shape, sort, conjugate, bmat, sign, \
asarray, matrix, isfinite, all
-
from numpy.random import rand
def random(size):
Modified: trunk/scipy/linalg/tests/test_fblas.py
===================================================================
--- trunk/scipy/linalg/tests/test_fblas.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_fblas.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -6,11 +6,8 @@
# !! Complex calculations really aren't checked that carefully.
# !! Only real valued complex numbers are used in tests.
-import sys
-
-from numpy import dot, float32, float64, complex64, complex128, \
- arange, array, zeros, shape, transpose, newaxis, \
- common_type, conjugate
+from numpy import float32, float64, complex64, complex128, arange, array, \
+ zeros, shape, transpose, newaxis, common_type, conjugate
from scipy.linalg import fblas
from numpy.testing import *
Modified: trunk/scipy/linalg/tests/test_lapack.py
===================================================================
--- trunk/scipy/linalg/tests/test_lapack.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_lapack.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -3,8 +3,6 @@
# Created by: Pearu Peterson, September 2002
#
-
-import sys
from numpy.testing import *
from numpy import ones
Modified: trunk/scipy/linalg/tests/test_matfuncs.py
===================================================================
--- trunk/scipy/linalg/tests/test_matfuncs.py 2008-09-18 19:31:49 UTC (rev 4729)
+++ trunk/scipy/linalg/tests/test_matfuncs.py 2008-09-18 19:34:57 UTC (rev 4730)
@@ -6,15 +6,11 @@
"""
-import sys
-
-import numpy
from numpy import array, identity, dot, sqrt
-
from numpy.testing import *
import scipy.linalg
-from scipy.linalg import signm,logm,funm, sqrtm, expm, expm2, expm3
+from scipy.linalg import signm, logm, sqrtm, expm, expm2, expm3
class TestSignM(TestCase):
More information about the Scipy-svn
mailing list