17#ifndef _QUANTUM_GATES_H_
18#define _QUANTUM_GATES_H_
21#include "QuantumGate.h"
72template <
typename Time = Types::time_type>
100 virtual std::vector<double>
GetParams()
const {
return {}; }
121template <
typename Time = Types::time_type>
197 std::shared_ptr<IOperation<Time>>
Remap(
198 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
199 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
201 auto newGate = this->
Clone();
203 const auto qubitit = qubitsMap.find(qubit);
204 if (qubitit != qubitsMap.end())
205 std::static_pointer_cast<SingleQubitGate<Time>>(newGate)->
SetQubit(
226template <
typename Time = Types::time_type>
242 :
IQuantumGate<Time>(delay), qubit1(qubit1), qubit2(qubit2) {}
301 return {qubit1, qubit2};
314 std::shared_ptr<IOperation<Time>>
Remap(
315 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
316 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
318 auto newGate = this->
Clone();
320 const auto qubitit1 = qubitsMap.find(qubit1);
321 if (qubitit1 != qubitsMap.end())
322 std::static_pointer_cast<TwoQubitsGate<Time>>(newGate)->
SetQubit(
323 qubitit1->second, 0);
325 const auto qubitit2 = qubitsMap.find(qubit2);
326 if (qubitit2 != qubitsMap.end())
327 std::static_pointer_cast<TwoQubitsGate<Time>>(newGate)->
SetQubit(
328 qubitit2->second, 1);
348template <
typename Time = Types::time_type>
432 return {qubit1, qubit2, qubit3};
445 std::shared_ptr<IOperation<Time>>
Remap(
446 const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
447 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
449 auto newGate = this->
Clone();
451 const auto qubitit1 = qubitsMap.find(qubit1);
452 if (qubitit1 != qubitsMap.end())
453 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
454 qubitit1->second, 0);
456 const auto qubitit2 = qubitsMap.find(qubit2);
457 if (qubitit2 != qubitsMap.end())
458 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
459 qubitit2->second, 1);
461 const auto qubitit3 = qubitsMap.find(qubit3);
462 if (qubitit3 != qubitsMap.end())
463 std::static_pointer_cast<ThreeQubitsGate<Time>>(newGate)->
SetQubit(
464 qubitit3->second, 2);
488template <
typename Time = Types::time_type>
514 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
552 std::shared_ptr<IOperation<Time>>
Clone()
const override {
564 std::vector<double>
GetParams()
const override {
return {lambda}; }
576 if (std::abs(lambda - M_PI_2) > 1e-10)
return false;
588 const QC::Gates::PhaseShiftGate<> pgate(lambda);
590 return pgate.getRawOperatorMatrix();
605template <
typename Time = Types::time_type>
630 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
652 std::shared_ptr<IOperation<Time>>
Clone()
const override {
675 static const QC::Gates::PauliXGate<> xgate;
677 return xgate.getRawOperatorMatrix();
689template <
typename Time = Types::time_type>
714 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
736 std::shared_ptr<IOperation<Time>>
Clone()
const override {
759 static const QC::Gates::PauliYGate<> ygate;
761 return ygate.getRawOperatorMatrix();
773template <
typename Time = Types::time_type>
798 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
820 std::shared_ptr<IOperation<Time>>
Clone()
const override {
843 static const QC::Gates::PauliZGate<> zgate;
845 return zgate.getRawOperatorMatrix();
857template <
typename Time = Types::time_type>
882 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
904 std::shared_ptr<IOperation<Time>>
Clone()
const override {
905 return std::make_shared<HadamardGate<Time>>(
937 static const QC::Gates::HadamardGate<> hgate;
939 return hgate.getRawOperatorMatrix();
951template <
typename Time = Types::time_type>
976 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
998 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1021 static const QC::Gates::SGate<> sgate;
1023 return sgate.getRawOperatorMatrix();
1035template <
typename Time = Types::time_type>
1060 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1082 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1105 static const QC::Gates::SDGGate<> sdggate;
1107 return sdggate.getRawOperatorMatrix();
1119template <
typename Time = Types::time_type>
1144 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1166 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1178 static const QC::Gates::TGate<> tgate;
1180 return tgate.getRawOperatorMatrix();
1192template <
typename Time = Types::time_type>
1217 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1239 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1251 static const QC::Gates::TDGGate<> tdggate;
1253 return tdggate.getRawOperatorMatrix();
1265template <
typename Time = Types::time_type>
1290 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1312 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1345 static const QC::Gates::SquareRootNOTGate<> sxgate;
1346 return sxgate.getRawOperatorMatrix();
1358template <
typename Time = Types::time_type>
1383 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1405 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1438 static const QC::Gates::SquareRootNOTDagGate<> sxdggate;
1439 return sxdggate.getRawOperatorMatrix();
1451template <
typename Time = Types::time_type>
1476 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1498 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1531 static const QC::Gates::HyGate<> hygate;
1532 return hygate.getRawOperatorMatrix();
1544template <
typename Time = Types::time_type>
1583 std::vector<double>
GetParams()
const override {
return {theta}; }
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 {
1671 return rxgate.getRawOperatorMatrix();
1684template <
typename Time = Types::time_type>
1710 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1733 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1757 return rygate.getRawOperatorMatrix();
1770template <
typename Time = Types::time_type>
1796 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1819 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1833 return rzgate.getRawOperatorMatrix();
1845template <
typename Time = Types::time_type>
1859 double lambda = 0,
double gamma = 0, Time delay = 0)
1876 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
1898 std::shared_ptr<IOperation<Time>>
Clone()
const override {
1899 return std::make_shared<UGate<Time>>(
1975 return {theta, phi, lambda, gamma};
2006 const QC::Gates::UGate<> ugate(theta, phi, lambda, gamma);
2007 return ugate.getRawOperatorMatrix();
2032template <
typename Time = Types::time_type>
2058 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2081 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2105 static const QC::Gates::SwapGate<> swapgate;
2106 return swapgate.getRawOperatorMatrix();
2120template <
typename Time = Types::time_type>
2146 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2169 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2193 static const QC::Gates::CNOTGate<> cnotgate;
2194 return cnotgate.getRawOperatorMatrix();
2206template <
typename Time = Types::time_type>
2232 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2255 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2279 static const QC::Gates::ControlledYGate<> cygate;
2280 return cygate.getRawOperatorMatrix();
2292template <
typename Time = Types::time_type>
2318 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2341 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2365 static const QC::Gates::ControlledZGate<> czgate;
2366 return czgate.getRawOperatorMatrix();
2378template <
typename Time = Types::time_type>
2394 :
TwoQubitsGate<Time>(ctrl, target, delay), lambda(lambda) {}
2406 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2445 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2446 return std::make_shared<CPGate<Time>>(
2457 std::vector<double>
GetParams()
const override {
return {lambda}; }
2466 const QC::Gates::ControlledPhaseShiftGate<> cpgate(lambda);
2467 return cpgate.getRawOperatorMatrix();
2482template <
typename Time = Types::time_type>
2498 double theta = 0, Time delay = 0)
2523 std::vector<double>
GetParams()
const override {
return {theta}; }
2537template <
typename Time = Types::time_type>
2565 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2589 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2590 return std::make_shared<CRxGate<Time>>(
2613 return crxgate.getRawOperatorMatrix();
2625template <
typename Time = Types::time_type>
2653 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2677 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2678 return std::make_shared<CRyGate<Time>>(
2701 return crygate.getRawOperatorMatrix();
2713template <
typename Time = Types::time_type>
2741 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2765 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2766 return std::make_shared<CRzGate<Time>>(
2779 return crzgate.getRawOperatorMatrix();
2791template <
typename Time = Types::time_type>
2817 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2840 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2863 static const QC::Gates::ControlledHadamardGate<> chgate;
2864 return chgate.getRawOperatorMatrix();
2876template <
typename Time = Types::time_type>
2902 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
2925 std::shared_ptr<IOperation<Time>>
Clone()
const override {
2948 static const QC::Gates::ControlledSquareRootNOTGate<> csxgate;
2949 return csxgate.getRawOperatorMatrix();
2961template <
typename Time = Types::time_type>
2987 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
3010 std::shared_ptr<IOperation<Time>>
Clone()
const override {
3033 static const QC::Gates::ControlledSquareRootNOTDagGate<> csxdaggate;
3034 return csxdaggate.getRawOperatorMatrix();
3046template <
typename Time = Types::time_type>
3064 double phi = 0,
double lambda = 0,
double gamma = 0, Time delay = 0)
3081 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
3169 std::shared_ptr<IOperation<Time>>
Clone()
const override {
3170 return std::make_shared<CUGate<Time>>(
3183 return {theta, phi, lambda, gamma};
3203 const QC::Gates::ControlledUGate<> cugate(theta, phi, lambda, gamma);
3204 return cugate.getRawOperatorMatrix();
3228template <
typename Time = Types::time_type>
3256 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
3280 std::shared_ptr<IOperation<Time>>
Clone()
const override {
3281 return std::make_shared<CCXGate<Time>>(
3293 static const QC::Gates::ToffoliGate<> ccxaggate;
3294 return ccxaggate.getRawOperatorMatrix();
3306template <
typename Time = Types::time_type>
3334 void Execute(
const std::shared_ptr<Simulators::ISimulator> &sim,
3358 std::shared_ptr<IOperation<Time>>
Clone()
const override {
3359 return std::make_shared<CSwapGate<Time>>(
3371 static const QC::Gates::FredkinGate<> cswapgate;
3372 return cswapgate.getRawOperatorMatrix();
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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 Eigen::MatrixXcd GetMatrix() const =0
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the quantum gate.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum 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.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation 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.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
Eigen::MatrixXcd GetMatrix() const override
Get the matrix representation of the quantum gate.
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.