SimulaQron.cqc.backend package

Subpackages

SimulaQron.cqc.backend.cqcHeader module

class SimulaQron.cqc.backend.cqcHeader.CQCCmdHeader(headerBytes=None)[source]

Bases: object

Header for a command instruction packet.

pack()[source]

Pack data into packet format. For defnitions see cLib/cgc.h

printable()[source]

Produce a printable string for information purposes.

setVals(qubit_id, instr, notify, block, action)[source]

Set using given values.

unpack(headerBytes)[source]

Unpack packet data. For definitions see cLib/cqc.h

class SimulaQron.cqc.backend.cqcHeader.CQCHeader(headerBytes=None)[source]

Bases: object

Definition of the general CQC header.

pack()[source]

Pack data into packet format. For defnitions see cLib/cgc.h

printable()[source]

Produce a printable string for information purposes.

setVals(version, tp, app_id, length)[source]

Set using given values.

unpack(headerBytes)[source]

Unpack packet data. For definitions see cLib/cqc.h

class SimulaQron.cqc.backend.cqcHeader.CQCNotifyHeader(headerBytes=None)[source]

Bases: object

Header used to specify notification details.

pack()[source]

Pack data into packet form. For definitions see cLib/cqc.h

printable()[source]

Produce a printable string for information purposes.

setVals(qubit_id, outcome, remote_app_id, remote_node, remote_port, datetime)[source]

Set using given values.

unpack(headerBytes)[source]

Unpack packet data. For defnitions see cLib/cqc.h

class SimulaQron.cqc.backend.cqcHeader.CQCXtraHeader(headerBytes=None)[source]

Bases: object

Optional addtional cmd header information. Only relevant for certain commands.

pack()[source]

Pack data into packet form. For definitions see cLib/cqc.h

printable()[source]

Produce a printable string for information purposes.

setVals(xtra_qubit_id, step, remote_app_id, remote_node, remote_port, cmdLength)[source]

Set using given values.

unpack(headerBytes)[source]

Unpack packet data. For defnitions see cLib/cqc.h

SimulaQron.cqc.backend.cqcProtocol module

class SimulaQron.cqc.backend.cqcProtocol.CQCFactory(host, name, cqcNet)[source]

Bases: twisted.internet.protocol.Factory

buildProtocol(addr)[source]

Return an instance of CQCProtocol when a connection is made.

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.

set_virtual_reg(qReg)[source]

Set the default register to use on the SimulaQron backend.

class SimulaQron.cqc.backend.cqcProtocol.CQCProtocol(factory)[source]

Bases: twisted.internet.protocol.Protocol

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)[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)

cmd_recv(cqc_header, cmd, xtra)[source]

Receive qubit from another node. Block until qubit is received.

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

connectionLost(reason)[source]
connectionMade()[source]
dataReceived(data)[source]

Receive data. We will always wait to receive enough data for the header, and then the entire packet first before commencing processing.

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

Handle incoming command requests.

handle_factory(header, data)[source]
handle_hello(header, data)[source]

Hello just requires us to return hello - for testing availablility.

handle_time(header, data)[source]
hasXtra(cmd)[source]

Check whether this command includes an extra header with additional information.

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.

new_qubit_id(app_id)[source]

Returns a new unique qubit id for the specified app_id. Used by cmd_new and cmd_recv

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

Send qubit to another node.

class SimulaQron.cqc.backend.cqcProtocol.CQCQubit(qubit_id=0, timestamp=0, virt=0)[source]

Bases: object

Module contents