Maestro 0.3.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Circuits::IOperation< Time > Class Template Referenceabstract

The operation interface. More...

#include <Operations.h>

Inheritance diagram for Circuits::IOperation< Time >:
Collaboration diagram for Circuits::IOperation< Time >:

Public Member Functions

 IOperation (Time delay=0)
 Construct a new IOperation object.
virtual ~IOperation ()=default
 Destroy the IOperation object.
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
virtual Types::qubits_vector AffectedQubits () const
 Returns the affected qubits.
virtual bool CanAffectQuantumState () const
 Find if the operation can affect the quantum state.
virtual std::shared_ptr< IOperation< Time > > Clone () const =0
 Get a shared pointer to a clone of this object.
virtual void Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const =0
 Execute the operation.
Time GetDelay () const
 Get the delay of the operation.
std::shared_ptr< IOperation< Time > > getptr ()
 Get a shared pointer to this object.
virtual OperationType GetType () const
 Get the type of the operation.
virtual bool IsBranching () const
 Checks if the operation is a branching one.
virtual bool IsClifford () const
 Checks if the operation is a Clifford one.
virtual bool IsConditional () const
 Find if the operation is a conditional operation.
bool IsNoiseless () const
 Whether noise models skip this operation.
virtual bool NeedsEntanglementForDistribution () const
 Find if the operation needs entanglement for distribution.
virtual std::shared_ptr< IOperation< Time > > Remap (const std::unordered_map< Types::qubit_t, Types::qubit_t > &qubitsMap, const std::unordered_map< Types::qubit_t, Types::qubit_t > &bitsMap={}) const =0
 Get a shared pointer to a remapped operation.
virtual void SetDelay (Time d)
 Set the delay of the operation.
void SetNoiseless (bool value=true)
 Mark the operation as exempt from injected gate noise.

Detailed Description

template<typename Time = Types::time_type>
class Circuits::IOperation< Time >

The operation interface.

The operation interface along with implementation of some generic functions that apply to all operations.

Template Parameters
TimeThe type of the time parameter.
See also
IOperation

Definition at line 401 of file Operations.h.

Constructor & Destructor Documentation

◆ IOperation()

template<typename Time = Types::time_type>
Circuits::IOperation< Time >::IOperation ( Time delay = 0)
inline

Construct a new IOperation object.

Construct a new IOperation object with the specified execution time.

Parameters
delayThe execution time of the operation.

Definition at line 410 of file Operations.h.

Referenced by Simulators::FusionRoutingOperation::FusionRoutingOperation().

◆ ~IOperation()

template<typename Time = Types::time_type>
virtual Circuits::IOperation< Time >::~IOperation ( )
virtualdefault

Destroy the IOperation object.

Destroy the IOperation object. It's a virtual destructor because this class is an abstract class that needs to be derived from.

Member Function Documentation

◆ AffectedBits()

template<typename Time = Types::time_type>
virtual std::vector< size_t > Circuits::IOperation< Time >::AffectedBits ( ) const
inlinevirtual

◆ AffectedQubits()

◆ CanAffectQuantumState()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::CanAffectQuantumState ( ) const
inlinevirtual

Find if the operation can affect the quantum state.

Returns true if the operation can affect the quantum state, false otherwise.

Returns
True if the operation can affect the quantum state, false otherwise.

Reimplemented in Circuits::Circuit< Time >, Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, Circuits::Delay< Time >, and Circuits::QuantumChannelOperation< Time >.

Definition at line 473 of file Operations.h.

◆ Clone()

template<typename Time = Types::time_type>
virtual std::shared_ptr< IOperation< Time > > Circuits::IOperation< Time >::Clone ( ) const
pure virtual

Get a shared pointer to a clone of this object.

Returns a shared pointer to a copy of this object.

Returns
A shared pointer to this object.

Implemented in Circuits::Circuit< Time >, Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, Circuits::CloneableGate< CCXGate, ThreeQubitsGate, Types::time_type >, Circuits::CloneableGate< CHGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CPGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CRxGate, ControlledRotationGate, Types::time_type >, Circuits::CloneableGate< CRyGate, ControlledRotationGate, Types::time_type >, Circuits::CloneableGate< CRzGate, ControlledRotationGate, Types::time_type >, Circuits::CloneableGate< CSwapGate, ThreeQubitsGate, Types::time_type >, Circuits::CloneableGate< CSxDagGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CSxGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CUGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CXGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CYGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< CZGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< HadamardGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< KGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< PhaseGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< RxGate, RotationGate, Types::time_type >, Circuits::CloneableGate< RyGate, RotationGate, Types::time_type >, Circuits::CloneableGate< RzGate, RotationGate, Types::time_type >, Circuits::CloneableGate< SdgGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< SGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< SwapGate, TwoQubitsGate, Types::time_type >, Circuits::CloneableGate< SxDagGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< SxGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< TdgGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< TGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< UGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< XGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< YGate, SingleQubitGate, Types::time_type >, Circuits::CloneableGate< ZGate, SingleQubitGate, Types::time_type >, Circuits::ConditionalGate< Time >, Circuits::ConditionalMeasurement< Time >, Circuits::ConditionalRandomGen< Time >, Circuits::Delay< Time >, Circuits::MeasurementOperation< Time >, Circuits::NoOperation< Time >, Circuits::QuantumChannelOperation< Time >, Circuits::Random< Time >, Circuits::Reset< Time >, and Simulators::FusionRoutingOperation.

◆ Execute()

template<typename Time = Types::time_type>
virtual void Circuits::IOperation< Time >::Execute ( const std::shared_ptr< Simulators::ISimulator > & sim,
OperationState & state ) const
pure virtual

◆ GetDelay()

template<typename Time = Types::time_type>
Time Circuits::IOperation< Time >::GetDelay ( ) const
inline

◆ getptr()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::IOperation< Time >::getptr ( )
inline

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 535 of file Operations.h.

◆ GetType()

◆ IsBranching()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::IsBranching ( ) const
inlinevirtual

◆ IsClifford()

◆ IsConditional()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::IsConditional ( ) const
inlinevirtual

Find if the operation is a conditional operation.

Returns true if the operation is conditional, false otherwise.

Returns
True if the operation is conditional, false otherwise.

Definition at line 500 of file Operations.h.

◆ IsNoiseless()

template<typename Time = Types::time_type>
bool Circuits::IOperation< Time >::IsNoiseless ( ) const
inline

Whether noise models skip this operation.

Returns
True if no gate noise is injected after this operation.

Definition at line 580 of file Operations.h.

◆ NeedsEntanglementForDistribution()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::NeedsEntanglementForDistribution ( ) const
inlinevirtual

Find if the operation needs entanglement for distribution.

Returns true if the operation needs entanglement for distribution, false otherwise.

Returns
True if the operation needs entanglement for distribution, false otherwise.

Reimplemented in Circuits::Circuit< Time >, Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, and Circuits::QuantumChannelOperation< Time >.

Definition at line 488 of file Operations.h.

◆ Remap()

template<typename Time = Types::time_type>
virtual std::shared_ptr< IOperation< Time > > Circuits::IOperation< Time >::Remap ( const std::unordered_map< Types::qubit_t, Types::qubit_t > & qubitsMap,
const std::unordered_map< Types::qubit_t, Types::qubit_t > & bitsMap = {} ) const
pure virtual

Get a shared pointer to a remapped operation.

Returns a shared pointer to a copy of the operation with qubits and classical bits changed according to the provided maps.

Parameters
qubitsMapThe map of qubits to remap.
bitsMapThe map of classical bits to remap.
Returns
A shared pointer to the remapped object.

Implemented in Circuits::Delay< Time >, Circuits::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::MeasurementOperation< Time >, Circuits::NoOperation< Time >, Circuits::QuantumChannelOperation< Time >, Circuits::Random< Time >, Circuits::Reset< Time >, Circuits::SingleQubitGate< Time >, Circuits::SingleQubitGate< Types::time_type >, Circuits::ThreeQubitsGate< Time >, Circuits::ThreeQubitsGate< Types::time_type >, Circuits::TwoQubitsGate< Time >, Circuits::TwoQubitsGate< Types::time_type >, and Simulators::FusionRoutingOperation.

◆ SetDelay()

template<typename Time = Types::time_type>
virtual void Circuits::IOperation< Time >::SetDelay ( Time d)
inlinevirtual

Set the delay of the operation.

Sets the delay due of the execution time of the operation.

Parameters
dThe delay of the operation.

Definition at line 557 of file Operations.h.

Referenced by Circuits::Delay< Time >::SetDuration().

◆ SetNoiseless()

template<typename Time = Types::time_type>
void Circuits::IOperation< Time >::SetNoiseless ( bool value = true)
inline

Mark the operation as exempt from injected gate noise.

Noise models add no noise after a noiseless operation. This is for basis changes that belong to a non-Z measurement or reset rather than being gates in their own right. Gate copies (Clone, Remap) keep the mark.

Parameters
valueTrue to exempt the operation from gate noise.

Definition at line 570 of file Operations.h.


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