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>
187 std::shared_ptr<IOperation<Time>>
188 Remap(
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(
216template <
typename Time = Types::time_type>
232 :
IQuantumGate<Time>(delay), qubit1(qubit1), qubit2(qubit2) {}
291 return {qubit1, qubit2};
304 std::shared_ptr<IOperation<Time>>
305 Remap(
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);
338template <
typename Time = Types::time_type>
355 :
IQuantumGate<Time>(delay), qubit1(qubit1), qubit2(qubit2),
420 return {qubit1, qubit2, qubit3};
433 std::shared_ptr<IOperation<Time>>
434 Remap(
const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
435 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
437 auto newGate = this->
Clone();
439 const auto qubitit1 = qubitsMap.find(qubit1);
440 if (qubitit1 != qubitsMap.end())
441 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
442 qubitit1->second, 0);
444 const auto qubitit2 = qubitsMap.find(qubit2);
445 if (qubitit2 != qubitsMap.end())
446 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
447 qubitit2->second, 1);
449 const auto qubitit3 = qubitsMap.find(qubit3);
450 if (qubitit3 != qubitsMap.end())
451 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
452 qubitit3->second, 2);
476template <
typename Time = Types::time_type>
502 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
540 std::shared_ptr<IOperation<Time>>
Clone()
const override {
552 std::vector<double>
GetParams()
const override {
return {lambda}; }
564 if (std::abs(lambda - M_PI_2) > 1e-10)
582template <
typename Time = Types::time_type>
607 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
629 std::shared_ptr<IOperation<Time>>
Clone()
const override {
654template <
typename Time = Types::time_type>
679 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
701 std::shared_ptr<IOperation<Time>>
Clone()
const override {
726template <
typename Time = Types::time_type>
751 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
773 std::shared_ptr<IOperation<Time>>
Clone()
const override {
798template <
typename Time = Types::time_type>
823 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
845 std::shared_ptr<IOperation<Time>>
Clone()
const override {
846 return std::make_shared<HadamardGate<Time>>(
870template <
typename Time = Types::time_type>
895 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
917 std::shared_ptr<IOperation<Time>>
Clone()
const override {
942template <
typename Time = Types::time_type>
967 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
989 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1014template <
typename Time = Types::time_type>
1039 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1061 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1075template <
typename Time = Types::time_type>
1100 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1122 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1136template <
typename Time = Types::time_type>
1161 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1183 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1208template <
typename Time = Types::time_type>
1233 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1255 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1280template <
typename Time = Types::time_type>
1305 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1327 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1352template <
typename Time = Types::time_type>
1391 std::vector<double>
GetParams()
const override {
return {theta}; }
1406template <
typename Time = Types::time_type>
1432 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1455 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1471template <
typename Time = Types::time_type>
1497 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1520 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1536template <
typename Time = Types::time_type>
1562 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1585 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1600template <
typename Time = Types::time_type>
1614 double lambda = 0,
double gamma = 0, Time delay = 0)
1616 lambda(lambda), gamma(gamma) {}
1628 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1650 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1651 return std::make_shared<UGate<Time>>(
1727 return {theta, phi, lambda, gamma};
1763template <
typename Time = Types::time_type>
1789 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1812 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1840template <
typename Time = Types::time_type>
1866 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1889 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>
2081 :
TwoQubitsGate<Time>(ctrl, target, delay), lambda(lambda) {}
2093 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2132 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2133 return std::make_shared<CPGate<Time>>(
2144 std::vector<double>
GetParams()
const override {
return {lambda}; }
2158template <
typename Time = Types::time_type>
2174 double theta = 0, Time delay = 0)
2199 std::vector<double>
GetParams()
const override {
return {theta}; }
2213template <
typename Time = Types::time_type>
2241 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2265 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2266 return std::make_shared<CRxGate<Time>>(
2280template <
typename Time = Types::time_type>
2308 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2332 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2333 return std::make_shared<CRyGate<Time>>(
2347template <
typename Time = Types::time_type>
2375 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2399 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2400 return std::make_shared<CRzGate<Time>>(
2414template <
typename Time = Types::time_type>
2440 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2463 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2478template <
typename Time = Types::time_type>
2504 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2527 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2542template <
typename Time = Types::time_type>
2568 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2591 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2606template <
typename Time = Types::time_type>
2624 double phi = 0,
double lambda = 0,
double gamma = 0, Time delay = 0)
2625 :
TwoQubitsGate<Time>(ctrl, target, delay), theta(theta), phi(phi),
2626 lambda(lambda), gamma(gamma) {}
2638 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2726 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2727 return std::make_shared<CUGate<Time>>(
2740 return {theta, phi, lambda, gamma};
2764template <
typename Time = Types::time_type>
2792 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2816 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2817 return std::make_shared<CCXGate<Time>>(
2831template <
typename Time = Types::time_type>
2859 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2883 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2884 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.