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>>(
882template <
typename Time = Types::time_type>
907 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
929 std::shared_ptr<IOperation<Time>>
Clone()
const override {
954template <
typename Time = Types::time_type>
979 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1001 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1026template <
typename Time = Types::time_type>
1051 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1073 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1087template <
typename Time = Types::time_type>
1112 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1134 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1148template <
typename Time = Types::time_type>
1173 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1195 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1230template <
typename Time = Types::time_type>
1255 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1277 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1312template <
typename Time = Types::time_type>
1337 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1359 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1394template <
typename Time = Types::time_type>
1433 std::vector<double>
GetParams()
const override {
return {theta}; }
1448template <
typename Time = Types::time_type>
1474 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1497 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1523template <
typename Time = Types::time_type>
1549 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1572 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1598template <
typename Time = Types::time_type>
1624 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1647 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1662template <
typename Time = Types::time_type>
1676 double lambda = 0,
double gamma = 0, Time delay = 0)
1693 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1715 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1716 return std::make_shared<UGate<Time>>(
1792 return {theta, phi, lambda, gamma};
1838template <
typename Time = Types::time_type>
1864 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1887 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1915template <
typename Time = Types::time_type>
1941 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1964 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1990template <
typename Time = Types::time_type>
2016 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2039 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2065template <
typename Time = Types::time_type>
2091 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2114 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2140template <
typename Time = Types::time_type>
2156 :
TwoQubitsGate<Time>(ctrl, target, delay), lambda(lambda) {}
2168 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2207 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2208 return std::make_shared<CPGate<Time>>(
2219 std::vector<double>
GetParams()
const override {
return {lambda}; }
2233template <
typename Time = Types::time_type>
2249 double theta = 0, Time delay = 0)
2274 std::vector<double>
GetParams()
const override {
return {theta}; }
2288template <
typename Time = Types::time_type>
2316 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2340 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2341 return std::make_shared<CRxGate<Time>>(
2365template <
typename Time = Types::time_type>
2393 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2417 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2418 return std::make_shared<CRyGate<Time>>(
2442template <
typename Time = Types::time_type>
2470 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2494 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2495 return std::make_shared<CRzGate<Time>>(
2509template <
typename Time = Types::time_type>
2535 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2558 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2583template <
typename Time = Types::time_type>
2609 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2632 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2657template <
typename Time = Types::time_type>
2683 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2706 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2731template <
typename Time = Types::time_type>
2749 double phi = 0,
double lambda = 0,
double gamma = 0, Time delay = 0)
2766 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2854 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2855 return std::make_shared<CUGate<Time>>(
2868 return {theta, phi, lambda, gamma};
2902template <
typename Time = Types::time_type>
2930 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2954 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2955 return std::make_shared<CCXGate<Time>>(
2969template <
typename Time = Types::time_type>
2997 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
3021 std::shared_ptr<IOperation<Time>>
Clone()
const override {
3022 return std::make_shared<CSwapGate<Time>>(
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.
bool IsBranching() const override
Checks if the operation is a branching one.
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.
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.
bool IsBranching() const override
Checks if the operation is a branching 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.
CRyGate(Types::qubit_t ctrl=0, Types::qubit_t target=1, double theta=0, Time delay=0)
CRyGate constructor.
bool IsBranching() const override
Checks if the operation is a branching one.
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.
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.
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.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
bool IsBranching() const override
Checks if the operation is a branching one.
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.
bool IsBranching() const override
Checks if the operation is a branching one.
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.
bool IsBranching() const override
Checks if the operation is a branching one.
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 IsBranching() const override
Checks if the operation is a branching one.
bool IsClifford() const override
Checks if the operation is a Clifford one.
IGateOperation(Types::time_type delay=0)
Time GetDelay() const
Get the delay of the operation.
virtual std::shared_ptr< IOperation< Types::time_type > > Clone() const =0
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.
bool IsBranching() const override
Checks if the operation is a branching one.
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.
bool IsBranching() const override
Checks if the operation is a branching 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.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
bool IsBranching() const override
Checks if the operation is a branching one.
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.
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 IsBranching() const override
Checks if the operation is a branching one.
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.
bool IsBranching() const override
Checks if the operation is a branching 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.
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.
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.
bool IsBranching() const override
Checks if the operation is a branching 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.
std::vector< qubit_t > qubits_vector
The type of a vector of qubits.
uint_fast64_t qubit_t
The type of a qubit.