|
Maestro 0.1.0
Unified interface for quantum circuit simulation
|
The simple controller host implementation. More...
#include <SimpleController.h>
Inheritance diagram for Network::SimpleController< Time >:
Collaboration diagram for Network::SimpleController< Time >:Public Member Functions | |
| std::shared_ptr< Circuits::Circuit< Time > > | DistributeCircuit (const std::shared_ptr< INetwork< Time > > &network, const std::shared_ptr< Circuits::Circuit< Time > > &circuit) override |
| Distributes the circuit on the hosts. | |
| std::shared_ptr< Circuits::Circuit< Time > > | SplitCompositeOperations (const std::shared_ptr< INetwork< Time > > &network, const std::shared_ptr< Circuits::Circuit< Time > > &circuit) override |
| Splits the composite operations from the circuit. | |
| size_t | GetId () const override |
| Get the host id. | |
| size_t | GetNumQubits () const override |
| Get the number of qubits. | |
| size_t | GetNumNetworkEntangledQubits () const override |
| Get the number of network entangled qubits. | |
| size_t | GetNumClassicalBits () const override |
| Get the number of classical bits. | |
| bool | IsQubitOnHost (size_t qubitId) const override |
| Check if a qubit is in the host. | |
| bool | IsClassicalBitOnHost (size_t qubitId) const override |
| Check if a classical bit is in the host. | |
| bool | IsEntangledQubitOnHost (size_t qubitId) const override |
| Check if a qubit used for entanglement between hosts is in the host. | |
| bool | AreQubitsOnSameHost (size_t qubitId1, size_t qubitId2) const override |
| Check if two qubits are in the same host. | |
| bool | AreCbitsOnSameHost (size_t qubitId1, size_t qubitId2) const override |
| Check if two classical bits are in the same host. | |
| std::vector< size_t > | GetQubitsIds () const override |
| Get the ids of the qubits in the host. | |
| std::vector< size_t > | GetNetworkEntangledQubitsIds () const override |
| Get the ids of the qubits used for entanglement between hosts in the host. | |
| std::vector< size_t > | GetClassicalBitsIds () const override |
| Get the ids of the classical bits in the host. | |
| std::vector< size_t > | GetEntangledQubitMeasurementBitIds () const override |
| Get the ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host. | |
| void | SetRemapper (const std::shared_ptr< Distribution::IRemapper< Time > > &r) override |
| Changes the remapper that is used for remapping a circuit to a distributed one. | |
| std::shared_ptr< Distribution::IRemapper< Time > > | GetRemapper () const override |
| Gets the remapper that is used for remapping a circuit to a distributed one. | |
| bool | SendPacketToHost (size_t hostId, const std::vector< uint8_t > &packet) override |
| Send a packet to a host. | |
| bool | RecvPacketFromHost (size_t hostId, const std::vector< uint8_t > &packet) override |
| Receive a packet from a host. | |
| size_t | GetStartQubitId () const override |
| Get the id of the first qubit assigned to the host. | |
| size_t | GetStartClassicalBitId () const override |
| Get the id of the first classical bit assigned to the host. | |
| std::shared_ptr< Graphs::IOptimiser< Time > > | GetOptimiser () const override |
| Returns the optimiser used. | |
| void | CreateOptimiser (Graphs::OptimiserType type) override |
| Creates an optimiser. | |
| std::shared_ptr< Circuits::Circuit< Time > > | DoNetworkSpecificConversionsForDistribution (const std::shared_ptr< INetwork< Time > > &network, const std::shared_ptr< Circuits::Circuit< Time > > &circuit) override |
| Convert the circuit for distribution for specific networks. | |
| void | CreateScheduler (const std::shared_ptr< INetwork< Time > > &network, SchedulerType schType=SchedulerType::kNoEntanglementQubitsParallel) override |
| Create the scheduler for the network. | |
| std::shared_ptr< Schedulers::IScheduler< Time > > | GetScheduler () const override |
| Get the scheduler for the network. | |
| bool | GetOptimizeRotationGates () const override |
| void | SetOptimizeRotationGates (bool val=true) override |
| void | SetOptimizeCircuit (bool o=true) override |
| Set circuit optimization. | |
| bool | GetOptimizeCircuit () const override |
| Get circuit optimization. | |
Public Member Functions inherited from Network::IHost< Time > | |
| virtual | ~IHost ()=default |
| The destructor. | |
| std::shared_ptr< IHost< Time > > | getptr () |
| Get a shared pointer to this object. | |
Protected Attributes | |
| std::shared_ptr< Distribution::IRemapper< Time > > | remapper |
| The remapper used to remap a circuit to a distributed one. | |
| std::shared_ptr< Graphs::IOptimiser< Time > > | optimiser |
| std::shared_ptr< Schedulers::IScheduler< Time > > | scheduler |
| The scheduler used to schedule the circuits. | |
The simple controller host implementation.
The controller is a special kind of host, it is the one that distributes the circuit to the other hosts. The simple controller just converts a local circuit to a distributed one.
| Time | The time representation to use for execution times. |
Definition at line 42 of file SimpleController.h.
|
inlineoverridevirtual |
Check if two classical bits are in the same host.
Checks if two classical bits with the specified ids are in the same host. The controller is a special host, it's not a quantum computer, so it returns false.
Implements Network::IHost< Time >.
Definition at line 221 of file SimpleController.h.
|
inlineoverridevirtual |
Check if two qubits are in the same host.
Checks if two qubits with the specified ids are in the same host, excluding the one(s) used only for entanglement with other hosts. The controller is a special host, it's not a quantum computer, so it returns false.
Implements Network::IHost< Time >.
Definition at line 209 of file SimpleController.h.
|
inlineoverridevirtual |
Creates an optimiser.
Creates an optimiser of the specified type.
| type | The type of optimiser to create. |
Implements Network::IController< Time >.
Definition at line 379 of file SimpleController.h.
|
inlineoverridevirtual |
Create the scheduler for the network.
Creates the scheduler for the network. Call this only after the network topology has been set up. Should create the scheduler and set the network for it and any other necessary parameters.
| simType | The type of the scheduler to create. |
Implements Network::IController< Time >.
Definition at line 416 of file SimpleController.h.
|
inlineoverridevirtual |
Distributes the circuit on the hosts.
The network will call this, the conversion and distribution should happen before execution.
| network | The network to distribute the circuit for. |
| circuit | The circuit to distribute. |
Implements Network::IController< Time >.
Definition at line 54 of file SimpleController.h.
|
inlineoverridevirtual |
Convert the circuit for distribution for specific networks.
Convert the circuit for distribution for specific networks. Particular networks might need additional circuit conversions before distribution. They should override this implementation. By default, it does nothing.
| network | The network to convert the circuit for. |
| circuit | The circuit to convert. |
Implements Network::IController< Time >.
Definition at line 399 of file SimpleController.h.
|
inlineoverridevirtual |
Get the ids of the classical bits in the host.
Obtain the ids of the classical bits in the host. The controller is a special host, it's not a quantum computer, so it returns an empty vector.
Implements Network::IHost< Time >.
Definition at line 257 of file SimpleController.h.
|
inlineoverridevirtual |
Get the ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host.
Obtain the ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host. The controller is a special host, it's not a quantum computer, so it returns an empty vector.
Implements Network::IHost< Time >.
Definition at line 269 of file SimpleController.h.
|
inlineoverridevirtual |
Get the host id.
Obtain a host id used to identify the host in the network. Since this is a special host, it returns the maximum value of size_t.
Implements Network::IHost< Time >.
Definition at line 137 of file SimpleController.h.
|
inlineoverridevirtual |
Get the ids of the qubits used for entanglement between hosts in the host.
Obtain the ids of the qubits used for entanglement between hosts in the host. The controller is a special host, it's not a quantum computer, so it returns an empty vector.
Implements Network::IHost< Time >.
Definition at line 245 of file SimpleController.h.
|
inlineoverridevirtual |
Get the number of classical bits.
Obtain the number of classical bits in the host. The controller is a special host, it's not a quantum computer, so it returns 0.
Implements Network::IHost< Time >.
Definition at line 168 of file SimpleController.h.
|
inlineoverridevirtual |
Get the number of network entangled qubits.
Obtain the number of qubits in the host used for entanglement with other hosts. The controller is a special host, it's not a quantum computer, so it returns 0.
Implements Network::IHost< Time >.
Definition at line 158 of file SimpleController.h.
|
inlineoverridevirtual |
Get the number of qubits.
Obtain the number of qubits in the host, excluding the one(s) used only for entanglement with other hosts. The controller is a special host, it's not a quantum computer, so it returns 0.
Implements Network::IHost< Time >.
Definition at line 147 of file SimpleController.h.
|
inlineoverridevirtual |
Returns the optimiser used.
Returns the optimiser used. Could be nullptr, that is, no optimiser.
Implements Network::IController< Time >.
Definition at line 368 of file SimpleController.h.
|
inlineoverridevirtual |
Get circuit optimization.
Returns true if the circuit will be optimized, false otherwise.
Implements Network::IController< Time >.
Definition at line 462 of file SimpleController.h.
|
inlineoverridevirtual |
Implements Network::IController< Time >.
Definition at line 437 of file SimpleController.h.
|
inlineoverridevirtual |
Get the ids of the qubits in the host.
Obtain the ids of the qubits in the host, excluding the one(s) used only for entanglement with other hosts. The controller is a special host, it's not a quantum computer, so it returns an empty vector.
Implements Network::IHost< Time >.
Definition at line 233 of file SimpleController.h.
|
inlineoverridevirtual |
Gets the remapper that is used for remapping a circuit to a distributed one.
The remapper is used to remap the circuit to a distributed one.
Implements Network::IController< Time >.
Definition at line 297 of file SimpleController.h.
|
inlineoverridevirtual |
Get the scheduler for the network.
Get the scheduler for the network.
Implements Network::IController< Time >.
Definition at line 433 of file SimpleController.h.
|
inlineoverridevirtual |
Get the id of the first classical bit assigned to the host.
Obtain the id of the first classical bit assigned to the host, the other ones are assigned contiquously.
Implements Network::IHost< Time >.
Definition at line 359 of file SimpleController.h.
|
inlineoverridevirtual |
Get the id of the first qubit assigned to the host.
Obtain the id of the first qubit assigned to the host, the other ones are assigned contiquously.
Implements Network::IHost< Time >.
Definition at line 349 of file SimpleController.h.
|
inlineoverridevirtual |
Check if a classical bit is in the host.
Checks if a classical bit with the specified id is in the host. The controller is a special host, it's not a quantum computer, so it returns false.
Implements Network::IHost< Time >.
Definition at line 188 of file SimpleController.h.
|
inlineoverridevirtual |
Check if a qubit used for entanglement between hosts is in the host.
Checks if a qubit used for entanglement between hosts with the specified id is in the host. The controller is a special host, it's not a quantum computer, so it returns false.
Implements Network::IHost< Time >.
Definition at line 199 of file SimpleController.h.
|
inlineoverridevirtual |
Check if a qubit is in the host.
Checks if a qubit with the specified id is in the host, excluding the one(s) used only for entanglement with other hosts. The controller is a special host, it's not a quantum computer, so it returns false.
Implements Network::IHost< Time >.
Definition at line 178 of file SimpleController.h.
|
inlineoverridevirtual |
Receive a packet from a host.
Receive a packet from a host. Usually called by the network implementation. For the simple network, receiving classical packets is not simulated, so this function does nothing and returns false. Most of network implementations do not simulate sending packets from the controller or receiving packets by the controller, only sending/receiving packets between quantum computers.
| hostId | The id of the host to receive the packet from. |
| packet | The packet to receive. |
Implements Network::IHost< Time >.
Definition at line 336 of file SimpleController.h.
|
inlineoverridevirtual |
Send a packet to a host.
Send a packet to a host. Usually called by the host implementation or perhaps in some cases by the network implementation. For the simple network, sending classical packets is not simulated, so this function does nothing and returns false. Most of network implementations do not simulate sending packets from the controller or receiving packets by the controller, only sending/receiving packets between quantum computers.
| hostId | The id of the host to send the packet to. |
| packet | The packet to send. |
Implements Network::IHost< Time >.
Definition at line 316 of file SimpleController.h.
|
inlineoverridevirtual |
Set circuit optimization.
If the parameter is true, the circuit will be optimized, otherwise it will not be optimized.
| optimize | True if the circuit should be optimized, false otherwise. |
Implements Network::IController< Time >.
Definition at line 453 of file SimpleController.h.
|
inlineoverridevirtual |
Implements Network::IController< Time >.
Definition at line 441 of file SimpleController.h.
|
inlineoverridevirtual |
Changes the remapper that is used for remapping a circuit to a distributed one.
The remapper is used to remap a circuit to a distributed one. A default remapper is already set, so calling this function is optional.
| r | The new remapper. |
Implements Network::IController< Time >.
Definition at line 283 of file SimpleController.h.
|
inlineoverridevirtual |
Splits the composite operations from the circuit.
Splits some composite operations. There are composite operations - other than multiple qubits quantum gates - that act on multiple qubits/classical bits that might act on qubits that are not local. This function splits those operations into ones that act on a single qubit/classical bit. For example measurements on several qubits are split into several measurements on a single qubit.
| network | The network to execute the circuit for. |
| circuit | The circuit to execute. |
Implements Network::IController< Time >.
Definition at line 121 of file SimpleController.h.
|
protected |
Definition at line 476 of file SimpleController.h.
|
protected |
The remapper used to remap a circuit to a distributed one.
Definition at line 466 of file SimpleController.h.
|
protected |
The scheduler used to schedule the circuits.
Definition at line 481 of file SimpleController.h.