summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2015-08-24 19:40:19 +0300
committerPauli Virtanen <pav@iki.fi>2015-08-24 19:40:19 +0300
commit02ae0e3ea9fb3567c12e8d0c93ae8dbd4977623e (patch)
treef940afa62e62f1f87b4bb6421cc3beced460250d /benchmarks
parent8f31e5e1761bbfba5eb6e71acab6734bfa468e2d (diff)
downloadnumpy-02ae0e3ea9fb3567c12e8d0c93ae8dbd4977623e.tar.gz
WHT: break long lines + pep8
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_app.py10
-rw-r--r--benchmarks/benchmarks/bench_indexing.py5
-rw-r--r--benchmarks/benchmarks/bench_linalg.py1
-rw-r--r--benchmarks/benchmarks/common.py19
4 files changed, 21 insertions, 14 deletions
diff --git a/benchmarks/benchmarks/bench_app.py b/benchmarks/benchmarks/bench_app.py
index 85aefe9d3..0e2aca64b 100644
--- a/benchmarks/benchmarks/bench_app.py
+++ b/benchmarks/benchmarks/bench_app.py
@@ -18,7 +18,9 @@ class LaplaceInplace(Benchmark):
dy2 = (dy * dy)
def num_update(u, dx2, dy2):
- u[1:(-1), 1:(-1)] = ((((u[2:, 1:(-1)] + u[:(-2), 1:(-1)]) * dy2) + ((u[1:(-1), 2:] + u[1:(-1), :(-2)]) * dx2)) / (2 * (dx2 + dy2)))
+ u[1:(-1), 1:(-1)] = ((((u[2:, 1:(-1)] + u[:(-2), 1:(-1)]) * dy2) +
+ ((u[1:(-1), 2:] + u[1:(-1), :(-2)]) * dx2))
+ / (2 * (dx2 + dy2)))
def num_inplace(u, dx2, dy2):
tmp = u[:(-2), 1:(-1)].copy()
@@ -28,7 +30,8 @@ class LaplaceInplace(Benchmark):
np.add(tmp2, u[1:(-1), :(-2)], out=tmp2)
np.multiply(tmp2, dx2, out=tmp2)
np.add(tmp, tmp2, out=tmp)
- np.multiply(tmp, (1.0 / (2.0 * (dx2 + dy2))), out=u[1:(-1), 1:(-1)])
+ np.multiply(tmp, (1.0 / (2.0 * (dx2 + dy2))),
+ out=u[1:(-1), 1:(-1)])
def laplace(N, Niter=100, func=num_update, args=()):
u = np.zeros([N, N], order='C')
@@ -55,7 +58,8 @@ class MaxesOfDots(Benchmark):
nfeat = 100
ntime = 200
- self.arrays = [np.random.normal(size=(ntime, nfeat)) for i in xrange(nsubj)]
+ self.arrays = [np.random.normal(size=(ntime, nfeat))
+ for i in xrange(nsubj)]
def maxes_of_dots(self, arrays):
"""
diff --git a/benchmarks/benchmarks/bench_indexing.py b/benchmarks/benchmarks/bench_indexing.py
index 98024e991..4f2482ef8 100644
--- a/benchmarks/benchmarks/bench_indexing.py
+++ b/benchmarks/benchmarks/bench_indexing.py
@@ -23,9 +23,10 @@ class Indexing(Benchmark):
'indexes_rand_': indexes_rand_}
if sys.version_info[0] >= 3:
- code = "def run():\n for a in squares_.values(): a[%s]%s" % (sel, op)
+ code = "def run():\n for a in squares_.values(): a[%s]%s"
else:
- code = "def run():\n for a in squares_.itervalues(): a[%s]%s" % (sel, op)
+ code = "def run():\n for a in squares_.itervalues(): a[%s]%s"
+ code = code % (sel, op)
six.exec_(code, ns)
self.func = ns['run']
diff --git a/benchmarks/benchmarks/bench_linalg.py b/benchmarks/benchmarks/bench_linalg.py
index eecea632d..c844cc79e 100644
--- a/benchmarks/benchmarks/bench_linalg.py
+++ b/benchmarks/benchmarks/bench_linalg.py
@@ -4,6 +4,7 @@ from .common import Benchmark, squares_, indexes_rand
import numpy as np
+
class Eindot(Benchmark):
def setup(self):
self.a = np.arange(60000.0).reshape(150, 400)
diff --git a/benchmarks/benchmarks/common.py b/benchmarks/benchmarks/common.py
index 9c5073c6c..c99b0afb8 100644
--- a/benchmarks/benchmarks/common.py
+++ b/benchmarks/benchmarks/common.py
@@ -16,19 +16,20 @@ nxs, nys = 100, 100
# a set of interesting types to test
TYPES1 = [
- 'int16', 'float16',
- 'int32', 'float32',
- 'int64', 'float64', 'complex64',
- 'longfloat', 'complex128',
- 'complex256',
- ]
+ 'int16', 'float16',
+ 'int32', 'float32',
+ 'int64', 'float64', 'complex64',
+ 'longfloat', 'complex128',
+ 'complex256',
+]
# values which will be used to construct our sample data matrices
# replicate 10 times to speed up initial imports of this helper
# and generate some redundancy
values = [random.uniform(0, 100) for x in range(nx*ny/10)]*10
-squares = {t: numpy.array(values, dtype=getattr(numpy, t)).reshape((nx, ny))
+squares = {t: numpy.array(values,
+ dtype=getattr(numpy, t)).reshape((nx, ny))
for t in TYPES1}
# adjust complex ones to have non-degenerated imagery part -- use
@@ -38,9 +39,9 @@ for t, v in squares.iteritems():
v += v.T*1j
# smaller squares
-squares_ = {t: s[:nxs, :nys] for t, s in squares.iteritems()}
+squares_ = {t: s[:nxs, :nys] for t, s in squares.iteritems()}
# vectors
-vectors = {t: s[0] for t, s in squares.iteritems()}
+vectors = {t: s[0] for t, s in squares.iteritems()}
indexes = range(nx)
# so we do not have all items