simulaqron.cqc_backend package¶
Submodules¶
simulaqron.cqc_backend.cqcFactory module¶
-
class
simulaqron.cqc_backend.cqcFactory.
CQCFactory
(host, name, cqc_net, backend, network_name='default')[source]¶ Bases:
twisted.internet.protocol.Factory
-
is_adjacent
(remote_host_name)[source]¶ Checks if remote host is adjacent to this node, according to the specified topology.
- Parameters
remote_host_name – str The name of the remote host
- Returns
-
simulaqron.cqc_backend.cqcMessageHandler module¶
-
class
simulaqron.cqc_backend.cqcMessageHandler.
CQCQubit
(qubit_id=0, timestamp=0, virt=0)[source]¶ Bases:
object
-
class
simulaqron.cqc_backend.cqcMessageHandler.
SimulaqronCQCHandler
(factory)[source]¶ Bases:
cqc.MessageHandler.CQCMessageHandler
-
apply_rotation
(cqc_header, cmd, xtra, axis)[source]¶ Apply a rotation of the qubit specified in cmd with an angle specified in xtra around the axis
-
cmd_epr
(cqc_header, cmd, xtra)[source]¶ Create EPR pair with another node. Depending on the ips and ports this will either create an EPR-pair and send one part, or just receive.
-
cmd_epr_recv
(cqc_header, cmd, xtra)[source]¶ Receive half of epr from another node. Block until qubit is received.
-
cmd_i
(cqc_header, cmd, xtra)[source]¶ Do nothing. In reality we would wait a timestep but in SimulaQron we just do nothing.
-
cmd_new
(cqc_header, cmd, xtra, return_q_id=False, ignore_max_qubits=False)[source]¶ Request a new qubit. Since we don’t need it, this python CQC just provides very crude timing information. (return_q_id is used internally) (ignore_max_qubits is used internally to ignore the check of number of virtual qubits at the node such that the node can temporarily create a qubit for EPR creation.)
-
cmd_recv
(cqc_header, cmd, xtra)[source]¶ Receive qubit from another node. Block until qubit is received.
-
static
get_error_class
(remote_err)[source]¶ This is a function to get the error class of a remote thrown error when using callRemote. :param remote_err:
twisted.spread.pb.RemoteError
:return: class
-
get_virt_qubit
(header, qubit_id)[source]¶ Get reference to the virtual qubit reference in SimulaQron given app and qubit id, if it exists. If not found, send back no qubit error.
Caution: Twisted PB does not allow references to objects to be passed back between connections. If you need to pass a qubit reference back to the Twisted PB on a _different_ connection, then use get_virt_qubit_indep below.
-
get_virt_qubit_indep
(header, qubit_id)[source]¶ Get NUMBER (not reference!) to virtual qubit in SimulaQron specific to this connection. If not found, send back no qubit error.
-
handle_hello
(header, data)[source]¶ Hello just requires us to return hello - for testing availability.
-
static
new_ent_id
(host_app_id, remote_node, remote_app_id)[source]¶ Returns a new unique entanglement id for the specified host_app_id, remote_node and remote_app_id. Used by cmd_epr.
-
static
new_qubit_id
(app_id)[source]¶ Returns a new unique qubit id for the specified app_id. Used by cmd_new and cmd_recv
-