yt.geometry_tests / test_hilbert.py

from yt.utilities._amr_utils.geometry_utils import \
    get_hilbert_points, \
    get_hilbert_indices
import numpy as na
import time

N = 1e8
order = 15
rand = (na.random.random((N, 3)) * (2**order)).astype("int64")
rand[0,:] = 0
#print rand
t0 = time.time()
ind = get_hilbert_indices(order, rand)
print "START"
t1 = time.time()
pos = get_hilbert_points(order, ind)
t2 = time.time()
print "END"
print na.all(pos == rand),
print pos.min(), pos.max()
print "Took %0.3es (%0.3e)" % (t1-t0, (t1-t0)/rand.shape[0])
print "Took %0.3es (%0.3e)" % (t2-t1, (t2-t1)/rand.shape[0])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.