17#ifndef _QUANTUM_GATES_H_
18#define _QUANTUM_GATES_H_
71template <
typename Time = Types::time_type>
99 virtual std::vector<double>
GetParams()
const {
return {}; }
112template <
typename Time = Types::time_type>
188 std::shared_ptr<IOperation<Time>>
Remap(
189 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
190 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
192 auto newGate = this->
Clone();
194 const auto qubitit = qubitsMap.find(qubit);
195 if (qubitit != qubitsMap.end())
196 std::static_pointer_cast<SingleQubitGate<Time>>(newGate)->
SetQubit(
217template <
typename Time = Types::time_type>
233 :
IQuantumGate<Time>(delay), qubit1(qubit1), qubit2(qubit2) {}
292 return {qubit1, qubit2};
305 std::shared_ptr<IOperation<Time>>
Remap(
306 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
307 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
309 auto newGate = this->
Clone();
311 const auto qubitit1 = qubitsMap.find(qubit1);
312 if (qubitit1 != qubitsMap.end())
313 std::static_pointer_cast<TwoQubitsGate<Time>>(newGate)->
SetQubit(
314 qubitit1->second, 0);
316 const auto qubitit2 = qubitsMap.find(qubit2);
317 if (qubitit2 != qubitsMap.end())
318 std::static_pointer_cast<TwoQubitsGate<Time>>(newGate)->
SetQubit(
319 qubitit2->second, 1);
339template <
typename Time = Types::time_type>
423 return {qubit1, qubit2, qubit3};
436 std::shared_ptr<IOperation<Time>>
Remap(
437 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
438 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
440 auto newGate = this->
Clone();
442 const auto qubitit1 = qubitsMap.find(qubit1);
443 if (qubitit1 != qubitsMap.end())
444 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
445 qubitit1->second, 0);
447 const auto qubitit2 = qubitsMap.find(qubit2);
448 if (qubitit2 != qubitsMap.end())
449 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
450 qubitit2->second, 1);
452 const auto qubitit3 = qubitsMap.find(qubit3);
453 if (qubitit3 != qubitsMap.end())
454 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
455 qubitit3->second, 2);
479template <
typename Time = Types::time_type>
505 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
543 std::shared_ptr<IOperation<Time>>
Clone()
const override {
555 std::vector<double>
GetParams()
const override {
return {lambda}; }
567 if (std::abs(lambda - M_PI_2) > 1e-10)
return false;
584template <
typename Time = Types::time_type>
609 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
631 std::shared_ptr<IOperation<Time>>
Clone()
const override {
656template <
typename Time = Types::time_type>
681 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
703 std::shared_ptr<IOperation<Time>>
Clone()
const override {
728template <
typename Time = Types::time_type>
753 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
775 std::shared_ptr<IOperation<Time>>
Clone()
const override {
800template <
typename Time = Types::time_type>
825 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
847 std::shared_ptr<IOperation<Time>>
Clone()
const override {
848 return std::make_shared<HadamardGate<Time>>(
872template <
typename Time = Types::time_type>
897 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
919 std::shared_ptr<IOperation<Time>>
Clone()
const override {
944template <
typename Time = Types::time_type>
969 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
991 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1016template <
typename Time = Types::time_type>
1041 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1063 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1077template <
typename Time = Types::time_type>
1102 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1124 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1138template <
typename Time = Types::time_type>
1163 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1185 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1210template <
typename Time = Types::time_type>
1235 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1257 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1282template <
typename Time = Types::time_type>
1307 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1329 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1354template <
typename Time = Types::time_type>
1393 std::vector<double>
GetParams()
const override {
return {theta}; }
1408template <
typename Time = Types::time_type>
1434 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1457 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1473template <
typename Time = Types::time_type>
1499 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1522 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1538template <
typename Time = Types::time_type>
1564 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1587 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1602template <
typename Time = Types::time_type>
1616 double lambda = 0,
double gamma = 0, Time delay = 0)
1633 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1655 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1656 return std::make_shared<UGate<Time>>(
1732 return {theta, phi, lambda, gamma};
1768template <
typename Time = Types::time_type>
1794 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1817 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1845template <
typename Time = Types::time_type>
1871 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1894 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1920template <
typename Time = Types::time_type>
1946 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1969 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1995template <
typename Time = Types::time_type>
2021 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2044 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2070template <
typename Time = Types::time_type>
2086 :
TwoQubitsGate<Time>(ctrl, target, delay), lambda(lambda) {}
2098 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2137 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2138 return std::make_shared<CPGate<Time>>(
2149 std::vector<double>
GetParams()
const override {
return {lambda}; }
2163template <
typename Time = Types::time_type>
2179 double theta = 0, Time delay = 0)
2204 std::vector<double>
GetParams()
const override {
return {theta}; }
2218template <
typename Time = Types::time_type>
2246 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2270 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2271 return std::make_shared<CRxGate<Time>>(
2285template <
typename Time = Types::time_type>
2313 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2337 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2338 return std::make_shared<CRyGate<Time>>(
2352template <
typename Time = Types::time_type>
2380 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2404 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2405 return std::make_shared<CRzGate<Time>>(
2419template <
typename Time = Types::time_type>
2445 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2468 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2483template <
typename Time = Types::time_type>
2509 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2532 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2547template <
typename Time = Types::time_type>
2573 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2596 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2611template <
typename Time = Types::time_type>
2629 double phi = 0,
double lambda = 0,
double gamma = 0, Time delay = 0)
2646 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2734 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2735 return std::make_shared<CUGate<Time>>(
2748 return {theta, phi, lambda, gamma};
2772template <
typename Time = Types::time_type>
2800 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2824 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2825 return std::make_shared<CCXGate<Time>>(
2839template <
typename Time = Types::time_type>
2867 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2891 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2892 return std::make_shared<CSwapGate<Time>>(
The controlled controlled x gate.
CCXGate(Types::qubit_t ctrl1=0, Types::qubit_t ctrl2=1, Types::qubit_t target=2, Time delay=0)
CCXGate constructor.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
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.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
CHGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, Time delay=0)
CHGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
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 SetLambda(double l)
Set the lambda parameter for the controlled phase gate.
double GetLambda() const
Get the lambda parameter for the controlled phase gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
CPGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, double lambda=0, Time delay=0)
CPGate constructor.
std::vector< double > GetParams() const override
Get the gate parameters.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
The controlled x rotation gate.
CRxGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, double theta=0, Time delay=0)
CRxGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
The controlled y rotation gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
CRyGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, double theta=0, Time delay=0)
CRyGate constructor.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
The controlled z rotation gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
CRzGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, double theta=0, Time delay=0)
CRzGate constructor.
The controlled swap gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
CSwapGate(Types::qubit_t ctrl=0, Types::qubit_t target1=1, Types::qubit_t target2=2, Time delay=0)
CSwapGate constructor.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
The controlled Sx dagger gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
CSxDagGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, Time delay=0)
CSxDagGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
CSxGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, Time delay=0)
CSxGate 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 SetLambda(double l)
Set the lambda parameter for the controlled U gate.
double GetLambda() const
Get the lambda parameter for the controlled U gate.
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.
double GetPhi() const
Get the phi parameter for the controlled U gate.
void SetPhi(double p)
Set the phi parameter for the controlled U gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
double GetTheta() const
Get the theta parameter for the controlled U gate.
void SetTheta(double t)
Set the theta parameter for the controlled U gate.
std::vector< double > GetParams() const override
Get the gate parameters.
double GetGamma() const
Get the gamma parameter for the controlled U gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
void SetGamma(double g)
Set the gamma parameter for the controlled U gate.
CXGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, Time delay=0)
CXGate 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.
bool IsClifford() const override
Checks if the operation is a Clifford one.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
CYGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, Time delay=0)
CYGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
CZGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, Time delay=0)
CZGate constructor.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
ControlledRotationGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, double theta=0, Time delay=0)
ControlledRotationGate constructor.
double GetTheta() const
Get the theta angle for the controlled rotation gate.
void SetTheta(double t)
Set the theta angle for the controlled rotation gate.
std::vector< double > GetParams() const override
Get the gate parameters.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
HadamardGate(Types::qubit_t qubit=0, Time delay=0)
HadamardGate 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.
bool IsClifford() const override
Checks if the operation is a Clifford one.
The gate operation interface.
Time GetDelay() const
Get the delay of the operation.
virtual std::shared_ptr< IOperation< Time > > Clone() const =0
Get a shared pointer to a clone of this object.
The interface for quantum gates.
IQuantumGate(Time 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.
bool IsClifford() const override
Checks if the operation is a Clifford one.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
KGate(Types::qubit_t qubit=0, Time delay=0)
KGate constructor.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
The state class that stores the classical state of a quantum circuit execution.
double GetLambda() const
Get the lambda parameter for the phase gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
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.
std::vector< double > GetParams() const override
Get the gate parameters.
void SetLambda(double l)
Set the lambda parameter for the phase gate.
PhaseGate(Types::qubit_t qubit=0, double lambda=0, Time delay=0)
PhaseGate constructor.
bool IsClifford() const override
Checks if the operation is a Clifford one.
RotationGate(Types::qubit_t qubit=0, double theta=0, Time delay=0)
RotationGate constructor.
double GetTheta() const
Get the theta angle for the rotation gate.
std::vector< double > GetParams() const override
Get the gate parameters.
void SetTheta(double t)
Set the theta angle for the rotation gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
RxGate(Types::qubit_t qubit=0, double theta=0, Time delay=0)
RxGate constructor.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
RyGate(Types::qubit_t qubit=0, double theta=0, Time delay=0)
RyGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
RzGate(Types::qubit_t qubit=0, double theta=0, Time delay=0)
RzGate constructor.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
SGate(Types::qubit_t qubit=0, Time delay=0)
SGate constructor.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
SdgGate(Types::qubit_t qubit=0, Time delay=0)
SdgGate constructor.
The interface for single qubit quantum gates.
void SetQubit(Types::qubit_t q, unsigned long index=0) override
Set the qubit the quantum gate is applied to.
SingleQubitGate(Types::qubit_t qubit=0, Time delay=0)
SingleQubitGate constructor.
virtual ~SingleQubitGate()
The SingleQubitGate destructor.
Types::qubits_vector AffectedQubits() const override
Get the qubits the quantum gate is applied to.
unsigned int GetNumQubits() const override
Get the number of qubits 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.
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.
SwapGate(Types::qubit_t qubit1=0, Types::qubit_t qubit2=1, Time delay=0)
SwapGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
bool IsClifford() const override
Checks if the operation is a Clifford one.
SxDagGate(Types::qubit_t qubit=0, Time delay=0)
SxDagGate constructor.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
SxGate(Types::qubit_t qubit=0, Time delay=0)
SxGate constructor.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
TGate(Types::qubit_t qubit=0, Time delay=0)
TGate 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.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
TdgGate(Types::qubit_t qubit=0, Time delay=0)
TdgGate constructor.
The interface for three qubits quantum gates.
Types::qubits_vector AffectedQubits() const override
Get the qubits 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.
unsigned int GetNumQubits() const override
Get the number of 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.
ThreeQubitsGate(Types::qubit_t qubit1=0, Types::qubit_t qubit2=0, Types::qubit_t qubit3=0, Time delay=0)
ThreeQubitsGate constructor.
virtual ~ThreeQubitsGate()
The ThreeQubitsGate destructor.
void SetQubit(Types::qubit_t q, unsigned long index=0) override
Set the qubit the quantum gate is applied to.
The interface for two qubits quantum gates.
Types::qubit_t GetQubit(unsigned int index=0) const override
Get the qubit 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.
virtual ~TwoQubitsGate()
The TwoQubitsGate destructor.
void SetQubit(Types::qubit_t q, unsigned long index=0) override
Set the qubit the quantum gate is applied to.
TwoQubitsGate(Types::qubit_t qubit1=0, Types::qubit_t qubit2=0, Time delay=0)
TwoQubitsGate constructor.
unsigned int GetNumQubits() const override
Get the number of qubits the quantum gate is applied to.
Types::qubits_vector AffectedQubits() const override
Get the qubits the quantum gate is applied to.
double GetGamma() const
Get the gamma parameter for the gate.
void SetLambda(double l)
Set the lambda parameter for the gate.
bool IsClifford() const override
Checks if the operation is a Clifford one.
void SetPhi(double p)
Set the phi parameter for the gate.
double GetLambda() const
Get the lambda parameter for the gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
void SetTheta(double t)
Set the theta parameter for the gate.
UGate(Types::qubit_t qubit=0, double theta=0, double phi=0, double lambda=0, double gamma=0, Time delay=0)
UGate constructor.
std::vector< double > GetParams() const override
Get the gate parameters.
double GetTheta() const
Get the theta parameter for the gate.
double GetPhi() const
Get the phi parameter for the gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
void SetGamma(double g)
Set the gamma parameter for the gate.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
bool IsClifford() const override
Checks if the operation is a Clifford one.
XGate(Types::qubit_t qubit=0, Time delay=0)
XGate constructor.
QuantumGateType GetGateType() const override
Get the type of the quantum gate.
YGate(Types::qubit_t qubit=0, Time delay=0)
YGate constructor.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
bool IsClifford() const override
Checks if the operation is a Clifford one.
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.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
bool IsClifford() const override
Checks if the operation is a Clifford one.
ZGate(Types::qubit_t qubit=0, Time delay=0)
ZGate constructor.
QuantumGateType
The type of quantum gates.
uint_fast64_t qubit_t
The type of a qubit.
std::vector< qubit_t > qubits_vector
The type of a vector of qubits.