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_recordMultiControlledMultiQubitNot (Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs) |
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_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) |
void | 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) |
void | qasm_recordParamGate (Qureg qureg, TargetGate gate, int targetQubit, qreal param) |
void | 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) |
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 864 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by clearRecordedQASM().
◆ qasm_free()
void qasm_free | ( | Qureg | qureg | ) |
Definition at line 887 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by destroyQureg().
◆ qasm_printRecorded()
void qasm_printRecorded | ( | Qureg | qureg | ) |
Definition at line 871 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by printRecordedQASM().
◆ qasm_recordAxisRotation()
Definition at line 224 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 121 of file QuEST_qasm.c.
References addStringToQASM(), COMMENT_PREF, MAX_LINE_LEN, and Qureg::qasmLog.
Referenced by addMultiVarOverridesToQASM(), addMultiVarRegsToQASM(), addShiftValuesToQASM(), applyDiagonalOp(), applyExponentiatedPauliHamil(), applyFullQFT(), applyMatrix2(), applyMatrix4(), applyMatrixN(), applyMultiControlledMatrixN(), applyPauliHamil(), applyPauliSum(), applyProjector(), applyQFT(), applyTrotterCircuit(), controlledMultiQubitUnitary(), controlledTwoQubitUnitary(), initBlankState(), initPureState(), initStateFromAmps(), mixDephasing(), mixDepolarising(), mixKrausMap(), mixMultiQubitKrausMap(), mixPauli(), mixTwoQubitDephasing(), mixTwoQubitDepolarising(), mixTwoQubitKrausMap(), multiControlledMultiQubitUnitary(), multiControlledMultiRotatePauli(), multiControlledMultiRotateZ(), multiControlledTwoQubitUnitary(), multiQubitUnitary(), multiRotatePauli(), multiRotateZ(), qasm_recordControlledParamGate(), qasm_recordControlledUnitary(), qasm_recordInitClassical(), qasm_recordInitPlus(), qasm_recordMultiControlledMultiQubitNot(), qasm_recordMultiControlledParamGate(), qasm_recordMultiControlledUnitary(), qasm_recordMultiStateControlledUnitary(), qasm_recordMultiVarPhaseFunc(), qasm_recordNamedPhaseFunc(), qasm_recordPhaseFunc(), setAmps(), setDensityAmps(), setWeightedQureg(), and twoQubitUnitary().
◆ qasm_recordCompactUnitary()
Definition at line 196 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 301 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 265 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 239 of file QuEST_qasm.c.
References addGateToQASM(), and Qureg::qasmLog.
Referenced by agnostic_applyQFT(), controlledNot(), controlledPauliY(), controlledPhaseFlip(), sqrtSwapGate(), and swapGate().
◆ qasm_recordControlledParamGate()
void qasm_recordControlledParamGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int | controlQubit, | ||
int | targetQubit, | ||
qreal | param | ||
) |
Definition at line 248 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 279 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 179 of file QuEST_qasm.c.
References addGateToQASM(), and Qureg::qasmLog.
Referenced by agnostic_applyQFT(), hadamard(), pauliX(), pauliY(), pauliZ(), qasm_recordInitClassical(), sGate(), and tGate().
◆ qasm_recordInitClassical()
void qasm_recordInitClassical | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 471 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 443 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 428 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 411 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 317 of file QuEST_qasm.c.
References addGateToQASM(), and Qureg::qasmLog.
Referenced by multiControlledPhaseFlip().
◆ qasm_recordMultiControlledMultiQubitNot()
void qasm_recordMultiControlledMultiQubitNot | ( | Qureg | qureg, |
int * | ctrls, | ||
int | numCtrls, | ||
int * | targs, | ||
int | numTargs | ||
) |
Definition at line 382 of file QuEST_qasm.c.
References addGateToQASM(), GATE_SIGMA_X, qasm_recordComment(), and Qureg::qasmLog.
Referenced by multiControlledMultiQubitNot(), and multiQubitNot().
◆ qasm_recordMultiControlledParamGate()
void qasm_recordMultiControlledParamGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int * | controlQubits, | ||
int | numControlQubits, | ||
int | targetQubit, | ||
qreal | param | ||
) |
Definition at line 325 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 342 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 363 of file QuEST_qasm.c.
References addGateToQASM(), GATE_SIGMA_X, qasm_recordComment(), qasm_recordMultiControlledUnitary(), and Qureg::qasmLog.
Referenced by multiStateControlledUnitary().
◆ qasm_recordMultiVarPhaseFunc()
void 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 | ||
) |
Definition at line 666 of file QuEST_qasm.c.
References addMultiVarOverridesToQASM(), addMultiVarRegsToQASM(), addStringToQASM(), bufferOverflow(), getPhaseFuncSymbol(), MAX_LINE_LEN, MAX_REG_SYMBS, qasm_recordComment(), and Qureg::qasmLog.
Referenced by applyMultiVarPhaseFunc(), and applyMultiVarPhaseFuncOverrides().
◆ qasm_recordNamedPhaseFunc()
void 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 | ||
) |
Definition at line 726 of file QuEST_qasm.c.
References addMultiVarOverridesToQASM(), addMultiVarRegsToQASM(), addShiftValuesToQASM(), addStringToQASM(), bufferOverflow(), DISTANCE, getPhaseFuncSymbol(), INVERSE_DISTANCE, INVERSE_NORM, INVERSE_PRODUCT, MAX_LINE_LEN, MAX_REG_SYMBS, NORM, PRODUCT, qasm_recordComment(), Qureg::qasmLog, SCALED_DISTANCE, SCALED_INVERSE_DISTANCE, SCALED_INVERSE_NORM, SCALED_INVERSE_PRODUCT, SCALED_INVERSE_SHIFTED_DISTANCE, SCALED_INVERSE_SHIFTED_NORM, SCALED_NORM, and SCALED_PRODUCT.
Referenced by agnostic_applyQFT(), applyNamedPhaseFunc(), applyNamedPhaseFuncOverrides(), applyParamNamedPhaseFunc(), and applyParamNamedPhaseFuncOverrides().
◆ qasm_recordParamGate()
void qasm_recordParamGate | ( | Qureg | qureg, |
TargetGate | gate, | ||
int | targetQubit, | ||
qreal | param | ||
) |
Definition at line 187 of file QuEST_qasm.c.
References addGateToQASM(), Qureg::qasmLog, and qreal.
Referenced by phaseShift(), rotateX(), rotateY(), and rotateZ().
◆ qasm_recordPhaseFunc()
void 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 | ||
) |
Definition at line 490 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), MAX_LINE_LEN, qasm_recordComment(), Qureg::qasmLog, TWOS_COMPLEMENT, and UNSIGNED.
Referenced by applyPhaseFunc(), and applyPhaseFuncOverrides().
◆ qasm_recordUnitary()
void qasm_recordUnitary | ( | Qureg | qureg, |
ComplexMatrix2 | u, | ||
int | targetQubit | ||
) |
Definition at line 208 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 61 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 85 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by startRecordingQASM().
◆ qasm_stopRecording()
void qasm_stopRecording | ( | Qureg | qureg | ) |
Definition at line 89 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 876 of file QuEST_qasm.c.
References Qureg::qasmLog.
Referenced by writeRecordedQASMToFile().