Merge branch 'master' of gitlab.com:pisquared/quantum
This commit is contained in:
commit
911d58bfde
15
06_krisis.py
15
06_krisis.py
@ -33,8 +33,11 @@ def math_sim(q2func=State.from_angles, iterations=1000, sample_count=1):
|
|||||||
all_samples = defaultdict(int)
|
all_samples = defaultdict(int)
|
||||||
for i in range(iterations):
|
for i in range(iterations):
|
||||||
# print("Running iteration {}".format(i))
|
# print("Running iteration {}".format(i))
|
||||||
# theta = round(np.random.uniform(0, np.pi), 3)
|
# Generating uniform random points on a sphere is not trivial
|
||||||
# phi = round(np.random.uniform(0, 2 * np.pi), 3)
|
# https://www.bogotobogo.com/Algorithms/uniform_distribution_sphere.php
|
||||||
|
# theta = np.arccos(2 * np.random.uniform(0, 1) - 1.0)
|
||||||
|
# phi = 2 * np.pi * np.random.uniform(0, 1.0)
|
||||||
|
|
||||||
t = round(np.random.uniform(0, 1), 10)
|
t = round(np.random.uniform(0, 1), 10)
|
||||||
phi = round(np.random.uniform(0, 2 * np.pi), 10)
|
phi = round(np.random.uniform(0, 2 * np.pi), 10)
|
||||||
theta = np.arccos(1 - 2 * t)
|
theta = np.arccos(1 - 2 * t)
|
||||||
@ -76,9 +79,11 @@ class MemoizedExp(object):
|
|||||||
|
|
||||||
|
|
||||||
def gen_exp_for_cirq_0():
|
def gen_exp_for_cirq_0():
|
||||||
t = round(np.random.uniform(0, 1), 10)
|
# TODO: FIX THIS AS AN EXPONENT UNIFORM DISTRIBUTION
|
||||||
phi = round(np.random.uniform(0, 2), 10)
|
# Generating uniform random points on a sphere is not trivial
|
||||||
theta = np.arccos(1 - 2 * t) / (2 * np.pi)
|
# https://www.bogotobogo.com/Algorithms/uniform_distribution_sphere.php
|
||||||
|
theta = round(np.random.uniform(0, 1), 10)
|
||||||
|
phi = round(np.random.uniform(0, 1), 10)
|
||||||
return theta, phi
|
return theta, phi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user