(n, distrib)
| 62 | print "py:hd_sd %.3f" % best_boost |
| 63 | |
| 64 | def compare_3d(n, distrib): |
| 65 | if distrib == 0: |
| 66 | r = np.random.rand(n) |
| 67 | else: |
| 68 | r = 0.3 * np.random.randn(n) |
| 69 | r = r.reshape(3, n/3) |
| 70 | |
| 71 | best_numpy = float("infinity") |
| 72 | best_boost = float("infinity") |
| 73 | for k in xrange(20): |
| 74 | t = timer() |
| 75 | w, xe = np.histogramdd(r.T, bins=(100, 100, 100), |
| 76 | range=((0.0, 1.0), |
| 77 | (0.0, 1.0), |
| 78 | (0.0, 1.0))) |
| 79 | t = timer() - t |
| 80 | best_numpy = min(t, best_numpy) |
| 81 | |
| 82 | h = histogram(regular(100, 0, 1), |
| 83 | regular(100, 0, 1), |
| 84 | regular(100, 0, 1)) |
| 85 | t = timer() |
| 86 | h.fill(r[0], r[1], r[2]) |
| 87 | t = timer() - t |
| 88 | best_boost = min(t, best_boost) |
| 89 | assert(np.all(w == np.array(h)[:-2,:-2,:-2])) |
| 90 | |
| 91 | print "py:numpy %.3f" % best_numpy |
| 92 | print "py:hd_sd %.3f" % best_boost |
| 93 | |
| 94 | def compare_6d(n, distrib): |
| 95 | if distrib == 0: |
no test coverage detected