|
Maestro 0.1.0
Unified interface for quantum circuit simulation
|
The simple network implementation. More...
#include <SimpleDisconnectedNetwork.h>
Inheritance diagram for Network::SimpleDisconnectedNetwork< Time, Controller >:
Collaboration diagram for Network::SimpleDisconnectedNetwork< Time, Controller >:Public Types | |
| using | BaseClass = INetwork< Time > |
| The base class type. | |
| using | ExecuteResults = typename BaseClass::ExecuteResults |
| The execute results type. | |
Public Types inherited from Network::INetwork< Time > | |
| using | ExecuteResults = typename Circuits::Circuit< Time >::ExecuteResults |
| using | SimulatorPair = std::pair< Simulators::SimulatorType, Simulators::SimulationType > |
| using | SimulatorsSet = std::unordered_set< SimulatorPair, boost::hash< SimulatorPair > > |
Public Member Functions | |
| SimpleDisconnectedNetwork (const std::vector< Types::qubit_t > &qubits={}, const std::vector< size_t > &cbits={}) | |
| The constructor. | |
| void | CreateNetwork (const std::vector< Types::qubit_t > &qubits, const std::vector< size_t > &cbits) |
| Creates the network hosts and controller. | |
| void | Execute (const std::shared_ptr< Circuits::Circuit< Time > > &circuit) override |
| Execute the circuit on the network. | |
| void | ExecuteOnHost (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId) override |
| Execute the circuit on the specified host. | |
| std::vector< double > | ExecuteExpectations (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, const std::vector< std::string > &paulis) override |
| Execute the circuit on the network and return the expectation values for the specified Pauli strings. | |
| std::vector< double > | ExecuteOnHostExpectations (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId, const std::vector< std::string > &paulis) |
| Execute the circuit on the specified host and return the expectation values for the specified Pauli strings. | |
| ExecuteResults | RepeatedExecute (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t shots=1000) override |
| Execute the circuit on the network, repeatedly. | |
| ExecuteResults | RepeatedExecuteOnHost (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId, size_t shots=1000) override |
| Execute the circuit on the specified host, repeatedly. | |
| size_t | GetNumberOfGatesDistributedOrCut (const std::shared_ptr< Circuits::Circuit< Time > > &circuit) const override |
| Get the number of gates that span more than one host. | |
| std::vector< ExecuteResults > | ExecuteScheduled (const std::vector< Schedulers::ExecuteCircuit< Time > > &circuits) override |
| Schedule and execute circuits on the network. | |
| void | CreateSimulator (Simulators::SimulatorType simType=Simulators::SimulatorType::kQCSim, Simulators::SimulationType simExecType=Simulators::SimulationType::kMatrixProductState, size_t nrQubits=0) override |
| Create the simulator for the network. | |
| void | Configure (const char *key, const char *value) override |
| Configures the network. | |
| std::shared_ptr< Simulators::ISimulator > | GetSimulator () const override |
| Get the simulator for the network. | |
| Circuits::OperationState & | GetState () override |
| Get the classical state of the network. | |
| void | CreateScheduler (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. | |
| const std::shared_ptr< IHost< Time > > | GetHost (size_t hostId) const override |
| Get the host with the specified id. | |
| const std::shared_ptr< IController< Time > > | GetController () const override |
| Get the controller for the network. | |
| size_t | GetNumHosts () const override |
| Get the number of hosts in the network. | |
| size_t | GetNumQubits () const override |
| Get the number of qubits in the network. | |
| size_t | GetNumQubitsForHost (size_t hostId) const override |
| Get the number of qubits in the network for the specified host. | |
| size_t | GetNumNetworkEntangledQubits () const override |
| Get the number of qubits used for entanglement between hosts. | |
| size_t | GetNumNetworkEntangledQubitsForHost (size_t hostId) const override |
| Get the number of qubits used for entanglement between hosts for the specified host. | |
| size_t | GetNumClassicalBits () const override |
| Get the number of classical bits in the network. | |
| size_t | GetNumClassicalBitsForHost (size_t hostId) const override |
| Get the number of classical bits in the network for the specified host. | |
| std::vector< std::shared_ptr< IHost< Time > > > & | GetHosts () |
| Get the hosts in the network. | |
| void | SetController (const std::shared_ptr< IController< Time > > &cntrl) |
| Set the network controller host. | |
| bool | SendPacket (size_t fromHostId, size_t toHostId, const std::vector< uint8_t > &packet) override |
| Sends a packet between two hosts. | |
| NetworkType | GetType () const override |
| Get the type of the network. | |
| bool | IsLocalOperation (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override |
| Check if the circuit operation is local. | |
| bool | IsDistributedOperation (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override |
| Check if the circuit operation is distributed. | |
| bool | OperatesWithNetworkEntangledQubit (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override |
| Check if the circuit operation operates on the entanglement qubits between hosts. | |
| bool | IsEntanglingGate (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override |
| Checks if a gate is an entangling gate. | |
| bool | ExpectsClassicalBitFromOtherHost (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override |
| Checks if a gate expects a classical bit from another host. | |
| size_t | GetHostIdForClassicalControl (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override |
| Get the host id where the classical control bit resides for a conditioned gate. | |
| bool | AreQubitsOnSameHost (size_t qubitId1, size_t qubitId2) const override |
| Check if the specified qubits are on the same host. | |
| bool | AreClassicalBitsOnSameHost (size_t bitId1, size_t bitId2) const override |
| Check if the specified classical bits are on the same host. | |
| bool | AreQubitAndClassicalBitOnSameHost (size_t qubitId, size_t bitId) const override |
| Check if the specified qubit and classical bit are on the same host. | |
| size_t | GetHostIdForQubit (size_t qubitId) const override |
| Get the host id for the specified qubit. | |
| size_t | GetHostIdForEntangledQubit (size_t qubitId) const override |
| Get the host id for the specified qubit used for entanglement between hosts. | |
| size_t | GetHostIdForAnyQubit (size_t qubitId) const override |
| Get the host id for the specified qubit. | |
| size_t | GetHostIdForClassicalBit (size_t classicalBitId) const override |
| Get the host id for the specified classical bit. | |
| std::vector< size_t > | GetQubitsIds (size_t hostId) const override |
| Get the qubit ids for the specified host. | |
| std::vector< size_t > | GetNetworkEntangledQubitsIds (size_t hostId) const override |
| Get the qubit ids used for entanglement between hosts for the specified host. | |
| std::vector< size_t > | GetClassicalBitsIds (size_t hostId) const override |
| Get the classical bit ids for the specified host. | |
| std::vector< size_t > | GetEntangledQubitMeasurementBitIds (size_t hostId) const override |
| Get the classical bit ids used for measurement of entanglement qubits between the hosts for the specified host. | |
| bool | IsNetworkEntangledQubit (size_t qubitId) const override |
| Check if the specified qubit id is for a qubit used for entanglement between hosts. | |
| bool | IsEntanglementQubitBusy (size_t qubitId) const override |
| Check if the specified qubit used for entanglement between hosts is busy. | |
| bool | AreEntanglementQubitsBusy (size_t qubitId1, size_t qubitId2) const override |
| Check if any of the two specified qubits used for entanglement between hosts are busy. | |
| void | MarkEntangledQubitsBusy (size_t qubitId1, size_t qubitId2) override |
| Mark the pair of the specified qubits used for entanglement between hosts as busy. | |
| void | MarkEntangledQubitFree (size_t qubitId) override |
| Mark the specified qubit used for entanglement between hosts as free. | |
| void | ClearEntanglements () override |
| Clear all entanglements between hosts in the network. | |
| std::shared_ptr< Circuits::Circuit< Time > > | GetDistributedCircuit () const override |
| Get the distributed circuit. | |
| Simulators::SimulatorType | GetLastSimulatorType () const override |
| Get the last used simulator type. | |
| Simulators::SimulationType | GetLastSimulationType () const override |
| Get the last used simulation type. | |
| size_t | GetMaxSimulators () const override |
| Get the maximum number of simulators that can be used in the network. | |
| void | SetMaxSimulators (size_t val) override |
| Set the maximum number of simulators that can be used in the network. | |
| void | SetOptimizeSimulator (bool optimize=true) override |
| Allows using an optimized simulator. | |
| bool | GetOptimizeSimulator () const override |
| Returns the 'optimize' flag. | |
| const BaseClass::SimulatorsSet & | GetSimulatorsSet () const override |
| Get the optimizations simulators set. | |
| void | AddOptimizationSimulator (Simulators::SimulatorType type, Simulators::SimulationType kind) override |
| Adds a simulator to the simulators optimization set. | |
| void | RemoveOptimizationSimulator (Simulators::SimulatorType type, Simulators::SimulationType kind) override |
| Removes a simulator from the simulators optimization set. | |
| void | RemoveAllOptimizationSimulatorsAndAdd (Simulators::SimulatorType type, Simulators::SimulationType kind) override |
| Removes all simulators from the simulators optimization set and adds the one specified. | |
| bool | OptimizationSimulatorExists (Simulators::SimulatorType type, Simulators::SimulationType kind) const override |
| Checks if a simulator exists in the optimization set. | |
| std::shared_ptr< INetwork< Time > > | Clone () const override |
| Clone the network. | |
| std::shared_ptr< Simulators::ISimulator > | ChooseBestSimulator (const std::shared_ptr< Circuits::Circuit< Time > > &dcirc, size_t &counts, size_t nrQubits, size_t nrCbits, size_t nrResultCbits, Simulators::SimulatorType &simType, Simulators::SimulationType &method, std::vector< bool > &executed, bool multithreading=false, bool dontRunCircuitStart=false) const override |
| Choose the best simulator for the given circuit. | |
Public Member Functions inherited from Network::INetwork< Time > | |
| virtual | ~INetwork ()=default |
| Destroy the INetwork object. | |
| ExecuteResults | RepeatedExecuteCircuit (const Schedulers::ExecuteCircuit< Time > &executeCircuit) |
| Execute the circuit on the network, repeatedly. | |
| ExecuteResults | RepeatedExecuteCircuitOnHost (const Schedulers::ExecuteCircuit< Time > &executeCircuit, size_t hostId) |
| Execute the circuit on the specified host, repeatedly. | |
| std::shared_ptr< INetwork< Time > > | getptr () |
| Get a shared pointer to this object. | |
| virtual std::vector< std::vector< std::string > > | GetSubroutinesTextCode () const |
| Get the text code that is executed on the hosts. | |
Protected Member Functions | |
| void | ConvertBackState () |
| Converts back the state from the optimized network distribution mapping. | |
| void | ConvertBackState (const std::unordered_map< Types::qubit_t, Types::qubit_t > &qubitsMap) |
| Converts back the state using the passed qubits map. | |
| void | ConvertBackResults (ExecuteResults &res) |
| Converts back the results from the optimized network distribution mapping. | |
| void | ConvertBackResults (ExecuteResults &res, const std::unordered_map< Types::qubit_t, Types::qubit_t > &bitsMap) const |
| Converts back the results using the passed qubits map. | |
| std::unordered_map< Types::qubit_t, Types::qubit_t > | MapCircuitOnHost (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId, size_t &nrQubits, size_t &nrCbits, bool useSeparateSimForHosts=false) |
| Map the circuit on the host. | |
Protected Attributes | |
| bool | optimizeSimulator = true |
| The flag to optimize the simulator. | |
| BaseClass::SimulatorsSet | simulatorsForOptimizations |
| Simulators::SimulatorType | lastSimulatorType |
| The last simulator type used. | |
| Simulators::SimulationType | lastMethod |
| The last simulation method used. | |
| std::string | maxBondDim |
| std::string | singularValueThreshold |
| std::string | mpsSample |
| size_t | maxSimulators |
| The maximum number of simulators that can be used in the network. | |
| Circuits::OperationState | classicalState |
| The classical state of the network. | |
| std::shared_ptr< Simulators::ISimulator > | simulator |
| The quantum computing simulator for the network. | |
| std::shared_ptr< Circuits::Circuit< Time > > | distCirc |
| The distributed circuit. | |
| std::shared_ptr< IController< Time > > | controller |
| The controller for the network. | |
| std::vector< std::shared_ptr< IHost< Time > > > | hosts |
| The hosts in the network. | |
| std::unique_ptr< Estimators::SimulatorsEstimatorInterface< Time > > | simulatorsEstimator |
| The simulators estimator. | |
The simple network implementation.
The simple network implementation. A simple network class, implementing a network containing a buch of hosts, no communication (classical or quantum) among them.
| Time | The time type used for execution times. |
Definition at line 42 of file SimpleDisconnectedNetwork.h.
| using Network::SimpleDisconnectedNetwork< Time, Controller >::BaseClass = INetwork<Time> |
The base class type.
Definition at line 44 of file SimpleDisconnectedNetwork.h.
| using Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteResults = typename BaseClass::ExecuteResults |
The execute results type.
Definition at line 45 of file SimpleDisconnectedNetwork.h.
|
inline |
The constructor.
Constructs the simple network object, creating the network hosts and the controller.
| qubits | The number of qubits for each host. |
| cbits | The number of classical bits for each host. |
Definition at line 57 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Adds a simulator to the simulators optimization set.
Adds a simulator (if not already present) to the simulators optimization set.
| type | The type of the simulator to add. |
| kind | The kind of the simulation to add. |
Implements Network::INetwork< Time >.
Definition at line 1633 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the specified classical bits are on the same host.
Check if the specified classical are on the same host. This does not include the classical bits used for measuring the qubits used for entanglement between the hosts.
Implements Network::INetwork< Time >.
Definition at line 1257 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if any of the two specified qubits used for entanglement between hosts are busy.
Check if any of the two specified qubits used for entanglement between hosts are busy. This is used to check if the qubits are free in order to use them for creating an entanglement between hosts. It's not used in the simple network, because it doesn't allow quantum communication between hosts.
| qubitId1 | The id of the first qubit to check. |
| qubitId2 | The id of the second qubit to check. |
Implements Network::INetwork< Time >.
Definition at line 1470 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the specified qubit and classical bit are on the same host.
Check if the specified qubit and classical bit are on the same host. This does not include the qubits used for entanglement between the hosts and the classical bits used for their measurement.
Implements Network::INetwork< Time >.
Definition at line 1281 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the specified qubits are on the same host.
Check if the specified qubits are on the same host. This does not include the qubits used for entanglement between the hosts.
Implements Network::INetwork< Time >.
Definition at line 1234 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Choose the best simulator for the given circuit.
Choose the best simulator for the given circuit, based on the number of qubits, number of classical bits, number of result classical bits and number of shots. The choice is made from the optimization simulators set.
| dcirc | The distributed circuit to choose the simulator for. |
| counts | The number of shots to be executed. |
| nrQubits | The number of qubits in the circuit. |
| nrCbits | The number of classical bits in the circuit. |
| nrResultCbits | The number of result classical bits in the circuit. |
| simType | The type of the chosen simulator. |
| method | The kind of simulation of the chosen simulator. |
| executed | A vector of bools marking the executed gates from the circuit (some of them might be executed when picking up the simulator - usually the gates from the beginning up to the measurements/resets). |
| multithreading | If true, allows simulators to support multithreading (default is false). Multithreading will be set to false if multithreading is implemented at a higher level (multiple simulators in parallel). |
Implements Network::INetwork< Time >.
Definition at line 1722 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Clear all entanglements between hosts in the network.
Clear all entanglements between hosts in the network. This marks all qubits used for entanglement between hosts as free. If the entanglements are explicitely coordinated in the network, all pairs of entangled qubits are released. It's not used in the simple network, because it doesn't allow quantum communication between hosts.
Implements Network::INetwork< Time >.
Definition at line 1517 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Clone the network.
Clone the network in a pristine state.
Implements Network::INetwork< Time >.
Definition at line 1693 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Configures the network.
This function is called to configure the network (for example the simulator(s) used by the network.
| key | The key of the configuration option. |
| value | The value of the configuration. |
Implements Network::INetwork< Time >.
Definition at line 809 of file SimpleDisconnectedNetwork.h.
|
inlineprotected |
Converts back the results from the optimized network distribution mapping.
Converts back the results from the optimized network distribution mapping. It's used only if there is an optimiser set, that is, there was a rempapping/optimizing of the circuit to be distributed.
| res | The results to convert back. |
Definition at line 1922 of file SimpleDisconnectedNetwork.h.
|
inlineprotected |
Converts back the results using the passed qubits map.
Converts back the results using the passed qubits map It's used only if there is an optimiser set, that is, there was a rempapping/optimizing of the circuit to be distributed. Or if there is an execution on a single host and the passed circuit had a different mapping for qubits than the host qubits.
| res | The results to convert back. |
| bitsMap | The map with the bits mapping. |
Definition at line 1944 of file SimpleDisconnectedNetwork.h.
|
inlineprotected |
Converts back the state from the optimized network distribution mapping.
Converts back the state from the optimized network distribution mapping. It's used only if there is an optimiser set, that is, there was a rempapping/optimizing of the circuit to be distributed.
Definition at line 1883 of file SimpleDisconnectedNetwork.h.
|
inlineprotected |
Converts back the state using the passed qubits map.
Converts back the state using the passed qubits map. It's used only if there is an optimiser set, that is, there was a rempapping/optimizing of the circuit to be distributed. Or if there is an execution on a single host and the passed circuit had a different mapping for qubits than the host qubits.
| qubitsMap | The map with the qubits mapping. |
Definition at line 1904 of file SimpleDisconnectedNetwork.h.
|
inline |
Creates the network hosts and controller.
Creates the network hosts and controller with the specified number of qubits and classical bits.
| qubits | The number of qubits for each host. |
| cbits | The number of classical bits for each host. |
Definition at line 71 of file SimpleDisconnectedNetwork.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::INetwork< Time >.
Definition at line 857 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Create the simulator for the network.
Creates the simulator for the network. Call this only after the network topology has been set up. Should create the simulator with the proper number of qubits for the whole network and also set up a 'classical state' for the whole network and distribute the qubits and cbits to the hosts. The nrQubits parameter is used internally to allocate a simulator for a single host only - if a circuit is executed on a single host. Let it to the default value - 0 - to allocate the number of qubits for the whole network.
| simType | The type of the simulator to create. |
| simExecType | The type of the simulation - statevector, composite, matrix product state, stabilizer, tensor network... |
| nrQubits | The number of qubits to allocate for the simulator. Default is 0 - allocate the number of qubits for the whole network. |
Implements Network::INetwork< Time >.
Definition at line 771 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Execute the circuit on the network.
Execute the circuit on the network, using the controller for distributing the operations to the hosts. Ensure the quantum computing simulator has been created before calling this.
| circuit | The circuit to execute. |
Implements Network::INetwork< Time >.
Definition at line 107 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Execute the circuit on the network and return the expectation values for the specified Pauli strings.
Execute the circuit on the network, using the controller for distributing the operations to the hosts and return the expectation values for the specified Pauli strings. The base class functionality is used for circuit distribution, but then the distributed circuit is converted to netqasm. Ensure the quantum computing simulator and the netqasm virtual machines have been created before calling this.
| circuit | The circuit to execute. |
| paulis | The Pauli strings to measure the expectations for. |
Implements Network::INetwork< Time >.
Definition at line 200 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Execute the circuit on the specified host.
Execute the circuit on the specified host. The circuit must fit on the host, otherwise an exception is thrown. The circuit will be mapped on the specified host, if its qubits start with indexing from 0 (if already mapped, the qubits won't be altered).
| circuit | The circuit to execute. |
| hostId | The id of the host to execute the circuit on. |
Implements Network::INetwork< Time >.
Definition at line 152 of file SimpleDisconnectedNetwork.h.
|
inlinevirtual |
Execute the circuit on the specified host and return the expectation values for the specified Pauli strings.
Execute the circuit on the specified host and return the expectation values for the specified Pauli strings. The circuit must fit on the host, otherwise an exception is thrown. The circuit will be mapped on the specified host, if its qubits start with indexing from 0 (if already mapped, the qubits won't be altered).
| circuit | The circuit to execute. |
| hostId | The id of the host to execute the circuit on. |
| paulis | The Pauli strings to measure the expectations for. |
Implements Network::INetwork< Time >.
Definition at line 280 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Schedule and execute circuits on the network.
Execute the circuits on the network, scheduling their execution and distributing the operations to the hosts. The way the circuits are distributed to the hosts depends on the specific interface implementations. The way they are scheduled depends on the network scheduler and parametrization.
| circuits | The circuits to execute, along with the number of shots. |
Implements Network::INetwork< Time >.
Definition at line 740 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Checks if a gate expects a classical bit from another host.
It must be a conditional gate, conditioned on a classical bit from another host. Use it on already distributed gates, not on the original circuit.
| op | The operation to check. |
Implements Network::INetwork< Time >.
Definition at line 1175 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the classical bit ids for the specified host.
Get the classical bit ids for the specified host, excluding the one(s) used for measurement of entanglemen qubits between the hosts.
| hostId | The id of the host to get the classical bit ids for. |
Implements Network::INetwork< Time >.
Definition at line 1403 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the controller for the network.
Gets a smart pointer to the controller for the network.
Implements Network::INetwork< Time >.
Definition at line 902 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the distributed circuit.
Get the distributed circuit. Execute() must be called first, otherwise the return would be nullptr.
Implements Network::INetwork< Time >.
Definition at line 1531 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the classical bit ids used for measurement of entanglement qubits between the hosts for the specified host.
Get the classical bit ids used for measurement of entanglement qubits between the hosts for the specified host.
| hostId | The id of the host to get the classical bit ids for. |
Implements Network::INetwork< Time >.
Definition at line 1419 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the host with the specified id.
Get a smart pointer to the host that has the specified id.
| hostId | The id of the host to get. |
Implements Network::INetwork< Time >.
Definition at line 888 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the host id for the specified qubit.
Get the host id for the squbit, including the qubits used for entanglement between hosts.
| qubitId | The id of the qubit to get the host id for. |
Implements Network::INetwork< Time >.
Definition at line 1340 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the host id for the specified classical bit.
Get the host id for the specified classical bit, excluding the one(s) used for measurement of entanglement qubits between the hosts.
| classicalBitId | The id of the classical bit to get the host id for. |
Implements Network::INetwork< Time >.
Definition at line 1356 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the host id where the classical control bit resides for a conditioned gate.
It must be a conditional gate, conditioned on a qubit from another host. Use it on already distributed gates, not on the original circuit.
| op | The operation to find the host of the control bit. |
Implements Network::INetwork< Time >.
Definition at line 1211 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the host id for the specified qubit used for entanglement between hosts.
Get the host id for the specified qubit used for entanglement between hosts.
| qubitId | The id of the qubit used for entanglement between hosts to get the host id for. |
Implements Network::INetwork< Time >.
Definition at line 1324 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the host id for the specified qubit.
Get the host id for the specified qubit, excluding the qubits used for entanglement between hosts.
| qubitId | The id of the qubit to get the host id for. |
Implements Network::INetwork< Time >.
Definition at line 1305 of file SimpleDisconnectedNetwork.h.
|
inline |
Get the hosts in the network.
Gets the hosts in the network.
Definition at line 1022 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the last used simulation type.
Get the last used simulation type.
Implements Network::INetwork< Time >.
Definition at line 1554 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the last used simulator type.
Get the last used simulator type.
Implements Network::INetwork< Time >.
Definition at line 1543 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the maximum number of simulators that can be used in the network.
Get the maximum number of simulators that can be used in the network. This is used to limit the number of simulators (and corresponding threads) that can be used in the network.
Implements Network::INetwork< Time >.
Definition at line 1568 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the qubit ids used for entanglement between hosts for the specified host.
Get the qubit ids used for entanglement between hosts for the specified host.
| hostId | The id of the host to get the qubit ids for. |
Implements Network::INetwork< Time >.
Definition at line 1387 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of gates that span more than one host.
Get the number of gates that span more than one host for the given circuit.
| circuit | The circuit to check. |
Implements Network::INetwork< Time >.
Definition at line 712 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of classical bits in the network.
Get the number of classical bits in the network, excluding the classical bits used for measurement of entanglement qubits between the hosts.
Implements Network::INetwork< Time >.
Definition at line 988 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of classical bits in the network for the specified host.
Get the number of classical bits in the network for the specified host, excluding the classical bits used for measurement of entanglement qubits between the hosts.
| hostId | The id of the host to get the number of classical bits for. |
Implements Network::INetwork< Time >.
Definition at line 1007 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of hosts in the network.
Get the number of hosts in the network, excluding the controller.
Implements Network::INetwork< Time >.
Definition at line 913 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of qubits used for entanglement between hosts.
Get the number of qubits used for entanglement between hosts in the network. For the simple network it's one qubit per host.
Implements Network::INetwork< Time >.
Definition at line 954 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of qubits used for entanglement between hosts for the specified host.
Get the number of qubits used for entanglement between hosts in the network for the specified host. For the simple network it's a single qubit.
| hostId | The id of the host to get the number of qubits used for entanglement between hosts for. |
Implements Network::INetwork< Time >.
Definition at line 974 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of qubits in the network.
Get the number of qubits in the network, excluding the qubits used for entanglement between the hosts.
Implements Network::INetwork< Time >.
Definition at line 923 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the number of qubits in the network for the specified host.
Get the number of qubits in the network for the specified host, excluding the qubits used for entanglement between the hosts.
| hostId | The id of the host to get the number of qubits for. |
Implements Network::INetwork< Time >.
Definition at line 940 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Returns the 'optimize' flag.
Returns the flag set by SetOptimizeSimulator().
Implements Network::INetwork< Time >.
Definition at line 1610 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the qubit ids for the specified host.
Get the qubit ids for the specified host.
| hostId | The id of the host to get the qubit ids for. |
Implements Network::INetwork< Time >.
Definition at line 1371 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the scheduler for the network.
Get the scheduler for the network.
Implements Network::INetwork< Time >.
Definition at line 873 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the simulator for the network.
Get the simulator for the network.
Implements Network::INetwork< Time >.
Definition at line 832 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the optimizations simulators set.
Get the optimization simulators set. To be used internally, will not be exposed from the library.
Implements Network::INetwork< Time >.
Definition at line 1620 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the classical state of the network.
Gets a reference to the classical state of the network.
Implements Network::INetwork< Time >.
Definition at line 844 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Get the type of the network.
Get the type of the network.
Implements Network::INetwork< Time >.
Definition at line 1060 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the circuit operation is distributed.
Check if the specified circuit operation is distributed. A distributed operation is an operation that is executed on multiple hosts. This does not include the operations that also operate on the entanglement qubits between hosts.
| op | The operation to check. |
Implements Network::INetwork< Time >.
Definition at line 1100 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the specified qubit used for entanglement between hosts is busy.
Check if the specified qubit used for entanglement between hosts is busy. It's not used in the simple network, because it doesn't allow quantum communication between hosts.
| qubitId | The id of the qubit to check. |
Implements Network::INetwork< Time >.
Definition at line 1453 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Checks if a gate is an entangling gate.
An entangling gate is a gate that operates on two qubits that are used for entanglement between hosts.
| op | The operation to check. |
Implements Network::INetwork< Time >.
Definition at line 1155 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the circuit operation is local.
Check if the specified circuit operation is local. A local operation is an operation that is executed on a single host. This does not include the operations that also operate on the entanglement qubits between hosts.
| op | The operation to check. |
Implements Network::INetwork< Time >.
Definition at line 1074 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the specified qubit id is for a qubit used for entanglement between hosts.
Check if the specified qubit id is for a qubit used for entanglement between hosts.
| qubitId | The id of the qubit to check. |
Implements Network::INetwork< Time >.
Definition at line 1437 of file SimpleDisconnectedNetwork.h.
|
inlineprotected |
Map the circuit on the host.
Map the circuit on the host. It's used only if there is an execution on a single host and the passed circuit had a different mapping for qubits than the host qubits.
| circuit | The circuit to map. |
| hostId | The id of the host to map the circuit on. |
Definition at line 1976 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Mark the specified qubit used for entanglement between hosts as free.
Mark the specified qubit used for entanglement between hosts as free. This is used to mark the qubits as free when they are not used anymore for an entanglement between hosts. It's not used in the simple network, because it doesn't allow quantum communication between hosts.
| qubitId | The id of the qubit to mark as free. |
Implements Network::INetwork< Time >.
Definition at line 1503 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Mark the pair of the specified qubits used for entanglement between hosts as busy.
Mark the pair of the specified qubits used for entanglement between hosts as busy. This is used to mark the qubits as busy when they are used for creating an entanglement between hosts. It's not used in the simple network, because it doesn't allow quantum communication between hosts.
| qubitId1 | The id of the first qubit to mark as busy. |
| qubitId2 | The id of the second qubit to mark as busy. |
Implements Network::INetwork< Time >.
Definition at line 1487 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Check if the circuit operation operates on the entanglement qubits between hosts.
Check if the specified circuit operation operates on the entanglement qubits between hosts.
| op | The operation to check. |
Implements Network::INetwork< Time >.
Definition at line 1134 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Checks if a simulator exists in the optimization set.
Checks if a simulator exists in the optimization set.
| type | The type of the simulator to check. |
| kind | The kind of the simulation to check. |
Implements Network::INetwork< Time >.
Definition at line 1678 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Removes all simulators from the simulators optimization set and adds the one specified.
Removes all simulators from the simulators optimization set and adds the one specified.
| type | The type of the simulator to add. |
| kind | The kind of the simulation to add. |
Implements Network::INetwork< Time >.
Definition at line 1661 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Removes a simulator from the simulators optimization set.
Removes a simulator from the simulators optimization set, if it exists.
| type | The type of the simulator to remove. |
| kind | The kind of the simulation to remove. |
Implements Network::INetwork< Time >.
Definition at line 1646 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Execute the circuit on the network, repeatedly.
Execute the circuit on the network, distributing the operations to the hosts, repeating the execution 'shots' times. The way the circuit is distributed to the hosts depends on the specific interface implementations.
| circuit | The circuit to execute. |
| shots | The number of times to repeat the execution. |
Implements Network::INetwork< Time >.
Definition at line 361 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Execute the circuit on the specified host, repeatedly.
Execute the circuit on the specified host, repeating the execution 'shots' times. The circuit must fit on the host, otherwise an exception is thrown. The circuit will be mapped on the specified host, if its qubits start with indexing from 0 (if already mapped, the qubits won't be altered).
| circuit | The circuit to execute. |
| hostId | The id of the host to execute the circuit on. |
| shots | The number of times to repeat the execution. |
Implements Network::INetwork< Time >.
Definition at line 550 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Sends a packet between two hosts.
Sends a packet between the two specified hosts. It's not used in the simple network, because sending/receiving the classical information is done using a shared classical state for the simulator.
| fromHostId | The id of the host to send the packet from. |
| toHostId | The id of the host to send the packet to. |
| packet | The packet to send. |
Implements Network::INetwork< Time >.
Definition at line 1048 of file SimpleDisconnectedNetwork.h.
|
inline |
Set the network controller host.
Sets the network controller host.
| [in] | cntrl | The controller host. |
Definition at line 1031 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Set the maximum number of simulators that can be used in the network.
Set the maximum number of simulators that can be used in the network. This is used to limit the number of simulators (and corresponding threads) that can be used in the network.
| maxSimulators | The maximum number of simulators that can be used in the network. |
Implements Network::INetwork< Time >.
Definition at line 1581 of file SimpleDisconnectedNetwork.h.
|
inlineoverridevirtual |
Allows using an optimized simulator.
If set, allows changing the simulator with an optimized one. States/amplitudes are not available in such a case, disable if you need them.
| optimize | If true, the simulator will be optimized if possible. |
Implements Network::INetwork< Time >.
Definition at line 1599 of file SimpleDisconnectedNetwork.h.
|
protected |
The classical state of the network.
Definition at line 2074 of file SimpleDisconnectedNetwork.h.
|
protected |
The controller for the network.
Definition at line 2082 of file SimpleDisconnectedNetwork.h.
|
protected |
The distributed circuit.
Definition at line 2079 of file SimpleDisconnectedNetwork.h.
|
protected |
The hosts in the network.
Definition at line 2087 of file SimpleDisconnectedNetwork.h.
|
protected |
The last simulation method used.
Definition at line 2061 of file SimpleDisconnectedNetwork.h.
|
protected |
The last simulator type used.
Definition at line 2059 of file SimpleDisconnectedNetwork.h.
|
protected |
Definition at line 2065 of file SimpleDisconnectedNetwork.h.
|
protected |
The maximum number of simulators that can be used in the network.
Definition at line 2069 of file SimpleDisconnectedNetwork.h.
|
protected |
Definition at line 2067 of file SimpleDisconnectedNetwork.h.
|
protected |
The flag to optimize the simulator.
Definition at line 2056 of file SimpleDisconnectedNetwork.h.
|
protected |
The quantum computing simulator for the network.
Definition at line 2076 of file SimpleDisconnectedNetwork.h.
|
protected |
The simulators estimator.
Definition at line 2090 of file SimpleDisconnectedNetwork.h.
|
protected |
Definition at line 2057 of file SimpleDisconnectedNetwork.h.
|
protected |
Definition at line 2066 of file SimpleDisconnectedNetwork.h.