progress.hardware.qhardware
This module implements the quantum hardware (the Physical layer) of a quantum network device.
- class progress.hardware.qhardware.QHardware(name, num_qnics=2, num_qbits_qnic=1, qproc_params=None)[source]
Bases:
Node
This node contains the quantum hardware of a Quantum Internet node, including the quantum processor and the QNICS.
- Parameters:
- namestr
The name of this Repeater
- num_qnicsint, optional
The number of QNICS of this device. Defaults to 2.
- num_qbits_qnicint, optional
The number of physical qubits assigned to each QNIC of this device. Defaults to 1.
- qproc_paramsdict[str, any] or None, optional
The parameters of the quantum processor of this device. See
get_processor()
for details. If None, a default processor is created. Defaults to None. The field num_positions can be omitted, as it is set to num_qnics * num_qbits_qnic.
Notes
Ports:
“qnic{0..[num_qnics-1]}” (in/out): The QNICS of this device. These ports are forwarded to the “q{i}” ports of the quantum device.
“q_ops” (output): Used to send out responses and outcomes for requested quantum operations.
“new_entanglements” (output): Used to signal to the outside (typically to the QHAL) that a new entangled qubit is available.
- Attributes:
- qproc_paramsdict[str, any]
The parameters of the quantum processor of this device.
- num_qnicsint
The number of QNICS of this device.
- num_qbits_qnicint
The number of physical qubits assigned to each QNIC of this device.
qmemory
netsquid.components.qprocessor.QuantumProcessor
The primary quantum memory, if present.
- get_subscribed_llp(qnic)[source]
Returns the Link Layer protocol subscribed to the given QNIC.
- Parameters:
- qnicint or str
The QNIC to get the subscribed link protocol from. Can be either the qnic’s name or its index.
- Returns:
LinkProtocol
or None
- map_info_to_qubit(qnic, idx)[source]
Maps the qnic and the index of the qubit to the position in the quantum processor.
- put_qop(request)[source]
Submit a quantum operation request. The response is sent through the port “q_ops” of the node.
- Parameters:
- request: namedtuple
The request to be submitted. See
QuantumOperationRequest
for details.
- subscribe_llp(qnic, llp)[source]
Subscribe a link layer protocol to the given QNIC.
- Parameters:
- qnicint or str
The QNIC to subscribe the link protocol to. Can be either the qnic’s name or its index.
- llp
LinkProtocol
The link layer protocol to subscribe.
- class progress.hardware.qhardware.QuantumOperationsService(node, name=None)[source]
Bases:
ServiceProtocol
This protocol is used to request quantum operations to the quantum processor. It sends the measurement outcomes (if present) out from the port q_ops of the quantum hardware.
- Parameters:
- node
Node
The component to which the service is attached.
- namestr or None, optional
The name of the service, for labelling purposes. Defaults to None.
- node
- class CorrectProgram(num_qubits=None, parallel=True, qubit_mapping=None)[source]
Bases:
QuantumProgram
Quantum processor program that applies corrections to restore the |beta00> state.
- default_num_qubits = 1
int: default number of qubits program requires. If -1 it can run on any number of qubits.
- free(qnic, idx)[source]
Free the qubit on the given socket.
- Parameters:
- qnicstr
The qnic identifier.
- idxint
The index of the qubit on the qnic.
- handle_request(request, identifier, start_time=None, **kwargs)[source]
Schedule the request on the queue.
- Parameters:
- request
The object representing the request.
- identifierstr
The identifier for this request.
- start_timefloat, optional
The time at which the request can be executed. Default current simulation time. [ns]
- kwargsdict, optional
Additional arguments which can be set by the service.
- Returns:
- dict
The dictionary with additional arguments.
Notes
This method is called after
netsquid.protocols.serviceprotocol.ServiceProtocol.put()
which does the type checking etc.
- class req_correct(id, qnic1, idx1, cur_state)
Bases:
tuple
Request to correct a qubit in the quantum processor. The qubit is in the state specified by cur_state, which is an integer between 0 and 3 indicating the Bell state. The qubit is corrected to the Bell state \(\vert \beta_{00} \rangle\).
- Parameters:
id (int): The id of the request. qnic1 (int or str): The qnic to which the qubit is assigned. idx1 (int): The index of the qubit relative to the qnic. cur_state (int): The current state of the qubit. Can be either 0, 1, 2 or 3.
- cur_state
Alias for field number 3
- id
Alias for field number 0
- idx1
Alias for field number 2
- qnic1
Alias for field number 1
- req_dejmps
Request to perform DEJMPS distillation on two qubits in the quantum processor. The first one is the one distilled, the second one is used as ancilla. The “role” field is used to determine which rotation to apply (pi/2 or -pi/2), and can assume two values, either ‘A’ (pi/2) or ‘B’ (-pi/2).
- Parameters:
id (int): The id of the request. qnic1 (int or str): The qnic to which the first qubit is assigned. idx1 (int): The index of the first qubit relative to the qnic. qnic2 (int or str): The qnic to which the second qubit is assigned. idx2 (int): The index of the second qubit relative to the qnic. role (str): The role of this device in the distillation. Can be either ‘A’ or ‘B’.
alias of
req_purify
- class req_free(qnic, idx)
Bases:
tuple
Request to free a qubit from the quantum processor at a specified position.
- Parameters:
qnic (int or str): The qnic to which the qubit is assigned. idx (int): The index of the qubit relative to the qnic.
- idx
Alias for field number 1
- qnic
Alias for field number 0
- class req_qcirc(id, qubits_map, qcirc)
Bases:
tuple
Request to perform a generic quantum circuit on a set of qubits in the quantum processor. When the circuit is executed, the measurement outcomes are sent out from the port q_ops.
- Parameters:
id (int): The id of the request. qubits_map (list of tuples): A list of tuples, each one containing the qnic and the index of the qubit
relative to the qnic.
qcirc (QuantumProgram): The quantum program to execute.
- id
Alias for field number 0
- qcirc
Alias for field number 2
- qubits_map
Alias for field number 1
- class req_swap(id, qnic1, idx1, qnic2, idx2)
Bases:
tuple
Request to perform entanglement swapping on two qubits in the quantum processor.
- Parameters:
id (int): The id of the request. qnic1 (int or str): The qnic to which the first qubit is assigned. idx1 (int): The index of the first qubit relative to the qnic. qnic2 (int or str): The qnic to which the second qubit is assigned. idx2 (int): The index of the second qubit relative to the qnic.
- id
Alias for field number 0
- idx1
Alias for field number 2
- idx2
Alias for field number 4
- qnic1
Alias for field number 1
- qnic2
Alias for field number 3
- progress.hardware.qhardware.get_processor(num_positions, coherence_time=None, one_qbit_noise=None, two_qbit_noise=None, two_qbit_p_err=0.005, meas_p_err=0.0, instr_duration=0.0)[source]
Get an operational quantum processor
- Parameters:
- num_positionsint
The number of qubits in the quantum memory of this processor.
- coherence_timeint or None, optional
- The coherence time of the quantum memory. It is the time after which the fidelity of the qubit state
drops more than 5%. [ns]
- one_qbit_noise
netsquid.models.model.Model
, None, optional The noise model of one qubit instructions of this processor.
- two_qbit_noise
netsquid.models.model.Model
, None, optional The noise model of two qubit instructions of this processor.
- two_qbit_p_errfloat, optional
The probability of error of two qubit instructions of this processor. The error means that the instruction depolarizes the qubits. If two_qbit_noise is not None, this parameter is ignored.
- meas_p_errfloat, optional
The probability of error of CBS measurement instruction of this processor. The error means that the instruction depolarizes the qubit right before the measurement.
- instr_durationfloat, optional
The duration of each instruction of this processor. Defaults to 0. [ns]
- Returns:
netsquid.components.qprocessor.QuantumProcessor
The quantum processor, ready to use.