QuEST_qasm.h
1// Distributed under MIT licence. See https://github.com/QuEST-Kit/QuEST/blob/master/LICENCE.txt for details
2
9# ifndef QUEST_QASM_H
10# define QUEST_QASM_H
11
12# include "QuEST.h"
13# include "QuEST_precision.h"
14
15# ifdef __cplusplus
16extern "C" {
17# endif
18
20typedef enum {
21 GATE_SIGMA_X,
22 GATE_SIGMA_Y,
23 GATE_SIGMA_Z,
24 GATE_T,
25 GATE_S,
26 GATE_HADAMARD,
27 GATE_ROTATE_X,
28 GATE_ROTATE_Y,
29 GATE_ROTATE_Z,
30 GATE_ROTATE_AROUND_AXIS,
31 GATE_UNITARY,
32 GATE_PHASE_SHIFT,
33 GATE_SWAP,
34 GATE_SQRT_SWAP
35} TargetGate;
36
37void qasm_setup(Qureg* qureg);
38
39void qasm_startRecording(Qureg qureg);
40
41void qasm_stopRecording(Qureg qureg);
42
43void qasm_recordGate(Qureg qureg, TargetGate gate, int targetQubit);
44
45void qasm_recordParamGate(Qureg qureg, TargetGate gate, int targetQubit, qreal param);
46
47void qasm_recordCompactUnitary(Qureg qureg, Complex alpha, Complex beta, int targetQubit);
48
49void qasm_recordUnitary(Qureg qureg, ComplexMatrix2 u, int targetQubit);
50
51void qasm_recordAxisRotation(Qureg qureg, qreal angle, Vector axis, int targetQubit);
52
53void qasm_recordControlledGate(Qureg qureg, TargetGate gate, int controlQubit, int targetQubit);
54
55void qasm_recordControlledParamGate(Qureg qureg, TargetGate gate, int controlQubit, int targetQubit, qreal param);
56
57void qasm_recordControlledCompactUnitary(Qureg qureg, Complex alpha, Complex beta, int controlQubit, int targetQubit);
58
59void qasm_recordControlledUnitary(Qureg qureg, ComplexMatrix2 u, int controlQubit, int targetQubit);
60
61void qasm_recordControlledAxisRotation(Qureg qureg, qreal angle, Vector axis, int controlQubit, int targetQubit);
62
63void qasm_recordMultiControlledGate(Qureg qureg,
64TargetGate gate, int* controlQubits, int numControlQubits, int targetQubit);
65
66void qasm_recordMultiControlledParamGate(Qureg qureg, TargetGate gate, int* controlQubits, int numControlQubits, int targetQubit, qreal param);
67
68void qasm_recordMultiControlledUnitary(Qureg qureg, ComplexMatrix2 u, int* controlQubits, int numControlQubits, int targetQubit);
69
70void qasm_recordMultiStateControlledUnitary(Qureg qureg, ComplexMatrix2 u, int* controlQubits, int* controlState, int numControlQubits, int targetQubit);
71
72void qasm_recordMultiControlledMultiQubitNot(Qureg qureg, int* ctrls, int numCtrls, int* targs, int numTargs);
73
74/* not actually used. D'oh!
75void qasm_recordMultiControlledAxisRotation(Qureg qureg, qreal angle, Vector axis, int* controlQubits, int numControlQubits, int targetQubit);\
76*/
77
78void qasm_recordMeasurement(Qureg qureg, int measureQubit);
79
80void qasm_recordInitZero(Qureg qureg);
81
82void qasm_recordInitPlus(Qureg qureg);
83
84void qasm_recordInitClassical(Qureg qureg, long long int stateInd);
85
86void qasm_recordPhaseFunc(Qureg qureg, int* qubits, int numQubits, enum bitEncoding encoding, qreal* coeffs, qreal* exponents, int numTerms, long long int* overrideInds, qreal* overridePhases, int numOverrides);
87
88void qasm_recordMultiVarPhaseFunc(Qureg qureg, int* qubits, int* numQubitsPerReg, int numRegs, enum bitEncoding encoding, qreal* coeffs, qreal* exponents, int* numTermsPerReg, long long int* overrideInds, qreal* overridePhases, int numOverrides);
89
90void qasm_recordNamedPhaseFunc(Qureg qureg, int* qubits, int* numQubitsPerReg, int numRegs, enum bitEncoding encoding, enum phaseFunc functionNameCode, qreal* params, int numParams, long long int* overrideInds, qreal* overridePhases, int numOverrides);
91
92void qasm_recordComment(Qureg qureg, char* comment, ...);
93
94void qasm_clearRecorded(Qureg qureg);
95
96void qasm_printRecorded(Qureg qureg);
97
98int qasm_writeRecordedToFile(Qureg qureg, char* filename);
99
100void qasm_free(Qureg qureg);
101
102# ifdef __cplusplus
103}
104# endif
105
106# endif // QUEST_QASM_H
#define qreal
A precision-agnostic floating point number, as determined by QuEST_PREC.
bitEncoding
Flags for specifying how the bits in sub-register computational basis states are mapped to indices in...
Definition: QuEST.h:288
phaseFunc
Flags for specifying named phase functions.
Definition: QuEST.h:249
Represents a 2x2 matrix of complex numbers.
Definition: QuEST.h:155
Represents one complex number.
Definition: QuEST.h:121
Represents a system of qubits.
Definition: QuEST.h:361
Represents a 3-vector of real numbers.
Definition: QuEST.h:216