mirror of
https://github.com/boostorg/histogram.git
synced 2026-01-30 20:02:13 +00:00
fix
This commit is contained in:
@@ -40,20 +40,20 @@ def compare_2d(n, distrib):
|
||||
r = np.random.rand(n)
|
||||
else:
|
||||
r = 0.5 + 0.3 * np.random.randn(n)
|
||||
r = r.reshape(n/2, 2)
|
||||
r = r.reshape(2, n/2)
|
||||
|
||||
best_numpy = float("infinity")
|
||||
best_boost = float("infinity")
|
||||
for k in xrange(50):
|
||||
t = timer()
|
||||
w, xe, ye = np.histogram2d(r[:,0], r[:,1], bins=(100, 100),
|
||||
w, xe, ye = np.histogram2d(r[0], r[1], bins=(100, 100),
|
||||
range=((0.0, 1.0), (0.0, 1.0)))
|
||||
t = timer() - t
|
||||
best_numpy = min(t, best_numpy)
|
||||
|
||||
h = histogram(regular(100, 0, 1), regular(100, 0, 1))
|
||||
t = timer()
|
||||
h.fill(r[:,0], r[:,1])
|
||||
h.fill(r[0], r[1])
|
||||
t = timer() - t
|
||||
best_boost = min(t, best_boost)
|
||||
assert(np.all(w == np.array(h)[:-2,:-2]))
|
||||
@@ -66,13 +66,13 @@ def compare_3d(n, distrib):
|
||||
r = np.random.rand(n)
|
||||
else:
|
||||
r = 0.3 * np.random.randn(n)
|
||||
r = r.reshape(n/3, 3)
|
||||
r = r.reshape(3, n/3)
|
||||
|
||||
best_numpy = float("infinity")
|
||||
best_boost = float("infinity")
|
||||
for k in xrange(50):
|
||||
t = timer()
|
||||
w, xe = np.histogramdd(r, bins=(100, 100, 100),
|
||||
w, xe = np.histogramdd(r.T, bins=(100, 100, 100),
|
||||
range=((0.0, 1.0),
|
||||
(0.0, 1.0),
|
||||
(0.0, 1.0)))
|
||||
@@ -83,7 +83,7 @@ def compare_3d(n, distrib):
|
||||
regular(100, 0, 1),
|
||||
regular(100, 0, 1))
|
||||
t = timer()
|
||||
h.fill(r[:,0], r[:,1], r[:,2])
|
||||
h.fill(r[0], r[1], r[2])
|
||||
t = timer() - t
|
||||
best_boost = min(t, best_boost)
|
||||
assert(np.all(w == np.array(h)[:-2,:-2,:-2]))
|
||||
@@ -96,13 +96,13 @@ def compare_6d(n, distrib):
|
||||
r = np.random.rand(n)
|
||||
else:
|
||||
r = 0.3 * np.random.randn(n)
|
||||
r = r.reshape(n/6, 6)
|
||||
r = r.reshape(6, n/6)
|
||||
|
||||
best_numpy = float("infinity")
|
||||
best_boost = float("infinity")
|
||||
for k in xrange(50):
|
||||
t = timer()
|
||||
w, xe = np.histogramdd(r, bins=(10, 10, 10,
|
||||
w, xe = np.histogramdd(r.T, bins=(10, 10, 10,
|
||||
10, 10, 10),
|
||||
range=((0.0, 1.0),
|
||||
(0.0, 1.0),
|
||||
@@ -120,7 +120,7 @@ def compare_6d(n, distrib):
|
||||
regular(10, 0, 1),
|
||||
regular(10, 0, 1))
|
||||
t = timer()
|
||||
h.fill(r[:,0], r[:,1], r[:,2], r[:,3], r[:,4], r[:,5])
|
||||
h.fill(r[0], r[1], r[2], r[3], r[4], r[5])
|
||||
t = timer() - t
|
||||
best_boost = min(t, best_boost)
|
||||
assert(np.all(w == np.array(h)[:-2,:-2,:-2,:-2,:-2,:-2]))
|
||||
|
||||
Reference in New Issue
Block a user