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

buildProtocol(addr)[source]

Return an instance of CQCProtocol when a connection is made.

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

lookup(ip, port)[source]

Lookup name of remote host used within SimulaQron given ip and portnumber.

set_virtual_node(virtRoot)[source]

Set the virtual root allowing connections to the SimulaQron backend.

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

apply_single_qubit_gate(cqc_header, qubit_id, gate)[source]
apply_two_qubit_gate(cqc_header, cmd, xtra, gate)[source]
cmd_allocate(cqc_header, cmd, xtra)[source]

Allocate multiple qubits.

cmd_cnot(cqc_header, cmd, xtra)[source]

Apply CNOT Gate

cmd_cphase(cqc_header, cmd, xtra)[source]

Apply CPHASE Gate

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_h(cqc_header, cmd, xtra)[source]

Apply H Gate

cmd_i(cqc_header, cmd, xtra)[source]

Do nothing. In reality we would wait a timestep but in SimulaQron we just do nothing.

cmd_k(cqc_header, cmd, xtra)[source]

Apply K Gate

cmd_measure(cqc_header, cmd, xtra, inplace=False)[source]

Measure

cmd_measure_inplace(cqc_header, cmd, xtra)[source]
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.

cmd_release(cqc_header, cmd, xtra)[source]

Release

cmd_reset(cqc_header, cmd, xtra)[source]

Reset Qubit to |0>

cmd_rotx(cqc_header, cmd, xtra)[source]

Rotate around x axis

cmd_roty(cqc_header, cmd, xtra)[source]

Rotate around y axis

cmd_rotz(cqc_header, cmd, xtra)[source]

Rotate around z axis

cmd_send(cqc_header, cmd, xtra)[source]

Send qubit to another node.

cmd_t(cqc_header, cmd, xtra)[source]

Apply T Gate

cmd_x(cqc_header, cmd, xtra)[source]

Apply X Gate

cmd_y(cqc_header, cmd, xtra)[source]

Apply Y Gate

cmd_z(cqc_header, cmd, xtra)[source]

Apply Z Gate

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.

handle_time(header, data)[source]
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

remove_qubit_id(app_id, qubit_id)[source]

Remove qubit id from current used qubit_id so it can be reused :param app_id: The app id of the current qubit_id :param qubit_id: The qubit id to be removed

send_epr_half(cqc_header, cmd, xtra, ent_info)[source]

Send qubit to another node.

Module contents