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

The interface for quantum gates. More...

#include <QuantumGates.h>

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

Public Member Functions

 IQuantumGate (Time delay=0)
 IQuantumGate constructor.
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
virtual Types::qubits_vector AffectedQubits () const
 Returns the affected qubits.
virtual Types::qubits_vector AffectedQubits () const
 Returns the affected qubits.
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 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.
virtual QuantumGateType GetGateType () const =0
 Get the type of the quantum gate.
virtual unsigned int GetNumQubits () const=0
 Get the number of qubits.
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.
virtual Types::qubit_t GetQubit (unsigned int index=0) const=0
 Get the qubit involved.
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 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 NeedsEntanglementForDistribution () const
 Find if the operation needs entanglement for distribution.
virtual bool NeedsEntanglementForDistribution () const
 Find if the operation needs entanglement for distribution.
virtual std::shared_ptr< IOperation< Types::time_type > > 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 std::shared_ptr< IOperation< Types::time_type > > 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.
void SetDelay (Types::time_type d)
 Set the delay of the operation.
void SetDelay (Types::time_type d)
 Set the delay of the operation.
virtual void SetQubit (Types::qubit_t qubit, unsigned long index=0)=0
 Set the qubits involved.

Detailed Description

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

The interface for quantum gates.

The interface for quantum gates. Quantum gates are quantum operations that can be applied to a quantum state.

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

Definition at line 72 of file QuantumGates.h.

Constructor & Destructor Documentation

◆ IQuantumGate()

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

IQuantumGate constructor.

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

See also
IGateOperation

Definition at line 81 of file QuantumGates.h.

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

Member Function Documentation

◆ AffectedBits() [1/2]

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() [2/2]

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.

◆ AffectedQubits() [1/2]

virtual Types::qubits_vector Circuits::IOperation< Types::time_type >::AffectedQubits ( ) const
inlinevirtualinherited

Returns the affected qubits.

Returns the affected qubits by the operation.

Returns
A vector with the affected qubits.

Definition at line 470 of file Operations.h.

◆ AffectedQubits() [2/2]

◆ CanAffectQuantumState() [1/2]

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() [2/2]

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.

◆ Clone() [1/2]

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() [2/2]

◆ Execute() [1/2]

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() [2/2]

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

◆ GetDelay() [1/2]

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() [2/2]

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

◆ GetGateType()

◆ GetNumQubits()

virtual unsigned int Circuits::IGateOperation< Types::time_type >::GetNumQubits ( ) const
pure virtualinherited

Get the number of qubits.

Get the number of qubits the gate operates on.

Returns
The number of qubits the gate operates on.

Implemented in Circuits::SingleQubitGate< Time >, Circuits::SingleQubitGate< Types::time_type >, Circuits::ThreeQubitsGate< Time >, Circuits::ThreeQubitsGate< Types::time_type >, Circuits::TwoQubitsGate< Time >, and Circuits::TwoQubitsGate< Types::time_type >.

◆ GetParams()

template<typename Time = Types::time_type>
virtual std::vector< double > Circuits::IQuantumGate< Time >::GetParams ( ) const
inlinevirtual

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.

Referenced by Circuits::ComparableCircuit< Time >::operator==().

◆ getptr() [1/2]

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/2]

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

virtual Types::qubit_t Circuits::IGateOperation< Types::time_type >::GetQubit ( unsigned int index = 0) const
pure virtualinherited

Get the qubit involved.

Get the qubit involved.

Parameters
indexThe index of the qubit to get (0, 1, or 2, the maximum depending on the number of qubits of the gate).
Returns
The qubit involved.

Implemented in Circuits::SingleQubitGate< Time >, Circuits::SingleQubitGate< Types::time_type >, Circuits::ThreeQubitsGate< Time >, Circuits::ThreeQubitsGate< Types::time_type >, Circuits::TwoQubitsGate< Time >, and Circuits::TwoQubitsGate< Types::time_type >.

◆ GetType()

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.

◆ IsBranching() [1/2]

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() [2/2]

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

◆ IsClifford() [1/2]

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() [2/2]

◆ IsConditional() [1/2]

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/2]

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/2]

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() [2/2]

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.

◆ Remap() [1/2]

virtual std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< Types::time_type >::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 virtualinherited

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.

◆ Remap() [2/2]

virtual std::shared_ptr< IOperation< Types::time_type > > Circuits::IOperation< Types::time_type >::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 virtualinherited

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::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::MeasurementOperation< Time >, Circuits::NoOperation< 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 >, and Circuits::TwoQubitsGate< Types::time_type >.

◆ SetDelay() [1/2]

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() [2/2]

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

virtual void Circuits::IGateOperation< Types::time_type >::SetQubit ( Types::qubit_t qubit,
unsigned long index = 0 )
pure virtualinherited

Set the qubits involved.

Set the qubits involved.

Parameters
qubitThe qubit to set.
indexThe index of the qubit to set (0 for 1 qubit gates, 0 and 1 for two qubit gates, 0, 1 and 3 for three qubit gates).

Implemented in Circuits::SingleQubitGate< Time >, Circuits::SingleQubitGate< Types::time_type >, Circuits::ThreeQubitsGate< Time >, Circuits::ThreeQubitsGate< Types::time_type >, Circuits::TwoQubitsGate< Time >, and Circuits::TwoQubitsGate< Types::time_type >.


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