diff options
author | Pauli Virtanen <pav@iki.fi> | 2015-12-06 01:08:43 +0200 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2015-12-06 01:09:38 +0200 |
commit | 8e9c91ca962b1cb76c392983740300691a37c3cd (patch) | |
tree | 02dd9b287ab54048080b76756fa0ad4f49317fdb /benchmarks | |
parent | a42cb551c5da01072a9dd4b980d6a68620672a4e (diff) | |
download | numpy-8e9c91ca962b1cb76c392983740300691a37c3cd.tar.gz |
BENCH: allow benchmark suite to run on Python 3
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/benchmarks/bench_app.py | 2 | ||||
-rw-r--r-- | benchmarks/benchmarks/common.py | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/benchmarks/benchmarks/bench_app.py b/benchmarks/benchmarks/bench_app.py index 0e2aca64b..ccf6e4c4a 100644 --- a/benchmarks/benchmarks/bench_app.py +++ b/benchmarks/benchmarks/bench_app.py @@ -4,6 +4,8 @@ from .common import Benchmark import numpy as np +from six.moves import xrange + class LaplaceInplace(Benchmark): params = ['inplace', 'normal'] diff --git a/benchmarks/benchmarks/common.py b/benchmarks/benchmarks/common.py index c99b0afb8..e98396bed 100644 --- a/benchmarks/benchmarks/common.py +++ b/benchmarks/benchmarks/common.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, division, print_function + import numpy import random @@ -26,7 +28,7 @@ TYPES1 = [ # 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 +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)) @@ -34,16 +36,16 @@ squares = {t: numpy.array(values, # adjust complex ones to have non-degenerated imagery part -- use # original data transposed for that -for t, v in squares.iteritems(): +for t, v in squares.items(): if t.startswith('complex'): 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.items()} # vectors -vectors = {t: s[0] for t, s in squares.iteritems()} +vectors = {t: s[0] for t, s in squares.items()} -indexes = range(nx) +indexes = list(range(nx)) # so we do not have all items indexes.pop(5) indexes.pop(95) |