#include "QuEST.h"
#include "QuEST_precision.h"
#include "QuEST_internal.h"
#include "mt19937ar.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
Go to the source code of this file.
Macros | |
#define | DEBUG 0 |
#define | REDUCE_SHARED_SIZE 512 |
Functions | |
DiagonalOp | agnostic_createDiagonalOp (int numQubits, QuESTEnv env) |
void | agnostic_destroyDiagonalOp (DiagonalOp op) |
void | agnostic_setDiagonalOpElems (DiagonalOp op, long long int startInd, qreal *real, qreal *imag, long long int numElems) |
void | agnostic_syncDiagonalOp (DiagonalOp op) |
__global__ void | copySharedReduceBlock (qreal *arrayIn, qreal *reducedArray, int length) |
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... | |
QuESTEnv | createQuESTEnv (void) |
Create the QuEST execution environment. More... | |
void | densmatr_applyDiagonalOp (Qureg qureg, DiagonalOp op) |
__global__ void | densmatr_applyDiagonalOpKernel (Qureg qureg, DiagonalOp op) |
Complex | densmatr_calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
__global__ void | densmatr_calcExpecDiagonalOpKernel (int getRealComp, qreal *matReal, qreal *matImag, qreal *opReal, qreal *opImag, int numQubits, long long int numTermsToSum, qreal *reducedArray) |
qreal | densmatr_calcFidelity (Qureg qureg, Qureg pureState) |
__global__ void | densmatr_calcFidelityKernel (Qureg dens, Qureg vec, long long int dim, qreal *reducedArray) |
computes one term of (vec^*T) dens * vec More... | |
qreal | densmatr_calcHilbertSchmidtDistance (Qureg a, Qureg b) |
__global__ void | densmatr_calcHilbertSchmidtDistanceSquaredKernel (qreal *aRe, qreal *aIm, qreal *bRe, qreal *bIm, long long int numAmpsToSum, qreal *reducedArray) |
qreal | densmatr_calcInnerProduct (Qureg a, Qureg b) |
__global__ void | densmatr_calcInnerProductKernel (Qureg a, Qureg b, long long int numTermsToSum, qreal *reducedArray) |
computes Tr(conjTrans(a) b) = sum of (a_ij^* b_ij), which is a real number More... | |
qreal | densmatr_calcProbOfOutcome (Qureg qureg, int measureQubit, int outcome) |
qreal | densmatr_calcPurity (Qureg qureg) |
Computes the trace of the density matrix squared. More... | |
__global__ void | densmatr_calcPurityKernel (qreal *vecReal, qreal *vecImag, long long int numAmpsToSum, qreal *reducedArray) |
qreal | densmatr_calcTotalProb (Qureg qureg) |
void | densmatr_collapseToKnownProbOutcome (Qureg qureg, int measureQubit, int outcome, qreal outcomeProb) |
This involves finding |...i...><...j...| states and killing those where i!=j. More... | |
__global__ void | densmatr_collapseToKnownProbOutcomeKernel (qreal outcomeProb, qreal *vecReal, qreal *vecImag, long long int numBasesToVisit, long long int part1, long long int part2, long long int part3, long long int rowBit, long long int colBit, long long int desired, long long int undesired) |
Maps thread ID to a |..0..><..0..| state and then locates |0><1|, |1><0| and |1><1|. More... | |
qreal | densmatr_findProbabilityOfZero (Qureg qureg, int measureQubit) |
__global__ void | densmatr_findProbabilityOfZeroKernel (Qureg qureg, int measureQubit, qreal *reducedArray) |
void | densmatr_initClassicalState (Qureg qureg, long long int stateInd) |
__global__ void | densmatr_initClassicalStateKernel (long long int densityNumElems, qreal *densityReal, qreal *densityImag, long long int densityInd) |
void | densmatr_initPlusState (Qureg qureg) |
__global__ void | densmatr_initPlusStateKernel (long long int stateVecSize, qreal probFactor, qreal *stateVecReal, qreal *stateVecImag) |
void | densmatr_initPureState (Qureg targetQureg, Qureg copyQureg) |
__global__ void | densmatr_initPureStateKernel (long long int numPureAmps, qreal *targetVecReal, qreal *targetVecImag, qreal *copyVecReal, qreal *copyVecImag) |
void | densmatr_mixDamping (Qureg qureg, int targetQubit, qreal damping) |
__global__ void | densmatr_mixDampingKernel (qreal damping, qreal *vecReal, qreal *vecImag, long long int numAmpsToVisit, long long int part1, long long int part2, long long int part3, long long int bothBits) |
Works like mixDephasing but modifies every other element, and elements are averaged in pairs. More... | |
void | densmatr_mixDensityMatrix (Qureg combineQureg, qreal otherProb, Qureg otherQureg) |
__global__ void | densmatr_mixDensityMatrixKernel (Qureg combineQureg, qreal otherProb, Qureg otherQureg, long long int numAmpsToVisit) |
void | densmatr_mixDephasing (Qureg qureg, int targetQubit, qreal dephase) |
__global__ void | densmatr_mixDephasingKernel (qreal fac, qreal *vecReal, qreal *vecImag, long long int numAmpsToVisit, long long int part1, long long int part2, long long int part3, long long int colBit, long long int rowBit) |
Called once for every 4 amplitudes in density matrix Works by establishing the |..0..><..0..| state (for its given index) then visiting |..1..><..0..| and |..0..><..1..|. More... | |
void | densmatr_mixDepolarising (Qureg qureg, int targetQubit, qreal depolLevel) |
__global__ void | densmatr_mixDepolarisingKernel (qreal depolLevel, qreal *vecReal, qreal *vecImag, long long int numAmpsToVisit, long long int part1, long long int part2, long long int part3, long long int bothBits) |
Works like mixDephasing but modifies every other element, and elements are averaged in pairs. More... | |
void | densmatr_mixTwoQubitDephasing (Qureg qureg, int qubit1, int qubit2, qreal dephase) |
__global__ void | densmatr_mixTwoQubitDephasingKernel (qreal fac, qreal *vecReal, qreal *vecImag, long long int numBackgroundStates, long long int numAmpsToVisit, long long int part1, long long int part2, long long int part3, long long int part4, long long int part5, long long int colBit1, long long int rowBit1, long long int colBit2, long long int rowBit2) |
Called 12 times for every 16 amplitudes in density matrix Each sums from the |..0..0..><..0..0..| index to visit either |..0..0..><..0..1..|, |..0..0..><..1..0..|, |..0..0..><..1..1..|, |..0..1..><..0..0..| etc and so on to |..1..1..><..1..0|. More... | |
void | densmatr_mixTwoQubitDepolarising (Qureg qureg, int qubit1, int qubit2, qreal depolLevel) |
__global__ void | densmatr_mixTwoQubitDepolarisingKernel (qreal depolLevel, qreal *vecReal, qreal *vecImag, long long int numAmpsToVisit, long long int part1, long long int part2, long long int part3, long long int part4, long long int part5, long long int rowCol1, long long int rowCol2) |
Called once for every 16 amplitudes. More... | |
void | densmatr_oneQubitDegradeOffDiagonal (Qureg qureg, int targetQubit, qreal dephFac) |
void | destroyQuESTEnv (QuESTEnv env) |
Destroy the QuEST environment. More... | |
__forceinline__ __device__ int | extractBit (const int locationOfBitFromRight, const long long int theEncodedNumber) |
__forceinline__ __device__ long long int | flipBit (const long long int number, const int bitInd) |
__forceinline__ __device__ int | getBitMaskParity (long long int mask) |
void | getEnvironmentString (QuESTEnv env, Qureg qureg, char str[200]) |
Sets str to a string containing the number of qubits in qureg , and the hardware facilities used (e.g. More... | |
int | getNumReductionLevels (long long int numValuesToReduce, int numReducedPerLevel) |
int | GPUExists (void) |
__forceinline__ __device__ long long int | insertTwoZeroBits (const long long int number, const int bit1, const int bit2) |
__forceinline__ __device__ long long int | insertZeroBit (const long long int number, const int index) |
__forceinline__ __device__ long long int | insertZeroBits (long long int number, int *inds, const int numInds) |
__device__ __host__ unsigned int | log2Int (unsigned int x) |
__device__ void | reduceBlock (qreal *arrayIn, qreal *reducedArray, int length) |
void | reportQuESTEnv (QuESTEnv env) |
Report information about the QuEST environment. More... | |
void | seedQuESTDefault () |
Seed the Mersenne Twister used for random number generation in the QuEST environment with an example defualt seed. More... | |
void | statevec_applyDiagonalOp (Qureg qureg, DiagonalOp op) |
__global__ void | statevec_applyDiagonalOpKernel (Qureg qureg, DiagonalOp op) |
Complex | statevec_calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
__global__ void | statevec_calcExpecDiagonalOpKernel (int getRealComp, qreal *vecReal, qreal *vecImag, qreal *opReal, qreal *opImag, long long int numTermsToSum, qreal *reducedArray) |
computes either a real or imag term of |vec_i|^2 op_i More... | |
Complex | statevec_calcInnerProduct (Qureg bra, Qureg ket) |
Terrible code which unnecessarily individually computes and sums the real and imaginary components of the inner product, so as to not have to worry about keeping the sums separated during reduction. More... | |
__global__ void | statevec_calcInnerProductKernel (int getRealComp, qreal *vecReal1, qreal *vecImag1, qreal *vecReal2, qreal *vecImag2, long long int numTermsToSum, qreal *reducedArray) |
computes either a real or imag term in the inner product More... | |
qreal | statevec_calcProbOfOutcome (Qureg qureg, int measureQubit, int outcome) |
qreal | statevec_calcTotalProb (Qureg qureg) |
void | statevec_cloneQureg (Qureg targetQureg, Qureg copyQureg) |
works for both statevectors and density matrices More... | |
void | statevec_collapseToKnownProbOutcome (Qureg qureg, int measureQubit, int outcome, qreal outcomeProb) |
__global__ void | statevec_collapseToKnownProbOutcomeKernel (Qureg qureg, int measureQubit, int outcome, qreal totalProbability) |
void | statevec_compactUnitary (Qureg qureg, int targetQubit, Complex alpha, Complex beta) |
__global__ void | statevec_compactUnitaryKernel (Qureg qureg, int rotQubit, Complex alpha, Complex beta) |
int | statevec_compareStates (Qureg mq1, Qureg mq2, qreal precision) |
void | statevec_controlledCompactUnitary (Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta) |
__global__ void | statevec_controlledCompactUnitaryKernel (Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta) |
void | statevec_controlledNot (Qureg qureg, int controlQubit, int targetQubit) |
__global__ void | statevec_controlledNotKernel (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliY (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliYConj (Qureg qureg, int controlQubit, int targetQubit) |
__global__ void | statevec_controlledPauliYKernel (Qureg qureg, int controlQubit, int targetQubit, int conjFac) |
void | statevec_controlledPhaseFlip (Qureg qureg, int idQubit1, int idQubit2) |
__global__ void | statevec_controlledPhaseFlipKernel (Qureg qureg, int idQubit1, int idQubit2) |
void | statevec_controlledPhaseShift (Qureg qureg, int idQubit1, int idQubit2, qreal angle) |
__global__ void | statevec_controlledPhaseShiftKernel (Qureg qureg, int idQubit1, int idQubit2, qreal cosAngle, qreal sinAngle) |
void | statevec_controlledUnitary (Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u) |
__global__ void | statevec_controlledUnitaryKernel (Qureg qureg, int controlQubit, int targetQubit, ArgMatrix2 u) |
void | statevec_createQureg (Qureg *qureg, int numQubits, QuESTEnv env) |
void | statevec_destroyQureg (Qureg qureg, QuESTEnv env) |
qreal | statevec_findProbabilityOfZero (Qureg qureg, int measureQubit) |
__global__ void | statevec_findProbabilityOfZeroKernel (Qureg qureg, int measureQubit, qreal *reducedArray) |
qreal | statevec_getImagAmp (Qureg qureg, long long int index) |
qreal | statevec_getRealAmp (Qureg qureg, long long int index) |
void | statevec_hadamard (Qureg qureg, int targetQubit) |
__global__ void | statevec_hadamardKernel (Qureg qureg, int targetQubit) |
void | statevec_initBlankState (Qureg qureg) |
__global__ void | statevec_initBlankStateKernel (long long int stateVecSize, qreal *stateVecReal, qreal *stateVecImag) |
void | statevec_initClassicalState (Qureg qureg, long long int stateInd) |
__global__ void | statevec_initClassicalStateKernel (long long int stateVecSize, qreal *stateVecReal, qreal *stateVecImag, long long int stateInd) |
void | statevec_initDebugState (Qureg qureg) |
Initialise the state vector of probability amplitudes to an (unphysical) state with each component of each probability amplitude a unique floating point value. More... | |
__global__ void | statevec_initDebugStateKernel (long long int stateVecSize, qreal *stateVecReal, qreal *stateVecImag) |
void | statevec_initPlusState (Qureg qureg) |
__global__ void | statevec_initPlusStateKernel (long long int stateVecSize, qreal *stateVecReal, qreal *stateVecImag) |
int | statevec_initStateFromSingleFile (Qureg *qureg, char filename[200], QuESTEnv env) |
void | statevec_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... | |
__global__ void | statevec_initStateOfSingleQubitKernel (long long int stateVecSize, qreal *stateVecReal, qreal *stateVecImag, int qubitId, int outcome) |
void | statevec_initZeroState (Qureg qureg) |
__global__ void | statevec_initZeroStateKernel (long long int stateVecSize, qreal *stateVecReal, qreal *stateVecImag) |
void | statevec_multiControlledMultiQubitUnitary (Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. More... | |
__global__ void | statevec_multiControlledMultiQubitUnitaryKernel (Qureg qureg, long long int ctrlMask, int *targs, int numTargs, qreal *uRe, qreal *uIm, long long int *ampInds, qreal *reAmps, qreal *imAmps, long long int numTargAmps) |
void | statevec_multiControlledPhaseFlip (Qureg qureg, int *controlQubits, int numControlQubits) |
__global__ void | statevec_multiControlledPhaseFlipKernel (Qureg qureg, long long int mask) |
void | statevec_multiControlledPhaseShift (Qureg qureg, int *controlQubits, int numControlQubits, qreal angle) |
__global__ void | statevec_multiControlledPhaseShiftKernel (Qureg qureg, long long int mask, qreal cosAngle, qreal sinAngle) |
void | statevec_multiControlledTwoQubitUnitary (Qureg qureg, long long int ctrlMask, int q1, int q2, ComplexMatrix4 u) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. More... | |
__global__ void | statevec_multiControlledTwoQubitUnitaryKernel (Qureg qureg, long long int ctrlMask, int q1, int q2, ArgMatrix4 u) |
void | statevec_multiControlledUnitary (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ComplexMatrix2 u) |
__global__ void | statevec_multiControlledUnitaryKernel (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ArgMatrix2 u) |
void | statevec_multiRotateZ (Qureg qureg, long long int mask, qreal angle) |
__global__ void | statevec_multiRotateZKernel (Qureg qureg, long long int mask, qreal cosAngle, qreal sinAngle) |
void | statevec_pauliX (Qureg qureg, int targetQubit) |
__global__ void | statevec_pauliXKernel (Qureg qureg, int targetQubit) |
void | statevec_pauliY (Qureg qureg, int targetQubit) |
void | statevec_pauliYConj (Qureg qureg, int targetQubit) |
__global__ void | statevec_pauliYKernel (Qureg qureg, int targetQubit, int conjFac) |
void | statevec_phaseShiftByTerm (Qureg qureg, int targetQubit, Complex term) |
__global__ void | statevec_phaseShiftByTermKernel (Qureg qureg, int targetQubit, qreal cosAngle, qreal sinAngle) |
void | statevec_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 | statevec_setAmps (Qureg qureg, long long int startInd, qreal *reals, qreal *imags, long long int numAmps) |
void | statevec_setWeightedQureg (Complex fac1, Qureg qureg1, Complex fac2, Qureg qureg2, Complex facOut, Qureg out) |
__global__ void | statevec_setWeightedQuregKernel (Complex fac1, Qureg qureg1, Complex fac2, Qureg qureg2, Complex facOut, Qureg out) |
void | statevec_swapQubitAmps (Qureg qureg, int qb1, int qb2) |
__global__ void | statevec_swapQubitAmpsKernel (Qureg qureg, int qb1, int qb2) |
void | statevec_unitary (Qureg qureg, int targetQubit, ComplexMatrix2 u) |
__global__ void | statevec_unitaryKernel (Qureg qureg, int targetQubit, ArgMatrix2 u) |
void | swapDouble (qreal **a, qreal **b) |
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... | |
Detailed Description
An implementation of the backend in ../QuEST_internal.h for a GPU environment.
Definition in file QuEST_gpu.cu.
Macro Definition Documentation
◆ DEBUG
#define DEBUG 0 |
Definition at line 20 of file QuEST_gpu.cu.
◆ REDUCE_SHARED_SIZE
#define REDUCE_SHARED_SIZE 512 |
Definition at line 19 of file QuEST_gpu.cu.
Function Documentation
◆ agnostic_createDiagonalOp()
DiagonalOp agnostic_createDiagonalOp | ( | int | numQubits, |
QuESTEnv | env | ||
) |
Definition at line 338 of file QuEST_gpu.cu.
References DiagonalOp::chunkId, DiagonalOp::deviceOperator, DiagonalOp::imag, DiagonalOp::numChunks, DiagonalOp::numElemsPerChunk, DiagonalOp::numQubits, QuESTEnv::numRanks, qreal, QuESTEnv::rank, and DiagonalOp::real.
Referenced by createDiagonalOp().
◆ agnostic_destroyDiagonalOp()
void agnostic_destroyDiagonalOp | ( | DiagonalOp | op | ) |
Definition at line 375 of file QuEST_gpu.cu.
References DiagonalOp::deviceOperator, DiagonalOp::imag, and DiagonalOp::real.
Referenced by destroyDiagonalOp().
◆ agnostic_setDiagonalOpElems()
void agnostic_setDiagonalOpElems | ( | DiagonalOp | op, |
long long int | startInd, | ||
qreal * | real, | ||
qreal * | imag, | ||
long long int | numElems | ||
) |
Definition at line 3233 of file QuEST_gpu.cu.
References DiagonalOp::deviceOperator, DiagonalOp::imag, qreal, and DiagonalOp::real.
Referenced by initDiagonalOp(), and setDiagonalOpElems().
◆ agnostic_syncDiagonalOp()
void agnostic_syncDiagonalOp | ( | DiagonalOp | op | ) |
Definition at line 382 of file QuEST_gpu.cu.
References DiagonalOp::deviceOperator, DiagonalOp::imag, DiagonalOp::numQubits, qreal, and DiagonalOp::real.
Referenced by syncDiagonalOp().
◆ copySharedReduceBlock()
Definition at line 1806 of file QuEST_gpu.cu.
References qreal, and reduceBlock().
Referenced by densmatr_calcExpecDiagonalOp(), densmatr_calcFidelity(), densmatr_calcHilbertSchmidtDistance(), densmatr_calcInnerProduct(), densmatr_calcPurity(), densmatr_findProbabilityOfZero(), statevec_calcExpecDiagonalOp(), statevec_calcInnerProduct(), and statevec_findProbabilityOfZero().
◆ densmatr_applyDiagonalOp()
void densmatr_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 2970 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by applyDiagonalOp().
◆ densmatr_applyDiagonalOpKernel()
__global__ void densmatr_applyDiagonalOpKernel | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 2947 of file QuEST_gpu.cu.
References DiagonalOp::deviceOperator, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, DiagonalOp::numQubits, and qreal.
◆ densmatr_calcExpecDiagonalOp()
Complex densmatr_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 3142 of file QuEST_gpu.cu.
References copySharedReduceBlock(), DiagonalOp::deviceOperator, Qureg::deviceStateVec, Qureg::firstLevelReduction, Complex::imag, Qureg::numAmpsPerChunk, DiagonalOp::numQubits, qreal, Complex::real, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcExpecDiagonalOp().
◆ densmatr_calcExpecDiagonalOpKernel()
__global__ void densmatr_calcExpecDiagonalOpKernel | ( | int | getRealComp, |
qreal * | matReal, | ||
qreal * | matImag, | ||
qreal * | opReal, | ||
qreal * | opImag, | ||
int | numQubits, | ||
long long int | numTermsToSum, | ||
qreal * | reducedArray | ||
) |
if the thread represents a diagonal op, then it computes either a real or imag term of matr_{ii} op_i. Otherwise, it writes a 0 to the reduction array
Definition at line 3097 of file QuEST_gpu.cu.
References qreal, and reduceBlock().
◆ densmatr_calcFidelity()
Definition at line 2249 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::firstLevelReduction, Qureg::numQubitsRepresented, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcFidelity().
◆ densmatr_calcFidelityKernel()
__global__ void densmatr_calcFidelityKernel | ( | Qureg | dens, |
Qureg | vec, | ||
long long int | dim, | ||
qreal * | reducedArray | ||
) |
computes one term of (vec^*T) dens * vec
Definition at line 2211 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, qreal, and reduceBlock().
◆ densmatr_calcHilbertSchmidtDistance()
Definition at line 2323 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::deviceStateVec, Qureg::firstLevelReduction, Qureg::numAmpsPerChunk, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcHilbertSchmidtDistance().
◆ densmatr_calcHilbertSchmidtDistanceSquaredKernel()
__global__ void densmatr_calcHilbertSchmidtDistanceSquaredKernel | ( | qreal * | aRe, |
qreal * | aIm, | ||
qreal * | bRe, | ||
qreal * | bIm, | ||
long long int | numAmpsToSum, | ||
qreal * | reducedArray | ||
) |
◆ densmatr_calcInnerProduct()
Definition at line 2043 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::firstLevelReduction, Qureg::numAmpsTotal, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcDensityInnerProduct().
◆ densmatr_calcInnerProductKernel()
__global__ void densmatr_calcInnerProductKernel | ( | Qureg | a, |
Qureg | b, | ||
long long int | numTermsToSum, | ||
qreal * | reducedArray | ||
) |
computes Tr(conjTrans(a) b) = sum of (a_ij^* b_ij), which is a real number
Definition at line 2022 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, qreal, and reduceBlock().
◆ densmatr_calcProbOfOutcome()
Definition at line 2013 of file QuEST_gpu.cu.
References densmatr_findProbabilityOfZero(), and qreal.
Referenced by calcProbOfOutcome(), collapseToOutcome(), and densmatr_measureWithStats().
◆ densmatr_calcPurity()
Computes the trace of the density matrix squared.
Definition at line 2394 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::deviceStateVec, Qureg::firstLevelReduction, Qureg::numAmpsPerChunk, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcPurity().
◆ densmatr_calcPurityKernel()
__global__ void densmatr_calcPurityKernel | ( | qreal * | vecReal, |
qreal * | vecImag, | ||
long long int | numAmpsToSum, | ||
qreal * | reducedArray | ||
) |
◆ densmatr_calcTotalProb()
Definition at line 1531 of file QuEST_gpu.cu.
References copyStateFromGPU(), Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by calcTotalProb(), and statevec_calcExpecPauliProd().
◆ densmatr_collapseToKnownProbOutcome()
void densmatr_collapseToKnownProbOutcome | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | outcomeProb | ||
) |
This involves finding |...i...><...j...| states and killing those where i!=j.
Renorms (/prob) every | * outcome * >< * outcome * | state, setting all others to zero.
Definition at line 2535 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by collapseToOutcome(), and densmatr_measureWithStats().
◆ densmatr_collapseToKnownProbOutcomeKernel()
__global__ void densmatr_collapseToKnownProbOutcomeKernel | ( | qreal | outcomeProb, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
long long int | numBasesToVisit, | ||
long long int | part1, | ||
long long int | part2, | ||
long long int | part3, | ||
long long int | rowBit, | ||
long long int | colBit, | ||
long long int | desired, | ||
long long int | undesired | ||
) |
Maps thread ID to a |..0..><..0..| state and then locates |0><1|, |1><0| and |1><1|.
Definition at line 2509 of file QuEST_gpu.cu.
◆ densmatr_findProbabilityOfZero()
Definition at line 1919 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::firstLevelReduction, Qureg::numQubitsRepresented, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by densmatr_calcProbOfOutcome().
◆ densmatr_findProbabilityOfZeroKernel()
__global__ void densmatr_findProbabilityOfZeroKernel | ( | Qureg | qureg, |
int | measureQubit, | ||
qreal * | reducedArray | ||
) |
Definition at line 1815 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numQubitsRepresented, qreal, and reduceBlock().
◆ densmatr_initClassicalState()
void densmatr_initClassicalState | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 258 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by initClassicalState().
◆ densmatr_initClassicalStateKernel()
__global__ void densmatr_initClassicalStateKernel | ( | long long int | densityNumElems, |
qreal * | densityReal, | ||
qreal * | densityImag, | ||
long long int | densityInd | ||
) |
Definition at line 239 of file QuEST_gpu.cu.
◆ densmatr_initPlusState()
void densmatr_initPlusState | ( | Qureg | qureg | ) |
Definition at line 226 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by initPlusState().
◆ densmatr_initPlusStateKernel()
__global__ void densmatr_initPlusStateKernel | ( | long long int | stateVecSize, |
qreal | probFactor, | ||
qreal * | stateVecReal, | ||
qreal * | stateVecImag | ||
) |
Definition at line 216 of file QuEST_gpu.cu.
◆ densmatr_initPureState()
Definition at line 205 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initPureState().
◆ densmatr_initPureStateKernel()
__global__ void densmatr_initPureStateKernel | ( | long long int | numPureAmps, |
qreal * | targetVecReal, | ||
qreal * | targetVecImag, | ||
qreal * | copyVecReal, | ||
qreal * | copyVecImag | ||
) |
◆ densmatr_mixDamping()
Definition at line 2778 of file QuEST_gpu.cu.
References densmatr_oneQubitDegradeOffDiagonal(), Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by mixDamping().
◆ densmatr_mixDampingKernel()
__global__ void densmatr_mixDampingKernel | ( | qreal | damping, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
long long int | numAmpsToVisit, | ||
long long int | part1, | ||
long long int | part2, | ||
long long int | part3, | ||
long long int | bothBits | ||
) |
Works like mixDephasing but modifies every other element, and elements are averaged in pairs.
Definition at line 2731 of file QuEST_gpu.cu.
References qreal.
◆ densmatr_mixDensityMatrix()
Definition at line 2576 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by mixDensityMatrix().
◆ densmatr_mixDensityMatrixKernel()
__global__ void densmatr_mixDensityMatrixKernel | ( | Qureg | combineQureg, |
qreal | otherProb, | ||
Qureg | otherQureg, | ||
long long int | numAmpsToVisit | ||
) |
◆ densmatr_mixDephasing()
Definition at line 2629 of file QuEST_gpu.cu.
References densmatr_oneQubitDegradeOffDiagonal(), and qreal.
Referenced by densmatr_mixDepolarising(), and mixDephasing().
◆ densmatr_mixDephasingKernel()
__global__ void densmatr_mixDephasingKernel | ( | qreal | fac, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
long long int | numAmpsToVisit, | ||
long long int | part1, | ||
long long int | part2, | ||
long long int | part3, | ||
long long int | colBit, | ||
long long int | rowBit | ||
) |
Called once for every 4 amplitudes in density matrix Works by establishing the |..0..><..0..| state (for its given index) then visiting |..1..><..0..| and |..0..><..1..|.
Labels |part1 X pa><rt2 NOT(X) part3| From the brain of Simon Benjamin
Definition at line 2593 of file QuEST_gpu.cu.
◆ densmatr_mixDepolarising()
Definition at line 2752 of file QuEST_gpu.cu.
References densmatr_mixDephasing(), Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by mixDepolarising().
◆ densmatr_mixDepolarisingKernel()
__global__ void densmatr_mixDepolarisingKernel | ( | qreal | depolLevel, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
long long int | numAmpsToVisit, | ||
long long int | part1, | ||
long long int | part2, | ||
long long int | part3, | ||
long long int | bothBits | ||
) |
Works like mixDephasing but modifies every other element, and elements are averaged in pairs.
Definition at line 2705 of file QuEST_gpu.cu.
References qreal.
◆ densmatr_mixTwoQubitDephasing()
Definition at line 2668 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by densmatr_mixTwoQubitDepolarising(), and mixTwoQubitDephasing().
◆ densmatr_mixTwoQubitDephasingKernel()
__global__ void densmatr_mixTwoQubitDephasingKernel | ( | qreal | fac, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
long long int | numBackgroundStates, | ||
long long int | numAmpsToVisit, | ||
long long int | part1, | ||
long long int | part2, | ||
long long int | part3, | ||
long long int | part4, | ||
long long int | part5, | ||
long long int | colBit1, | ||
long long int | rowBit1, | ||
long long int | colBit2, | ||
long long int | rowBit2 | ||
) |
Called 12 times for every 16 amplitudes in density matrix Each sums from the |..0..0..><..0..0..| index to visit either |..0..0..><..0..1..|, |..0..0..><..1..0..|, |..0..0..><..1..1..|, |..0..1..><..0..0..| etc and so on to |..1..1..><..1..0|.
Labels |part1 0 part2 0 par><t3 0 part4 0 part5|. From the brain of Simon Benjamin
Definition at line 2644 of file QuEST_gpu.cu.
◆ densmatr_mixTwoQubitDepolarising()
Definition at line 2838 of file QuEST_gpu.cu.
References densmatr_mixTwoQubitDephasing(), Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by mixTwoQubitDepolarising().
◆ densmatr_mixTwoQubitDepolarisingKernel()
__global__ void densmatr_mixTwoQubitDepolarisingKernel | ( | qreal | depolLevel, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
long long int | numAmpsToVisit, | ||
long long int | part1, | ||
long long int | part2, | ||
long long int | part3, | ||
long long int | part4, | ||
long long int | part5, | ||
long long int | rowCol1, | ||
long long int | rowCol2 | ||
) |
Called once for every 16 amplitudes.
Definition at line 2806 of file QuEST_gpu.cu.
References qreal.
◆ densmatr_oneQubitDegradeOffDiagonal()
Definition at line 2609 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by densmatr_mixDamping(), and densmatr_mixDephasing().
◆ extractBit()
__forceinline__ __device__ int extractBit | ( | const int | locationOfBitFromRight, |
const long long int | theEncodedNumber | ||
) |
Definition at line 82 of file QuEST_gpu.cu.
Referenced by compressPairVectorForSingleQubitDepolarise(), compressPairVectorForTwoQubitDepolarise(), densmatr_collapseToKnownProbOutcome(), densmatr_findProbabilityOfZeroLocal(), densmatr_mixDampingDistributed(), densmatr_mixDepolarisingDistributed(), densmatr_mixTwoQubitDepolarisingDistributed(), densmatr_mixTwoQubitDepolarisingQ1LocalQ2DistributedPart3(), getGlobalIndOfOddParityInChunk(), statevec_controlledCompactUnitaryDistributed(), statevec_controlledCompactUnitaryKernel(), statevec_controlledCompactUnitaryLocal(), statevec_controlledNotDistributed(), statevec_controlledNotKernel(), statevec_controlledNotLocal(), statevec_controlledPauliYDistributed(), statevec_controlledPauliYKernel(), statevec_controlledPauliYLocal(), statevec_controlledPhaseFlip(), statevec_controlledPhaseFlipKernel(), statevec_controlledPhaseShift(), statevec_controlledPhaseShiftKernel(), statevec_controlledUnitaryDistributed(), statevec_controlledUnitaryKernel(), statevec_controlledUnitaryLocal(), statevec_initStateOfSingleQubit(), statevec_initStateOfSingleQubitKernel(), statevec_multiControlledMultiQubitUnitaryKernel(), statevec_multiControlledMultiQubitUnitaryLocal(), and statevec_phaseShiftByTerm().
◆ flipBit()
__forceinline__ __device__ long long int flipBit | ( | const long long int | number, |
const int | bitInd | ||
) |
Definition at line 95 of file QuEST_gpu.cu.
Referenced by getGlobalIndOfOddParityInChunk(), statevec_multiControlledMultiQubitUnitary(), statevec_multiControlledMultiQubitUnitaryKernel(), statevec_multiControlledMultiQubitUnitaryLocal(), statevec_multiControlledTwoQubitUnitary(), statevec_multiControlledTwoQubitUnitaryKernel(), statevec_multiControlledTwoQubitUnitaryLocal(), statevec_swapQubitAmps(), statevec_swapQubitAmpsDistributed(), statevec_swapQubitAmpsKernel(), and statevec_swapQubitAmpsLocal().
◆ getBitMaskParity()
__forceinline__ __device__ int getBitMaskParity | ( | long long int | mask | ) |
◆ getNumReductionLevels()
int getNumReductionLevels | ( | long long int | numValuesToReduce, |
int | numReducedPerLevel | ||
) |
Definition at line 1903 of file QuEST_gpu.cu.
◆ GPUExists()
int GPUExists | ( | void | ) |
◆ insertTwoZeroBits()
__forceinline__ __device__ long long int insertTwoZeroBits | ( | const long long int | number, |
const int | bit1, | ||
const int | bit2 | ||
) |
Definition at line 106 of file QuEST_gpu.cu.
References insertZeroBit().
Referenced by statevec_multiControlledTwoQubitUnitaryKernel(), statevec_multiControlledTwoQubitUnitaryLocal(), statevec_swapQubitAmpsKernel(), and statevec_swapQubitAmpsLocal().
◆ insertZeroBit()
__forceinline__ __device__ long long int insertZeroBit | ( | const long long int | number, |
const int | index | ||
) |
Definition at line 99 of file QuEST_gpu.cu.
Referenced by insertTwoZeroBits(), insertZeroBits(), and statevec_multiControlledMultiQubitUnitaryLocal().
◆ insertZeroBits()
__forceinline__ __device__ long long int insertZeroBits | ( | long long int | number, |
int * | inds, | ||
const int | numInds | ||
) |
Definition at line 112 of file QuEST_gpu.cu.
References insertZeroBit().
Referenced by statevec_multiControlledMultiQubitUnitaryKernel().
◆ log2Int()
__device__ __host__ unsigned int log2Int | ( | unsigned int | x | ) |
Definition at line 1780 of file QuEST_gpu.cu.
Referenced by reduceBlock().
◆ reduceBlock()
Definition at line 1787 of file QuEST_gpu.cu.
References log2Int().
Referenced by copySharedReduceBlock(), densmatr_calcExpecDiagonalOpKernel(), densmatr_calcFidelityKernel(), densmatr_calcHilbertSchmidtDistanceSquaredKernel(), densmatr_calcInnerProductKernel(), densmatr_calcPurityKernel(), densmatr_findProbabilityOfZeroKernel(), statevec_calcExpecDiagonalOpKernel(), statevec_calcInnerProductKernel(), and statevec_findProbabilityOfZeroKernel().
◆ statevec_applyDiagonalOp()
void statevec_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 2939 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by applyDiagonalOp().
◆ statevec_applyDiagonalOpKernel()
__global__ void statevec_applyDiagonalOpKernel | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 2917 of file QuEST_gpu.cu.
References DiagonalOp::deviceOperator, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_calcExpecDiagonalOp()
Complex statevec_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 3006 of file QuEST_gpu.cu.
References copySharedReduceBlock(), DiagonalOp::deviceOperator, Qureg::deviceStateVec, Qureg::firstLevelReduction, Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcExpecDiagonalOp().
◆ statevec_calcExpecDiagonalOpKernel()
__global__ void statevec_calcExpecDiagonalOpKernel | ( | int | getRealComp, |
qreal * | vecReal, | ||
qreal * | vecImag, | ||
qreal * | opReal, | ||
qreal * | opImag, | ||
long long int | numTermsToSum, | ||
qreal * | reducedArray | ||
) |
computes either a real or imag term of |vec_i|^2 op_i
Definition at line 2979 of file QuEST_gpu.cu.
References qreal, and reduceBlock().
◆ statevec_calcInnerProduct()
Terrible code which unnecessarily individually computes and sums the real and imaginary components of the inner product, so as to not have to worry about keeping the sums separated during reduction.
Truly disgusting, probably doubles runtime, please fix. @TODO could even do the kernel twice, storing real in bra.reduc and imag in ket.reduc?
Definition at line 2123 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::deviceStateVec, Qureg::firstLevelReduction, Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcInnerProduct(), statevec_calcExpecPauliProd(), and statevec_calcFidelity().
◆ statevec_calcInnerProductKernel()
__global__ void statevec_calcInnerProductKernel | ( | int | getRealComp, |
qreal * | vecReal1, | ||
qreal * | vecImag1, | ||
qreal * | vecReal2, | ||
qreal * | vecImag2, | ||
long long int | numTermsToSum, | ||
qreal * | reducedArray | ||
) |
computes either a real or imag term in the inner product
Definition at line 2093 of file QuEST_gpu.cu.
References qreal, and reduceBlock().
◆ statevec_calcProbOfOutcome()
Definition at line 2005 of file QuEST_gpu.cu.
References qreal, and statevec_findProbabilityOfZero().
Referenced by calcProbOfOutcome(), collapseToOutcome(), and statevec_measureWithStats().
◆ statevec_calcTotalProb()
Definition at line 1554 of file QuEST_gpu.cu.
References copyStateFromGPU(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by calcTotalProb().
◆ statevec_cloneQureg()
works for both statevectors and density matrices
Definition at line 170 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, and Qureg::numAmpsPerChunk.
Referenced by cloneQureg(), createCloneQureg(), initPureState(), and statevec_calcExpecPauliProd().
◆ statevec_collapseToKnownProbOutcome()
void statevec_collapseToKnownProbOutcome | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | outcomeProb | ||
) |
Definition at line 2500 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by collapseToOutcome(), and statevec_measureWithStats().
◆ statevec_collapseToKnownProbOutcomeKernel()
__global__ void statevec_collapseToKnownProbOutcomeKernel | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | totalProbability | ||
) |
Definition at line 2443 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_compactUnitary()
Definition at line 776 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by compactUnitary(), statevec_multiRotatePauli(), statevec_rotateAroundAxis(), and statevec_rotateAroundAxisConj().
◆ statevec_compactUnitaryKernel()
__global__ void statevec_compactUnitaryKernel | ( | Qureg | qureg, |
int | rotQubit, | ||
Complex | alpha, | ||
Complex | beta | ||
) |
fix – no necessary for GPU version
Definition at line 721 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
◆ statevec_compareStates()
Definition at line 703 of file QuEST_gpu.cu.
References copyStateFromGPU(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by compareStates().
◆ statevec_controlledCompactUnitary()
void statevec_controlledCompactUnitary | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
Complex | alpha, | ||
Complex | beta | ||
) |
Definition at line 843 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledCompactUnitary(), statevec_controlledRotateAroundAxis(), and statevec_controlledRotateAroundAxisConj().
◆ statevec_controlledCompactUnitaryKernel()
__global__ void statevec_controlledCompactUnitaryKernel | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
Complex | alpha, | ||
Complex | beta | ||
) |
fix – no necessary for GPU version
Definition at line 784 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
◆ statevec_controlledNot()
void statevec_controlledNot | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1772 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledNot().
◆ statevec_controlledNotKernel()
__global__ void statevec_controlledNotKernel | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1733 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledPauliY()
void statevec_controlledPauliY | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1377 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPauliY().
◆ statevec_controlledPauliYConj()
void statevec_controlledPauliYConj | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1386 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPauliY().
◆ statevec_controlledPauliYKernel()
__global__ void statevec_controlledPauliYKernel | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
int | conjFac | ||
) |
Definition at line 1341 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledPhaseFlip()
void statevec_controlledPhaseFlip | ( | Qureg | qureg, |
int | idQubit1, | ||
int | idQubit2 | ||
) |
Definition at line 1607 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPhaseFlip().
◆ statevec_controlledPhaseFlipKernel()
__global__ void statevec_controlledPhaseFlipKernel | ( | Qureg | qureg, |
int | idQubit1, | ||
int | idQubit2 | ||
) |
Definition at line 1586 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledPhaseShift()
Definition at line 1459 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPhaseShift().
◆ statevec_controlledPhaseShiftKernel()
__global__ void statevec_controlledPhaseShiftKernel | ( | Qureg | qureg, |
int | idQubit1, | ||
int | idQubit2, | ||
qreal | cosAngle, | ||
qreal | sinAngle | ||
) |
Definition at line 1434 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledUnitary()
void statevec_controlledUnitary | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 1169 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledUnitary().
◆ statevec_controlledUnitaryKernel()
__global__ void statevec_controlledUnitaryKernel | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
ArgMatrix2 | u | ||
) |
fix – no necessary for GPU version
Definition at line 1111 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_createQureg()
Definition at line 275 of file QuEST_gpu.cu.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::firstLevelReduction, Qureg::isDensityMatrix, Qureg::numAmpsPerChunk, Qureg::numAmpsTotal, Qureg::numChunks, Qureg::numQubitsInStateVec, QuESTEnv::numRanks, Qureg::pairStateVec, qreal, QuESTEnv::rank, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and Qureg::stateVec.
Referenced by createCloneQureg(), createDensityQureg(), and createQureg().
◆ statevec_destroyQureg()
Definition at line 321 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::firstLevelReduction, QuESTEnv::numRanks, Qureg::pairStateVec, Qureg::secondLevelReduction, and Qureg::stateVec.
Referenced by destroyQureg().
◆ statevec_findProbabilityOfZero()
Definition at line 1967 of file QuEST_gpu.cu.
References copySharedReduceBlock(), Qureg::firstLevelReduction, Qureg::numAmpsPerChunk, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by statevec_calcProbOfOutcome().
◆ statevec_findProbabilityOfZeroKernel()
__global__ void statevec_findProbabilityOfZeroKernel | ( | Qureg | qureg, |
int | measureQubit, | ||
qreal * | reducedArray | ||
) |
Definition at line 1853 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and reduceBlock().
◆ statevec_getImagAmp()
Definition at line 508 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, and qreal.
Referenced by getAmp(), getDensityAmp(), getImagAmp(), and statevec_getProbAmp().
◆ statevec_getRealAmp()
Definition at line 501 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, and qreal.
Referenced by getAmp(), getDensityAmp(), getRealAmp(), and statevec_getProbAmp().
◆ statevec_hadamard()
void statevec_hadamard | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1725 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by hadamard().
◆ statevec_hadamardKernel()
__global__ void statevec_hadamardKernel | ( | Qureg | qureg, |
int | targetQubit | ||
) |
fix – no necessary for GPU version
Definition at line 1676 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_initBlankState()
void statevec_initBlankState | ( | Qureg | qureg | ) |
Definition at line 525 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initBlankState(), and statevec_applyPauliSum().
◆ statevec_initBlankStateKernel()
__global__ void statevec_initBlankStateKernel | ( | long long int | stateVecSize, |
qreal * | stateVecReal, | ||
qreal * | stateVecImag | ||
) |
Definition at line 515 of file QuEST_gpu.cu.
◆ statevec_initClassicalState()
void statevec_initClassicalState | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 600 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initClassicalState().
◆ statevec_initClassicalStateKernel()
__global__ void statevec_initClassicalStateKernel | ( | long long int | stateVecSize, |
qreal * | stateVecReal, | ||
qreal * | stateVecImag, | ||
long long int | stateInd | ||
) |
Definition at line 585 of file QuEST_gpu.cu.
◆ statevec_initDebugState()
void statevec_initDebugState | ( | Qureg | qureg | ) |
Initialise the state vector of probability amplitudes to an (unphysical) state with each component of each probability amplitude a unique floating point value.
For debugging processes
- Parameters
-
[in,out] qureg object representing the set of qubits to be initialised
Definition at line 621 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initDebugState().
◆ statevec_initDebugStateKernel()
__global__ void statevec_initDebugStateKernel | ( | long long int | stateVecSize, |
qreal * | stateVecReal, | ||
qreal * | stateVecImag | ||
) |
Definition at line 611 of file QuEST_gpu.cu.
◆ statevec_initPlusState()
void statevec_initPlusState | ( | Qureg | qureg | ) |
Definition at line 574 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initPlusState().
◆ statevec_initPlusStateKernel()
__global__ void statevec_initPlusStateKernel | ( | long long int | stateVecSize, |
qreal * | stateVecReal, | ||
qreal * | stateVecImag | ||
) |
◆ statevec_initStateFromSingleFile()
Definition at line 659 of file QuEST_gpu.cu.
References Qureg::chunkId, copyStateToGPU(), Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
Referenced by initStateFromSingleFile().
◆ statevec_initStateOfSingleQubit()
void statevec_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] value of qubit 'qubitId'
Definition at line 650 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initStateOfSingleQubit().
◆ statevec_initStateOfSingleQubitKernel()
__global__ void statevec_initStateOfSingleQubitKernel | ( | long long int | stateVecSize, |
qreal * | stateVecReal, | ||
qreal * | stateVecImag, | ||
int | qubitId, | ||
int | outcome | ||
) |
◆ statevec_initZeroState()
void statevec_initZeroState | ( | Qureg | qureg | ) |
Definition at line 552 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
Referenced by initZeroState().
◆ statevec_initZeroStateKernel()
__global__ void statevec_initZeroStateKernel | ( | long long int | stateVecSize, |
qreal * | stateVecReal, | ||
qreal * | stateVecImag | ||
) |
Definition at line 536 of file QuEST_gpu.cu.
◆ statevec_multiControlledMultiQubitUnitary()
void statevec_multiControlledMultiQubitUnitary | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int * | targs, | ||
int | numTargs, | ||
ComplexMatrixN | u | ||
) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct.
It is already gauranteed here that all target qubits can fit on each node (this is validated in the front-end)
@TODO: refactor so that the 'swap back' isn't performed; instead the qubit locations are updated.
Definition at line 971 of file QuEST_gpu.cu.
References ComplexMatrixN::imag, Qureg::numAmpsPerChunk, ComplexMatrixN::numQubits, qreal, and ComplexMatrixN::real.
Referenced by applyMultiControlledMatrixN(), densmatr_applyMultiQubitKrausSuperoperator(), densmatr_applyTwoQubitKrausSuperoperator(), multiControlledMultiQubitUnitary(), statevec_controlledMultiQubitUnitary(), and statevec_multiQubitUnitary().
◆ statevec_multiControlledMultiQubitUnitaryKernel()
__global__ void statevec_multiControlledMultiQubitUnitaryKernel | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int * | targs, | ||
int | numTargs, | ||
qreal * | uRe, | ||
qreal * | uIm, | ||
long long int * | ampInds, | ||
qreal * | reAmps, | ||
qreal * | imAmps, | ||
long long int | numTargAmps | ||
) |
Definition at line 912 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), flipBit(), insertZeroBits(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiControlledPhaseFlip()
void statevec_multiControlledPhaseFlip | ( | Qureg | qureg, |
int * | controlQubits, | ||
int | numControlQubits | ||
) |
Definition at line 1633 of file QuEST_gpu.cu.
References getQubitBitMask(), Qureg::numAmpsPerChunk, and qreal.
Referenced by multiControlledPhaseFlip().
◆ statevec_multiControlledPhaseFlipKernel()
__global__ void statevec_multiControlledPhaseFlipKernel | ( | Qureg | qureg, |
long long int | mask | ||
) |
Definition at line 1615 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiControlledPhaseShift()
void statevec_multiControlledPhaseShift | ( | Qureg | qureg, |
int * | controlQubits, | ||
int | numControlQubits, | ||
qreal | angle | ||
) |
Definition at line 1490 of file QuEST_gpu.cu.
References getQubitBitMask(), Qureg::numAmpsPerChunk, and qreal.
Referenced by multiControlledPhaseShift().
◆ statevec_multiControlledPhaseShiftKernel()
__global__ void statevec_multiControlledPhaseShiftKernel | ( | Qureg | qureg, |
long long int | mask, | ||
qreal | cosAngle, | ||
qreal | sinAngle | ||
) |
Definition at line 1470 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiControlledTwoQubitUnitary()
void statevec_multiControlledTwoQubitUnitary | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int | q1, | ||
int | q2, | ||
ComplexMatrix4 | u | ||
) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct.
Note the order of q1 and q2 in the call to twoQubitUnitaryLocal is important.
@TODO: refactor so that the 'swap back' isn't performed; instead the qubit locations are updated. @TODO: the double swap (q1,q2 to 0,1) may be possible simultaneously by a bespoke swap routine.
Definition at line 1104 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by densmatr_applyKrausSuperoperator(), multiControlledTwoQubitUnitary(), statevec_controlledTwoQubitUnitary(), and statevec_twoQubitUnitary().
◆ statevec_multiControlledTwoQubitUnitaryKernel()
__global__ void statevec_multiControlledTwoQubitUnitaryKernel | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int | q1, | ||
int | q2, | ||
ArgMatrix4 | u | ||
) |
Definition at line 1028 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, flipBit(), insertTwoZeroBits(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiControlledUnitary()
void statevec_multiControlledUnitary | ( | Qureg | qureg, |
long long int | ctrlQubitsMask, | ||
long long int | ctrlFlipMask, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 1237 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by multiControlledUnitary(), and multiStateControlledUnitary().
◆ statevec_multiControlledUnitaryKernel()
__global__ void statevec_multiControlledUnitaryKernel | ( | Qureg | qureg, |
long long int | ctrlQubitsMask, | ||
long long int | ctrlFlipMask, | ||
int | targetQubit, | ||
ArgMatrix2 | u | ||
) |
fix – no necessary for GPU version
Definition at line 1177 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiRotateZ()
Definition at line 1520 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by multiRotateZ(), and statevec_multiRotatePauli().
◆ statevec_multiRotateZKernel()
__global__ void statevec_multiRotateZKernel | ( | Qureg | qureg, |
long long int | mask, | ||
qreal | cosAngle, | ||
qreal | sinAngle | ||
) |
Definition at line 1503 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, getBitMaskParity(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_pauliX()
void statevec_pauliX | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1292 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by pauliX(), and statevec_applyPauliProd().
◆ statevec_pauliXKernel()
__global__ void statevec_pauliXKernel | ( | Qureg | qureg, |
int | targetQubit | ||
) |
fix – no necessary for GPU version
Definition at line 1248 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_pauliY()
void statevec_pauliY | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1325 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by pauliY(), and statevec_applyPauliProd().
◆ statevec_pauliYConj()
void statevec_pauliYConj | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1333 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by pauliY().
◆ statevec_pauliYKernel()
__global__ void statevec_pauliYKernel | ( | Qureg | qureg, |
int | targetQubit, | ||
int | conjFac | ||
) |
Definition at line 1300 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_phaseShiftByTerm()
Definition at line 1423 of file QuEST_gpu.cu.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_pauliZ(), statevec_phaseShift(), statevec_sGate(), statevec_sGateConj(), statevec_tGate(), and statevec_tGateConj().
◆ statevec_phaseShiftByTermKernel()
__global__ void statevec_phaseShiftByTermKernel | ( | Qureg | qureg, |
int | targetQubit, | ||
qreal | cosAngle, | ||
qreal | sinAngle | ||
) |
Definition at line 1395 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_reportStateToScreen()
Print the current state vector of probability amplitudes for a set of qubits to standard out.
For debugging purposes. Each rank should print output serially. Only print output for systems <= 5 qubits
Definition at line 475 of file QuEST_gpu.cu.
References Qureg::chunkId, copyStateFromGPU(), Qureg::numAmpsPerChunk, Qureg::numChunks, Qureg::numQubitsInStateVec, Qureg::stateVec, and syncQuESTEnv().
Referenced by reportStateToScreen().
◆ statevec_setAmps()
void statevec_setAmps | ( | Qureg | qureg, |
long long int | startInd, | ||
qreal * | reals, | ||
qreal * | imags, | ||
long long int | numAmps | ||
) |
Definition at line 153 of file QuEST_gpu.cu.
References Qureg::deviceStateVec.
Referenced by initStateFromAmps(), setAmps(), and setDensityAmps().
◆ statevec_setWeightedQureg()
void statevec_setWeightedQureg | ( | Complex | fac1, |
Qureg | qureg1, | ||
Complex | fac2, | ||
Qureg | qureg2, | ||
Complex | facOut, | ||
Qureg | out | ||
) |
Definition at line 2905 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by setWeightedQureg(), and statevec_applyPauliSum().
◆ statevec_setWeightedQuregKernel()
__global__ void statevec_setWeightedQuregKernel | ( | Complex | fac1, |
Qureg | qureg1, | ||
Complex | fac2, | ||
Qureg | qureg2, | ||
Complex | facOut, | ||
Qureg | out | ||
) |
Definition at line 2873 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
◆ statevec_swapQubitAmps()
void statevec_swapQubitAmps | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
Definition at line 1668 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by swapGate().
◆ statevec_swapQubitAmpsKernel()
__global__ void statevec_swapQubitAmpsKernel | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
Definition at line 1642 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, flipBit(), insertTwoZeroBits(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_unitary()
void statevec_unitary | ( | Qureg | qureg, |
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 904 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by applyMatrix2(), and unitary().
◆ statevec_unitaryKernel()
__global__ void statevec_unitaryKernel | ( | Qureg | qureg, |
int | targetQubit, | ||
ArgMatrix2 | u | ||
) |
fix – no necessary for GPU version
Definition at line 851 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ swapDouble()
Definition at line 1912 of file QuEST_gpu.cu.
References qreal.
Referenced by densmatr_calcExpecDiagonalOp(), densmatr_calcFidelity(), densmatr_calcHilbertSchmidtDistance(), densmatr_calcInnerProduct(), densmatr_calcPurity(), densmatr_findProbabilityOfZero(), statevec_calcExpecDiagonalOp(), statevec_calcInnerProduct(), and statevec_findProbabilityOfZero().