Maestro 0.2.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Network::SimpleDisconnectedNetwork< Time, Controller > Class Template Referenceabstract

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
 The execute results type.
using SimulatorPair
using SimulatorsSet

Public Member Functions

 SimpleDisconnectedNetwork (const std::vector< Types::qubit_t > &qubits={}, const std::vector< size_t > &cbits={})
 The constructor.
void AddOptimizationSimulator (Simulators::SimulatorType type, Simulators::SimulationType kind) override
 Adds a simulator to the simulators optimization set.
bool AreClassicalBitsOnSameHost (size_t bitId1, size_t bitId2) const override
 Check if the specified classical bits are on the same host.
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.
bool AreQubitAndClassicalBitOnSameHost (size_t qubitId, size_t bitId) const override
 Check if the specified qubit and classical bit are on the same host.
bool AreQubitsOnSameHost (size_t qubitId1, size_t qubitId2) const override
 Check if the specified qubits are on the same host.
virtual std::shared_ptr< Simulators::ISimulatorChooseBestSimulator (std::shared_ptr< Circuits::Circuit< Types::time_type > > &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=0
 Choose the best simulator for the given circuit.
std::shared_ptr< Simulators::ISimulatorChooseBestSimulator (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
void ClearEntanglements () override
 Clear all entanglements between hosts in the network.
std::shared_ptr< INetwork< Time > > Clone () const override
 Clone the network.
void Configure (const char *key, const char *value) override
 Configures the network.
void CreateNetwork (const std::vector< Types::qubit_t > &qubits, const std::vector< size_t > &cbits)
 Creates the network hosts and controller.
void CreateScheduler (SchedulerType schType=SchedulerType::kNoEntanglementQubitsParallel) override
 Create the scheduler for 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.
virtual void Execute (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit)=0
 Execute the circuit on the network.
void Execute (const std::shared_ptr< Circuits::Circuit< Time > > &circuit) override
 Execute the circuit on the network.
virtual std::vector< double > ExecuteExpectations (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, const std::vector< std::string > &paulis)=0
 Execute the circuit on the network and return the expectation values for the specified Pauli strings.
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.
virtual void ExecuteOnHost (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, size_t hostId)=0
 Execute the circuit on the specified host.
void ExecuteOnHost (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId) override
 Execute the circuit on the specified host.
virtual std::vector< std::complex< double > > ExecuteOnHostAmplitudes (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, size_t hostId)=0
 Execute the circuit on the specified host and return the full statevector (complex amplitudes for each basis state).
std::vector< std::complex< double > > ExecuteOnHostAmplitudes (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId) override
 Execute circuit on host and return full statevector amplitudes.
virtual std::vector< double > ExecuteOnHostExpectations (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, size_t hostId, const std::vector< std::string > &paulis)=0
 Execute the circuit on the specified host 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) override
 Execute the circuit on the specified host and return the expectation values for the specified Pauli strings.
virtual std::complex< double > ExecuteOnHostProjectOnZero (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, size_t hostId)=0
 Execute circuit on host and return the projection onto the zero state.
std::complex< double > ExecuteOnHostProjectOnZero (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t hostId) override
 Execute circuit on host and return the projection onto the zero state.
virtual std::vector< ExecuteResultsExecuteScheduled (const std::vector< Schedulers::ExecuteCircuit< Types::time_type > > &circuits)=0
 Schedule and execute circuits on the network.
std::vector< ExecuteResultsExecuteScheduled (const std::vector< Schedulers::ExecuteCircuit< Time > > &circuits) override
 Schedule and execute circuits on the network.
virtual bool ExpectsClassicalBitFromOtherHost (const std::shared_ptr< Circuits::IOperation< Types::time_type > > &op) const=0
 Checks if a gate expects a classical bit from another host.
bool ExpectsClassicalBitFromOtherHost (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override
 Checks if a gate expects a classical bit from another host.
std::vector< size_t > GetClassicalBitsIds (size_t hostId) const override
 Get the classical bit ids for the specified host.
const std::shared_ptr< IController< Time > > GetController () const override
 Get the controller for the network.
std::shared_ptr< Circuits::Circuit< Time > > GetDistributedCircuit () const override
 Get the distributed circuit.
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.
double getGrowthFactorGate () const override
double getGrowthFactorSwap () const override
const std::shared_ptr< IHost< Time > > GetHost (size_t hostId) const override
 Get the host with the specified id.
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.
virtual size_t GetHostIdForClassicalControl (const std::shared_ptr< Circuits::IOperation< Types::time_type > > &op) const=0
 Get the host id where the classical control bit resides for a conditioned gate.
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.
size_t GetHostIdForEntangledQubit (size_t qubitId) const override
 Get the host id for the specified qubit used for entanglement between hosts.
size_t GetHostIdForQubit (size_t qubitId) const override
 Get the host id for the specified qubit.
std::vector< std::shared_ptr< IHost< Time > > > & GetHosts ()
 Get the hosts in the network.
bool GetInitialQubitsMapOptimization () const override
Simulators::SimulationType GetLastSimulationType () const override
 Get the last used simulation type.
Simulators::SimulatorType GetLastSimulatorType () const override
 Get the last used simulator type.
int GetLookaheadDepth () const override
int GetLookaheadDepthWithHeuristic () const override
size_t GetMaxSimulators () const override
 Get the maximum number of simulators that can be used in the network.
size_t GetMPSOptimizationBondDimensionThreshold () const override
size_t GetMPSOptimizationQubitsNumberThreshold () const override
bool GetMPSOptimizeSwaps () const override
std::vector< size_t > GetNetworkEntangledQubitsIds (size_t hostId) const override
 Get the qubit ids used for entanglement between hosts for the specified host.
virtual size_t GetNumberOfGatesDistributedOrCut (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit) const=0
 Get the number of gates that span more than one host.
size_t GetNumberOfGatesDistributedOrCut (const std::shared_ptr< Circuits::Circuit< Time > > &circuit) const override
 Get the number of gates that span more than one 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.
size_t GetNumHosts () const override
 Get the number of hosts in the network.
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 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.
bool GetOptimizeSimulator () const override
 Returns the 'optimize' flag.
std::shared_ptr< INetwork< Types::time_type > > getptr ()
 Get a shared pointer to this object.
std::vector< size_t > GetQubitsIds (size_t hostId) const override
 Get the qubit ids for the specified host.
std::shared_ptr< Schedulers::IScheduler< Time > > GetScheduler () const override
 Get the scheduler for the network.
std::shared_ptr< Simulators::ISimulatorGetSimulator () const override
 Get the simulator for the network.
const BaseClass::SimulatorsSetGetSimulatorsSet () const override
 Get the optimizations simulators set.
Circuits::OperationStateGetState () override
 Get the classical state of the network.
virtual std::vector< std::vector< std::string > > GetSubroutinesTextCode () const
 Get the text code that is executed on the hosts.
NetworkType GetType () const override
 Get the type of the network.
virtual bool IsDistributedOperation (const std::shared_ptr< Circuits::IOperation< Types::time_type > > &op) const=0
 Check if the circuit operation is distributed.
bool IsDistributedOperation (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override
 Check if the circuit operation is distributed.
bool IsEntanglementQubitBusy (size_t qubitId) const override
 Check if the specified qubit used for entanglement between hosts is busy.
virtual bool IsEntanglingGate (const std::shared_ptr< Circuits::IOperation< Types::time_type > > &op) const=0
 Checks if a gate is an entangling gate.
bool IsEntanglingGate (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override
 Checks if a gate is an entangling gate.
virtual bool IsLocalOperation (const std::shared_ptr< Circuits::IOperation< Types::time_type > > &op) const=0
 Check if the circuit operation is local.
bool IsLocalOperation (const std::shared_ptr< Circuits::IOperation< Time > > &op) const override
 Check if the circuit operation is local.
bool IsNetworkEntangledQubit (size_t qubitId) const override
 Check if the specified qubit id is for a qubit used for entanglement between hosts.
void MarkEntangledQubitFree (size_t qubitId) override
 Mark the specified qubit used for entanglement between hosts as free.
void MarkEntangledQubitsBusy (size_t qubitId1, size_t qubitId2) override
 Mark the pair of the specified qubits used for entanglement between hosts as busy.
virtual bool OperatesWithNetworkEntangledQubit (const std::shared_ptr< Circuits::IOperation< Types::time_type > > &op) const=0
 Check if the circuit operation operates on the entanglement qubits between hosts.
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 OptimizationSimulatorExists (Simulators::SimulatorType type, Simulators::SimulationType kind) const override
 Checks if a simulator exists in the optimization set.
void RemoveAllOptimizationSimulatorsAndAdd (Simulators::SimulatorType type, Simulators::SimulationType kind) override
 Removes all simulators from the simulators optimization set and adds the one specified.
void RemoveOptimizationSimulator (Simulators::SimulatorType type, Simulators::SimulationType kind) override
 Removes a simulator from the simulators optimization set.
virtual ExecuteResults RepeatedExecute (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, size_t shots=1000)=0
 Execute the circuit on the network, repeatedly.
ExecuteResults RepeatedExecute (const std::shared_ptr< Circuits::Circuit< Time > > &circuit, size_t shots=1000) override
 Execute the circuit on the network, repeatedly.
ExecuteResults RepeatedExecuteCircuit (const Schedulers::ExecuteCircuit< Types::time_type > &executeCircuit)
 Execute the circuit on the network, repeatedly.
ExecuteResults RepeatedExecuteCircuitOnHost (const Schedulers::ExecuteCircuit< Types::time_type > &executeCircuit, size_t hostId)
 Execute the circuit on the specified host, repeatedly.
virtual ExecuteResults RepeatedExecuteOnHost (const std::shared_ptr< Circuits::Circuit< Types::time_type > > &circuit, size_t hostId, size_t shots=1000)=0
 Execute the circuit on the specified host, 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.
bool SendPacket (size_t fromHostId, size_t toHostId, const std::vector< uint8_t > &packet) override
 Sends a packet between two hosts.
void SetController (const std::shared_ptr< IController< Time > > &cntrl)
 Set the network controller host.
void setGrowthFactorGate (double factor) override
void setGrowthFactorSwap (double factor) override
void SetInitialQubitsMapOptimization (bool optimize=true) override
void SetLookaheadDepth (int depth) override
void SetLookaheadDepthWithHeuristic (int depth) override
void SetMaxSimulators (size_t val) override
 Set the maximum number of simulators that can be used in the network.
void SetMPSOptimizationBondDimensionThreshold (size_t threshold) override
void SetMPSOptimizationQubitsNumberThreshold (size_t threshold) override
void SetMPSOptimizeSwaps (bool optimize=true) override
void SetOptimizeSimulator (bool optimize=true) override
 Allows using an optimized simulator.

Protected Member Functions

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.
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.
std::unordered_map< Types::qubit_t, Types::qubit_tMapCircuitOnHost (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.
void OptimizeMPSInitialQubitsMap (std::shared_ptr< Simulators::ISimulator > &sim, std::shared_ptr< Circuits::Circuit< Time > > &dcirc, size_t nrQubits) const

Protected Attributes

Circuits::OperationState classicalState
 The classical state of the network.
std::shared_ptr< IController< Time > > controller
 The controller for the network.
std::shared_ptr< Circuits::Circuit< Time > > distCirc
 The distributed circuit.
std::vector< std::shared_ptr< IHost< Time > > > hosts
 The hosts in the network.
Simulators::SimulationType lastMethod
 The last simulation method used.
Simulators::SimulatorType lastSimulatorType
 The last simulator type used.
std::string maxBondDim
size_t maxSimulators
 The maximum number of simulators that can be used in the network.
std::string mpsSample
bool optimizeSimulator = true
 The flag to optimize the simulator.
std::shared_ptr< Simulators::ISimulatorsimulator
 The quantum computing simulator for the network.
std::unique_ptr< Estimators::SimulatorsEstimatorInterface< Time > > simulatorsEstimator
 The simulators estimator.
BaseClass::SimulatorsSet simulatorsForOptimizations
std::string singularValueThreshold
bool useDoublePrecision = false

Detailed Description

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
class Network::SimpleDisconnectedNetwork< Time, Controller >

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.

Template Parameters
TimeThe time type used for execution times.
See also
INetwork
SimpleController
SimpleHost

Definition at line 43 of file SimpleDisconnectedNetwork.h.

Member Typedef Documentation

◆ BaseClass

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
using Network::SimpleDisconnectedNetwork< Time, Controller >::BaseClass = INetwork<Time>

The base class type.

Definition at line 45 of file SimpleDisconnectedNetwork.h.

◆ ExecuteResults

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
using Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteResults
Initial value:
typename Circuits::Circuit< Time >::ExecuteResults ExecuteResults
Definition Network.h:60

The execute results type.

Definition at line 46 of file SimpleDisconnectedNetwork.h.

◆ SimulatorPair

using Network::INetwork< Types::time_type >::SimulatorPair
inherited

Definition at line 61 of file Network.h.

◆ SimulatorsSet

using Network::INetwork< Types::time_type >::SimulatorsSet
inherited

Definition at line 63 of file Network.h.

Constructor & Destructor Documentation

◆ SimpleDisconnectedNetwork()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Network::SimpleDisconnectedNetwork< Time, Controller >::SimpleDisconnectedNetwork ( const std::vector< Types::qubit_t > & qubits = {},
const std::vector< size_t > & cbits = {} )
inline

The constructor.

Constructs the simple network object, creating the network hosts and the controller.

Parameters
qubitsThe number of qubits for each host.
cbitsThe number of classical bits for each host.

Definition at line 58 of file SimpleDisconnectedNetwork.h.

Member Function Documentation

◆ AddOptimizationSimulator()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::AddOptimizationSimulator ( Simulators::SimulatorType type,
Simulators::SimulationType kind )
inlineoverridevirtual

Adds a simulator to the simulators optimization set.

Adds a simulator (if not already present) to the simulators optimization set.

Parameters
typeThe type of the simulator to add.
kindThe kind of the simulation to add.

Implements Network::INetwork< Types::time_type >.

Definition at line 1812 of file SimpleDisconnectedNetwork.h.

References simulatorsForOptimizations.

◆ AreClassicalBitsOnSameHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::AreClassicalBitsOnSameHost ( size_t bitId1,
size_t bitId2 ) const
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.

Returns
True if the specified qubits are on the same host, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1436 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ AreEntanglementQubitsBusy()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::AreEntanglementQubitsBusy ( size_t qubitId1,
size_t qubitId2 ) const
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.

Parameters
qubitId1The id of the first qubit to check.
qubitId2The id of the second qubit to check.
Returns
True if any of the two specified qubits used for entanglement between hosts are busy, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1649 of file SimpleDisconnectedNetwork.h.

◆ AreQubitAndClassicalBitOnSameHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::AreQubitAndClassicalBitOnSameHost ( size_t qubitId,
size_t bitId ) const
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.

Returns
True if the specified qubit and classical bit are on the same host, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1460 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ AreQubitsOnSameHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::AreQubitsOnSameHost ( size_t qubitId1,
size_t qubitId2 ) const
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.

Returns
True if the specified qubits are on the same host, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1413 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by IsDistributedOperation(), and IsLocalOperation().

◆ ChooseBestSimulator() [1/2]

virtual std::shared_ptr< Simulators::ISimulator > Network::INetwork< Types::time_type >::ChooseBestSimulator ( std::shared_ptr< Circuits::Circuit< Types::time_type > > & 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
pure virtualinherited

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.

WARNING: the circuit might be modified, depending on the chosen simulator and some optimization settings

Parameters
dcircThe distributed circuit to choose the simulator for.
countsThe number of shots to be executed.
nrQubitsThe number of qubits in the circuit.
nrCbitsThe number of classical bits in the circuit.
nrResultCbitsThe number of result classical bits in the circuit.
simTypeThe type of the chosen simulator.
methodThe kind of simulation of the chosen simulator.
executedA 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).
multithreadingIf 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).
Returns
A shared pointer to the chosen simulator.

◆ ChooseBestSimulator() [2/2]

◆ ClearEntanglements()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::ClearEntanglements ( )
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< Types::time_type >.

Definition at line 1696 of file SimpleDisconnectedNetwork.h.

◆ Clone()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr< INetwork< Time > > Network::SimpleDisconnectedNetwork< Time, Controller >::Clone ( ) const
inlineoverridevirtual

Clone the network.

Clone the network in a pristine state.

Returns
A shared pointer to the cloned network.

Implements Network::INetwork< Types::time_type >.

Definition at line 1872 of file SimpleDisconnectedNetwork.h.

References GetNumClassicalBitsForHost(), GetNumHosts(), GetNumQubitsForHost(), GetSimulationType(), GetSimulator(), GetType(), maxBondDim, mpsSample, and singularValueThreshold.

◆ Configure()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::Configure ( const char * key,
const char * value )
inlineoverridevirtual

Configures the network.

This function is called to configure the network (for example the simulator(s) used by the network.

Parameters
keyThe key of the configuration option.
valueThe value of the configuration.

Implements Network::INetwork< Types::time_type >.

Definition at line 985 of file SimpleDisconnectedNetwork.h.

References maxBondDim, maxSimulators, mpsSample, simulator, singularValueThreshold, and useDoublePrecision.

◆ ConvertBackResults() [1/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackResults ( ExecuteResults & res)
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.

Parameters
resThe results to convert back.

Definition at line 2292 of file SimpleDisconnectedNetwork.h.

References controller, and ConvertBackResults().

Referenced by ConvertBackResults(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ ConvertBackResults() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackResults ( ExecuteResults & res,
const std::unordered_map< Types::qubit_t, Types::qubit_t > & bitsMap ) const
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.

Parameters
resThe results to convert back.
bitsMapThe map with the bits mapping.

Definition at line 2314 of file SimpleDisconnectedNetwork.h.

References Circuits::OperationState::GetAllBits(), GetNumClassicalBits(), and Circuits::OperationState::Remap().

◆ ConvertBackState() [1/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackState ( )
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 2253 of file SimpleDisconnectedNetwork.h.

References controller, and ConvertBackState().

Referenced by ConvertBackState().

◆ ConvertBackState() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackState ( const std::unordered_map< Types::qubit_t, Types::qubit_t > & qubitsMap)
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.

Parameters
qubitsMapThe map with the qubits mapping.

Definition at line 2274 of file SimpleDisconnectedNetwork.h.

References GetState(), and Circuits::OperationState::Remap().

◆ CreateNetwork()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::CreateNetwork ( const std::vector< Types::qubit_t > & qubits,
const std::vector< size_t > & cbits )
inline

Creates the network hosts and controller.

Creates the network hosts and controller with the specified number of qubits and classical bits.

Parameters
qubitsThe number of qubits for each host.
cbitsThe number of classical bits for each host.

Definition at line 72 of file SimpleDisconnectedNetwork.h.

References controller, and hosts.

◆ CreateScheduler()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::CreateScheduler ( SchedulerType schType = SchedulerType::kNoEntanglementQubitsParallel)
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.

Parameters
simTypeThe type of the scheduler to create.
See also
SchedulerType

Implements Network::INetwork< Types::time_type >.

Definition at line 1036 of file SimpleDisconnectedNetwork.h.

References controller, Network::INetwork< Time >::getptr(), and Network::kNoEntanglementQubitsParallel.

Referenced by ExecuteScheduled().

◆ CreateSimulator()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::CreateSimulator ( Simulators::SimulatorType simType = Simulators::SimulatorType::kQCSim,
Simulators::SimulationType simExecType = Simulators::SimulationType::kMatrixProductState,
size_t nrQubits = 0 )
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.

Parameters
simTypeThe type of the simulator to create.
simExecTypeThe type of the simulation - statevector, composite, matrix product state, stabilizer, tensor network...
nrQubitsThe number of qubits to allocate for the simulator. Default is 0 - allocate the number of qubits for the whole network.
See also
Simulators::SimulatorType

Implements Network::INetwork< Types::time_type >.

Definition at line 946 of file SimpleDisconnectedNetwork.h.

References classicalState, Simulators::SimulatorsFactory::CreateSimulator(), GetNumClassicalBits(), GetNumNetworkEntangledQubits(), GetNumQubits(), Simulators::kMatrixProductState, Simulators::kQCSim, maxBondDim, mpsSample, simulator, singularValueThreshold, and useDoublePrecision.

Referenced by Execute(), ExecuteExpectations(), ExecuteOnHost(), ExecuteOnHostAmplitudes(), ExecuteOnHostExpectations(), ExecuteOnHostProjectOnZero(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ Execute() [1/2]

virtual void Network::INetwork< Types::time_type >::Execute ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit)
pure virtualinherited

Execute the circuit on the network.

Execute the circuit on the network, using the controller for distributing the operations to the hosts. 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.

Parameters
circuitThe circuit to execute.
See also
Circuits::Circuit

◆ Execute() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::Execute ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit)
inlineoverride

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.

Parameters
circuitThe circuit to execute.
See also
Circuits::Circuit

Definition at line 108 of file SimpleDisconnectedNetwork.h.

References CreateSimulator(), GetState(), Simulators::kMatrixProductState, Simulators::kQCSim, RepeatedExecute(), Circuits::OperationState::SetResultsInOrder(), and simulator.

◆ ExecuteExpectations() [1/2]

virtual std::vector< double > Network::INetwork< Types::time_type >::ExecuteExpectations ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
const std::vector< std::string > & paulis )
pure virtualinherited

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.

Parameters
circuitThe circuit to execute.
paulisThe Pauli strings to measure the expectations for.
See also
Circuits::Circuit

◆ ExecuteExpectations() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< double > Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteExpectations ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
const std::vector< std::string > & paulis )
inlineoverride

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.

Parameters
circuitThe circuit to execute.
paulisThe Pauli strings to measure the expectations for.
See also
Circuits::Circuit

Definition at line 201 of file SimpleDisconnectedNetwork.h.

References controller, CreateSimulator(), GetState(), Simulators::kMatrixProductState, Simulators::kQCSim, RepeatedExecute(), Circuits::OperationState::SetResultsInOrder(), and simulator.

◆ ExecuteOnHost() [1/2]

virtual void Network::INetwork< Types::time_type >::ExecuteOnHost ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
size_t hostId )
pure virtualinherited

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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
See also
Circuits::Circuit

◆ ExecuteOnHost() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHost ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t hostId )
inlineoverride

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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
See also
Circuits::Circuit

Definition at line 153 of file SimpleDisconnectedNetwork.h.

References CreateSimulator(), GetState(), Simulators::kMatrixProductState, Simulators::kQCSim, RepeatedExecuteOnHost(), Circuits::OperationState::SetResultsInOrder(), and simulator.

◆ ExecuteOnHostAmplitudes() [1/2]

virtual std::vector< std::complex< double > > Network::INetwork< Types::time_type >::ExecuteOnHostAmplitudes ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
size_t hostId )
pure virtualinherited

Execute the circuit on the specified host and return the full statevector (complex amplitudes for each basis state).

Execute the circuit on the specified host and return the complex amplitudes of the resulting quantum state. 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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
Returns
A vector of complex amplitudes, one per basis state.
See also
Circuits::Circuit

◆ ExecuteOnHostAmplitudes() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< std::complex< double > > Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHostAmplitudes ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t hostId )
inlineoverride

Execute circuit on host and return full statevector amplitudes.

Execute the circuit on the specified host and return the complex amplitudes of the resulting quantum state (one per basis state 0..2^n-1). Supported for Statevector and MPS simulation types.

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
Returns
A vector of complex<double> amplitudes of length 2^n.

Definition at line 373 of file SimpleDisconnectedNetwork.h.

References CreateSimulator(), GetState(), Simulators::kMatrixProductState, Simulators::kQCSim, RepeatedExecuteOnHost(), Circuits::OperationState::SetResultsInOrder(), and simulator.

◆ ExecuteOnHostExpectations() [1/2]

virtual std::vector< double > Network::INetwork< Types::time_type >::ExecuteOnHostExpectations ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
size_t hostId,
const std::vector< std::string > & paulis )
pure virtualinherited

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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
paulisThe Pauli strings to measure the expectations for.
See also
Circuits::Circuit

◆ ExecuteOnHostExpectations() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< double > Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHostExpectations ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t hostId,
const std::vector< std::string > & paulis )
inlineoverride

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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
paulisThe Pauli strings to measure the expectations for.
See also
Circuits::Circuit

Definition at line 281 of file SimpleDisconnectedNetwork.h.

References CreateSimulator(), GetState(), Simulators::kMatrixProductState, Simulators::kQCSim, RepeatedExecuteOnHost(), Circuits::OperationState::SetResultsInOrder(), and simulator.

◆ ExecuteOnHostProjectOnZero() [1/2]

virtual std::complex< double > Network::INetwork< Types::time_type >::ExecuteOnHostProjectOnZero ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
size_t hostId )
pure virtualinherited

Execute circuit on host and return the projection onto the zero state.

Execute the circuit on the specified host and return <0|Psi>, the inner product of the resulting quantum state with the all-zeros basis state. This is equivalent to Amplitude(0) but can be faster for certain simulator back-ends (e.g. MPS).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
Returns
The complex amplitude <0|Psi>.
See also
Circuits::Circuit

◆ ExecuteOnHostProjectOnZero() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::complex< double > Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHostProjectOnZero ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t hostId )
inlineoverride

Execute circuit on host and return the projection onto the zero state.

Execute the circuit on the specified host and return <0|Psi>, the inner product of the resulting quantum state with the all-zeros basis state. This is equivalent to Amplitude(0) but can be faster for certain simulator back-ends (e.g. MPS).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
Returns
The complex amplitude <0|Psi>.

Definition at line 464 of file SimpleDisconnectedNetwork.h.

References CreateSimulator(), GetState(), Simulators::kMatrixProductState, Simulators::kQCSim, RepeatedExecuteOnHost(), Circuits::OperationState::SetResultsInOrder(), and simulator.

◆ ExecuteScheduled() [1/2]

virtual std::vector< ExecuteResults > Network::INetwork< Types::time_type >::ExecuteScheduled ( const std::vector< Schedulers::ExecuteCircuit< Types::time_type > > & circuits)
pure virtualinherited

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.

Parameters
Circuit RepresentationThe circuits to execute, along with the number of shots.
Returns
A vector of maps with the results of each circuit execution, where the key is the state as a vector of bools and the value is the number of times it was measured.
See also
Circuits::Circuit
ExecuteCircuit

◆ ExecuteScheduled() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< ExecuteResults > Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteScheduled ( const std::vector< Schedulers::ExecuteCircuit< Time > > & circuits)
inlineoverride

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.

Parameters
Circuit RepresentationThe circuits to execute, along with the number of shots.
Returns
A vector of maps with the results of each circuit execution, where the key is the state as a vector of bools and the value is the number of times it was measured.
See also
Circuits::Circuit
ExecuteCircuit

Definition at line 915 of file SimpleDisconnectedNetwork.h.

References CreateScheduler(), and GetScheduler().

◆ ExpectsClassicalBitFromOtherHost() [1/2]

virtual bool Network::INetwork< Types::time_type >::ExpectsClassicalBitFromOtherHost ( const std::shared_ptr< Circuits::IOperation< Types::time_type > > & op) const
pure virtualinherited

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation needs a classical bit from another host, false otherwise.

◆ ExpectsClassicalBitFromOtherHost() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::ExpectsClassicalBitFromOtherHost ( const std::shared_ptr< Circuits::IOperation< Time > > & op) const
inlineoverride

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation needs a classical bit from another host, false otherwise.

Definition at line 1354 of file SimpleDisconnectedNetwork.h.

References GetHostIdForAnyQubit(), and GetHostIdForClassicalBit().

◆ GetClassicalBitsIds()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< size_t > Network::SimpleDisconnectedNetwork< Time, Controller >::GetClassicalBitsIds ( size_t hostId) const
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.

Parameters
hostIdThe id of the host to get the classical bit ids for.
Returns
A vector with the classical bit ids.

Implements Network::INetwork< Types::time_type >.

Definition at line 1582 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ GetController()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
const std::shared_ptr< IController< Time > > Network::SimpleDisconnectedNetwork< Time, Controller >::GetController ( ) const
inlineoverridevirtual

Get the controller for the network.

Gets a smart pointer to the controller for the network.

Returns
The controller for the network.
See also
IController

Implements Network::INetwork< Types::time_type >.

Definition at line 1081 of file SimpleDisconnectedNetwork.h.

References controller.

Referenced by RepeatedExecuteOnHost().

◆ GetDistributedCircuit()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr< Circuits::Circuit< Time > > Network::SimpleDisconnectedNetwork< Time, Controller >::GetDistributedCircuit ( ) const
inlineoverridevirtual

Get the distributed circuit.

Get the distributed circuit. Execute() must be called first, otherwise the return would be nullptr.

Returns
The distributed circuit.
See also
Circuits::Circuit

Implements Network::INetwork< Types::time_type >.

Definition at line 1710 of file SimpleDisconnectedNetwork.h.

References distCirc.

◆ GetEntangledQubitMeasurementBitIds()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< size_t > Network::SimpleDisconnectedNetwork< Time, Controller >::GetEntangledQubitMeasurementBitIds ( size_t hostId) const
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.

Parameters
hostIdThe id of the host to get the classical bit ids for.
Returns
A vector with the classical bit ids.

Implements Network::INetwork< Types::time_type >.

Definition at line 1598 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ getGrowthFactorGate()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
double Network::SimpleDisconnectedNetwork< Time, Controller >::getGrowthFactorGate ( ) const
inlineoverridevirtual

Reimplemented from Network::INetwork< Types::time_type >.

Definition at line 2153 of file SimpleDisconnectedNetwork.h.

◆ getGrowthFactorSwap()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
double Network::SimpleDisconnectedNetwork< Time, Controller >::getGrowthFactorSwap ( ) const
inlineoverridevirtual

Reimplemented from Network::INetwork< Types::time_type >.

Definition at line 2152 of file SimpleDisconnectedNetwork.h.

◆ GetHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
const std::shared_ptr< IHost< Time > > Network::SimpleDisconnectedNetwork< Time, Controller >::GetHost ( size_t hostId) const
inlineoverridevirtual

Get the host with the specified id.

Get a smart pointer to the host that has the specified id.

Parameters
hostIdThe id of the host to get.
Returns
A smart pointer to the host that has the specified id.
See also
IHost

Implements Network::INetwork< Types::time_type >.

Definition at line 1067 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by MapCircuitOnHost().

◆ GetHostIdForAnyQubit()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetHostIdForAnyQubit ( size_t qubitId) const
inlineoverridevirtual

Get the host id for the specified qubit.

Get the host id for the squbit, including the qubits used for entanglement between hosts.

Parameters
qubitIdThe id of the qubit to get the host id for.
Returns
The host id for the specified qubit.

Implements Network::INetwork< Types::time_type >.

Definition at line 1519 of file SimpleDisconnectedNetwork.h.

References GetHostIdForEntangledQubit(), GetHostIdForQubit(), and IsNetworkEntangledQubit().

Referenced by ExpectsClassicalBitFromOtherHost().

◆ GetHostIdForClassicalBit()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetHostIdForClassicalBit ( size_t classicalBitId) const
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.

Parameters
classicalBitIdThe id of the classical bit to get the host id for.
Returns
The host id for the specified classical bit.

Implements Network::INetwork< Types::time_type >.

Definition at line 1535 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by ExpectsClassicalBitFromOtherHost(), and GetHostIdForClassicalControl().

◆ GetHostIdForClassicalControl() [1/2]

virtual size_t Network::INetwork< Types::time_type >::GetHostIdForClassicalControl ( const std::shared_ptr< Circuits::IOperation< Types::time_type > > & op) const
pure virtualinherited

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.

Parameters
opThe operation to find the host of the control bit.
Returns
The host id.

◆ GetHostIdForClassicalControl() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetHostIdForClassicalControl ( const std::shared_ptr< Circuits::IOperation< Time > > & op) const
inlineoverride

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.

Parameters
opThe operation to find the host of the control bit.
Returns
The host id.

Definition at line 1390 of file SimpleDisconnectedNetwork.h.

References GetHostIdForClassicalBit().

◆ GetHostIdForEntangledQubit()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetHostIdForEntangledQubit ( size_t qubitId) const
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.

Parameters
qubitIdThe id of the qubit used for entanglement between hosts to get the host id for.
Returns
The host id for the specified qubit used for entanglement between hosts.

Implements Network::INetwork< Types::time_type >.

Definition at line 1503 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by GetHostIdForAnyQubit().

◆ GetHostIdForQubit()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetHostIdForQubit ( size_t qubitId) const
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.

Parameters
qubitIdThe id of the qubit to get the host id for.
Returns
The host id for the specified qubit.

Implements Network::INetwork< Types::time_type >.

Definition at line 1484 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by GetHostIdForAnyQubit().

◆ GetHosts()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< std::shared_ptr< IHost< Time > > > & Network::SimpleDisconnectedNetwork< Time, Controller >::GetHosts ( )
inline

Get the hosts in the network.

Gets the hosts in the network.

Returns
A vector with the hosts in the network.
See also
IHost
SimpleHost

Definition at line 1201 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ GetInitialQubitsMapOptimization()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::GetInitialQubitsMapOptimization ( ) const
inlineoverridevirtual

◆ GetLastSimulationType()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Simulators::SimulationType Network::SimpleDisconnectedNetwork< Time, Controller >::GetLastSimulationType ( ) const
inlineoverridevirtual

Get the last used simulation type.

Get the last used simulation type.

Returns
The simulation type that was used last time.

Implements Network::INetwork< Types::time_type >.

Definition at line 1733 of file SimpleDisconnectedNetwork.h.

References lastMethod.

◆ GetLastSimulatorType()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Simulators::SimulatorType Network::SimpleDisconnectedNetwork< Time, Controller >::GetLastSimulatorType ( ) const
inlineoverridevirtual

Get the last used simulator type.

Get the last used simulator type.

Returns
The simulator type that was used last time.

Implements Network::INetwork< Types::time_type >.

Definition at line 1722 of file SimpleDisconnectedNetwork.h.

References lastSimulatorType.

◆ GetLookaheadDepth()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
int Network::SimpleDisconnectedNetwork< Time, Controller >::GetLookaheadDepth ( ) const
inlineoverridevirtual

◆ GetLookaheadDepthWithHeuristic()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
int Network::SimpleDisconnectedNetwork< Time, Controller >::GetLookaheadDepthWithHeuristic ( ) const
inlineoverridevirtual

◆ GetMaxSimulators()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetMaxSimulators ( ) const
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.

Returns
The maximum number of simulators that can be used in the network.

Implements Network::INetwork< Types::time_type >.

Definition at line 1747 of file SimpleDisconnectedNetwork.h.

References maxSimulators.

Referenced by ChooseBestSimulator(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ GetMPSOptimizationBondDimensionThreshold()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetMPSOptimizationBondDimensionThreshold ( ) const
inlineoverridevirtual

◆ GetMPSOptimizationQubitsNumberThreshold()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetMPSOptimizationQubitsNumberThreshold ( ) const
inlineoverridevirtual

◆ GetMPSOptimizeSwaps()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::GetMPSOptimizeSwaps ( ) const
inlineoverridevirtual

◆ GetNetworkEntangledQubitsIds()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< size_t > Network::SimpleDisconnectedNetwork< Time, Controller >::GetNetworkEntangledQubitsIds ( size_t hostId) const
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.

Parameters
hostIdThe id of the host to get the qubit ids for.
Returns
A vector with the qubit ids.

Implements Network::INetwork< Types::time_type >.

Definition at line 1566 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ GetNumberOfGatesDistributedOrCut() [1/2]

virtual size_t Network::INetwork< Types::time_type >::GetNumberOfGatesDistributedOrCut ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit) const
pure virtualinherited

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.

Parameters
circuitThe circuit to check.
Returns
The number of gates that need distribution or cutting.

◆ GetNumberOfGatesDistributedOrCut() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumberOfGatesDistributedOrCut ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit) const
inlineoverride

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.

Parameters
circuitThe circuit to check.
Returns
The number of gates that need distribution or cutting.

Definition at line 887 of file SimpleDisconnectedNetwork.h.

References IsLocalOperation().

◆ GetNumClassicalBits()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumClassicalBits ( ) const
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.

Returns
The number of classical bits in the network.

Implements Network::INetwork< Types::time_type >.

Definition at line 1167 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by ConvertBackResults(), CreateSimulator(), and RepeatedExecute().

◆ GetNumClassicalBitsForHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumClassicalBitsForHost ( size_t hostId) const
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.

Parameters
hostIdThe id of the host to get the number of classical bits for.
Returns
The number of classical bits in the network for the specified host.

Implements Network::INetwork< Types::time_type >.

Definition at line 1186 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by Clone().

◆ GetNumHosts()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumHosts ( ) const
inlineoverridevirtual

Get the number of hosts in the network.

Get the number of hosts in the network, excluding the controller.

Returns
The number of hosts in the network.

Implements Network::INetwork< Types::time_type >.

Definition at line 1092 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by Clone(), and RepeatedExecuteOnHost().

◆ GetNumNetworkEntangledQubits()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumNetworkEntangledQubits ( ) const
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.

Returns
The number of qubits used for entanglement between hosts.

Implements Network::INetwork< Types::time_type >.

Definition at line 1133 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by CreateSimulator(), and RepeatedExecute().

◆ GetNumNetworkEntangledQubitsForHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumNetworkEntangledQubitsForHost ( size_t hostId) const
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.

Parameters
hostIdThe id of the host to get the number of qubits used for entanglement between hosts for.
Returns
The number of qubits used for entanglement between hosts for the specified host.

Implements Network::INetwork< Types::time_type >.

Definition at line 1153 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ GetNumQubits()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumQubits ( ) const
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.

Returns
The number of qubits in the network.

Implements Network::INetwork< Types::time_type >.

Definition at line 1102 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by CreateSimulator(), IsNetworkEntangledQubit(), and RepeatedExecute().

◆ GetNumQubitsForHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::GetNumQubitsForHost ( size_t hostId) const
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.

Parameters
hostIdThe id of the host to get the number of qubits for.
Returns
The number of qubits in the network for the specified host.

Implements Network::INetwork< Types::time_type >.

Definition at line 1119 of file SimpleDisconnectedNetwork.h.

References hosts.

Referenced by Clone().

◆ GetOptimizeSimulator()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::GetOptimizeSimulator ( ) const
inlineoverridevirtual

Returns the 'optimize' flag.

Returns the flag set by SetOptimizeSimulator().

Returns
The 'optimize' flag.

Implements Network::INetwork< Types::time_type >.

Definition at line 1789 of file SimpleDisconnectedNetwork.h.

References optimizeSimulator.

Referenced by RepeatedExecute(), and RepeatedExecuteOnHost().

◆ getptr()

std::shared_ptr< INetwork< Types::time_type > > Network::INetwork< Types::time_type >::getptr ( )
inlineinherited

Get a shared pointer to this object.

Returns a shared pointer to this object. The object needs to be already wrapped in a shared pointer.

Returns
A shared pointer to this object.

Definition at line 772 of file Network.h.

◆ GetQubitsIds()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::vector< size_t > Network::SimpleDisconnectedNetwork< Time, Controller >::GetQubitsIds ( size_t hostId) const
inlineoverridevirtual

Get the qubit ids for the specified host.

Get the qubit ids for the specified host.

Parameters
hostIdThe id of the host to get the qubit ids for.
Returns
A vector with the qubit ids.

Implements Network::INetwork< Types::time_type >.

Definition at line 1550 of file SimpleDisconnectedNetwork.h.

References hosts.

◆ GetScheduler()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr< Schedulers::IScheduler< Time > > Network::SimpleDisconnectedNetwork< Time, Controller >::GetScheduler ( ) const
inlineoverridevirtual

Get the scheduler for the network.

Get the scheduler for the network.

Returns
The scheduler for the network.
See also
Schedulers::IScheduler

Implements Network::INetwork< Types::time_type >.

Definition at line 1052 of file SimpleDisconnectedNetwork.h.

References controller.

Referenced by ExecuteScheduled().

◆ GetSimulator()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr< Simulators::ISimulator > Network::SimpleDisconnectedNetwork< Time, Controller >::GetSimulator ( ) const
inlineoverridevirtual

Get the simulator for the network.

Get the simulator for the network.

Returns
The simulator for the network.
See also
Simulators::ISimulator

Implements Network::INetwork< Types::time_type >.

Definition at line 1011 of file SimpleDisconnectedNetwork.h.

References simulator.

Referenced by Clone().

◆ GetSimulatorsSet()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
const BaseClass::SimulatorsSet & Network::SimpleDisconnectedNetwork< Time, Controller >::GetSimulatorsSet ( ) const
inlineoverridevirtual

Get the optimizations simulators set.

Get the optimization simulators set. To be used internally, will not be exposed from the library.

Returns
The simulators set.

Implements Network::INetwork< Types::time_type >.

Definition at line 1799 of file SimpleDisconnectedNetwork.h.

References simulatorsForOptimizations.

◆ GetState()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Circuits::OperationState & Network::SimpleDisconnectedNetwork< Time, Controller >::GetState ( )
inlineoverridevirtual

Get the classical state of the network.

Gets a reference to the classical state of the network.

Returns
The classical state of the network.
See also
Circuits::ClassicalState

Implements Network::INetwork< Types::time_type >.

Definition at line 1023 of file SimpleDisconnectedNetwork.h.

References classicalState.

Referenced by ConvertBackState(), Execute(), ExecuteExpectations(), ExecuteOnHost(), ExecuteOnHostAmplitudes(), ExecuteOnHostExpectations(), ExecuteOnHostProjectOnZero(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ GetSubroutinesTextCode()

virtual std::vector< std::vector< std::string > > Network::INetwork< Types::time_type >::GetSubroutinesTextCode ( ) const
inlinevirtualinherited

Get the text code that is executed on the hosts.

Get the text code that is executed on the hosts, if available. The circuit might be converted to code to be executed (example: netqasm). If that's the case, the text code is returned in an array, each element of the array being the code for a host. Each host might have multiple subroutines, so each element of the array is an array of strings, each string being a subroutine.

Returns
The text code that is executed on the hosts.

Definition at line 940 of file Network.h.

◆ GetType()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
NetworkType Network::SimpleDisconnectedNetwork< Time, Controller >::GetType ( ) const
inlineoverridevirtual

Get the type of the network.

Get the type of the network.

Returns
The type of the network.
See also
NetworkType

Implements Network::INetwork< Types::time_type >.

Definition at line 1239 of file SimpleDisconnectedNetwork.h.

References Network::kSimpleDisconnectedNetwork.

Referenced by Clone().

◆ IsDistributedOperation() [1/2]

virtual bool Network::INetwork< Types::time_type >::IsDistributedOperation ( const std::shared_ptr< Circuits::IOperation< Types::time_type > > & op) const
pure virtualinherited

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation is distributed, false otherwise.

◆ IsDistributedOperation() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::IsDistributedOperation ( const std::shared_ptr< Circuits::IOperation< Time > > & op) const
inlineoverride

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation is distributed, false otherwise.

Definition at line 1279 of file SimpleDisconnectedNetwork.h.

References AreQubitsOnSameHost(), and IsNetworkEntangledQubit().

◆ IsEntanglementQubitBusy()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::IsEntanglementQubitBusy ( size_t qubitId) const
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.

Parameters
qubitIdThe id of the qubit to check.
Returns
True if the specified qubit used for entanglement between hosts is busy, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1632 of file SimpleDisconnectedNetwork.h.

◆ IsEntanglingGate() [1/2]

virtual bool Network::INetwork< Types::time_type >::IsEntanglingGate ( const std::shared_ptr< Circuits::IOperation< Types::time_type > > & op) const
pure virtualinherited

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation is an entangling gate, false otherwise.

◆ IsEntanglingGate() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::IsEntanglingGate ( const std::shared_ptr< Circuits::IOperation< Time > > & op) const
inlineoverride

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation is an entangling gate, false otherwise.

Definition at line 1334 of file SimpleDisconnectedNetwork.h.

References IsNetworkEntangledQubit(), and Circuits::kGate.

◆ IsLocalOperation() [1/2]

virtual bool Network::INetwork< Types::time_type >::IsLocalOperation ( const std::shared_ptr< Circuits::IOperation< Types::time_type > > & op) const
pure virtualinherited

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation is local, false otherwise.

◆ IsLocalOperation() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::IsLocalOperation ( const std::shared_ptr< Circuits::IOperation< Time > > & op) const
inlineoverride

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation is local, false otherwise.

Definition at line 1253 of file SimpleDisconnectedNetwork.h.

References AreQubitsOnSameHost().

Referenced by GetNumberOfGatesDistributedOrCut().

◆ IsNetworkEntangledQubit()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::IsNetworkEntangledQubit ( size_t qubitId) const
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.

Parameters
qubitIdThe id of the qubit to check.
Returns
True if the specified qubit id is for a qubit used for entanglement between hosts, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1616 of file SimpleDisconnectedNetwork.h.

References GetNumQubits().

Referenced by GetHostIdForAnyQubit(), IsDistributedOperation(), IsEntanglingGate(), and OperatesWithNetworkEntangledQubit().

◆ MapCircuitOnHost()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::unordered_map< Types::qubit_t, Types::qubit_t > Network::SimpleDisconnectedNetwork< Time, Controller >::MapCircuitOnHost ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t hostId,
size_t & nrQubits,
size_t & nrCbits,
bool useSeparateSimForHosts = false )
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.

Parameters
circuitThe circuit to map.
hostIdThe id of the host to map the circuit on.
Returns
The reverse qubits/cbits map.

Definition at line 2346 of file SimpleDisconnectedNetwork.h.

References distCirc, and GetHost().

Referenced by RepeatedExecuteOnHost().

◆ MarkEntangledQubitFree()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::MarkEntangledQubitFree ( size_t qubitId)
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.

Parameters
qubitIdThe id of the qubit to mark as free.

Implements Network::INetwork< Types::time_type >.

Definition at line 1682 of file SimpleDisconnectedNetwork.h.

◆ MarkEntangledQubitsBusy()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::MarkEntangledQubitsBusy ( size_t qubitId1,
size_t qubitId2 )
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.

Parameters
qubitId1The id of the first qubit to mark as busy.
qubitId2The id of the second qubit to mark as busy.

Implements Network::INetwork< Types::time_type >.

Definition at line 1666 of file SimpleDisconnectedNetwork.h.

◆ OperatesWithNetworkEntangledQubit() [1/2]

virtual bool Network::INetwork< Types::time_type >::OperatesWithNetworkEntangledQubit ( const std::shared_ptr< Circuits::IOperation< Types::time_type > > & op) const
pure virtualinherited

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation operates on the entanglement qubits between hosts, false otherwise.

◆ OperatesWithNetworkEntangledQubit() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::OperatesWithNetworkEntangledQubit ( const std::shared_ptr< Circuits::IOperation< Time > > & op) const
inlineoverride

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.

Parameters
opThe operation to check.
Returns
True if the specified circuit operation operates on the entanglement qubits between hosts, false otherwise.

Definition at line 1313 of file SimpleDisconnectedNetwork.h.

References IsNetworkEntangledQubit().

◆ OptimizationSimulatorExists()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::OptimizationSimulatorExists ( Simulators::SimulatorType type,
Simulators::SimulationType kind ) const
inlineoverridevirtual

Checks if a simulator exists in the optimization set.

Checks if a simulator exists in the optimization set.

Parameters
typeThe type of the simulator to check.
kindThe kind of the simulation to check.
Returns
True if the simulator exists in the optimization set, false otherwise.

Implements Network::INetwork< Types::time_type >.

Definition at line 1857 of file SimpleDisconnectedNetwork.h.

References simulatorsForOptimizations.

Referenced by ChooseBestSimulator().

◆ OptimizeMPSInitialQubitsMap()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::OptimizeMPSInitialQubitsMap ( std::shared_ptr< Simulators::ISimulator > & sim,
std::shared_ptr< Circuits::Circuit< Time > > & dcirc,
size_t nrQubits ) const
inlineprotected

◆ RemoveAllOptimizationSimulatorsAndAdd()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::RemoveAllOptimizationSimulatorsAndAdd ( Simulators::SimulatorType type,
Simulators::SimulationType kind )
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.

Parameters
typeThe type of the simulator to add.
kindThe kind of the simulation to add.

Implements Network::INetwork< Types::time_type >.

Definition at line 1840 of file SimpleDisconnectedNetwork.h.

References simulatorsForOptimizations.

◆ RemoveOptimizationSimulator()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::RemoveOptimizationSimulator ( Simulators::SimulatorType type,
Simulators::SimulationType kind )
inlineoverridevirtual

Removes a simulator from the simulators optimization set.

Removes a simulator from the simulators optimization set, if it exists.

Parameters
typeThe type of the simulator to remove.
kindThe kind of the simulation to remove.

Implements Network::INetwork< Types::time_type >.

Definition at line 1825 of file SimpleDisconnectedNetwork.h.

References simulatorsForOptimizations.

◆ RepeatedExecute() [1/2]

virtual ExecuteResults Network::INetwork< Types::time_type >::RepeatedExecute ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
size_t shots = 1000 )
pure virtualinherited

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.

Parameters
circuitThe circuit to execute.
shotsThe number of times to repeat the execution.
Returns
A vector of maps with the results of each circuit execution, where the key is the state as a vector of bools and the value is the number of times it was measured.
See also
Circuits::Circuit

◆ RepeatedExecute() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
ExecuteResults Network::SimpleDisconnectedNetwork< Time, Controller >::RepeatedExecute ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t shots = 1000 )
inlineoverride

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.

Parameters
circuitThe circuit to execute.
shotsThe number of times to repeat the execution.
Returns
A map with the results of the execution, where the key is the qubit id and the value is the number of times the qubit was measured to be 1.
See also
Circuits::Circuit

Definition at line 520 of file SimpleDisconnectedNetwork.h.

References ChooseBestSimulator(), Circuits::OperationState::Clear(), controller, ConvertBackResults(), CreateSimulator(), distCirc, GetMaxSimulators(), GetNumClassicalBits(), GetNumNetworkEntangledQubits(), GetNumQubits(), GetOptimizeSimulator(), Network::INetwork< Time >::getptr(), GetState(), Simulators::kCompositeQCSim, Simulators::kCompositeQiskitAer, Simulators::kGpuSim, Simulators::kPathIntegral, Simulators::kQCSim, Simulators::kQiskitAer, Simulators::kQuestSim, Simulators::kStabilizer, Simulators::kStatevector, lastMethod, lastSimulatorType, maxBondDim, mpsSample, OptimizeMPSInitialQubitsMap(), optimizeSimulator, simulator, simulatorsEstimator, and singularValueThreshold.

Referenced by Execute(), and ExecuteExpectations().

◆ RepeatedExecuteCircuit()

ExecuteResults Network::INetwork< Types::time_type >::RepeatedExecuteCircuit ( const Schedulers::ExecuteCircuit< Types::time_type > & executeCircuit)
inlineinherited

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.

Parameters
executeCircuitThe circuit to execute, together with the number of shots.
Returns
A vector of maps with the results of each circuit execution, where the key is the state as a vector of bools and the value is the number of times it was measured.
See also
Circuits::Circuit
ExecuteCircuit

Definition at line 223 of file Network.h.

◆ RepeatedExecuteCircuitOnHost()

ExecuteResults Network::INetwork< Types::time_type >::RepeatedExecuteCircuitOnHost ( const Schedulers::ExecuteCircuit< Types::time_type > & executeCircuit,
size_t hostId )
inlineinherited

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).

Parameters
executeCircuitThe circuit to execute, together with the number of shots.
hostIdThe id of the host to execute the circuit on.
Returns
A vector of maps with the results of each circuit execution, where the key is the state as a vector of bools and the value is the number of times it was measured.
See also
Circuits::Circuit
ExecuteCircuit

Definition at line 265 of file Network.h.

◆ RepeatedExecuteOnHost() [1/2]

virtual ExecuteResults Network::INetwork< Types::time_type >::RepeatedExecuteOnHost ( const std::shared_ptr< Circuits::Circuit< Types::time_type > > & circuit,
size_t hostId,
size_t shots = 1000 )
pure virtualinherited

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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
shotsThe number of times to repeat the execution.
Returns
A vector of maps with the results of each circuit execution, where the key is the state as a vector of bools and the value is the number of times it was measured.
See also
Circuits::Circuit

◆ RepeatedExecuteOnHost() [2/2]

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
ExecuteResults Network::SimpleDisconnectedNetwork< Time, Controller >::RepeatedExecuteOnHost ( const std::shared_ptr< Circuits::Circuit< Time > > & circuit,
size_t hostId,
size_t shots = 1000 )
inlineoverride

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).

Parameters
circuitThe circuit to execute.
hostIdThe id of the host to execute the circuit on.
shotsThe number of times to repeat the execution.
Returns
A map with the results of the execution, where the key is the qubit id and the value is the number of times the qubit was measured to be 1.
See also
Circuits::Circuit

Definition at line 719 of file SimpleDisconnectedNetwork.h.

References ChooseBestSimulator(), Circuits::OperationState::Clear(), ConvertBackResults(), CreateSimulator(), distCirc, GetController(), GetMaxSimulators(), GetNumHosts(), GetOptimizeSimulator(), Network::INetwork< Time >::getptr(), GetState(), Simulators::kCompositeQCSim, Simulators::kCompositeQiskitAer, Simulators::kGpuSim, Simulators::kPathIntegral, Simulators::kQCSim, Simulators::kQiskitAer, Simulators::kQuestSim, Simulators::kStabilizer, Simulators::kStatevector, lastMethod, lastSimulatorType, MapCircuitOnHost(), maxBondDim, mpsSample, simulator, and singularValueThreshold.

Referenced by ExecuteOnHost(), ExecuteOnHostAmplitudes(), ExecuteOnHostExpectations(), and ExecuteOnHostProjectOnZero().

◆ SendPacket()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::SendPacket ( size_t fromHostId,
size_t toHostId,
const std::vector< uint8_t > & packet )
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.

Parameters
fromHostIdThe id of the host to send the packet from.
toHostIdThe id of the host to send the packet to.
packetThe packet to send.
Returns
False.

Implements Network::INetwork< Types::time_type >.

Definition at line 1227 of file SimpleDisconnectedNetwork.h.

◆ SetController()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetController ( const std::shared_ptr< IController< Time > > & cntrl)
inline

Set the network controller host.

Sets the network controller host.

Parameters
[in]cntrlThe controller host.
See also
IController

Definition at line 1210 of file SimpleDisconnectedNetwork.h.

References controller.

◆ setGrowthFactorGate()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::setGrowthFactorGate ( double factor)
inlineoverridevirtual

Reimplemented from Network::INetwork< Types::time_type >.

Definition at line 2159 of file SimpleDisconnectedNetwork.h.

◆ setGrowthFactorSwap()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::setGrowthFactorSwap ( double factor)
inlineoverridevirtual

Reimplemented from Network::INetwork< Types::time_type >.

Definition at line 2155 of file SimpleDisconnectedNetwork.h.

◆ SetInitialQubitsMapOptimization()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetInitialQubitsMapOptimization ( bool optimize = true)
inlineoverridevirtual

◆ SetLookaheadDepth()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetLookaheadDepth ( int depth)
inlineoverridevirtual

◆ SetLookaheadDepthWithHeuristic()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetLookaheadDepthWithHeuristic ( int depth)
inlineoverridevirtual

◆ SetMaxSimulators()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetMaxSimulators ( size_t val)
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.

Parameters
maxSimulatorsThe maximum number of simulators that can be used in the network.

Implements Network::INetwork< Types::time_type >.

Definition at line 1760 of file SimpleDisconnectedNetwork.h.

References maxSimulators.

◆ SetMPSOptimizationBondDimensionThreshold()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetMPSOptimizationBondDimensionThreshold ( size_t threshold)
inlineoverridevirtual

◆ SetMPSOptimizationQubitsNumberThreshold()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetMPSOptimizationQubitsNumberThreshold ( size_t threshold)
inlineoverridevirtual

◆ SetMPSOptimizeSwaps()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetMPSOptimizeSwaps ( bool optimize = true)
inlineoverridevirtual

◆ SetOptimizeSimulator()

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
void Network::SimpleDisconnectedNetwork< Time, Controller >::SetOptimizeSimulator ( bool optimize = true)
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.

Parameters
optimizeIf true, the simulator will be optimized if possible.

Implements Network::INetwork< Types::time_type >.

Definition at line 1778 of file SimpleDisconnectedNetwork.h.

References optimizeSimulator.

Member Data Documentation

◆ classicalState

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Circuits::OperationState Network::SimpleDisconnectedNetwork< Time, Controller >::classicalState
protected

The classical state of the network.

Definition at line 2445 of file SimpleDisconnectedNetwork.h.

Referenced by CreateSimulator(), and GetState().

◆ controller

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr<IController<Time> > Network::SimpleDisconnectedNetwork< Time, Controller >::controller
protected

◆ distCirc

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr<Circuits::Circuit<Time> > Network::SimpleDisconnectedNetwork< Time, Controller >::distCirc
protected

The distributed circuit.

Definition at line 2450 of file SimpleDisconnectedNetwork.h.

Referenced by GetDistributedCircuit(), MapCircuitOnHost(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ hosts

◆ lastMethod

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Simulators::SimulationType Network::SimpleDisconnectedNetwork< Time, Controller >::lastMethod
protected
Initial value:

The last simulation method used.

Definition at line 2431 of file SimpleDisconnectedNetwork.h.

Referenced by GetLastSimulationType(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ lastSimulatorType

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
Simulators::SimulatorType Network::SimpleDisconnectedNetwork< Time, Controller >::lastSimulatorType
protected
Initial value:

The last simulator type used.

Definition at line 2429 of file SimpleDisconnectedNetwork.h.

Referenced by GetLastSimulatorType(), RepeatedExecute(), and RepeatedExecuteOnHost().

◆ maxBondDim

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::string Network::SimpleDisconnectedNetwork< Time, Controller >::maxBondDim
protected

◆ maxSimulators

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
size_t Network::SimpleDisconnectedNetwork< Time, Controller >::maxSimulators
protected
Initial value:
= QC::QubitRegisterCalculator<>::
GetNumberOfThreads()

The maximum number of simulators that can be used in the network.

Definition at line 2440 of file SimpleDisconnectedNetwork.h.

Referenced by Configure(), GetMaxSimulators(), and SetMaxSimulators().

◆ mpsSample

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::string Network::SimpleDisconnectedNetwork< Time, Controller >::mpsSample
protected

◆ optimizeSimulator

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::optimizeSimulator = true
protected

The flag to optimize the simulator.

Definition at line 2426 of file SimpleDisconnectedNetwork.h.

Referenced by ChooseBestSimulator(), GetOptimizeSimulator(), RepeatedExecute(), and SetOptimizeSimulator().

◆ simulator

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::shared_ptr<Simulators::ISimulator> Network::SimpleDisconnectedNetwork< Time, Controller >::simulator
protected

◆ simulatorsEstimator

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::unique_ptr<Estimators::SimulatorsEstimatorInterface<Time> > Network::SimpleDisconnectedNetwork< Time, Controller >::simulatorsEstimator
protected

The simulators estimator.

Definition at line 2461 of file SimpleDisconnectedNetwork.h.

Referenced by ChooseBestSimulator(), and RepeatedExecute().

◆ simulatorsForOptimizations

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
BaseClass::SimulatorsSet Network::SimpleDisconnectedNetwork< Time, Controller >::simulatorsForOptimizations
protected

◆ singularValueThreshold

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
std::string Network::SimpleDisconnectedNetwork< Time, Controller >::singularValueThreshold
protected

◆ useDoublePrecision

template<typename Time = Types::time_type, class Controller = SimpleController<Time>>
bool Network::SimpleDisconnectedNetwork< Time, Controller >::useDoublePrecision = false
protected

Definition at line 2438 of file SimpleDisconnectedNetwork.h.

Referenced by Configure(), and CreateSimulator().


The documentation for this class was generated from the following file: