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

The interface for single qubit quantum gates. More...

#include <QuantumGates.h>

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

Public Member Functions

 SingleQubitGate (Types::qubit_t qubit=0, Time delay=0)
 SingleQubitGate constructor.
virtual ~SingleQubitGate ()
 The SingleQubitGate destructor.
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
Types::qubits_vector AffectedQubits () const override
 Get the qubits the quantum gate is applied to.
virtual bool CanAffectQuantumState () const
 Find if the operation can affect the quantum state.
virtual bool CanAffectQuantumState () const
 Find if the operation can affect the quantum state.
virtual bool CanAffectQuantumState () const
 Find if the operation can affect the quantum state.
virtual std::shared_ptr< IOperation< Types::time_type > > Clone () const=0
 Get a shared pointer to a clone of this object.
virtual std::shared_ptr< IOperation< Types::time_type > > Clone () const =0
 Get a shared pointer to a clone of this object.
virtual std::shared_ptr< IOperation< Types::time_type > > 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.
virtual void Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const =0
 Execute the operation.
virtual void Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const=0
 Execute the operation.
Types::time_type GetDelay () const
 Get the delay of the operation.
Types::time_type GetDelay () const
 Get the delay of the operation.
Types::time_type GetDelay () const
 Get the delay of the operation.
virtual QuantumGateType GetGateType () const=0
 Get the type of the quantum gate.
unsigned int GetNumQubits () const override
 Get the number of qubits the quantum gate is applied to.
virtual std::vector< double > GetParams () const
 Get the gate parameters.
std::shared_ptr< IOperation< Types::time_type > > getptr ()
 Get a shared pointer to this object.
std::shared_ptr< IOperation< Types::time_type > > getptr ()
 Get a shared pointer to this object.
std::shared_ptr< IOperation< Types::time_type > > getptr ()
 Get a shared pointer to this object.
Types::qubit_t GetQubit (unsigned int index=0) const override
 Get the qubit the quantum gate is applied to.
OperationType GetType () const override
 Get the type of the operation.
OperationType GetType () const override
 Get the type of the operation.
virtual bool IsBranching () const
 Checks if the operation is a branching one.
virtual bool IsBranching () const
 Checks if the operation is a branching one.
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 IsClifford () const
 Checks if the operation is a Clifford 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.
virtual bool IsConditional () const
 Find if the operation is a conditional operation.
virtual bool IsConditional () const
 Find if the operation is a conditional operation.
virtual bool NeedsEntanglementForDistribution () const
 Find if the operation needs entanglement for distribution.
virtual bool NeedsEntanglementForDistribution () const
 Find if the operation needs entanglement for distribution.
virtual bool NeedsEntanglementForDistribution () const
 Find if the operation needs entanglement for distribution.
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 override
 Get a shared pointer to a remapped operation.
void SetDelay (Types::time_type d)
 Set the delay of the operation.
void SetDelay (Types::time_type d)
 Set the delay of the operation.
void SetDelay (Types::time_type d)
 Set the delay of the operation.
void SetQubit (Types::qubit_t q, unsigned long index=0) override
 Set the qubit the quantum gate is applied to.

Detailed Description

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

The interface for single qubit quantum gates.

The interface for single qubit quantum gates. Single qubit quantum gates are quantum operations that can be applied to a single qubit. This class is abstract and will be derived from.

Template Parameters
TimeThe type of the execution delay.
See also
IQuantumGate

Definition at line 113 of file QuantumGates.h.

Constructor & Destructor Documentation

◆ SingleQubitGate()

template<typename Time = Types::time_type>
Circuits::SingleQubitGate< Time >::SingleQubitGate ( Types::qubit_t qubit = 0,
Time delay = 0 )
inline

SingleQubitGate constructor.

Constructs the SingleQubitGate object. If specified, the delay is the time the quantum gate takes to execute.

Parameters
qubitThe qubit the quantum gate is applied to.
delayThe time the quantum gate takes to execute.
See also
IQuantumGate

Definition at line 124 of file QuantumGates.h.

References Circuits::IQuantumGate< Types::time_type >::IQuantumGate().

◆ ~SingleQubitGate()

template<typename Time = Types::time_type>
virtual Circuits::SingleQubitGate< Time >::~SingleQubitGate ( )
inlinevirtual

The SingleQubitGate destructor.

The SingleQubitGate destructor, virtual because this is an abstract class that will be derived from.

Definition at line 133 of file QuantumGates.h.

Member Function Documentation

◆ AffectedBits() [1/3]

virtual std::vector< size_t > Circuits::IOperation< Types::time_type >::AffectedBits ( ) const
inlinevirtualinherited

Returns the affected bits.

Returns the affected classical bits.

Returns
The affected bits.

Reimplemented in Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, Circuits::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::MeasurementOperation< Time >, and Circuits::Random< Time >.

Definition at line 478 of file Operations.h.

◆ AffectedBits() [2/3]

virtual std::vector< size_t > Circuits::IOperation< Types::time_type >::AffectedBits ( ) const
inlinevirtualinherited

Returns the affected bits.

Returns the affected classical bits.

Returns
The affected bits.

Definition at line 478 of file Operations.h.

◆ AffectedBits() [3/3]

virtual std::vector< size_t > Circuits::IOperation< Types::time_type >::AffectedBits ( ) const
inlinevirtualinherited

Returns the affected bits.

Returns the affected classical bits.

Returns
The affected bits.

Definition at line 478 of file Operations.h.

◆ AffectedQubits()

template<typename Time = Types::time_type>
Types::qubits_vector Circuits::SingleQubitGate< Time >::AffectedQubits ( ) const
inlineoverridevirtual

Get the qubits the quantum gate is applied to.

Returns the qubits the quantum gate is applied to, in this case a single qubit.

Returns
The qubits the quantum gate is applied to.

Reimplemented from Circuits::IOperation< Types::time_type >.

Definition at line 176 of file QuantumGates.h.

◆ CanAffectQuantumState() [1/3]

virtual bool Circuits::IOperation< Types::time_type >::CanAffectQuantumState ( ) const
inlinevirtualinherited

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 >, and Circuits::Circuit< Types::time_type >.

Definition at line 429 of file Operations.h.

◆ CanAffectQuantumState() [2/3]

virtual bool Circuits::IOperation< Types::time_type >::CanAffectQuantumState ( ) const
inlinevirtualinherited

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.

Definition at line 429 of file Operations.h.

◆ CanAffectQuantumState() [3/3]

virtual bool Circuits::IOperation< Types::time_type >::CanAffectQuantumState ( ) const
inlinevirtualinherited

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.

Definition at line 429 of file Operations.h.

◆ Clone() [1/3]

◆ Clone() [2/3]

virtual std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< Types::time_type >::Clone ( ) const
pure virtualinherited

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.

◆ Clone() [3/3]

virtual std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< Types::time_type >::Clone ( ) const
pure virtualinherited

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.

◆ Execute() [1/3]

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

◆ Execute() [2/3]

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

Execute the operation.

Execute the operation on the specified simulator.

Parameters
simThe simulator to execute the operation on.
stateThe state of the operation.
See also
ISimulator
OperationState

◆ Execute() [3/3]

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

Execute the operation.

Execute the operation on the specified simulator.

Parameters
simThe simulator to execute the operation on.
stateThe state of the operation.
See also
ISimulator
OperationState

◆ GetDelay() [1/3]

Get the delay of the operation.

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

Returns
The delay of the operation.

Definition at line 497 of file Operations.h.

Referenced by Circuits::NoOperation< Time >::Clone().

◆ GetDelay() [2/3]

Types::time_type Circuits::IOperation< Types::time_type >::GetDelay ( ) const
inlineinherited

Get the delay of the operation.

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

Returns
The delay of the operation.

Definition at line 497 of file Operations.h.

◆ GetDelay() [3/3]

Types::time_type Circuits::IOperation< Types::time_type >::GetDelay ( ) const
inlineinherited

Get the delay of the operation.

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

Returns
The delay of the operation.

Definition at line 497 of file Operations.h.

◆ GetGateType()

◆ GetNumQubits()

template<typename Time = Types::time_type>
unsigned int Circuits::SingleQubitGate< Time >::GetNumQubits ( ) const
inlineoverridevirtual

Get the number of qubits the quantum gate is applied to.

Returns the number of qubits the quantum gate is applied to, in this case 1.

Returns
The number of qubits the quantum gate is applied to: 1.

Implements Circuits::IGateOperation< Types::time_type >.

Definition at line 142 of file QuantumGates.h.

◆ GetParams()

virtual std::vector< double > Circuits::IQuantumGate< Types::time_type >::GetParams ( ) const
inlinevirtualinherited

Get the gate parameters.

Returns the parameters of the gate.

Returns
A vector with the parameters of the gate, empty if there are no parameters.

Reimplemented in Circuits::ControlledRotationGate< Time >, Circuits::ControlledRotationGate< Types::time_type >, Circuits::CPGate< Time >, Circuits::CUGate< Time >, Circuits::PhaseGate< Time >, Circuits::RotationGate< Time >, Circuits::RotationGate< Types::time_type >, and Circuits::UGate< Time >.

Definition at line 99 of file QuantumGates.h.

◆ getptr() [1/3]

std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< 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 487 of file Operations.h.

◆ getptr() [2/3]

std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< 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 487 of file Operations.h.

◆ getptr() [3/3]

std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< 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 487 of file Operations.h.

◆ GetQubit()

template<typename Time = Types::time_type>
Types::qubit_t Circuits::SingleQubitGate< Time >::GetQubit ( unsigned int index = 0) const
inlineoverridevirtual

Get the qubit the quantum gate is applied to.

Returns the qubit the quantum gate is applied to. Either specify zero for the index or leave it default. The parameter value is ignored anyway.

Parameters
indexThe index of the qubit to get (ignored, default 0).
Returns
The qubit the quantum gate is applied to.

Implements Circuits::IGateOperation< Types::time_type >.

Definition at line 165 of file QuantumGates.h.

Referenced by Circuits::HadamardGate< Time >::Clone(), Circuits::KGate< Time >::Clone(), Circuits::PhaseGate< Time >::Clone(), Circuits::RxGate< Time >::Clone(), Circuits::RyGate< Time >::Clone(), Circuits::RzGate< Time >::Clone(), Circuits::SdgGate< Time >::Clone(), Circuits::SGate< Time >::Clone(), Circuits::SxDagGate< Time >::Clone(), Circuits::SxGate< Time >::Clone(), Circuits::TdgGate< Time >::Clone(), Circuits::TGate< Time >::Clone(), Circuits::UGate< Time >::Clone(), Circuits::XGate< Time >::Clone(), Circuits::YGate< Time >::Clone(), Circuits::ZGate< Time >::Clone(), Circuits::HadamardGate< Time >::Execute(), Circuits::KGate< Time >::Execute(), Circuits::PhaseGate< Time >::Execute(), Circuits::RxGate< Time >::Execute(), Circuits::RyGate< Time >::Execute(), Circuits::RzGate< Time >::Execute(), Circuits::SdgGate< Time >::Execute(), Circuits::SGate< Time >::Execute(), Circuits::SxDagGate< Time >::Execute(), Circuits::SxGate< Time >::Execute(), Circuits::TdgGate< Time >::Execute(), Circuits::TGate< Time >::Execute(), Circuits::UGate< Time >::Execute(), Circuits::XGate< Time >::Execute(), Circuits::YGate< Time >::Execute(), and Circuits::ZGate< Time >::Execute().

◆ GetType() [1/2]

OperationType Circuits::IGateOperation< Types::time_type >::GetType ( ) const
inlineoverridevirtualinherited

Get the type of the operation.

Get the type of the operation, in this case, gate.

Returns
The type of the operation, gate in this case.
See also
OperationType

Reimplemented from Circuits::IOperation< Types::time_type >.

Definition at line 631 of file Operations.h.

◆ GetType() [2/2]

OperationType Circuits::IGateOperation< Types::time_type >::GetType ( ) const
inlineoverrideinherited

Get the type of the operation.

Get the type of the operation, in this case, gate.

Returns
The type of the operation, gate in this case.
See also
OperationType

Definition at line 631 of file Operations.h.

◆ IsBranching() [1/3]

virtual bool Circuits::IOperation< Types::time_type >::IsBranching ( ) const
inlinevirtualinherited

◆ IsBranching() [2/3]

virtual bool Circuits::IOperation< Types::time_type >::IsBranching ( ) const
inlinevirtualinherited

Checks if the operation is a branching one.

Checks if the operation is a branching one, meaning that it can lead to splitting paths (relevant for the path integral simulator).

Returns
True if it branches a path, false otherwise.

Definition at line 526 of file Operations.h.

◆ IsBranching() [3/3]

virtual bool Circuits::IOperation< Types::time_type >::IsBranching ( ) const
inlinevirtualinherited

Checks if the operation is a branching one.

Checks if the operation is a branching one, meaning that it can lead to splitting paths (relevant for the path integral simulator).

Returns
True if it branches a path, false otherwise.

Definition at line 526 of file Operations.h.

◆ IsClifford() [1/3]

◆ IsClifford() [2/3]

virtual bool Circuits::IOperation< Types::time_type >::IsClifford ( ) const
inlinevirtualinherited

Checks if the operation is a Clifford one.

Checks if the operation is a Clifford one, allowing to be simulated in a stabilizers simulator.

Returns
True if it can be applied in a stabilizers simulator, false otherwise.

Definition at line 516 of file Operations.h.

◆ IsClifford() [3/3]

virtual bool Circuits::IOperation< Types::time_type >::IsClifford ( ) const
inlinevirtualinherited

Checks if the operation is a Clifford one.

Checks if the operation is a Clifford one, allowing to be simulated in a stabilizers simulator.

Returns
True if it can be applied in a stabilizers simulator, false otherwise.

Definition at line 516 of file Operations.h.

◆ IsConditional() [1/3]

virtual bool Circuits::IOperation< Types::time_type >::IsConditional ( ) const
inlinevirtualinherited

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

◆ IsConditional() [2/3]

virtual bool Circuits::IOperation< Types::time_type >::IsConditional ( ) const
inlinevirtualinherited

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

◆ IsConditional() [3/3]

virtual bool Circuits::IOperation< Types::time_type >::IsConditional ( ) const
inlinevirtualinherited

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

◆ NeedsEntanglementForDistribution() [1/3]

virtual bool Circuits::IOperation< Types::time_type >::NeedsEntanglementForDistribution ( ) const
inlinevirtualinherited

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 >, and Circuits::Circuit< Types::time_type >.

Definition at line 446 of file Operations.h.

◆ NeedsEntanglementForDistribution() [2/3]

virtual bool Circuits::IOperation< Types::time_type >::NeedsEntanglementForDistribution ( ) const
inlinevirtualinherited

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.

Definition at line 446 of file Operations.h.

◆ NeedsEntanglementForDistribution() [3/3]

virtual bool Circuits::IOperation< Types::time_type >::NeedsEntanglementForDistribution ( ) const
inlinevirtualinherited

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.

Definition at line 446 of file Operations.h.

◆ Remap()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::SingleQubitGate< 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
inlineoverridevirtual

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.

Implements Circuits::IOperation< Types::time_type >.

Definition at line 188 of file QuantumGates.h.

◆ SetDelay() [1/3]

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

◆ SetDelay() [2/3]

void Circuits::IOperation< Types::time_type >::SetDelay ( Types::time_type d)
inlineinherited

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

◆ SetDelay() [3/3]

void Circuits::IOperation< Types::time_type >::SetDelay ( Types::time_type d)
inlineinherited

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

◆ SetQubit()

template<typename Time = Types::time_type>
void Circuits::SingleQubitGate< Time >::SetQubit ( Types::qubit_t q,
unsigned long index = 0 )
inlineoverridevirtual

Set the qubit the quantum gate is applied to.

Sets the qubit the quantum gate is applied to. Either specify zero for the index or leave it default.

Parameters
qThe qubit the quantum gate is applied to.
indexThe index of the qubit to set (ignored, default 0).

Implements Circuits::IGateOperation< Types::time_type >.

Definition at line 152 of file QuantumGates.h.


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