|
Maestro 0.2.11
Unified interface for quantum circuit simulation
|
The simple controller host implementation. More...
#include <SimpleController.h>
Public Member Functions | |
| bool | AreCbitsOnSameHost (size_t qubitId1, size_t qubitId2) const override |
| Check if two classical bits are in the same host. | |
| bool | AreQubitsOnSameHost (size_t qubitId1, size_t qubitId2) const override |
| Check if two qubits are in the same host. | |
| void | CreateOptimiser (Graphs::OptimiserType type) override |
| Creates an optimiser. | |
| virtual void | CreateScheduler (const std::shared_ptr< INetwork< Types::time_type > > &network, SchedulerType schType=SchedulerType::kNoEntanglementQubitsParallel)=0 |
| Create the scheduler for the network. | |
| void | CreateScheduler (const std::shared_ptr< INetwork< Time > > &network, SchedulerType schType=SchedulerType::kNoEntanglementQubitsParallel) override |
| Create the scheduler for the network. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| size_t | GetId () const override |
| Get the host id. | |
| std::vector< size_t > | GetNetworkEntangledQubitsIds () const override |
| Get the ids of the qubits used for entanglement between hosts in the host. | |
| size_t | GetNumClassicalBits () const override |
| Get the number of classical bits. | |
| size_t | GetNumNetworkEntangledQubits () const override |
| Get the number of network entangled qubits. | |
| size_t | GetNumQubits () const override |
| Get the number of qubits. | |
| std::shared_ptr< Graphs::IOptimiser< Time > > | GetOptimiser () const override |
| Returns the optimiser used. | |
| bool | GetOptimizeCircuit () const override |
| Get circuit optimization. | |
| bool | GetOptimizeRotationGates () const override |
| std::shared_ptr< IHost< Types::time_type > > | getptr () |
| Get a shared pointer to this object. | |
| std::vector< size_t > | GetQubitsIds () const override |
| Get the ids of the qubits in the host. | |
| std::shared_ptr< Distribution::IRemapper< Time > > | GetRemapper () const override |
| Gets the remapper that is used for remapping a circuit to a distributed one. | |
| std::shared_ptr< Schedulers::IScheduler< Time > > | GetScheduler () const override |
| Get the scheduler for the network. | |
| size_t | GetStartClassicalBitId () const override |
| Get the id of the first classical bit assigned to the host. | |
| size_t | GetStartQubitId () const override |
| Get the id of the first qubit assigned to 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 | IsQubitOnHost (size_t qubitId) const override |
| Check if a qubit is in the host. | |
| bool | RecvPacketFromHost (size_t hostId, const std::vector< uint8_t > &packet) override |
| Receive a packet from a host. | |
| bool | SendPacketToHost (size_t hostId, const std::vector< uint8_t > &packet) override |
| Send a packet to a host. | |
| void | SetOptimizeCircuit (bool o=true) override |
| Set circuit optimization. | |
| void | SetOptimizeRotationGates (bool val=true) override |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
Protected Attributes | |
| std::shared_ptr< Graphs::IOptimiser< Time > > | optimiser |
| std::shared_ptr< Distribution::IRemapper< Time > > | remapper |
| The remapper used to remap a circuit to a distributed one. | |
| 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 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< Types::time_type >.
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< Types::time_type >.
Definition at line 379 of file SimpleController.h.
|
pure virtualinherited |
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.
| Distributed Quantum Computing | The network to create the scheduler for. |
| simType | The type of the scheduler to create. |
|
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 416 of file SimpleController.h.
References Network::kNoEntanglementQubitsParallel.
|
pure virtualinherited |
Distributes the circuit on the hosts.
The network will call this, the conversion and distribution that should happen before execution.
| Distributed Quantum Computing | The network to distribute the circuit for. |
| circuit | The circuit to distribute. |
|
inlineoverride |
Distributes the circuit on the hosts.
The network will call this, the conversion and distribution should happen before execution.
| Distributed Quantum Computing | The network to distribute the circuit for. |
| circuit | The circuit to distribute. |
Definition at line 54 of file SimpleController.h.
References DoNetworkSpecificConversionsForDistribution(), optimiser, and remapper.
|
pure virtualinherited |
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.
| Distributed Quantum Computing | The network to convert the circuit for. |
| circuit | The circuit to convert. |
|
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.
| Distributed Quantum Computing | The network to convert the circuit for. |
| circuit | The circuit to convert. |
Definition at line 399 of file SimpleController.h.
Referenced by DistributeCircuit().
|
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 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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
Definition at line 368 of file SimpleController.h.
References optimiser.
|
inlineoverridevirtual |
Get circuit optimization.
Returns true if the circuit will be optimized, false otherwise.
Implements Network::IController< Types::time_type >.
Definition at line 462 of file SimpleController.h.
|
inlineoverridevirtual |
Implements Network::IController< Types::time_type >.
Definition at line 437 of file SimpleController.h.
|
inlineinherited |
|
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 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< Types::time_type >.
Definition at line 297 of file SimpleController.h.
References remapper.
|
inlineoverridevirtual |
Get the scheduler for the network.
Get the scheduler for the network.
Implements Network::IController< Types::time_type >.
Definition at line 433 of file SimpleController.h.
References scheduler.
|
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 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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
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< Types::time_type >.
Definition at line 453 of file SimpleController.h.
|
inlineoverridevirtual |
Implements Network::IController< Types::time_type >.
Definition at line 441 of file SimpleController.h.
|
pure virtualinherited |
Changes 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.
| remapper | The new remapper. |
|
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 283 of file SimpleController.h.
References remapper.
|
pure virtualinherited |
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.
| Distributed Quantum Computing | The network to execute the circuit for. |
| circuit | The circuit to execute. |
|
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.
| Distributed Quantum Computing | The network to execute the circuit for. |
| circuit | The circuit to execute. |
Definition at line 121 of file SimpleController.h.
References remapper.
|
protected |
Definition at line 476 of file SimpleController.h.
Referenced by DistributeCircuit(), and GetOptimiser().
|
protected |
The remapper used to remap a circuit to a distributed one.
Definition at line 466 of file SimpleController.h.
Referenced by DistributeCircuit(), GetRemapper(), SetRemapper(), and SplitCompositeOperations().
|
protected |
< The optimiser used to optimise the circuit.
The scheduler used to schedule the circuits.
Definition at line 481 of file SimpleController.h.
Referenced by GetScheduler().