3#if defined(__linux__) && defined(INCLUDED_BY_FACTORY)
8template <
class State>
class ImmediateDistributedGpuSimulatorBase :
public State
14 this->Native().ApplyOneQubitMatrixWithLayout(q,
reinterpret_cast<const double *
>(gate.data()), DistributedGpuApi::MGD_MATRIX_COLUMN_MAJOR);
15 this->NotifyObservers({q});
22 this->Native().ApplyTwoQubitMatrixWithLayout(q0, q1,
reinterpret_cast<const double *
>(gate.data()), DistributedGpuApi::MGD_MATRIX_COLUMN_MAJOR);
23 this->NotifyObservers({q0, q1});
31 this->Native().ApplyThreeQubitMatrixWithLayout(q0, q1, q2,
reinterpret_cast<const double *
>(gate.data()), DistributedGpuApi::MGD_MATRIX_COLUMN_MAJOR);
32 this->NotifyObservers({q0, q1, q2});
37 this->QubitIndex(qubit);
38 this->Native().ApplyP(qubit, lambda);
39 this->NotifyObservers({qubit});
44 this->QubitIndex(qubit);
45 this->Native().ApplyX(qubit);
46 this->NotifyObservers({qubit});
51 this->QubitIndex(qubit);
52 this->Native().ApplyY(qubit);
53 this->NotifyObservers({qubit});
58 this->QubitIndex(qubit);
59 this->Native().ApplyZ(qubit);
60 this->NotifyObservers({qubit});
65 this->QubitIndex(qubit);
66 this->Native().ApplyH(qubit);
67 this->NotifyObservers({qubit});
72 this->QubitIndex(qubit);
73 this->Native().ApplyS(qubit);
74 this->NotifyObservers({qubit});
79 this->QubitIndex(qubit);
80 this->Native().ApplySDG(qubit);
81 this->NotifyObservers({qubit});
86 this->QubitIndex(qubit);
87 this->Native().ApplyT(qubit);
88 this->NotifyObservers({qubit});
93 this->QubitIndex(qubit);
94 this->Native().ApplyTDG(qubit);
95 this->NotifyObservers({qubit});
100 this->QubitIndex(qubit);
101 this->Native().ApplySX(qubit);
102 this->NotifyObservers({qubit});
107 this->QubitIndex(qubit);
108 this->Native().ApplySXDG(qubit);
109 this->NotifyObservers({qubit});
114 this->QubitIndex(qubit);
115 this->Native().ApplyK(qubit);
116 this->NotifyObservers({qubit});
121 this->QubitIndex(qubit);
122 this->Native().ApplyRx(qubit, theta);
123 this->NotifyObservers({qubit});
128 this->QubitIndex(qubit);
129 this->Native().ApplyRy(qubit, theta);
130 this->NotifyObservers({qubit});
135 this->QubitIndex(qubit);
136 this->Native().ApplyRz(qubit, theta);
137 this->NotifyObservers({qubit});
140 void ApplyU(
Types::qubit_t qubit,
double theta,
double phi,
double lambda,
double gamma)
override
142 this->QubitIndex(qubit);
143 this->Native().ApplyU(qubit, theta, phi, lambda, gamma);
144 this->NotifyObservers({qubit});
149 this->QubitIndex(ctrl_qubit);
150 this->QubitIndex(tgt_qubit);
151 this->Native().ApplyCX(ctrl_qubit, tgt_qubit);
152 this->NotifyObservers({ctrl_qubit, tgt_qubit});
157 this->QubitIndex(ctrl_qubit);
158 this->QubitIndex(tgt_qubit);
159 this->Native().ApplyCY(ctrl_qubit, tgt_qubit);
160 this->NotifyObservers({ctrl_qubit, tgt_qubit});
165 this->QubitIndex(ctrl_qubit);
166 this->QubitIndex(tgt_qubit);
167 this->Native().ApplyCZ(ctrl_qubit, tgt_qubit);
168 this->NotifyObservers({ctrl_qubit, tgt_qubit});
173 this->QubitIndex(ctrl_qubit);
174 this->QubitIndex(tgt_qubit);
175 this->Native().ApplyCP(ctrl_qubit, tgt_qubit, lambda);
176 this->NotifyObservers({ctrl_qubit, tgt_qubit});
181 this->QubitIndex(ctrl_qubit);
182 this->QubitIndex(tgt_qubit);
183 this->Native().ApplyCRx(ctrl_qubit, tgt_qubit, theta);
184 this->NotifyObservers({ctrl_qubit, tgt_qubit});
189 this->QubitIndex(ctrl_qubit);
190 this->QubitIndex(tgt_qubit);
191 this->Native().ApplyCRy(ctrl_qubit, tgt_qubit, theta);
192 this->NotifyObservers({ctrl_qubit, tgt_qubit});
197 this->QubitIndex(ctrl_qubit);
198 this->QubitIndex(tgt_qubit);
199 this->Native().ApplyCRz(ctrl_qubit, tgt_qubit, theta);
200 this->NotifyObservers({ctrl_qubit, tgt_qubit});
205 this->QubitIndex(ctrl_qubit);
206 this->QubitIndex(tgt_qubit);
207 this->Native().ApplyCH(ctrl_qubit, tgt_qubit);
208 this->NotifyObservers({ctrl_qubit, tgt_qubit});
213 this->QubitIndex(ctrl_qubit);
214 this->QubitIndex(tgt_qubit);
215 this->Native().ApplyCSX(ctrl_qubit, tgt_qubit);
216 this->NotifyObservers({ctrl_qubit, tgt_qubit});
221 this->QubitIndex(ctrl_qubit);
222 this->QubitIndex(tgt_qubit);
223 this->Native().ApplyCSXDG(ctrl_qubit, tgt_qubit);
224 this->NotifyObservers({ctrl_qubit, tgt_qubit});
229 this->QubitIndex(qubit0);
230 this->QubitIndex(qubit1);
231 this->Native().ApplySwap(qubit0, qubit1);
232 this->NotifyObservers({qubit0, qubit1});
237 this->QubitIndex(qubit0);
238 this->QubitIndex(qubit1);
239 this->QubitIndex(qubit2);
240 this->Native().ApplyCCX(qubit0, qubit1, qubit2);
241 this->NotifyObservers({qubit0, qubit1, qubit2});
246 this->QubitIndex(ctrl_qubit);
247 this->QubitIndex(qubit0);
248 this->QubitIndex(qubit1);
249 this->Native().ApplyCSwap(ctrl_qubit, qubit0, qubit1);
250 this->NotifyObservers({ctrl_qubit, qubit0, qubit1});
255 this->QubitIndex(ctrl_qubit);
256 this->QubitIndex(tgt_qubit);
257 this->Native().ApplyCU(ctrl_qubit, tgt_qubit, theta, phi, lambda, gamma);
258 this->NotifyObservers({ctrl_qubit, tgt_qubit});
261 void ApplyNop()
override
263 this->NotifyObservers({});
266 std::unique_ptr<ISimulator> Clone()
override
268 auto copy = std::make_unique<ImmediateDistributedGpuSimulatorBase<State>>();
269 copy->configuration = this->configuration;
270 copy->nrQubits = this->nrQubits;
272 copy->state = this->state->Clone();
277using ImmediateDistributedGpuSimulator = ImmediateDistributedGpuSimulatorBase<DistributedGpuState>;
278using ImmediateDistributedMpiGpuSimulator = ImmediateDistributedGpuSimulatorBase<DistributedMpiGpuState>;
int ApplyK(void *sim, int qubit)
int ApplyRx(void *sim, int qubit, double theta)
int ApplyX(void *sim, int qubit)
int ApplyU(void *sim, int qubit, double theta, double phi, double lambda, double gamma)
int ApplyCRy(void *sim, int controlQubit, int targetQubit, double theta)
int ApplyTDG(void *sim, int qubit)
int ApplyS(void *sim, int qubit)
int ApplyCX(void *sim, int controlQubit, int targetQubit)
int ApplyCRz(void *sim, int controlQubit, int targetQubit, double theta)
int ApplyCP(void *sim, int controlQubit, int targetQubit, double theta)
int ApplySDG(void *sim, int qubit)
int ApplyCSwap(void *sim, int controlQubit, int qubit1, int qubit2)
int ApplyCCX(void *sim, int controlQubit1, int controlQubit2, int targetQubit)
int ApplyY(void *sim, int qubit)
int ApplyZ(void *sim, int qubit)
int ApplyH(void *sim, int qubit)
int ApplyGenericThreeQubitGate(void *sim, unsigned long q0, unsigned long q1, unsigned long q2, const double *buffer)
int ApplyCY(void *sim, int controlQubit, int targetQubit)
int ApplyCU(void *sim, int controlQubit, int targetQubit, double theta, double phi, double lambda, double gamma)
int ApplySwap(void *sim, int qubit1, int qubit2)
int ApplyRy(void *sim, int qubit, double theta)
int ApplyP(void *sim, int qubit, double theta)
int ApplyCH(void *sim, int controlQubit, int targetQubit)
int ApplyCZ(void *sim, int controlQubit, int targetQubit)
int ApplyRz(void *sim, int qubit, double theta)
int ApplyT(void *sim, int qubit)
int ApplyCRx(void *sim, int controlQubit, int targetQubit, double theta)
int ApplyGenericOneQubitGate(void *sim, unsigned long q0, const double *buffer)
int ApplyGenericTwoQubitGate(void *sim, unsigned long q0, unsigned long q1, const double *buffer)
uint_fast64_t qubit_t
The type of a qubit.