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

The controlled U gate. More...

#include <QuantumGates.h>

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

Public Member Functions

 CUGate (Types::qubit_t ctrl=0, Types::qubit_t target=1, double theta=0, double phi=0, double lambda=0, double gamma=0, Time delay=0)
 CUGate constructor.
void Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
 Execute the quantum gate.
QuantumGateType GetGateType () const override
 Get the type of the quantum gate.
void SetTheta (double t)
 Set the theta parameter for the controlled U gate.
double GetTheta () const
 Get the theta parameter for the controlled U gate.
void SetPhi (double p)
 Set the phi parameter for the controlled U gate.
double GetPhi () const
 Get the phi parameter for the controlled U gate.
void SetLambda (double l)
 Set the lambda parameter for the controlled U gate.
double GetLambda () const
 Get the lambda parameter for the controlled U gate.
void SetGamma (double g)
 Set the gamma parameter for the controlled U gate.
double GetGamma () const
 Get the gamma parameter for the controlled U gate.
std::shared_ptr< IOperation< Time > > Clone () const override
 Get a shared pointer to a clone of this object.
std::vector< double > GetParams () const override
 Get the gate parameters.
Public Member Functions inherited from Circuits::TwoQubitsGate< Types::time_type >
 TwoQubitsGate (Types::qubit_t qubit1=0, Types::qubit_t qubit2=0, Types::time_type 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< 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 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.
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 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::CUGate< Time >

The controlled U gate.

The controlled U gate.

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

Definition at line 2607 of file QuantumGates.h.

Constructor & Destructor Documentation

◆ CUGate()

template<typename Time = Types::time_type>
Circuits::CUGate< Time >::CUGate ( Types::qubit_t ctrl = 0,
Types::qubit_t target = 1,
double theta = 0,
double phi = 0,
double lambda = 0,
double gamma = 0,
Time delay = 0 )
inline

CUGate constructor.

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

Parameters
ctrlThe control qubit the quantum gate is applied to.
targetThe target qubit the quantum gate is applied to.
thetaThe theta parameter for the controlled U gate.
phiThe phi parameter for the controlled U gate.
lambdaThe lambda parameter for the controlled U gate.
gammaThe gamma parameter for the controlled U gate.
delayThe time the quantum gate takes to execute.
See also
TwoQubitsGate

Definition at line 2623 of file QuantumGates.h.

Member Function Documentation

◆ Clone()

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

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.

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

Definition at line 2726 of file QuantumGates.h.

◆ Execute()

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

Execute the quantum gate.

Executes the quantum gate on the given simulator with the given classical state.

Parameters
simThe simulator to execute the quantum gate on.
stateThe classical state to execute the quantum gate with.
See also
ISimulator
ClassicalState

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

Definition at line 2638 of file QuantumGates.h.

◆ GetGamma()

template<typename Time = Types::time_type>
double Circuits::CUGate< Time >::GetGamma ( ) const
inline

Get the gamma parameter for the controlled U gate.

Returns the gamma parameter for the controlled U gate.

Returns
The gamma parameter for the controlled U gate.

Definition at line 2718 of file QuantumGates.h.

◆ GetGateType()

template<typename Time = Types::time_type>
QuantumGateType Circuits::CUGate< Time >::GetGateType ( ) const
inlineoverridevirtual

Get the type of the quantum gate.

Returns the type of the quantum gate.

Returns
The type of the quantum gate.
See also
QuantumGateType

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

Definition at line 2652 of file QuantumGates.h.

◆ GetLambda()

template<typename Time = Types::time_type>
double Circuits::CUGate< Time >::GetLambda ( ) const
inline

Get the lambda parameter for the controlled U gate.

Returns the lambda parameter for the controlled U gate.

Returns
The lambda parameter for the controlled U gate.

Definition at line 2702 of file QuantumGates.h.

◆ GetParams()

template<typename Time = Types::time_type>
std::vector< double > Circuits::CUGate< Time >::GetParams ( ) const
inlineoverridevirtual

Get the gate parameters.

Returns the parameters of the gate.

Returns
A vector with the parameters of the gate.

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

Definition at line 2739 of file QuantumGates.h.

◆ GetPhi()

template<typename Time = Types::time_type>
double Circuits::CUGate< Time >::GetPhi ( ) const
inline

Get the phi parameter for the controlled U gate.

Returns the phi parameter for the controlled U gate.

Returns
The phi parameter for the controlled U gate.

Definition at line 2686 of file QuantumGates.h.

◆ GetTheta()

template<typename Time = Types::time_type>
double Circuits::CUGate< Time >::GetTheta ( ) const
inline

Get the theta parameter for the controlled U gate.

Returns the theta parameter for the controlled U gate.

Returns
The theta parameter for the controlled U gate.

Definition at line 2670 of file QuantumGates.h.

◆ SetGamma()

template<typename Time = Types::time_type>
void Circuits::CUGate< Time >::SetGamma ( double g)
inline

Set the gamma parameter for the controlled U gate.

Sets the gamma parameter for the controlled U gate.

Parameters
gThe gamma parameter for the controlled U gate.

Definition at line 2710 of file QuantumGates.h.

◆ SetLambda()

template<typename Time = Types::time_type>
void Circuits::CUGate< Time >::SetLambda ( double l)
inline

Set the lambda parameter for the controlled U gate.

Sets the lambda parameter for the controlled U gate.

Parameters
lThe lambda parameter for the controlled U gate.

Definition at line 2694 of file QuantumGates.h.

◆ SetPhi()

template<typename Time = Types::time_type>
void Circuits::CUGate< Time >::SetPhi ( double p)
inline

Set the phi parameter for the controlled U gate.

Sets the phi parameter for the controlled U gate.

Parameters
pThe phi parameter for the controlled U gate.

Definition at line 2678 of file QuantumGates.h.

◆ SetTheta()

template<typename Time = Types::time_type>
void Circuits::CUGate< Time >::SetTheta ( double t)
inline

Set the theta parameter for the controlled U gate.

Sets the theta parameter for the controlled U gate.

Parameters
tThe theta parameter for the controlled U gate.

Definition at line 2662 of file QuantumGates.h.


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