QuEST.h File Reference
#include "QuEST_precision.h"

Go to the source code of this file.

Data Structures

struct  Complex
 Represents one complex number. More...
 
struct  ComplexMatrix2
 Represents a 2x2 matrix of complex numbers. More...
 
struct  ComplexMatrix4
 Represents a 4x4 matrix of complex numbers. More...
 
struct  ComplexMatrixN
 Represents a general 2^N by 2^N matrix of complex numbers. More...
 
struct  DiagonalOp
 Represents a diagonal complex operator on the full Hilbert state of a Qureg. More...
 
struct  PauliHamil
 A Pauli Hamiltonian, expressed as a real-weighted sum of pauli products, and which can hence represent any Hermitian operator. More...
 
struct  QuESTEnv
 Information about the environment the program is running in. More...
 
struct  Qureg
 Represents a system of qubits. More...
 
struct  Vector
 Represents a 3-vector of real numbers. More...
 

Macros

#define getStaticComplexMatrixN(numQubits, re, im)
 Creates a ComplexMatrixN struct which lives in the stack and so does not need freeing, but cannot be returned beyond the calling scope. More...
 

Enumerations

enum  bitEncoding { UNSIGNED =0, TWOS_COMPLEMENT =1 }
 Flags for specifying how the bits in sub-register computational basis states are mapped to indices in functions like applyPhaseFunc(). More...
 
enum  pauliOpType { PAULI_I =0, PAULI_X =1, PAULI_Y =2, PAULI_Z =3 }
 Codes for specifying Pauli operators. More...
 
enum  phaseFunc {
  NORM =0, SCALED_NORM =1, INVERSE_NORM =2, SCALED_INVERSE_NORM =3,
  SCALED_INVERSE_SHIFTED_NORM =4, PRODUCT =5, SCALED_PRODUCT =6, INVERSE_PRODUCT =7,
  SCALED_INVERSE_PRODUCT =8, DISTANCE =9, SCALED_DISTANCE =10, INVERSE_DISTANCE =11,
  SCALED_INVERSE_DISTANCE =12, SCALED_INVERSE_SHIFTED_DISTANCE =13
}
 Flags for specifying named phase functions. More...
 

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 $ \exp(-i \, \text{hamil} \, \text{time}) $ 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 $ \langle \text{bra} | \text{ket} \rangle $ of two equal-size state vectors, given by. More...
 
void calcProbOfAllOutcomes (qreal *outcomeProbs, 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...
 
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 $ \exp(i \theta) $ on state $ |11\rangle $ 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...
 
void copyStateFromGPU (Qureg qureg)
 In GPU mode, this copies the state-vector (or density matrix) from GPU memory (qureg.deviceStateVec) to RAM (qureg.stateVec), where it can be accessed/modified by the user. More...
 
void copyStateToGPU (Qureg qureg)
 In GPU mode, this copies the state-vector (or density matrix) from RAM (qureg.stateVec) to VRAM / GPU-memory (qureg.deviceStateVec), which is the version operated upon by other calls to the API. 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...
 
QuESTEnv createQuESTEnv (void)
 Create the QuEST execution environment. 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 matr)
 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 hamil)
 Destroy a PauliHamil instance, created with either createPauliHamil() or createPauliHamilFromFile(). More...
 
void destroyQuESTEnv (QuESTEnv env)
 Destroy the QuEST environment. 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...
 
void getEnvironmentString (QuESTEnv env, char str[200])
 Sets str to a string containing information about the runtime environment, including whether simulation is using CUDA (for GPU), OpenMP (for multithreading) and/or MPI (for distribution). 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...
 
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 real[][1<< m.numQubits], qreal imag[][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 $n$-th complex amplitude given by $2n/10 + i(2n+1)/10$. 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 initZeroState (Qureg qureg)
 Initialise qureg into the zero state. More...
 
void invalidQuESTInputError (const char *errMsg, const char *errFunc)
 An internal function called when invalid arguments are passed to a QuEST API call, which the user can optionally override by redefining. 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 prob, 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, $K_i$ (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 targetQubit, 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 $ \exp(i \theta) $ on state $ |1 \dots 1 \rangle $ 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 $ |0\rangle $ and $ |1\rangle $ 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 reportQuESTEnv (QuESTEnv env)
 Report information about the QuEST environment. More...
 
void reportQuregParams (Qureg qureg)
 Report metainformation about a set of qubits: number of qubits, number of probability amplitudes. More...
 
void reportState (Qureg qureg)
 Print the current state vector of probability amplitudes for a set of qubits to file. 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 rotQubit, qreal angle)
 Rotate a single qubit by a given angle around the X-axis of the Bloch-sphere. More...
 
void rotateY (Qureg qureg, int rotQubit, qreal angle)
 Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere. More...
 
void rotateZ (Qureg qureg, int rotQubit, 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 seedQuEST (QuESTEnv *env, unsigned long int *seedArray, int numSeeds)
 Seeds the random number generator with a custom array of key(s), overriding the default keys. 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 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 qubit1, int qubit2)
 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 syncQuESTEnv (QuESTEnv env)
 Guarantees that all code up to the given point has been executed on all nodes (if running in distributed mode) More...
 
int syncQuESTSuccess (int successCode)
 Performs a logical AND on all successCodes held by all processes. 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

The QuEST API. This file contains the comments used by doxygen for generating API doc.

Definition in file QuEST.h.