Maestro 0.2.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Simulator.h
Go to the documentation of this file.
1
13
14#pragma once
15
16#ifndef _SIMULATOR_INTERFACE_H_
17#define _SIMULATOR_INTERFACE_H_
18
19#include "State.h"
20
21namespace Simulators {
22
33class ISimulator : public IState, std::enable_shared_from_this<ISimulator> {
34 public:
41 const Eigen::Matrix2cd& gate) = 0;
42
50 Types::qubit_t qubit1,
51 const Eigen::Matrix4cd& gate) = 0;
52
60 virtual void ApplyP(Types::qubit_t qubit, double lambda) = 0;
61
68 virtual void ApplyX(Types::qubit_t qubit) = 0;
69
76 virtual void ApplyY(Types::qubit_t qubit) = 0;
77
84 virtual void ApplyZ(Types::qubit_t qubit) = 0;
85
92 virtual void ApplyH(Types::qubit_t qubit) = 0;
93
100 virtual void ApplyS(Types::qubit_t qubit) = 0;
101
108 virtual void ApplySDG(Types::qubit_t qubit) = 0;
109
116 virtual void ApplyT(Types::qubit_t qubit) = 0;
117
124 virtual void ApplyTDG(Types::qubit_t qubit) = 0;
125
132 virtual void ApplySx(Types::qubit_t qubit) = 0;
133
140 virtual void ApplySxDAG(Types::qubit_t qubit) = 0;
141
148 virtual void ApplyK(Types::qubit_t qubit) = 0;
149
157 virtual void ApplyRx(Types::qubit_t qubit, double theta) = 0;
158
166 virtual void ApplyRy(Types::qubit_t qubit, double theta) = 0;
167
175 virtual void ApplyRz(Types::qubit_t qubit, double theta) = 0;
176
187 virtual void ApplyU(Types::qubit_t qubit, double theta, double phi,
188 double lambda, double gamma) = 0;
189
197 virtual void ApplyCX(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit) = 0;
198
206 virtual void ApplyCY(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit) = 0;
207
215 virtual void ApplyCZ(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit) = 0;
216
225 virtual void ApplyCP(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit,
226 double lambda) = 0;
227
236 virtual void ApplyCRx(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit,
237 double theta) = 0;
238
247 virtual void ApplyCRy(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit,
248 double theta) = 0;
249
258 virtual void ApplyCRz(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit,
259 double theta) = 0;
260
268 virtual void ApplyCH(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit) = 0;
269
277 virtual void ApplyCSx(Types::qubit_t ctrl_qubit,
278 Types::qubit_t tgt_qubit) = 0;
279
287 virtual void ApplyCSxDAG(Types::qubit_t ctrl_qubit,
288 Types::qubit_t tgt_qubit) = 0;
289
297 virtual void ApplySwap(Types::qubit_t qubit0, Types::qubit_t qubit1) = 0;
298
307 virtual void ApplyCCX(Types::qubit_t qubit0, Types::qubit_t qubit1,
308 Types::qubit_t qubit2) = 0;
309
318 virtual void ApplyCSwap(Types::qubit_t ctrl_qubit, Types::qubit_t qubit0,
319 Types::qubit_t qubit1) = 0;
320
332 virtual void ApplyCU(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit,
333 double theta, double phi, double lambda,
334 double gamma) = 0;
335
343 virtual void ApplyNop() = 0;
344
355 virtual std::unique_ptr<ISimulator> Clone() = 0;
356
364 std::shared_ptr<ISimulator> getptr() { return shared_from_this(); }
365};
366} // namespace Simulators
367
368#endif // !_SIMULATOR_INTERFACE_H_
Interface class for a quantum computing simulator.
Definition Simulator.h:33
virtual void ApplyCRz(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta)=0
Applies a CRz gate to the qubits.
virtual void ApplySDG(Types::qubit_t qubit)=0
Applies a S dagger gate to the qubit.
virtual void ApplyCCX(Types::qubit_t qubit0, Types::qubit_t qubit1, Types::qubit_t qubit2)=0
Applies a controlled controlled not gate to the qubits.
virtual void ApplyX(Types::qubit_t qubit)=0
Applies a not gate to the qubit.
virtual void ApplyCSxDAG(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0
Applies a CSx dagger gate to the qubits.
std::shared_ptr< ISimulator > getptr()
Get a shared pointer to this object.
Definition Simulator.h:364
virtual void ApplyU(Types::qubit_t qubit, double theta, double phi, double lambda, double gamma)=0
Applies a U gate to the qubit.
virtual void ApplyP(Types::qubit_t qubit, double lambda)=0
Applies a phase shift gate to the qubit.
virtual void ApplySx(Types::qubit_t qubit)=0
Applies a Sx gate to the qubit.
virtual void ApplyTDG(Types::qubit_t qubit)=0
Applies a T dagger gate to the qubit.
virtual void ApplyCU(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta, double phi, double lambda, double gamma)=0
Applies a controlled U gate to the qubits.
virtual void ApplyCRy(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta)=0
Applies a CRy gate to the qubits.
virtual void ApplyCX(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0
Applies a CX gate to the qubits.
virtual void ApplyRy(Types::qubit_t qubit, double theta)=0
Applies a Ry gate to the qubit.
virtual void ApplyCH(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0
Applies a CH gate to the qubits.
virtual void ApplySwap(Types::qubit_t qubit0, Types::qubit_t qubit1)=0
Applies a swap gate to the qubits.
virtual void ApplyCSx(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0
Applies a CSx gate to the qubits.
virtual void ApplyGenericTwoQubitGate(Types::qubit_t qubit0, Types::qubit_t qubit1, const Eigen::Matrix4cd &gate)=0
Apply a generic two-qubit gate to the specified qubits.
virtual void ApplyK(Types::qubit_t qubit)=0
Applies a K gate to the qubit.
virtual void ApplyY(Types::qubit_t qubit)=0
Applies a Y gate to the qubit.
virtual void ApplyT(Types::qubit_t qubit)=0
Applies a T gate to the qubit.
virtual void ApplyS(Types::qubit_t qubit)=0
Applies a S gate to the qubit.
virtual void ApplyNop()=0
Applies a nop.
virtual void ApplyCSwap(Types::qubit_t ctrl_qubit, Types::qubit_t qubit0, Types::qubit_t qubit1)=0
Applies a controlled swap gate to the qubits.
virtual void ApplyZ(Types::qubit_t qubit)=0
Applies a Z gate to the qubit.
virtual void ApplyRz(Types::qubit_t qubit, double theta)=0
Applies a Rz gate to the qubit.
virtual void ApplyCRx(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta)=0
Applies a CRx gate to the qubits.
virtual void ApplyCY(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0
Applies a CY gate to the qubits.
virtual void ApplyCZ(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0
Applies a CZ gate to the qubits.
virtual std::unique_ptr< ISimulator > Clone()=0
Clones the simulator.
virtual void ApplyH(Types::qubit_t qubit)=0
Applies a Hadamard gate to the qubit.
virtual void ApplyRx(Types::qubit_t qubit, double theta)=0
Applies a Rx gate to the qubit.
virtual void ApplySxDAG(Types::qubit_t qubit)=0
Applies a Sx dagger gate to the qubit.
virtual void ApplyCP(Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double lambda)=0
Applies a CP gate to the qubits.
virtual void ApplyGenericOneQubitGate(Types::qubit_t qubit, const Eigen::Matrix2cd &gate)=0
Apply a generic one-qubit gate to the specified qubit.
Interface class for a quantum computing simulator state.
Definition State.h:104
uint_fast64_t qubit_t
The type of a qubit.
Definition Types.h:21