Maestro 0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Circuits::TwoQubitsGate< Time > Class Template Reference

The interface for two qubits quantum gates. More...

#include <QuantumGates.h>

Inheritance diagram for Circuits::TwoQubitsGate< Time >:
Circuits::IQuantumGate< Types::time_type > Circuits::IGateOperation< Types::time_type > Circuits::IOperation< Types::time_type >

Public Member Functions

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

Detailed Description

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

The interface for two qubits quantum gates.

The interface for two qubits quantum gates. Two qubits quantum gates are quantum operations that can be applied to two qubits.

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

Definition at line 217 of file QuantumGates.h.

Constructor & Destructor Documentation

◆ TwoQubitsGate()

template<typename Time = Types::time_type>
Circuits::TwoQubitsGate< Time >::TwoQubitsGate ( Types::qubit_t qubit1 = 0,
Types::qubit_t qubit2 = 0,
Time delay = 0 )
inline

TwoQubitsGate constructor.

Constructs the TwoQubitsGate object. If specified, the delay is the time the quantum gate takes to execute. This gate is abstract and will be derived from.

Parameters
qubit1The first qubit the quantum gate is applied to.
qubit2The second qubit the quantum gate is applied to.
delayThe time the quantum gate takes to execute.
See also
IQuantumGate

Definition at line 230 of file QuantumGates.h.

◆ ~TwoQubitsGate()

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

The TwoQubitsGate destructor.

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

Definition at line 240 of file QuantumGates.h.

Member Function Documentation

◆ AffectedQubits()

template<typename Time = Types::time_type>
Types::qubits_vector Circuits::TwoQubitsGate< 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 two qubits.

Returns
The qubits the quantum gate is applied to.

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

Definition at line 290 of file QuantumGates.h.

◆ GetNumQubits()

template<typename Time = Types::time_type>
unsigned int Circuits::TwoQubitsGate< 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 2.

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

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

Definition at line 249 of file QuantumGates.h.

◆ GetQubit()

template<typename Time = Types::time_type>
Types::qubit_t Circuits::TwoQubitsGate< 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 or one for the index or leave it default (0). If anything else is used, it will return UINT_MAX.

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

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

Definition at line 275 of file QuantumGates.h.

◆ Remap()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::TwoQubitsGate< 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 305 of file QuantumGates.h.

◆ SetQubit()

template<typename Time = Types::time_type>
void Circuits::TwoQubitsGate< 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 or one for the index or leave it default (0).

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

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

Definition at line 259 of file QuantumGates.h.


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