16#ifndef _QUANTUM_GATES_H_
17#define _QUANTUM_GATES_H_
70template <
typename Time = Types::time_type>
98 virtual std::vector<double>
GetParams()
const {
return {}; }
111template <
typename Time = Types::time_type>
151 void SetQubit(Types::qubit_t q,
unsigned long index = 0)
override {
164 Types::qubit_t
GetQubit(
unsigned int index = 0)
const override {
187 std::shared_ptr<IOperation<Time>>
Remap(
188 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
189 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
191 auto newGate = this->
Clone();
193 const auto qubitit = qubitsMap.find(qubit);
194 if (qubitit != qubitsMap.end())
195 std::static_pointer_cast<SingleQubitGate<Time>>(newGate)->
SetQubit(
204 Types::qubit_t qubit;
216template <
typename Time = Types::time_type>
232 :
IQuantumGate<Time>(delay), qubit1(qubit1), qubit2(qubit2) {}
259 void SetQubit(Types::qubit_t q,
unsigned long index = 0)
override {
275 Types::qubit_t
GetQubit(
unsigned int index = 0)
const override {
291 return {qubit1, qubit2};
304 std::shared_ptr<IOperation<Time>>
Remap(
305 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
306 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
308 auto newGate = this->
Clone();
310 const auto qubitit1 = qubitsMap.find(qubit1);
311 if (qubitit1 != qubitsMap.end())
312 std::static_pointer_cast<TwoQubitsGate<Time>>(newGate)->
SetQubit(
313 qubitit1->second, 0);
315 const auto qubitit2 = qubitsMap.find(qubit2);
316 if (qubitit2 != qubitsMap.end())
317 std::static_pointer_cast<TwoQubitsGate<Time>>(newGate)->
SetQubit(
318 qubitit2->second, 1);
324 Types::qubit_t qubit1;
338template <
typename Time = Types::time_type>
354 Types::qubit_t qubit3 = 0, Time delay = 0)
385 void SetQubit(Types::qubit_t q,
unsigned long index = 0)
override {
403 Types::qubit_t
GetQubit(
unsigned int index = 0)
const override {
422 return {qubit1, qubit2, qubit3};
435 std::shared_ptr<IOperation<Time>>
Remap(
436 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
437 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
439 auto newGate = this->
Clone();
441 const auto qubitit1 = qubitsMap.find(qubit1);
442 if (qubitit1 != qubitsMap.end())
443 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
444 qubitit1->second, 0);
446 const auto qubitit2 = qubitsMap.find(qubit2);
447 if (qubitit2 != qubitsMap.end())
448 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
449 qubitit2->second, 1);
451 const auto qubitit3 = qubitsMap.find(qubit3);
452 if (qubitit3 != qubitsMap.end())
453 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
454 qubitit3->second, 2);
460 Types::qubit_t qubit1;
463 Types::qubit_t qubit3;
478template <
typename Time = Types::time_type>
491 PhaseGate(Types::qubit_t qubit = 0,
double lambda = 0, Time delay = 0)
504 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
542 std::shared_ptr<IOperation<Time>>
Clone()
const override {
554 std::vector<double>
GetParams()
const override {
return {lambda}; }
566 if (std::abs(lambda - M_PI_2) > 1e-10)
return false;
583template <
typename Time = Types::time_type>
595 XGate(Types::qubit_t qubit = 0, Time delay = 0)
608 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
630 std::shared_ptr<IOperation<Time>>
Clone()
const override {
655template <
typename Time = Types::time_type>
667 YGate(Types::qubit_t qubit = 0, Time delay = 0)
680 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
702 std::shared_ptr<IOperation<Time>>
Clone()
const override {
727template <
typename Time = Types::time_type>
739 ZGate(Types::qubit_t qubit = 0, Time delay = 0)
752 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
774 std::shared_ptr<IOperation<Time>>
Clone()
const override {
799template <
typename Time = Types::time_type>
824 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
846 std::shared_ptr<IOperation<Time>>
Clone()
const override {
847 return std::make_shared<HadamardGate<Time>>(
871template <
typename Time = Types::time_type>
883 SGate(Types::qubit_t qubit = 0, Time delay = 0)
896 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
918 std::shared_ptr<IOperation<Time>>
Clone()
const override {
943template <
typename Time = Types::time_type>
955 SdgGate(Types::qubit_t qubit = 0, Time delay = 0)
968 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
990 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1015template <
typename Time = Types::time_type>
1027 TGate(Types::qubit_t qubit = 0, Time delay = 0)
1040 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1062 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1076template <
typename Time = Types::time_type>
1101 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1123 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1137template <
typename Time = Types::time_type>
1149 SxGate(Types::qubit_t qubit = 0, Time delay = 0)
1162 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1184 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1209template <
typename Time = Types::time_type>
1234 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1256 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1281template <
typename Time = Types::time_type>
1293 KGate(Types::qubit_t qubit = 0, Time delay = 0)
1306 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1328 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1353template <
typename Time = Types::time_type>
1392 std::vector<double>
GetParams()
const override {
return {theta}; }
1407template <
typename Time = Types::time_type>
1420 RxGate(Types::qubit_t qubit = 0,
double theta = 0, Time delay = 0)
1433 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1456 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1472template <
typename Time = Types::time_type>
1485 RyGate(Types::qubit_t qubit = 0,
double theta = 0, Time delay = 0)
1498 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1521 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1537template <
typename Time = Types::time_type>
1550 RzGate(Types::qubit_t qubit = 0,
double theta = 0, Time delay = 0)
1563 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1586 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1601template <
typename Time = Types::time_type>
1614 UGate(Types::qubit_t qubit = 0,
double theta = 0,
double phi = 0,
1615 double lambda = 0,
double gamma = 0, Time delay = 0)
1632 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1654 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1655 return std::make_shared<UGate<Time>>(
1731 return {theta, phi, lambda, gamma};
1767template <
typename Time = Types::time_type>
1780 SwapGate(Types::qubit_t qubit1 = 0, Types::qubit_t qubit2 = 1, Time delay = 0)
1793 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1816 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1844template <
typename Time = Types::time_type>
1857 CXGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1, Time delay = 0)
1870 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1893 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1919template <
typename Time = Types::time_type>
1932 CYGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1, Time delay = 0)
1945 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1968 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1994template <
typename Time = Types::time_type>
2007 CZGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1, Time delay = 0)
2020 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2043 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2069template <
typename Time = Types::time_type>
2083 CPGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1,
double lambda = 0,
2085 :
TwoQubitsGate<Time>(ctrl, target, delay), lambda(lambda) {}
2097 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2136 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2137 return std::make_shared<CPGate<Time>>(
2148 std::vector<double>
GetParams()
const override {
return {lambda}; }
2162template <
typename Time = Types::time_type>
2178 double theta = 0, Time delay = 0)
2203 std::vector<double>
GetParams()
const override {
return {theta}; }
2217template <
typename Time = Types::time_type>
2231 CRxGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1,
double theta = 0,
2245 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2269 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2270 return std::make_shared<CRxGate<Time>>(
2284template <
typename Time = Types::time_type>
2298 CRyGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1,
double theta = 0,
2312 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2336 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2337 return std::make_shared<CRyGate<Time>>(
2351template <
typename Time = Types::time_type>
2365 CRzGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1,
double theta = 0,
2379 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2403 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2404 return std::make_shared<CRzGate<Time>>(
2418template <
typename Time = Types::time_type>
2431 CHGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1, Time delay = 0)
2444 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2467 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2482template <
typename Time = Types::time_type>
2495 CSxGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1, Time delay = 0)
2508 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2531 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2546template <
typename Time = Types::time_type>
2559 CSxDagGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1, Time delay = 0)
2572 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2595 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2610template <
typename Time = Types::time_type>
2627 CUGate(Types::qubit_t ctrl = 0, Types::qubit_t target = 1,
double theta = 0,
2628 double phi = 0,
double lambda = 0,
double gamma = 0, Time delay = 0)
2645 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2733 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2734 return std::make_shared<CUGate<Time>>(
2747 return {theta, phi, lambda, gamma};
2771template <
typename Time = Types::time_type>
2785 CCXGate(Types::qubit_t ctrl1 = 0, Types::qubit_t ctrl2 = 1,
2786 Types::qubit_t target = 2, Time delay = 0)
2799 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2823 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2824 return std::make_shared<CCXGate<Time>>(
2838template <
typename Time = Types::time_type>
2852 CSwapGate(Types::qubit_t ctrl = 0, Types::qubit_t target1 = 1,
2853 Types::qubit_t target2 = 2, Time delay = 0)
2866 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2890 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2891 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.