Unverified Commit bc12f4fc authored by dwuggh's avatar dwuggh
Browse files

fix bug

parent cf69f674
......@@ -13,7 +13,9 @@ def write_coeffs(name, correct, error):
def ph_expedient(p_ph, p_local, name):
bell_operator = get_bell_pair(p_ph)
err_model = cc.ErrorModel(0.1, p_local, p_local)
# the below 0.0 is actually neglected in computing
bell_constructor = lambda: bell_operator
err_model = cc.ErrorModel(bell_constructor, p_local, p_local)
ρ = cc.make_bell_with_initial(bell_operator, err_model, False, False)
ρ = cc.make_GHZ_with(ρ, err_model, False, False)
result_correct, result_error = cc.get_result(ρ.operator, err_model)
......@@ -22,15 +24,22 @@ def ph_expedient(p_ph, p_local, name):
write_coeffs(name, r1, r2)
return ρ
def run(p_local, p_ph):
name = "bosonic_channels/" + str(p_ph) + '_' + str(p_local)
print("running " + name + " ...")
ph_expedient(p_ph, p_local, name)
print("finished " + name)
if __name__ == '__main__':
# for p_ph in np.arange(0.004, 0.0085, 0.0005):
p_local = 0.003
for p_ph in np.arange(0.000, 0.004, 0.0005):
# for p_local in [0, 0.003, 0.0045]:
name = "bosonic_channels/" + str(p_ph) + '_' + str(p_local)
print("running " + name + " ...")
ph_expedient(p_ph, p_local, name)
print("finished " + name)
argv = sys.argv
p_local = float(argv[1])
p_ph = float(argv[2])
# p_local = 0.003
# ph_expedient(p_ph, p_local, 'test')
run(p_ph, p_local)
# for p_ph in np.arange(0.005, 0.015, 0.001):
# pass
# for p_ph in [0.005, 0.006]:
# for p_local in np.arange(0.003, 0.006, 0.0005):
......
import numpy as np
import traceback
from functools import reduce
from .utils import *
from .QOperator import *
......@@ -177,6 +178,11 @@ def measure_z(q = 0):
# generate bell pair in werner form
def bell_pair(p_n, qubits = [0, 1], i = 0):
if callable(p_n):
return DensityOperator(qubits, p_n())
print('using normal bell pair generation... pn = {}'.format(p_n))
# traceback.print_stack()
ρ_00 = np.array([
[1, 0, 0, 1],
[0, 0, 0, 0],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment