Agents
- Codified Alice and Bob¶
-
class
netQuil.agents.
Agent
(program=None, qubits=[], cmem=[], name=None)[source]¶ Bases:
threading.Thread
-
__init__
(program=None, qubits=[], cmem=[], name=None)[source]¶ Agents are codified versions of Alice and Bob (i.e. single nodes in a quantum network) that can send and receive classical and quantum information over connections. Agents have the following properties:
Their run-time logic is in the form of an Agent.run() method
Their connections to other agents are by default ingress and egress
Agents’ manage their own target and source devices for noise and local time tracking
Agents have a network monitor to record the traffic they see
- Parameters
program (PyQuil<Program>) – program
qubits (List<int>) – list of qubits owned by agent
cmem (List<int>) – list of cbits owned by agent
name (String) – name of agent, defaults to name of class
-
add_cmem
(cbits)[source]¶ Add more classical memory in the form of a list of 0s and 1s
- Parameters
cbits (List<int>) – classical memory to extend
-
add_device
(device_type, device)[source]¶ Add a device to an agent.
- Parameters
device_type (String) – may be either source or target
device (Device) – instance of device added
-
add_source_devices
(new_source_devices)[source]¶ Add source devices. Every qubit sent by Agent will pass through these devices, and, if set, the device’s effect and time-delay will be applied
- Parameters
new_source_devices (List<Device>) – list of source devices
-
add_target_devices
(new_target_devices)[source]¶ Add target devices. Every qubit sent to agent will pass through these devices, and, if set, the device’s effect and time-delay will be applied
- Parameters
new_target_devices (List<Device>) – list of target devices
-
crecv
(source)[source]¶ Get cbits from source.
- Parameters
source (String) – name of Agent where cbits originated from.
- Returns
list of cbits sent from source
-
csend
(target, cbits)[source]¶ Sends classical bits from agent to target.
- Parameters
target (String) – name of target agent
cbits (List<int>) – indices of cbits source is sending to target
-
qrecv
(source)[source]¶ Agent receives qubits from source. Adds qubits to agent’s list of qubits and add time delay. Return list of qubits
- Parameters
source (String) – name of agent who sent qubits.
- Returns
list of qubits sent from source
-