Go to the source code of this file.
Enumerations | |
enum | TargetGate { GATE_SIGMA_X, GATE_SIGMA_Y, GATE_SIGMA_Z, GATE_T, GATE_S, GATE_HADAMARD, GATE_ROTATE_X, GATE_ROTATE_Y, GATE_ROTATE_Z, GATE_ROTATE_AROUND_AXIS, GATE_UNITARY, GATE_PHASE_SHIFT, GATE_SWAP, GATE_SQRT_SWAP } |
! Identifiers of single-target gates More... | |
Functions | |
void | qasm_clearRecorded (Qureg qureg) |
void | qasm_free (Qureg qureg) |
void | qasm_printRecorded (Qureg qureg) |
void | qasm_recordAxisRotation (Qureg qureg, qreal angle, Vector axis, int targetQubit) |
void | qasm_recordComment (Qureg qureg, char *comment,...) |
void | qasm_recordCompactUnitary (Qureg qureg, Complex alpha, Complex beta, int targetQubit) |
void | qasm_recordControlledAxisRotation (Qureg qureg, qreal angle, Vector axis, int controlQubit, int targetQubit) |
void | qasm_recordControlledCompactUnitary (Qureg qureg, Complex alpha, Complex beta, int controlQubit, int targetQubit) |
void | qasm_recordControlledGate (Qureg qureg, TargetGate gate, int controlQubit, int targetQubit) |
void | qasm_recordControlledParamGate (Qureg qureg, TargetGate gate, int controlQubit, int targetQubit, qreal param) |
void | qasm_recordControlledUnitary (Qureg qureg, ComplexMatrix2 u, int controlQubit, int targetQubit) |
additionally performs Rz on target to restore the global phase lost from u in QASM U(a,b,c) More... | |
void | qasm_recordGate (Qureg qureg, TargetGate gate, int targetQubit) |
void | qasm_recordInitClassical (Qureg qureg, long long int stateInd) |
void | qasm_recordInitPlus (Qureg qureg) |
void | qasm_recordInitZero (Qureg qureg) |
void | qasm_recordMeasurement (Qureg qureg, int measureQubit) |
void | qasm_recordMultiControlledGate (Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit) |
void | qasm_recordMultiControlledParamGate (Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit, qreal param) |
void | qasm_recordMultiControlledUnitary (Qureg qureg, ComplexMatrix2 u, int *controlQubits, int numControlQubits, int targetQubit) |
additionally performs Rz on target to restore the global phase lost from u in QASM U(a,b,c) More... | |
void | qasm_recordMultiStateControlledUnitary (Qureg qureg, ComplexMatrix2 u, int *controlQubits, int *controlState, int numControlQubits, int targetQubit) |
void | qasm_recordParamGate (Qureg qureg, TargetGate gate, int targetQubit, qreal param) |
void | qasm_recordUnitary (Qureg qureg, ComplexMatrix2 u, int targetQubit) |
void | qasm_setup (Qureg *qureg) |
void | qasm_startRecording (Qureg qureg) |
void | qasm_stopRecording (Qureg qureg) |
int | qasm_writeRecordedToFile (Qureg qureg, char *filename) |
returns success of file write More... | |
Detailed Description
Functions for generating QASM output from QuEST circuits
Definition in file QuEST_qasm.h.
Enumeration Type Documentation
◆ TargetGate
enum TargetGate |
! Identifiers of single-target gates
Enumerator | |
---|---|
GATE_SIGMA_X | |
GATE_SIGMA_Y | |
GATE_SIGMA_Z | |
GATE_T | |
GATE_S | |
GATE_HADAMARD | |
GATE_ROTATE_X | |
GATE_ROTATE_Y | |
GATE_ROTATE_Z | |
GATE_ROTATE_AROUND_AXIS | |
GATE_UNITARY | |
GATE_PHASE_SHIFT | |
GATE_SWAP | |
GATE_SQRT_SWAP |
Definition at line 20 of file QuEST_qasm.h.
Function Documentation
◆ qasm_clearRecorded()
void qasm_clearRecorded | ( | Qureg | qureg | ) |
Definition at line 477 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by clearRecordedQASM().
◆ qasm_free()
void qasm_free | ( | Qureg | qureg | ) |
Definition at line 500 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by destroyQureg().
◆ qasm_printRecorded()
void qasm_printRecorded | ( | Qureg | qureg | ) |
Definition at line 484 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by printRecordedQASM().
◆ qasm_recordAxisRotation()
Definition at line 223 of file QuEST_qasm.c.
References addGateToQASM(), GATE_UNITARY, getComplexPairFromRotation(), getZYZRotAnglesFromComplexPair(), Qureg::qasmLog, and qreal.
Referenced by rotateAroundAxis().
◆ qasm_recordComment()
void qasm_recordComment | ( | Qureg | qureg, |
char * | comment, | ||
... | |||
) |
Definition at line 120 of file QuEST_qasm.c.
References addStringToQASM(), COMMENT_PREF, MAX_LINE_LEN, and Qureg::qasmLog.
Referenced by applyDiagonalOp(), applyExponentiatedPauliHamil(), applyMatrix2(), applyMatrix4(), applyMatrixN(), applyMultiControlledMatrixN(), applyPauliHamil(), applyPauliSum(), applyTrotterCircuit(), controlledMultiQubitUnitary(), controlledTwoQubitUnitary(), initBlankState(), initPureState(), initStateFromAmps(), mixDephasing(), mixDepolarising(), mixKrausMap(), mixMultiQubitKrausMap(), mixPauli(), mixTwoQubitDephasing(), mixTwoQubitDepolarising(), mixTwoQubitKrausMap(), multiControlledMultiQubitUnitary(), multiControlledTwoQubitUnitary(), multiQubitUnitary(), multiRotatePauli(), multiRotateZ(), qasm_recordControlledParamGate(), qasm_recordControlledUnitary(), qasm_recordInitClassical(), qasm_recordInitPlus(), qasm_recordMultiControlledParamGate(), qasm_recordMultiControlledUnitary(), qasm_recordMultiStateControlledUnitary(), setAmps(), setDensityAmps(), setWeightedQureg(), and twoQubitUnitary().
◆ qasm_recordCompactUnitary()
Definition at line 195 of file QuEST_qasm.c.
References addGateToQASM(), GATE_UNITARY, getZYZRotAnglesFromComplexPair(), Qureg::qasmLog, and qreal.
Referenced by compactUnitary().
◆ qasm_recordControlledAxisRotation()
void qasm_recordControlledAxisRotation | ( | Qureg | qureg, |
qreal | angle, | ||
Vector | axis, | ||
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 300 of file QuEST_qasm.c.
References addGateToQASM(), GATE_UNITARY, getComplexPairFromRotation(), getZYZRotAnglesFromComplexPair(), Qureg::qasmLog, and qreal.
Referenced by controlledRotateAroundAxis().
◆ qasm_recordControlledCompactUnitary()
void qasm_recordControlledCompactUnitary | ( | Qureg | qureg, |
Complex | alpha, | ||
Complex | beta, | ||
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 264 of file QuEST_qasm.c.
References addGateToQASM(), GATE_UNITARY, getZYZRotAnglesFromComplexPair(), Qureg::qasmLog, and qreal.
Referenced by controlledCompactUnitary().
◆ qasm_recordControlledGate()
void qasm_recordControlledGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 238 of file QuEST_qasm.c.
References addGateToQASM(), and Qureg::qasmLog.
Referenced by controlledNot(), controlledPauliY(), controlledPhaseFlip(), sqrtSwapGate(), and swapGate().
◆ qasm_recordControlledParamGate()
void qasm_recordControlledParamGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int | controlQubit, | ||
int | targetQubit, | ||
qreal | param | ||
) |
Definition at line 247 of file QuEST_qasm.c.
References addGateToQASM(), GATE_PHASE_SHIFT, GATE_ROTATE_Z, qasm_recordComment(), Qureg::qasmLog, and qreal.
Referenced by controlledPhaseShift(), controlledRotateX(), controlledRotateY(), and controlledRotateZ().
◆ qasm_recordControlledUnitary()
void qasm_recordControlledUnitary | ( | Qureg | qureg, |
ComplexMatrix2 | u, | ||
int | controlQubit, | ||
int | targetQubit | ||
) |
additionally performs Rz on target to restore the global phase lost from u in QASM U(a,b,c)
Definition at line 278 of file QuEST_qasm.c.
References addGateToQASM(), GATE_ROTATE_Z, GATE_UNITARY, getComplexPairAndPhaseFromUnitary(), getZYZRotAnglesFromComplexPair(), qasm_recordComment(), Qureg::qasmLog, and qreal.
Referenced by controlledUnitary().
◆ qasm_recordGate()
void qasm_recordGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int | targetQubit | ||
) |
Definition at line 178 of file QuEST_qasm.c.
References addGateToQASM(), and Qureg::qasmLog.
Referenced by hadamard(), pauliX(), pauliY(), pauliZ(), qasm_recordInitClassical(), sGate(), and tGate().
◆ qasm_recordInitClassical()
void qasm_recordInitClassical | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 458 of file QuEST_qasm.c.
References GATE_SIGMA_X, MAX_LINE_LEN, Qureg::numQubitsRepresented, qasm_recordComment(), qasm_recordGate(), qasm_recordInitZero(), and Qureg::qasmLog.
Referenced by initClassicalState().
◆ qasm_recordInitPlus()
void qasm_recordInitPlus | ( | Qureg | qureg | ) |
Definition at line 430 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), GATE_HADAMARD, MAX_LINE_LEN, qasm_recordComment(), qasm_recordInitZero(), qasmGateLabels, Qureg::qasmLog, and QUREG_LABEL.
Referenced by initPlusState().
◆ qasm_recordInitZero()
void qasm_recordInitZero | ( | Qureg | qureg | ) |
Definition at line 415 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), INIT_ZERO_CMD, MAX_LINE_LEN, Qureg::qasmLog, and QUREG_LABEL.
Referenced by initZeroState(), qasm_recordInitClassical(), and qasm_recordInitPlus().
◆ qasm_recordMeasurement()
void qasm_recordMeasurement | ( | Qureg | qureg, |
int | measureQubit | ||
) |
Definition at line 398 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), MAX_LINE_LEN, MEASURE_CMD, MESREG_LABEL, Qureg::qasmLog, and QUREG_LABEL.
Referenced by collapseToOutcome(), measure(), and measureWithStats().
◆ qasm_recordMultiControlledGate()
void qasm_recordMultiControlledGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int * | controlQubits, | ||
int | numControlQubits, | ||
int | targetQubit | ||
) |
Definition at line 316 of file QuEST_qasm.c.
References addGateToQASM(), and Qureg::qasmLog.
Referenced by multiControlledPhaseFlip().
◆ qasm_recordMultiControlledParamGate()
void qasm_recordMultiControlledParamGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int * | controlQubits, | ||
int | numControlQubits, | ||
int | targetQubit, | ||
qreal | param | ||
) |
Definition at line 324 of file QuEST_qasm.c.
References addGateToQASM(), GATE_PHASE_SHIFT, GATE_ROTATE_Z, qasm_recordComment(), Qureg::qasmLog, and qreal.
Referenced by multiControlledPhaseShift().
◆ qasm_recordMultiControlledUnitary()
void qasm_recordMultiControlledUnitary | ( | Qureg | qureg, |
ComplexMatrix2 | u, | ||
int * | controlQubits, | ||
int | numControlQubits, | ||
int | targetQubit | ||
) |
additionally performs Rz on target to restore the global phase lost from u in QASM U(a,b,c)
Definition at line 341 of file QuEST_qasm.c.
References addGateToQASM(), GATE_ROTATE_Z, GATE_UNITARY, getComplexPairAndPhaseFromUnitary(), getZYZRotAnglesFromComplexPair(), qasm_recordComment(), Qureg::qasmLog, and qreal.
Referenced by multiControlledUnitary(), and qasm_recordMultiStateControlledUnitary().
◆ qasm_recordMultiStateControlledUnitary()
void qasm_recordMultiStateControlledUnitary | ( | Qureg | qureg, |
ComplexMatrix2 | u, | ||
int * | controlQubits, | ||
int * | controlState, | ||
int | numControlQubits, | ||
int | targetQubit | ||
) |
Definition at line 362 of file QuEST_qasm.c.
References addGateToQASM(), GATE_SIGMA_X, qasm_recordComment(), qasm_recordMultiControlledUnitary(), and Qureg::qasmLog.
Referenced by multiStateControlledUnitary().
◆ qasm_recordParamGate()
void qasm_recordParamGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int | targetQubit, | ||
qreal | param | ||
) |
Definition at line 186 of file QuEST_qasm.c.
References addGateToQASM(), Qureg::qasmLog, and qreal.
Referenced by phaseShift(), rotateX(), rotateY(), and rotateZ().
◆ qasm_recordUnitary()
void qasm_recordUnitary | ( | Qureg | qureg, |
ComplexMatrix2 | u, | ||
int | targetQubit | ||
) |
Definition at line 207 of file QuEST_qasm.c.
References addGateToQASM(), GATE_UNITARY, getComplexPairAndPhaseFromUnitary(), getZYZRotAnglesFromComplexPair(), Qureg::qasmLog, and qreal.
Referenced by unitary().
◆ qasm_setup()
void qasm_setup | ( | Qureg * | qureg | ) |
Definition at line 60 of file QuEST_qasm.c.
References BUF_INIT_SIZE, bufferOverflow(), MESREG_LABEL, Qureg::numQubitsRepresented, Qureg::qasmLog, and QUREG_LABEL.
Referenced by createCloneQureg(), createDensityQureg(), and createQureg().
◆ qasm_startRecording()
void qasm_startRecording | ( | Qureg | qureg | ) |
Definition at line 84 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by startRecordingQASM().
◆ qasm_stopRecording()
void qasm_stopRecording | ( | Qureg | qureg | ) |
Definition at line 88 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by stopRecordingQASM().
◆ qasm_writeRecordedToFile()
int qasm_writeRecordedToFile | ( | Qureg | qureg, |
char * | filename | ||
) |
returns success of file write
Definition at line 489 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by writeRecordedQASMToFile().