|
Maestro 0.1.0
Unified interface for quantum circuit simulation
|
The simple controller host implementation. More...
#include <SimpleController.h>
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::IController< Types::time_type > | |
| virtual std::shared_ptr< Circuits::Circuit< Types::time_type > > | DistributeCircuit (const std::shared_ptr< INetwork< Types::time_type > > &network, const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit)=0 |
| Distributes the circuit on the hosts. | |
| virtual std::shared_ptr< Circuits::Circuit< Types::time_type > > | SplitCompositeOperations (const std::shared_ptr< INetwork< Types::time_type > > &network, const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit)=0 |
| Splits the composite operations from the circuit. | |
| virtual void | SetRemapper (const std::shared_ptr< Distribution::IRemapper< Types::time_type > > &remapper)=0 |
| Changes the remapper that is used for remapping a circuit to a distributed one. | |
| virtual std::shared_ptr< Circuits::Circuit< Types::time_type > > | DoNetworkSpecificConversionsForDistribution (const std::shared_ptr< INetwork< Types::time_type > > &network, const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit)=0 |
| Convert the circuit for distribution for specific networks. | |
| virtual void | CreateScheduler (const std::shared_ptr< INetwork< Types::time_type > > &network, SchedulerType schType=SchedulerType::kNoEntanglementQubitsParallel)=0 |
| Create the scheduler for the network. | |
| Public Member Functions inherited from Network::IHost< Types::time_type > | |
| virtual | ~IHost ()=default |
| The destructor. | |
| std::shared_ptr< IHost< Types::time_type > > | 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 optimiser used to optimise the circuit. | |
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< Types::time_type >.
Definition at line 224 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< Types::time_type >.
Definition at line 212 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< Types::time_type >.
Definition at line 382 of file SimpleController.h.
|
inlineoverride |
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. |
Definition at line 419 of file SimpleController.h.
|
inlineoverride |
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. |
Definition at line 54 of file SimpleController.h.
|
inlineoverride |
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. |
Definition at line 401 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< Types::time_type >.
Definition at line 260 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< Types::time_type >.
Definition at line 272 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< Types::time_type >.
Definition at line 140 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< Types::time_type >.
Definition at line 248 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< Types::time_type >.
Definition at line 171 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< Types::time_type >.
Definition at line 161 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< Types::time_type >.
Definition at line 150 of file SimpleController.h.
|
inlineoverridevirtual |
Returns the optimiser used.
Returns the optimiser used. Could be nullptr, that is, no optimiser.
Implements Network::IController< Types::time_type >.
Definition at line 371 of file SimpleController.h.
|
inlineoverridevirtual |
Get circuit optimization.
Returns true if the circuit will be optimized, false otherwise.
Implements Network::IController< Types::time_type >.
Definition at line 463 of file SimpleController.h.
|
inlineoverridevirtual |
Implements Network::IController< Types::time_type >.
Definition at line 438 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< Types::time_type >.
Definition at line 236 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< Types::time_type >.
Definition at line 300 of file SimpleController.h.
|
inlineoverridevirtual |
Get the scheduler for the network.
Get the scheduler for the network.
Implements Network::IController< Types::time_type >.
Definition at line 434 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< Types::time_type >.
Definition at line 362 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< Types::time_type >.
Definition at line 352 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< Types::time_type >.
Definition at line 191 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< Types::time_type >.
Definition at line 202 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< Types::time_type >.
Definition at line 181 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< Types::time_type >.
Definition at line 339 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< Types::time_type >.
Definition at line 319 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< Types::time_type >.
Definition at line 454 of file SimpleController.h.
|
inlineoverridevirtual |
Implements Network::IController< Types::time_type >.
Definition at line 442 of file SimpleController.h.
|
inlineoverride |
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. |
Definition at line 286 of file SimpleController.h.
|
inlineoverride |
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. |
Definition at line 123 of file SimpleController.h.
|
protected |
Definition at line 477 of file SimpleController.h.
|
protected |
The remapper used to remap a circuit to a distributed one.
Definition at line 467 of file SimpleController.h.
|
protected |
< The optimiser used to optimise the circuit.
The scheduler used to schedule the circuits.
Definition at line 482 of file SimpleController.h.