#include "QuEST.h"#include "QuEST_precision.h"#include "QuEST_internal.h"#include "QuEST_validation.h"#include "QuEST_qasm.h"#include <stdlib.h>#include <string.h>Go to the source code of this file.
Functions | |
| void | applyDiagonalOp (Qureg qureg, DiagonalOp op) |
Apply a diagonal operator, which is possibly non-unitary and non-Hermitian, to the entire qureg. More... | |
| void | applyFullQFT (Qureg qureg) |
Applies the quantum Fourier transform (QFT) to the entirety of qureg. More... | |
| void | applyMatrix2 (Qureg qureg, int targetQubit, ComplexMatrix2 u) |
| Apply a general 2-by-2 matrix, which may be non-unitary. More... | |
| void | applyMatrix4 (Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u) |
| Apply a general 4-by-4 matrix, which may be non-unitary. More... | |
| void | applyMatrixN (Qureg qureg, int *targs, int numTargs, ComplexMatrixN u) |
| Apply a general N-by-N matrix, which may be non-unitary, on any number of target qubits. More... | |
| void | applyMultiControlledMatrixN (Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs, ComplexMatrixN u) |
| Apply a general N-by-N matrix, which may be non-unitary, with additional controlled qubits. More... | |
| void | applyMultiVarPhaseFunc (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, qreal *coeffs, qreal *exponents, int *numTermsPerReg) |
Induces a phase change upon each amplitude of qureg, determined by a multi-variable exponential polynomial "phase function". More... | |
| void | applyMultiVarPhaseFuncOverrides (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) |
Induces a phase change upon each amplitude of qureg, determined by a multi-variable exponential polynomial "phase function", and an explicit set of 'overriding' values at specific state indices. More... | |
| void | applyNamedPhaseFunc (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, enum phaseFunc functionNameCode) |
Induces a phase change upon each amplitude of qureg, determined by a named (and potentially multi-variable) phase function. More... | |
| void | applyNamedPhaseFuncOverrides (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, enum phaseFunc functionNameCode, long long int *overrideInds, qreal *overridePhases, int numOverrides) |
Induces a phase change upon each amplitude of qureg, determined by a named (and potentially multi-variable) phase function, and an explicit set of 'overriding' values at specific state indices. More... | |
| void | applyParamNamedPhaseFunc (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, enum phaseFunc functionNameCode, qreal *params, int numParams) |
Induces a phase change upon each amplitude of qureg, determined by a named, paramaterized (and potentially multi-variable) phase function. More... | |
| void | applyParamNamedPhaseFuncOverrides (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) |
Induces a phase change upon each amplitude of qureg, determined by a named, parameterised (and potentially multi-variable) phase function, and an explicit set of 'overriding' values at specific state indices. More... | |
| void | applyPauliHamil (Qureg inQureg, PauliHamil hamil, Qureg outQureg) |
Modifies outQureg to be the result of applying PauliHamil (a Hermitian but not necessarily unitary operator) to inQureg. More... | |
| void | applyPauliSum (Qureg inQureg, enum pauliOpType *allPauliCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg) |
Modifies outQureg to be the result of applying the weighted sum of Pauli products (a Hermitian but not necessarily unitary operator) to inQureg. More... | |
| void | applyPhaseFunc (Qureg qureg, int *qubits, int numQubits, enum bitEncoding encoding, qreal *coeffs, qreal *exponents, int numTerms) |
Induces a phase change upon each amplitude of qureg, determined by the passed exponential polynomial "phase function". More... | |
| void | applyPhaseFuncOverrides (Qureg qureg, int *qubits, int numQubits, enum bitEncoding encoding, qreal *coeffs, qreal *exponents, int numTerms, long long int *overrideInds, qreal *overridePhases, int numOverrides) |
Induces a phase change upon each amplitude of qureg, determined by the passed exponential polynomial "phase function", and an explicit set of 'overriding' values at specific state indices. More... | |
| void | applyProjector (Qureg qureg, int qubit, int outcome) |
Force the target qubit of qureg into the given classical outcome, via a non-renormalising projection. More... | |
| void | applyQFT (Qureg qureg, int *qubits, int numQubits) |
Applies the quantum Fourier transform (QFT) to a specific subset of qubits of the register qureg. More... | |
| void | applyTrotterCircuit (Qureg qureg, PauliHamil hamil, qreal time, int order, int reps) |
Applies a trotterisation of unitary evolution to qureg. More... | |
| qreal | calcDensityInnerProduct (Qureg rho1, Qureg rho2) |
Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of matrices) of two density matrices rho1 and rho2 of equivalent size. More... | |
| Complex | calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
Computes the expected value of the diagonal operator op for state qureg. More... | |
| qreal | calcExpecPauliHamil (Qureg qureg, PauliHamil hamil, Qureg workspace) |
Computes the expected value of qureg under Hermitian operator hamil. More... | |
| qreal | calcExpecPauliProd (Qureg qureg, int *targetQubits, enum pauliOpType *pauliCodes, int numTargets, Qureg workspace) |
| Computes the expected value of a product of Pauli operators. More... | |
| qreal | calcExpecPauliSum (Qureg qureg, enum pauliOpType *allPauliCodes, qreal *termCoeffs, int numSumTerms, Qureg workspace) |
| Computes the expected value of a sum of products of Pauli operators. More... | |
| qreal | calcFidelity (Qureg qureg, Qureg pureState) |
Calculates the fidelity of qureg (a state-vector or density matrix) against a reference pure state (necessarily a state-vector). More... | |
| qreal | calcHilbertSchmidtDistance (Qureg a, Qureg b) |
Computes the Hilbert Schmidt distance between two density matrices a and b, defined as the Frobenius norm of the difference between them. More... | |
| Complex | calcInnerProduct (Qureg bra, Qureg ket) |
Computes the inner product of two equal-size state vectors, given by. More... | |
| void | calcProbOfAllOutcomes (qreal *retProbs, Qureg qureg, int *qubits, int numQubits) |
Populates outcomeProbs with the probabilities of every outcome of the sub-register contained in qubits. More... | |
| qreal | calcProbOfOutcome (Qureg qureg, int measureQubit, int outcome) |
| Gives the probability of a specified qubit being measured in the given outcome (0 or 1). More... | |
| qreal | calcPurity (Qureg qureg) |
| Calculates the purity of a density matrix, by the trace of the density matrix squared. More... | |
| qreal | calcTotalProb (Qureg qureg) |
A debugging function which calculates the probability of the qubits in qureg being in any state, which should always be 1 for correctly normalised states (hence returning a real number). More... | |
| void | clearRecordedQASM (Qureg qureg) |
| Clear all QASM so far recorded. More... | |
| void | cloneQureg (Qureg targetQureg, Qureg copyQureg) |
Overwrite the amplitudes of targetQureg with those from copyQureg. More... | |
| qreal | collapseToOutcome (Qureg qureg, int measureQubit, int outcome) |
Updates qureg to be consistent with measuring measureQubit in the given outcome (0 or 1), and returns the probability of such a measurement outcome. More... | |
| void | compactUnitary (Qureg qureg, int targetQubit, Complex alpha, Complex beta) |
| Apply a single-qubit unitary parameterised by two given complex scalars. More... | |
| int | compareStates (Qureg qureg1, Qureg qureg2, qreal precision) |
| Return whether two given wavefunctions are equivalent within a given precision Global phase included in equivalence check. More... | |
| void | controlledCompactUnitary (Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta) |
| Apply a controlled unitary (single control, single target) parameterised by two given complex scalars. More... | |
| void | controlledMultiQubitUnitary (Qureg qureg, int ctrl, int *targs, int numTargs, ComplexMatrixN u) |
| Apply a general controlled multi-qubit unitary (including a global phase factor). More... | |
| void | controlledNot (Qureg qureg, int controlQubit, int targetQubit) |
| Apply the controlled not (single control, single target) gate, also known as the c-X, c-sigma-X, c-Pauli-X and c-bit-flip gate. More... | |
| void | controlledPauliY (Qureg qureg, int controlQubit, int targetQubit) |
| Apply the controlled pauliY (single control, single target) gate, also known as the c-Y and c-sigma-Y gate. More... | |
| void | controlledPhaseFlip (Qureg qureg, int idQubit1, int idQubit2) |
| Apply the (two-qubit) controlled phase flip gate, also known as the controlled pauliZ gate. More... | |
| void | controlledPhaseShift (Qureg qureg, int idQubit1, int idQubit2, qreal angle) |
Introduce a phase factor on state of qubits idQubit1 and idQubit2. More... | |
| void | controlledRotateAroundAxis (Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis) |
| Applies a controlled rotation by a given angle around a given vector on the Bloch-sphere. More... | |
| void | controlledRotateX (Qureg qureg, int controlQubit, int targetQubit, qreal angle) |
| Applies a controlled rotation by a given angle around the X-axis of the Bloch-sphere. More... | |
| void | controlledRotateY (Qureg qureg, int controlQubit, int targetQubit, qreal angle) |
| Applies a controlled rotation by a given angle around the Y-axis of the Bloch-sphere. More... | |
| void | controlledRotateZ (Qureg qureg, int controlQubit, int targetQubit, qreal angle) |
| Applies a controlled rotation by a given angle around the Z-axis of the Bloch-sphere. More... | |
| void | controlledTwoQubitUnitary (Qureg qureg, int controlQubit, int targetQubit1, int targetQubit2, ComplexMatrix4 u) |
| Apply a general controlled two-qubit unitary (including a global phase factor). More... | |
| void | controlledUnitary (Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u) |
| Apply a general controlled unitary (single control, single target), which can include a global phase factor. More... | |
| Qureg | createCloneQureg (Qureg qureg, QuESTEnv env) |
| Create a new Qureg which is an exact clone of the passed qureg, which can be either a state-vector or a density matrix. More... | |
| ComplexMatrixN | createComplexMatrixN (int numQubits) |
| Allocate dynamic memory for a square complex matrix of any size, which can be passed to functions like multiQubitUnitary() and applyMatrixN(). More... | |
| Qureg | createDensityQureg (int numQubits, QuESTEnv env) |
| Creates a density matrix Qureg object representing a set of qubits which can enter noisy and mixed states. More... | |
| DiagonalOp | createDiagonalOp (int numQubits, QuESTEnv env) |
| Creates a DiagonalOp representing a diagonal operator on the full Hilbert space of a Qureg. More... | |
| DiagonalOp | createDiagonalOpFromPauliHamilFile (char *fn, QuESTEnv env) |
Creates and initialiases a diagonal operator from the Z Pauli Hamiltonian encoded in file with filename fn. More... | |
| PauliHamil | createPauliHamil (int numQubits, int numSumTerms) |
| Dynamically allocates a Hamiltonian expressed as a real-weighted sum of products of Pauli operators. More... | |
| PauliHamil | createPauliHamilFromFile (char *fn) |
Creates a PauliHamil instance, a real-weighted sum of products of Pauli operators, populated with the data in filename fn. More... | |
| Qureg | createQureg (int numQubits, QuESTEnv env) |
| Creates a state-vector Qureg object representing a set of qubits which will remain in a pure state. More... | |
| void | destroyComplexMatrixN (ComplexMatrixN m) |
| Destroy a ComplexMatrixN instance created with createComplexMatrixN() More... | |
| void | destroyDiagonalOp (DiagonalOp op, QuESTEnv env) |
| Destroys a DiagonalOp created with createDiagonalOp(), freeing its memory. More... | |
| void | destroyPauliHamil (PauliHamil h) |
| Destroy a PauliHamil instance, created with either createPauliHamil() or createPauliHamilFromFile(). More... | |
| void | destroyQureg (Qureg qureg, QuESTEnv env) |
| Deallocate a Qureg, freeing its memory. More... | |
| Complex | getAmp (Qureg qureg, long long int index) |
| Get the complex amplitude at a given index in the state vector. More... | |
| Complex | getDensityAmp (Qureg qureg, long long int row, long long int col) |
| Get an amplitude from a density matrix at a given row and column. More... | |
| qreal | getImagAmp (Qureg qureg, long long int index) |
| Get the imaginary component of the complex probability amplitude at an index in the state vector. More... | |
| long long int | getNumAmps (Qureg qureg) |
Returns the number of complex amplitudes in a state-vector qureg. More... | |
| int | getNumQubits (Qureg qureg) |
Returns the number of qubits represented by qureg. More... | |
| qreal | getProbAmp (Qureg qureg, long long int index) |
| Get the probability of a state-vector at an index in the full state vector. More... | |
| int | getQuEST_PREC (void) |
| void | getQuESTSeeds (QuESTEnv env, unsigned long int **seeds, int *numSeeds) |
| Obtain the seeds presently used in random number generation. More... | |
| qreal | getRealAmp (Qureg qureg, long long int index) |
| Get the real component of the complex probability amplitude at an index in the state vector. More... | |
| void | hadamard (Qureg qureg, int targetQubit) |
| Apply the single-qubit Hadamard gate. More... | |
| void | initBlankState (Qureg qureg) |
| Initialises a qureg to have all-zero-amplitudes. More... | |
| void | initClassicalState (Qureg qureg, long long int stateInd) |
Initialise qureg into the classical state (also known as a "computational basis state") with index stateInd. More... | |
| void | initComplexMatrixN (ComplexMatrixN m, qreal re[][1<< m.numQubits], qreal im[][1<< m.numQubits]) |
Initialises a ComplexMatrixN instance to have the passed real and imag values. More... | |
| void | initDebugState (Qureg qureg) |
Initialises qureg to be in the un-normalised, non-physical state with with -th complex amplitude given by . More... | |
| void | initDiagonalOp (DiagonalOp op, qreal *real, qreal *imag) |
Overwrites the entire DiagonalOp op with the given real and imag complex elements. More... | |
| void | initDiagonalOpFromPauliHamil (DiagonalOp op, PauliHamil hamil) |
Populates the diagonal operator op to be equivalent to the given Pauli Hamiltonian hamil, assuming hamil contains only PAULI_Z operators. More... | |
| void | initPauliHamil (PauliHamil hamil, qreal *coeffs, enum pauliOpType *codes) |
Initialise PauliHamil instance hamil with the given term coefficients and Pauli codes (one for every qubit in every term). More... | |
| void | initPlusState (Qureg qureg) |
Initialise qureg into the plus state. More... | |
| void | initPureState (Qureg qureg, Qureg pure) |
Initialise qureg into to a given pure state of an equivalent Hilbert dimension. More... | |
| void | initStateFromAmps (Qureg qureg, qreal *reals, qreal *imags) |
Initialise qureg by specifying all amplitudes. More... | |
| void | initStateFromSingleFile (Qureg *qureg, char filename[200], QuESTEnv env) |
| Initialises the wavefunction amplitudes according to those specified in a file. More... | |
| void | initStateOfSingleQubit (Qureg *qureg, int qubitId, int outcome) |
| Initialise the state vector of probability amplitudes such that one qubit is set to 'outcome' and all other qubits are in an equal superposition of zero and one. More... | |
| void | initZeroState (Qureg qureg) |
Initialise qureg into the zero state. More... | |
| int | measure (Qureg qureg, int measureQubit) |
| Measures a single qubit, collapsing it randomly to 0 or 1. More... | |
| int | measureWithStats (Qureg qureg, int measureQubit, qreal *outcomeProb) |
| Measures a single qubit, collapsing it randomly to 0 or 1, and additionally gives the probability of that outcome. More... | |
| void | mixDamping (Qureg qureg, int targetQubit, qreal prob) |
Mixes a density matrix qureg to induce single-qubit amplitude damping (decay to 0 state). More... | |
| void | mixDensityMatrix (Qureg combineQureg, qreal otherProb, Qureg otherQureg) |
Modifies combineQureg to become (1-prob)combineProb + prob otherQureg. More... | |
| void | mixDephasing (Qureg qureg, int targetQubit, qreal prob) |
Mixes a density matrix qureg to induce single-qubit dephasing noise. More... | |
| void | mixDepolarising (Qureg qureg, int targetQubit, qreal prob) |
Mixes a density matrix qureg to induce single-qubit homogeneous depolarising noise. More... | |
| void | mixKrausMap (Qureg qureg, int target, ComplexMatrix2 *ops, int numOps) |
Apply a general single-qubit Kraus map to a density matrix, as specified by at most four Kraus operators, (ops). More... | |
| void | mixMultiQubitKrausMap (Qureg qureg, int *targets, int numTargets, ComplexMatrixN *ops, int numOps) |
| Apply a general N-qubit Kraus map to a density matrix, as specified by at most (2N)^2 Kraus operators. More... | |
| void | mixPauli (Qureg qureg, int qubit, qreal probX, qreal probY, qreal probZ) |
Mixes a density matrix qureg to induce general single-qubit Pauli noise. More... | |
| void | mixTwoQubitDephasing (Qureg qureg, int qubit1, int qubit2, qreal prob) |
Mixes a density matrix qureg to induce two-qubit dephasing noise. More... | |
| void | mixTwoQubitDepolarising (Qureg qureg, int qubit1, int qubit2, qreal prob) |
Mixes a density matrix qureg to induce two-qubit homogeneous depolarising noise. More... | |
| void | mixTwoQubitKrausMap (Qureg qureg, int target1, int target2, ComplexMatrix4 *ops, int numOps) |
| Apply a general two-qubit Kraus map to a density matrix, as specified by at most sixteen Kraus operators. More... | |
| void | multiControlledMultiQubitNot (Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs) |
| Apply a NOT (or Pauli X) gate with multiple control and target qubits. More... | |
| void | multiControlledMultiQubitUnitary (Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs, ComplexMatrixN u) |
| Apply a general multi-controlled multi-qubit unitary (including a global phase factor). More... | |
| void | multiControlledMultiRotatePauli (Qureg qureg, int *controlQubits, int numControls, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle) |
| Apply a multi-controlled multi-target multi-Pauli rotation, also known as a controlled Pauli gadget. More... | |
| void | multiControlledMultiRotateZ (Qureg qureg, int *controlQubits, int numControls, int *targetQubits, int numTargets, qreal angle) |
| Apply a multi-controlled multi-target Z rotation, also known as a controlled phase gadget. More... | |
| void | multiControlledPhaseFlip (Qureg qureg, int *controlQubits, int numControlQubits) |
| Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled pauliZ gate. More... | |
| void | multiControlledPhaseShift (Qureg qureg, int *controlQubits, int numControlQubits, qreal angle) |
Introduce a phase factor on state of the passed qubits. More... | |
| void | multiControlledTwoQubitUnitary (Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit1, int targetQubit2, ComplexMatrix4 u) |
| Apply a general multi-controlled two-qubit unitary (including a global phase factor). More... | |
| void | multiControlledUnitary (Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit, ComplexMatrix2 u) |
| Apply a general multiple-control single-target unitary, which can include a global phase factor. More... | |
| void | multiQubitNot (Qureg qureg, int *targs, int numTargs) |
| Apply a NOT (or Pauli X) gate with multiple target qubits, which has the same effect as (but is much faster than) applying each single-qubit NOT gate in turn. More... | |
| void | multiQubitUnitary (Qureg qureg, int *targs, int numTargs, ComplexMatrixN u) |
| Apply a general multi-qubit unitary (including a global phase factor) with any number of target qubits. More... | |
| void | multiRotatePauli (Qureg qureg, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle) |
| Apply a multi-qubit multi-Pauli rotation, also known as a Pauli gadget, on a selected number of qubits. More... | |
| void | multiRotateZ (Qureg qureg, int *qubits, int numQubits, qreal angle) |
| Apply a multi-qubit Z rotation, also known as a phase gadget, on a selected number of qubits. More... | |
| void | multiStateControlledUnitary (Qureg qureg, int *controlQubits, int *controlState, int numControlQubits, int targetQubit, ComplexMatrix2 u) |
| Apply a general single-qubit unitary with multiple control qubits, conditioned upon a specific bit sequence. More... | |
| void | pauliX (Qureg qureg, int targetQubit) |
| Apply the single-qubit Pauli-X (also known as the X, sigma-X, NOT or bit-flip) gate. More... | |
| void | pauliY (Qureg qureg, int targetQubit) |
| Apply the single-qubit Pauli-Y (also known as the Y or sigma-Y) gate. More... | |
| void | pauliZ (Qureg qureg, int targetQubit) |
| Apply the single-qubit Pauli-Z (also known as the Z, sigma-Z or phase-flip) gate. More... | |
| void | phaseShift (Qureg qureg, int targetQubit, qreal angle) |
Shift the phase between and of a single qubit by a given angle. More... | |
| void | printRecordedQASM (Qureg qureg) |
| Print recorded QASM to stdout. More... | |
| void | reportPauliHamil (PauliHamil hamil) |
Print the PauliHamil to screen. More... | |
| void | reportStateToScreen (Qureg qureg, QuESTEnv env, int reportRank) |
| Print the current state vector of probability amplitudes for a set of qubits to standard out. More... | |
| void | rotateAroundAxis (Qureg qureg, int rotQubit, qreal angle, Vector axis) |
| Rotate a single qubit by a given angle around a given Vector on the Bloch-sphere. More... | |
| void | rotateX (Qureg qureg, int targetQubit, qreal angle) |
| Rotate a single qubit by a given angle around the X-axis of the Bloch-sphere. More... | |
| void | rotateY (Qureg qureg, int targetQubit, qreal angle) |
| Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere. More... | |
| void | rotateZ (Qureg qureg, int targetQubit, qreal angle) |
| Rotate a single qubit by a given angle around the Z-axis of the Bloch-sphere (also known as a phase shift gate). More... | |
| void | seedQuESTDefault (QuESTEnv *env) |
| Seeds the random number generator with the (master node) current time and process ID. More... | |
| void | setAmps (Qureg qureg, long long int startInd, qreal *reals, qreal *imags, long long int numAmps) |
Overwrites a subset of the amplitudes in state-vector qureg, with those passed in reals and imags. More... | |
| void | setDensityAmps (Qureg qureg, qreal *reals, qreal *imags) |
| Set elements in the underlying state vector represenation of a density matrix. More... | |
| void | setDiagonalOpElems (DiagonalOp op, long long int startInd, qreal *real, qreal *imag, long long int numElems) |
Modifies a subset (starting at index startInd, and ending at index startInd + numElems) of the elements in DiagonalOp op with the given complex numbers (passed as real and imag components). More... | |
| void | setWeightedQureg (Complex fac1, Qureg qureg1, Complex fac2, Qureg qureg2, Complex facOut, Qureg out) |
Modifies qureg out to the result of (facOut out + fac1 qureg1 + fac2 qureg2), imposing no constraints on normalisation. More... | |
| void | sGate (Qureg qureg, int targetQubit) |
| Apply the single-qubit S gate. More... | |
| void | sqrtSwapGate (Qureg qureg, int qb1, int qb2) |
Performs a sqrt SWAP gate between qubit1 and qubit2. More... | |
| void | startRecordingQASM (Qureg qureg) |
| Enable QASM recording. More... | |
| void | stopRecordingQASM (Qureg qureg) |
| Disable QASM recording. More... | |
| void | swapGate (Qureg qureg, int qb1, int qb2) |
Performs a SWAP gate between qubit1 and qubit2. More... | |
| void | syncDiagonalOp (DiagonalOp op) |
Update the GPU memory with the current values in op.real and op.imag. More... | |
| void | tGate (Qureg qureg, int targetQubit) |
| Apply the single-qubit T gate. More... | |
| void | twoQubitUnitary (Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u) |
| Apply a general two-qubit unitary (including a global phase factor). More... | |
| void | unitary (Qureg qureg, int targetQubit, ComplexMatrix2 u) |
| Apply a general single-qubit unitary (including a global phase factor). More... | |
| void | writeRecordedQASMToFile (Qureg qureg, char *filename) |
| Writes recorded QASM to a file, throwing an error if inaccessible. More... | |
Detailed Description
Implements the QuEST.h API (and some debugging functions) in a hardware-agnostic way, for both pure and mixed states. These functions mostly wrap hardware-specific functions, and should never call eachother.
Density matrices rho of N qubits are flattened to appear as state-vectors |s> of 2N qubits. Operations U rho U^dag are implemented as U^* U |s> and make use of the pure state backend, and often don't need to explicitly compute U^*.
Definition in file QuEST.c.
Function Documentation
◆ compareStates()
Return whether two given wavefunctions are equivalent within a given precision Global phase included in equivalence check.
For debugging purposes.
Definition at line 1573 of file QuEST.c.
References statevec_compareStates(), and validateMatchingQuregDims().
◆ getQuEST_PREC()
| int getQuEST_PREC | ( | void | ) |
◆ initStateFromSingleFile()
Initialises the wavefunction amplitudes according to those specified in a file.
For debugging purpsoses
Definition at line 1582 of file QuEST.c.
References statevec_initStateFromSingleFile(), and validateFileOpened().
◆ initStateOfSingleQubit()
| void initStateOfSingleQubit | ( | Qureg * | qureg, |
| int | qubitId, | ||
| int | outcome | ||
| ) |
Initialise the state vector of probability amplitudes such that one qubit is set to 'outcome' and all other qubits are in an equal superposition of zero and one.
- Parameters
-
[in,out] qureg object representing the set of qubits to be initialised [in] qubitId id of qubit to set to state 'outcome' [in] outcome value of qubit 'qubitId' to set
Definition at line 1587 of file QuEST.c.
References statevec_initStateOfSingleQubit(), validateOutcome(), validateStateVecQureg(), and validateTarget().
◆ setDensityAmps()
Set elements in the underlying state vector represenation of a density matrix.
Not exposed in the public API as this requires an understanding of how the state vector is used to represent a density matrix. Currently can only be used to set all amps.
Definition at line 1030 of file QuEST.c.
References Qureg::numAmpsTotal, qasm_recordComment(), and statevec_setAmps().
to
of two equal-size state vectors, given by.
on state
of qubits
-th complex amplitude given by
.
(
of the passed qubits.
and
of a single qubit by a given angle.