Maestro 0.2.5
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Network::IController< Time > Class Template Referenceabstract

The controller host interface. More...

#include <Controller.h>

+ Inheritance diagram for Network::IController< Time >:
+ Collaboration diagram for Network::IController< Time >:

Public Member Functions

virtual bool AreCbitsOnSameHost (size_t cbitId1, size_t cbitId2) const =0
 Check if two classical bits are in the same host.
 
virtual bool AreQubitsOnSameHost (size_t qubitId1, size_t qubitId2) const =0
 Check if two qubits are in the same host.
 
virtual void CreateOptimiser (Graphs::OptimiserType type)=0
 Creates an optimiser.
 
virtual void CreateScheduler (const std::shared_ptr< INetwork< Time > > &network, SchedulerType schType=SchedulerType::kNoEntanglementQubitsParallel)=0
 Create the scheduler for the network.
 
virtual std::shared_ptr< Circuits::Circuit< Time > > DistributeCircuit (const std::shared_ptr< INetwork< Time > > &network, const std::shared_ptr< Circuits::Circuit< Time > > &circuit)=0
 Distributes the circuit on the hosts.
 
virtual std::shared_ptr< Circuits::Circuit< Time > > DoNetworkSpecificConversionsForDistribution (const std::shared_ptr< INetwork< Time > > &network, const std::shared_ptr< Circuits::Circuit< Time > > &circuit)=0
 Convert the circuit for distribution for specific networks.
 
virtual std::vector< size_t > GetClassicalBitsIds () const =0
 Get the ids of the classical bits in the host.
 
virtual std::vector< size_t > GetEntangledQubitMeasurementBitIds () const =0
 Get the ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host.
 
virtual size_t GetId () const =0
 Get the host id.
 
virtual std::vector< size_t > GetNetworkEntangledQubitsIds () const =0
 Get the ids of the qubits used for entanglement between hosts in the host.
 
virtual size_t GetNumClassicalBits () const =0
 Get the number of classical bits.
 
virtual size_t GetNumNetworkEntangledQubits () const =0
 Get the number of network entangled qubits.
 
virtual size_t GetNumQubits () const =0
 Get the number of qubits.
 
virtual std::shared_ptr< Graphs::IOptimiser< Time > > GetOptimiser () const =0
 Returns the optimiser used.
 
virtual bool GetOptimizeCircuit () const =0
 Get circuit optimization.
 
virtual bool GetOptimizeRotationGates () const =0
 
std::shared_ptr< IHost< Time > > getptr ()
 Get a shared pointer to this object.
 
virtual std::vector< size_t > GetQubitsIds () const =0
 Get the ids of the qubits in the host.
 
virtual std::shared_ptr< Distribution::IRemapper< Time > > GetRemapper () const =0
 Gets the remapper that is used for remapping a circuit to a distributed one.
 
virtual std::shared_ptr< Schedulers::IScheduler< Time > > GetScheduler () const =0
 Get the scheduler for the network.
 
virtual size_t GetStartClassicalBitId () const =0
 Get the id of the first classical bit assigned to the host.
 
virtual size_t GetStartQubitId () const =0
 Get the id of the first qubit assigned to the host.
 
virtual bool IsClassicalBitOnHost (size_t cbitId) const =0
 Check if a classical bit is in the host.
 
virtual bool IsEntangledQubitOnHost (size_t qubitId) const =0
 Check if a qubit used for entanglement between hosts is in the host.
 
virtual bool IsQubitOnHost (size_t qubitId) const =0
 Check if a qubit is in the host.
 
virtual bool RecvPacketFromHost (size_t hostId, const std::vector< uint8_t > &packet)=0
 Receive a packet from a host.
 
virtual bool SendPacketToHost (size_t hostId, const std::vector< uint8_t > &packet)=0
 Send a packet to a host.
 
virtual void SetOptimizeCircuit (bool optimize=true)=0
 Set circuit optimization.
 
virtual void SetOptimizeRotationGates (bool val=true)=0
 
virtual void SetRemapper (const std::shared_ptr< Distribution::IRemapper< Time > > &remapper)=0
 Changes the remapper that is used for remapping a circuit to a distributed one.
 
virtual std::shared_ptr< Circuits::Circuit< Time > > SplitCompositeOperations (const std::shared_ptr< INetwork< Time > > &network, const std::shared_ptr< Circuits::Circuit< Time > > &circuit)=0
 Splits the composite operations from the circuit.
 

Detailed Description

template<typename Time = Types::time_type>
class Network::IController< Time >

The controller host interface.

The controller is a special kind of host, it is the one that distributes the circuit to the other hosts.

Template Parameters
TimeThe time representation to use for execution times.
See also
IHost
INetwork

Definition at line 106 of file Controller.h.

Member Function Documentation

◆ AreCbitsOnSameHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::AreCbitsOnSameHost ( size_t  cbitId1,
size_t  cbitId2 
) const
pure virtualinherited

Check if two classical bits are in the same host.

Checks if two classical bits with the specified ids are in the same host.

Returns
True if the classical bits are on the same host, false otherwise.

Implemented in Network::SimpleHost< Time >, and Network::SimpleController< Time >.

◆ AreQubitsOnSameHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::AreQubitsOnSameHost ( size_t  qubitId1,
size_t  qubitId2 
) const
pure virtualinherited

Check if two qubits are in the same host.

Checks if two qubits with the specified ids are in the same host, excluding the one(s) used only for entanglement with other hosts.

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

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ CreateOptimiser()

template<typename Time = Types::time_type>
virtual void Network::IController< Time >::CreateOptimiser ( Graphs::OptimiserType  type)
pure virtual

Creates an optimiser.

Creates an optimiser of the specified type.

Parameters
typeThe type of optimiser to create.

Implemented in Network::SimpleController< Time >.

◆ CreateScheduler()

template<typename Time = Types::time_type>
virtual void Network::IController< Time >::CreateScheduler ( const std::shared_ptr< INetwork< Time > > &  network,
SchedulerType  schType = SchedulerType::kNoEntanglementQubitsParallel 
)
pure virtual

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
networkThe network to create the scheduler for.
simTypeThe type of the scheduler to create.
See also
SchedulerType

Implemented in Network::SimpleController< Time >.

◆ DistributeCircuit()

template<typename Time = Types::time_type>
virtual std::shared_ptr< Circuits::Circuit< Time > > Network::IController< Time >::DistributeCircuit ( const std::shared_ptr< INetwork< Time > > &  network,
const std::shared_ptr< Circuits::Circuit< Time > > &  circuit 
)
pure virtual

Distributes the circuit on the hosts.

The network will call this, the conversion and distribution that should happen before execution.

Parameters
networkThe network to distribute the circuit for.
circuitThe circuit to distribute.
Returns
The distributed circuit.

Implemented in Network::SimpleController< Time >.

◆ DoNetworkSpecificConversionsForDistribution()

template<typename Time = Types::time_type>
virtual std::shared_ptr< Circuits::Circuit< Time > > Network::IController< Time >::DoNetworkSpecificConversionsForDistribution ( const std::shared_ptr< INetwork< Time > > &  network,
const std::shared_ptr< Circuits::Circuit< Time > > &  circuit 
)
pure virtual

Convert the circuit for distribution for specific networks.

Convert the circuit for distribution for specific networks. Particular networks might need additional circuit conversions before distribution. They should override this implementation. By default, it does nothing.

Parameters
networkThe network to convert the circuit for.
circuitThe circuit to convert.
Returns
The converted circuit.
See also
Circuits::Circuit

Implemented in Network::SimpleController< Time >.

◆ GetClassicalBitsIds()

template<typename Time = Types::time_type>
virtual std::vector< size_t > Network::IHost< Time >::GetClassicalBitsIds ( ) const
pure virtualinherited

Get the ids of the classical bits in the host.

Obtain the ids of the classical bits in the host.

Returns
The ids of the classical bits in the host.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetEntangledQubitMeasurementBitIds()

template<typename Time = Types::time_type>
virtual std::vector< size_t > Network::IHost< Time >::GetEntangledQubitMeasurementBitIds ( ) const
pure virtualinherited

Get the ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host.

Obtain the ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host.

Returns
The ids of the classical bits used for measurement of the qubits used for entanglement between hosts present in the host.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetId()

template<typename Time = Types::time_type>
virtual size_t Network::IHost< Time >::GetId ( ) const
pure virtualinherited

Get the host id.

Obtain a host id used to identify the host in the network.

Returns
The host id.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetNetworkEntangledQubitsIds()

template<typename Time = Types::time_type>
virtual std::vector< size_t > Network::IHost< Time >::GetNetworkEntangledQubitsIds ( ) const
pure virtualinherited

Get the ids of the qubits used for entanglement between hosts in the host.

Obtain the ids of the qubits used for entanglement between hosts in the host.

Returns
The ids of the qubits used for entanglement between hosts in the host.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetNumClassicalBits()

template<typename Time = Types::time_type>
virtual size_t Network::IHost< Time >::GetNumClassicalBits ( ) const
pure virtualinherited

Get the number of classical bits.

Obtain the number of classical bits in the host. This does not include the bits used for measurement of the network entangled qubits.

Returns
The number of classical bits.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetNumNetworkEntangledQubits()

template<typename Time = Types::time_type>
virtual size_t Network::IHost< Time >::GetNumNetworkEntangledQubits ( ) const
pure virtualinherited

Get the number of network entangled qubits.

Obtain the number of qubits in the host used for entanglement with other hosts.

Returns
The number of network entangled qubits.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetNumQubits()

template<typename Time = Types::time_type>
virtual size_t Network::IHost< Time >::GetNumQubits ( ) const
pure virtualinherited

Get the number of qubits.

Obtain the number of qubits in the host, excluding the one(s) used only for entanglement with other hosts.

Returns
The number of qubits.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetOptimiser()

template<typename Time = Types::time_type>
virtual std::shared_ptr< Graphs::IOptimiser< Time > > Network::IController< Time >::GetOptimiser ( ) const
pure virtual

Returns the optimiser used.

Returns the optimiser used. Could be nullptr, that is, no optimiser.

Returns
The optimiser used.

Implemented in Network::SimpleController< Time >.

◆ GetOptimizeCircuit()

template<typename Time = Types::time_type>
virtual bool Network::IController< Time >::GetOptimizeCircuit ( ) const
pure virtual

Get circuit optimization.

Returns true if the circuit will be optimized, false otherwise.

Returns
True if the circuit will be optimized, false otherwise.

Implemented in Network::SimpleController< Time >.

◆ GetOptimizeRotationGates()

template<typename Time = Types::time_type>
virtual bool Network::IController< Time >::GetOptimizeRotationGates ( ) const
pure virtual

◆ getptr()

template<typename Time = Types::time_type>
std::shared_ptr< IHost< Time > > Network::IHost< Time >::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 233 of file Host.h.

◆ GetQubitsIds()

template<typename Time = Types::time_type>
virtual std::vector< size_t > Network::IHost< Time >::GetQubitsIds ( ) const
pure virtualinherited

Get the ids of the qubits in the host.

Obtain the ids of the qubits in the host, excluding the one(s) used only for entanglement with other hosts.

Returns
The ids of the qubits in the host.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetRemapper()

template<typename Time = Types::time_type>
virtual std::shared_ptr< Distribution::IRemapper< Time > > Network::IController< Time >::GetRemapper ( ) const
pure virtual

Gets the remapper that is used for remapping a circuit to a distributed one.

The remapper is used to remap the circuit to a distributed one.

Returns
The remapper.
See also
Distribution::IRemapper

Implemented in Network::SimpleController< Time >.

◆ GetScheduler()

template<typename Time = Types::time_type>
virtual std::shared_ptr< Schedulers::IScheduler< Time > > Network::IController< Time >::GetScheduler ( ) const
pure virtual

Get the scheduler for the network.

Get the scheduler for the network.

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

Implemented in Network::SimpleController< Time >.

◆ GetStartClassicalBitId()

template<typename Time = Types::time_type>
virtual size_t Network::IHost< Time >::GetStartClassicalBitId ( ) const
pure virtualinherited

Get the id of the first classical bit assigned to the host.

Obtain the id of the first classical bit assigned to the host, the other ones are assigned contiquously.

Returns
The id of the first classical bit assigned to the host.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ GetStartQubitId()

template<typename Time = Types::time_type>
virtual size_t Network::IHost< Time >::GetStartQubitId ( ) const
pure virtualinherited

Get the id of the first qubit assigned to the host.

Obtain the id of the first qubit assigned to the host, the other ones are assigned contiquously.

Returns
The id of the first qubit assigned to the host.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ IsClassicalBitOnHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::IsClassicalBitOnHost ( size_t  cbitId) const
pure virtualinherited

Check if a classical bit is in the host.

Checks if a classical bit with the specified id is in the host.

Returns
True if the classical bit is on this host, false otherwise.

Implemented in Network::SimpleHost< Time >, and Network::SimpleController< Time >.

◆ IsEntangledQubitOnHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::IsEntangledQubitOnHost ( size_t  qubitId) const
pure virtualinherited

Check if a qubit used for entanglement between hosts is in the host.

Checks if a qubit used for entanglement between hosts with the specified id is in the host.

Returns
True if the network entangled qubit is on this host, false otherwise.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ IsQubitOnHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::IsQubitOnHost ( size_t  qubitId) const
pure virtualinherited

Check if a qubit is in the host.

Checks if a qubit with the specified id is in the host, excluding the one(s) used only for entanglement with other hosts.

Returns
True if the qubit is on this host, false otherwise.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ RecvPacketFromHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::RecvPacketFromHost ( size_t  hostId,
const std::vector< uint8_t > &  packet 
)
pure virtualinherited

Receive a packet from a host.

Receive a packet from a host. Usually called by the network implementation.

Parameters
hostIdThe id of the host to receive the packet from.
packetThe packet to receive.
Returns
True if the packet was received successfully, false otherwise.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ SendPacketToHost()

template<typename Time = Types::time_type>
virtual bool Network::IHost< Time >::SendPacketToHost ( size_t  hostId,
const std::vector< uint8_t > &  packet 
)
pure virtualinherited

Send a packet to a host.

Send a packet to a host. Usually called by the host implementation or perhaps in some cases by the network implementation.

Parameters
hostIdThe id of the host to send the packet to.
packetThe packet to send.
Returns
True if the packet was sent successfully, false otherwise.

Implemented in Network::SimpleController< Time >, and Network::SimpleHost< Time >.

◆ SetOptimizeCircuit()

template<typename Time = Types::time_type>
virtual void Network::IController< Time >::SetOptimizeCircuit ( bool  optimize = true)
pure virtual

Set circuit optimization.

If the parameter is true, the circuit will be optimized, otherwise it will not be optimized. The default value is true.

Parameters
optimizeTrue if the circuit should be optimized, false otherwise.

Implemented in Network::SimpleController< Time >.

◆ SetOptimizeRotationGates()

template<typename Time = Types::time_type>
virtual void Network::IController< Time >::SetOptimizeRotationGates ( bool  val = true)
pure virtual

◆ SetRemapper()

template<typename Time = Types::time_type>
virtual void Network::IController< Time >::SetRemapper ( const std::shared_ptr< Distribution::IRemapper< Time > > &  remapper)
pure virtual

Changes the remapper that is used for remapping a circuit to a distributed one.

The remapper is used to remap the circuit to a distributed one.

Parameters
remapperThe new remapper.
See also
Distribution::IRemapper

Implemented in Network::SimpleController< Time >.

◆ SplitCompositeOperations()

template<typename Time = Types::time_type>
virtual std::shared_ptr< Circuits::Circuit< Time > > Network::IController< Time >::SplitCompositeOperations ( const std::shared_ptr< INetwork< Time > > &  network,
const std::shared_ptr< Circuits::Circuit< Time > > &  circuit 
)
pure virtual

Splits the composite operations from the circuit.

Splits some composite operations. There are composite operations - other than multiple qubits quantum gates - that act on multiple qubits/classical bits that might act on qubits that are not local. This function splits those operations into ones that act on a single qubit/classical bit. For example measurements on several qubits are split into several measurements on a single qubit.

Parameters
networkThe network to execute the circuit for.
circuitThe circuit to execute.
Returns
A shared pointer to the modified circuit.
See also
Circuits::Circuit
INetwork

Implemented in Network::SimpleController< Time >.


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