#include "QuEST.h"
#include "QuEST_precision.h"
#include "QuEST_internal.h"
#include "QuEST_qasm.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | BUF_GROW_FAC 2 |
#define | BUF_INIT_SIZE 1024 |
#define | COMMENT_PREF "//" |
#define | CTRL_LABEL_PREF "c" |
#define | INIT_ZERO_CMD "reset" |
#define | MAX_LINE_LEN 1024 |
#define | MAX_REG_SYMBS 24 |
#define | MEASURE_CMD "measure" |
#define | MESREG_LABEL "c" |
#define | QUREG_LABEL "q" |
TODO. More... | |
Functions | |
void | addGateToQASM (Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit, qreal *params, int numParams) |
void | addMultiVarOverridesToQASM (Qureg qureg, int numRegs, long long int *overrideInds, qreal *overridePhases, int numOverrides) |
void | addMultiVarRegsToQASM (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding) |
void | addShiftValuesToQASM (Qureg qureg, enum phaseFunc funcName, int numRegs, qreal *params) |
void | addStringToQASM (Qureg qureg, char line[], int lineLen) |
void | bufferOverflow (void) |
char | getPhaseFuncSymbol (int numSymbs, int ind) |
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 funcName, 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... | |
Variables | |
static const char * | qasmGateLabels [] |
Detailed Description
Functions for generating QASM output from QuEST circuits
Definition in file QuEST_qasm.c.
Macro Definition Documentation
◆ BUF_GROW_FAC
#define BUF_GROW_FAC 2 |
Definition at line 36 of file QuEST_qasm.c.
◆ BUF_INIT_SIZE
#define BUF_INIT_SIZE 1024 |
Definition at line 35 of file QuEST_qasm.c.
◆ COMMENT_PREF
#define COMMENT_PREF "//" |
Definition at line 32 of file QuEST_qasm.c.
◆ CTRL_LABEL_PREF
#define CTRL_LABEL_PREF "c" |
Definition at line 29 of file QuEST_qasm.c.
◆ INIT_ZERO_CMD
#define INIT_ZERO_CMD "reset" |
Definition at line 31 of file QuEST_qasm.c.
◆ MAX_LINE_LEN
#define MAX_LINE_LEN 1024 |
Definition at line 34 of file QuEST_qasm.c.
◆ MAX_REG_SYMBS
#define MAX_REG_SYMBS 24 |
Definition at line 37 of file QuEST_qasm.c.
◆ MEASURE_CMD
#define MEASURE_CMD "measure" |
Definition at line 30 of file QuEST_qasm.c.
◆ MESREG_LABEL
#define MESREG_LABEL "c" |
Definition at line 28 of file QuEST_qasm.c.
◆ QUREG_LABEL
#define QUREG_LABEL "q" |
TODO.
- allow user-set decimal precision (useful for when QASM is passed to a plotter)
- sort out fixing global phase in controlledPhaseShift to controlledRotateZ plug
- add functions to directly add comments to QASM by user
- add abilitiy for user to directly add strings to QASM buffer??
Definition at line 27 of file QuEST_qasm.c.
Function Documentation
◆ addGateToQASM()
void addGateToQASM | ( | Qureg | qureg, |
TargetGate | gate, | ||
int * | controlQubits, | ||
int | numControlQubits, | ||
int | targetQubit, | ||
qreal * | params, | ||
int | numParams | ||
) |
Definition at line 139 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), CTRL_LABEL_PREF, MAX_LINE_LEN, qasmGateLabels, and QUREG_LABEL.
Referenced by qasm_recordAxisRotation(), qasm_recordCompactUnitary(), qasm_recordControlledAxisRotation(), qasm_recordControlledCompactUnitary(), qasm_recordControlledGate(), qasm_recordControlledParamGate(), qasm_recordControlledUnitary(), qasm_recordGate(), qasm_recordMultiControlledGate(), qasm_recordMultiControlledMultiQubitNot(), qasm_recordMultiControlledParamGate(), qasm_recordMultiControlledUnitary(), qasm_recordMultiStateControlledUnitary(), qasm_recordParamGate(), and qasm_recordUnitary().
◆ addMultiVarOverridesToQASM()
void addMultiVarOverridesToQASM | ( | Qureg | qureg, |
int | numRegs, | ||
long long int * | overrideInds, | ||
qreal * | overridePhases, | ||
int | numOverrides | ||
) |
Definition at line 600 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), getPhaseFuncSymbol(), MAX_LINE_LEN, MAX_REG_SYMBS, and qasm_recordComment().
Referenced by qasm_recordMultiVarPhaseFunc(), and qasm_recordNamedPhaseFunc().
◆ addMultiVarRegsToQASM()
void addMultiVarRegsToQASM | ( | Qureg | qureg, |
int * | qubits, | ||
int * | numQubitsPerReg, | ||
int | numRegs, | ||
enum bitEncoding | encoding | ||
) |
Definition at line 571 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), getPhaseFuncSymbol(), MAX_LINE_LEN, MAX_REG_SYMBS, qasm_recordComment(), TWOS_COMPLEMENT, and UNSIGNED.
Referenced by qasm_recordMultiVarPhaseFunc(), and qasm_recordNamedPhaseFunc().
◆ addShiftValuesToQASM()
Definition at line 642 of file QuEST_qasm.c.
References addStringToQASM(), bufferOverflow(), MAX_LINE_LEN, qasm_recordComment(), SCALED_INVERSE_SHIFTED_DISTANCE, and SCALED_INVERSE_SHIFTED_NORM.
Referenced by qasm_recordNamedPhaseFunc().
◆ addStringToQASM()
void addStringToQASM | ( | Qureg | qureg, |
char | line[], | ||
int | lineLen | ||
) |
Definition at line 93 of file QuEST_qasm.c.
References BUF_GROW_FAC, bufferOverflow(), and Qureg::qasmLog.
Referenced by addGateToQASM(), addMultiVarOverridesToQASM(), addMultiVarRegsToQASM(), addShiftValuesToQASM(), qasm_recordComment(), qasm_recordInitPlus(), qasm_recordInitZero(), qasm_recordMeasurement(), qasm_recordMultiVarPhaseFunc(), qasm_recordNamedPhaseFunc(), and qasm_recordPhaseFunc().
◆ bufferOverflow()
void bufferOverflow | ( | void | ) |
Definition at line 56 of file QuEST_qasm.c.
Referenced by addGateToQASM(), addMultiVarOverridesToQASM(), addMultiVarRegsToQASM(), addShiftValuesToQASM(), addStringToQASM(), getPhaseFuncSymbol(), qasm_recordInitPlus(), qasm_recordInitZero(), qasm_recordMeasurement(), qasm_recordMultiVarPhaseFunc(), qasm_recordNamedPhaseFunc(), qasm_recordPhaseFunc(), and qasm_setup().
◆ getPhaseFuncSymbol()
char getPhaseFuncSymbol | ( | int | numSymbs, |
int | ind | ||
) |
Definition at line 556 of file QuEST_qasm.c.
References bufferOverflow(), and MAX_REG_SYMBS.
Referenced by addMultiVarOverridesToQASM(), addMultiVarRegsToQASM(), qasm_recordMultiVarPhaseFunc(), and qasm_recordNamedPhaseFunc().
◆ 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 | funcName, | ||
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().
Variable Documentation
◆ qasmGateLabels
|
static |
Definition at line 39 of file QuEST_qasm.c.
Referenced by addGateToQASM(), and qasm_recordInitPlus().