Contents | Summary | Panvia Quantum Computer | Method | |||
---|---|---|---|---|---|---|
Alice | Eve | Bob | ||||
Evolution | Results | Applications |
#############################################################################################
# Quantum Gate: 2 of 10
# CNOT on two qubits:
# latin control qubits
# korean target qubits
# CNOT modifies the |0> ... |1> state of a dependent tag by the state of an independent tag
# cnotTagPair returns an object with an independent tag and a dependent tag for cnot
# pass an independent type and an independent item
# plus a dependent type and a dependent item
# return an object with an independent object with the independent tag
# and with a dependent object with the dependent tag
# cnotTagPair(independentqtype,independentqdata,dependentqtype,dependentqdata):
#############################################################################################
secondGates = []
for i in range(items):
qubitPair = cnotTagPair('key', myLatinNums[i],tag, koreanNumbers[i])
cnotOperation = CNOT( i, items, qubitPair )
secondGates.append( cnotOperation )
which generates the list of commands
<pprint( secondGates )
[{'panvia': {'command': {'action': 'CNOT', 'item': 0, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'yeong'}},
'independent': {'tag': {'key': 'nihil'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 1, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'il'}},
'independent': {'tag': {'key': 'unus'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 2, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i'}},
'independent': {'tag': {'key': 'duo'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 3, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam'}},
'independent': {'tag': {'key': 'tres'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 4, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sa'}},
'independent': {'tag': {'key': 'quattuor'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 5, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'o'}},
'independent': {'tag': {'key': 'quinque'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 6, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'yuk'}},
'independent': {'tag': {'key': 'sex'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 7, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'chil'}},
'independent': {'tag': {'key': 'septem'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 8, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'pal'}},
'independent': {'tag': {'key': 'octo'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 9, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'gu'}},
'independent': {'tag': {'key': 'novem'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 10, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip'}},
'independent': {'tag': {'key': 'decem'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 11, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-il'}},
'independent': {'tag': {'key': 'undecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 12, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-i'}},
'independent': {'tag': {'key': 'duodecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 13, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-sam'}},
'independent': {'tag': {'key': 'tredecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 14, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-sa'}},
'independent': {'tag': {'key': 'quattuordecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 15, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-o'}},
'independent': {'tag': {'key': 'quindecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 16, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-yuk'}},
'independent': {'tag': {'key': 'sedecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 17, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-chil'}},
'independent': {'tag': {'key': 'septendecim'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 18, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-pal'}},
'independent': {'tag': {'key': 'duodeviginti'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 19, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sip-gu'}},
'independent': {'tag': {'key': 'undeviginti'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 20, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip'}},
'independent': {'tag': {'key': 'viginti'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 21, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-il'}},
'independent': {'tag': {'key': 'viginti unus'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 22, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-i'}},
'independent': {'tag': {'key': 'viginti duo'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 23, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-sam'}},
'independent': {'tag': {'key': 'viginti tres'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 24, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-sa'}},
'independent': {'tag': {'key': 'viginti quattuor'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 25, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-o'}},
'independent': {'tag': {'key': 'viginti quinque'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 26, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-yuk'}},
'independent': {'tag': {'key': 'viginti sex'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 27, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-chil'}},
'independent': {'tag': {'key': 'viginti septem'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 28, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-pal'}},
'independent': {'tag': {'key': 'duodetriginta'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 29, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'i-sip-gu'}},
'independent': {'tag': {'key': 'undetriginta'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 30, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip'}},
'independent': {'tag': {'key': 'triginta'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 31, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-il'}},
'independent': {'tag': {'key': 'triginta unus'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 32, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-i'}},
'independent': {'tag': {'key': 'triginta duo'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 33, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-sam'}},
'independent': {'tag': {'key': 'triginta tres'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 34, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-sa'}},
'independent': {'tag': {'key': 'triginta '
'quattuour'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 35, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-o'}},
'independent': {'tag': {'key': 'triginta quinque'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 36, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-yuk'}},
'independent': {'tag': {'key': 'triginta sex'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 37, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-chil'}},
'independent': {'tag': {'key': 'triginta septem'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 38, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-pal'}},
'independent': {'tag': {'key': 'duodequadraginta'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 39, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sam-sip-gu'}},
'independent': {'tag': {'key': 'undequadraginta'}}}]}},
{'panvia': {'command': {'action': 'CNOT', 'item': 40, 'total': 41},
'list': [{'dependent': {'tag': {'key': 'sa-sip'}},
'independent': {'tag': {'key': 'quadraginta'}}}]}}]
A program is a list of command lists, so Python creates a program as a list of named command lists in sequence
AlicesProgram = [ englishList, latinList, koreanList, QuantumNetList, firstGates, secondGates, thirdGates, fourthGates, englishMeasure ]
# Save program to JSON file
AlicesProgramListing = json.dump( AlicesProgram, open('alices_program.json','w'))
Here is the Python command to run Alice's 41 circuits of 3 qubits each:
>>> qps = Alice()
>>>
The function Alice returns the teleportation QPS JSON file.Alice function source code:
########################################################################################
# Alices Program
# pass arg trace = True to save state at each step
########################################################################################
def Alice(trace = False):
print("Debugging Panvia Future Technologies Inc. Teleportation Demo Alice's Circuit ")
if trace == True:
print("Writing trace responses to JSON files ...")
panviaSend(englishList,panviaServer)
panviaSend(latinList,panviaServer)
panviaSend(koreanList,panviaServer)
panviaSend(QuantumNetList,panviaServer)
if ntrace == True:
output = panviaSend(englishTrace,panviaServer)
json.dump(output, open('alice_states_0.json','w'))
panviaSend(firstGates,panviaServer)
if ntrace == True:
output = panviaSend(englishTrace,panviaServer)
json.dump(output, open('alice_states_1.json','w'))
panviaSend(secondGates,panviaServer)
if ntrace == True:
output = panviaSend(englishTrace,panviaServer)
json.dump(output, open('alice_states_2.json','w'))
panviaSend(thirdGates,panviaServer)
if ntrace == True:
output = panviaSend(englishTrace,panviaServer)
json.dump(output, open('alice_states_3.json','w'))
panviaSend(fourthGates,panviaServer)
if ntrace == True:
output = panviaSend(englishTrace,panviaServer)
json.dump(output, open('alice_states_4.json','w'))
output = panviaSend(englishMeasure,panviaServer)
if ntrace == True:
json.dump(output, open('alice_states_5.json','w'))
return output # trace of final state
# Connect to PanviaQuantumWebStore with ip address
# Send python list or JSON text string to PanviaQuantumWebStore
# Read and Convert JSON response to python by first converting bytearray to str
# then str to python using json.loads(str)
def panviaSend( commands, ip ):
if type(ip) == str:
webcon = http.client.HTTPConnection(ip)
webcon.connect()
if type(commands) == list:
JSON = json.dumps(commands, indent=4 )
webcon.request('POST','/PanviaWebAI', JSON, headers )
myresp = webcon.getresponse()
respdat = myresp.read()
print(respdat)
JSON = str(respdat,'latin-1')
pprint(JSON)
y = json.loads(JSON)
return y
else:
print('python list required')