#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 | |
| __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... | |
| 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, const 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, const 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, const int measureQubit) |
| __global__ void | densmatr_findProbabilityOfZeroKernel (Qureg qureg, const 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, const 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, const 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, const 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, const int targetQubit, qreal dephFac) |
| void | destroyQuESTEnv (QuESTEnv env) |
| Destroy the QuEST environment. More... | |
| __forceinline__ __device__ int | extractBit (int locationOfBitFromRight, long long int theEncodedNumber) |
| __forceinline__ __device__ long long int | flipBit (long long int number, 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 (long long int number, int bit1, int bit2) |
| __forceinline__ __device__ long long int | insertZeroBit (long long int number, int index) |
| __forceinline__ __device__ long long int | insertZeroBits (long long int number, int *inds, 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... | |
| 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, const 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, const int measureQubit, int outcome, qreal outcomeProb) |
| __global__ void | statevec_collapseToKnownProbOutcomeKernel (Qureg qureg, int measureQubit, int outcome, qreal totalProbability) |
| void | statevec_compactUnitary (Qureg qureg, const int targetQubit, Complex alpha, Complex beta) |
| __global__ void | statevec_compactUnitaryKernel (Qureg qureg, const int rotQubit, Complex alpha, Complex beta) |
| int | statevec_compareStates (Qureg mq1, Qureg mq2, qreal precision) |
| void | statevec_controlledCompactUnitary (Qureg qureg, const int controlQubit, const int targetQubit, Complex alpha, Complex beta) |
| __global__ void | statevec_controlledCompactUnitaryKernel (Qureg qureg, const int controlQubit, const int targetQubit, Complex alpha, Complex beta) |
| void | statevec_controlledNot (Qureg qureg, const int controlQubit, const int targetQubit) |
| __global__ void | statevec_controlledNotKernel (Qureg qureg, const int controlQubit, const int targetQubit) |
| void | statevec_controlledPauliY (Qureg qureg, const int controlQubit, const int targetQubit) |
| void | statevec_controlledPauliYConj (Qureg qureg, const int controlQubit, const int targetQubit) |
| __global__ void | statevec_controlledPauliYKernel (Qureg qureg, const int controlQubit, const int targetQubit, const int conjFac) |
| void | statevec_controlledPhaseFlip (Qureg qureg, const int idQubit1, const int idQubit2) |
| __global__ void | statevec_controlledPhaseFlipKernel (Qureg qureg, const int idQubit1, const int idQubit2) |
| void | statevec_controlledPhaseShift (Qureg qureg, const int idQubit1, const int idQubit2, qreal angle) |
| __global__ void | statevec_controlledPhaseShiftKernel (Qureg qureg, const int idQubit1, const int idQubit2, qreal cosAngle, qreal sinAngle) |
| void | statevec_controlledUnitary (Qureg qureg, const int controlQubit, const int targetQubit, ComplexMatrix2 u) |
| __global__ void | statevec_controlledUnitaryKernel (Qureg qureg, const int controlQubit, const 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, const int measureQubit) |
| __global__ void | statevec_findProbabilityOfZeroKernel (Qureg qureg, const 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, const int targetQubit) |
| __global__ void | statevec_hadamardKernel (Qureg qureg, const 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, const 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, const int q1, const 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, const int q1, const int q2, ArgMatrix4 u) |
| void | statevec_multiControlledUnitary (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, const int targetQubit, ComplexMatrix2 u) |
| __global__ void | statevec_multiControlledUnitaryKernel (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, const 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, const int targetQubit) |
| __global__ void | statevec_pauliXKernel (Qureg qureg, const int targetQubit) |
| void | statevec_pauliY (Qureg qureg, const int targetQubit) |
| void | statevec_pauliYConj (Qureg qureg, const int targetQubit) |
| __global__ void | statevec_pauliYKernel (Qureg qureg, const int targetQubit, const int conjFac) |
| void | statevec_phaseShiftByTerm (Qureg qureg, const int targetQubit, Complex term) |
| __global__ void | statevec_phaseShiftByTermKernel (Qureg qureg, const 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, const int targetQubit, ComplexMatrix2 u) |
| __global__ void | statevec_unitaryKernel (Qureg qureg, const 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
◆ copySharedReduceBlock()
Definition at line 1751 of file QuEST_gpu.cu.
References qreal, and reduceBlock().
Referenced by densmatr_calcFidelity(), densmatr_calcHilbertSchmidtDistance(), densmatr_calcInnerProduct(), densmatr_calcPurity(), densmatr_findProbabilityOfZero(), statevec_calcInnerProduct(), and statevec_findProbabilityOfZero().
◆ densmatr_calcFidelity()
Definition at line 2194 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 2156 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, qreal, and reduceBlock().
◆ densmatr_calcHilbertSchmidtDistance()
Definition at line 2268 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 1988 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 1967 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, qreal, and reduceBlock().
◆ densmatr_calcProbOfOutcome()
Definition at line 1958 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 2339 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 1476 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, |
| const 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 2480 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 2454 of file QuEST_gpu.cu.
◆ densmatr_findProbabilityOfZero()
Definition at line 1864 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, |
| const int | measureQubit, | ||
| qreal * | reducedArray | ||
| ) |
Definition at line 1760 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 2723 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 2676 of file QuEST_gpu.cu.
References qreal.
◆ densmatr_mixDensityMatrix()
Definition at line 2521 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 2574 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 2538 of file QuEST_gpu.cu.
◆ densmatr_mixDepolarising()
Definition at line 2697 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 2650 of file QuEST_gpu.cu.
References qreal.
◆ densmatr_mixTwoQubitDephasing()
Definition at line 2613 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 2589 of file QuEST_gpu.cu.
◆ densmatr_mixTwoQubitDepolarising()
Definition at line 2783 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 2751 of file QuEST_gpu.cu.
References qreal.
◆ densmatr_oneQubitDegradeOffDiagonal()
Definition at line 2554 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 | ( | int | locationOfBitFromRight, |
| 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 | ( | long long int | number, |
| 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 1848 of file QuEST_gpu.cu.
◆ GPUExists()
| int GPUExists | ( | void | ) |
◆ insertTwoZeroBits()
| __forceinline__ __device__ long long int insertTwoZeroBits | ( | long long int | number, |
| int | bit1, | ||
| 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 | ( | long long int | number, |
| 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, | ||
| 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 1725 of file QuEST_gpu.cu.
Referenced by reduceBlock().
◆ reduceBlock()
Definition at line 1732 of file QuEST_gpu.cu.
References log2Int().
Referenced by copySharedReduceBlock(), densmatr_calcFidelityKernel(), densmatr_calcHilbertSchmidtDistanceSquaredKernel(), densmatr_calcInnerProductKernel(), densmatr_calcPurityKernel(), densmatr_findProbabilityOfZeroKernel(), statevec_calcInnerProductKernel(), and statevec_findProbabilityOfZeroKernel().
◆ 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 2068 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 2038 of file QuEST_gpu.cu.
References qreal, and reduceBlock().
◆ statevec_calcProbOfOutcome()
Definition at line 1950 of file QuEST_gpu.cu.
References qreal, and statevec_findProbabilityOfZero().
Referenced by calcProbOfOutcome(), collapseToOutcome(), and statevec_measureWithStats().
◆ statevec_calcTotalProb()
Definition at line 1499 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, |
| const int | measureQubit, | ||
| int | outcome, | ||
| qreal | outcomeProb | ||
| ) |
Definition at line 2445 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 2388 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_compactUnitary()
Definition at line 722 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, |
| const int | rotQubit, | ||
| Complex | alpha, | ||
| Complex | beta | ||
| ) |
fix – no necessary for GPU version
Definition at line 667 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
◆ statevec_compareStates()
Definition at line 649 of file QuEST_gpu.cu.
References copyStateFromGPU(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by compareStates().
◆ statevec_controlledCompactUnitary()
| void statevec_controlledCompactUnitary | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| Complex | alpha, | ||
| Complex | beta | ||
| ) |
Definition at line 789 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, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| Complex | alpha, | ||
| Complex | beta | ||
| ) |
fix – no necessary for GPU version
Definition at line 730 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
◆ statevec_controlledNot()
| void statevec_controlledNot | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
Definition at line 1717 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledNot().
◆ statevec_controlledNotKernel()
| __global__ void statevec_controlledNotKernel | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
Definition at line 1678 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledPauliY()
| void statevec_controlledPauliY | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
Definition at line 1323 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPauliY().
◆ statevec_controlledPauliYConj()
| void statevec_controlledPauliYConj | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
Definition at line 1332 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPauliY().
◆ statevec_controlledPauliYKernel()
| __global__ void statevec_controlledPauliYKernel | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| const int | conjFac | ||
| ) |
Definition at line 1287 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledPhaseFlip()
| void statevec_controlledPhaseFlip | ( | Qureg | qureg, |
| const int | idQubit1, | ||
| const int | idQubit2 | ||
| ) |
Definition at line 1552 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPhaseFlip().
◆ statevec_controlledPhaseFlipKernel()
| __global__ void statevec_controlledPhaseFlipKernel | ( | Qureg | qureg, |
| const int | idQubit1, | ||
| const int | idQubit2 | ||
| ) |
Definition at line 1531 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledPhaseShift()
| void statevec_controlledPhaseShift | ( | Qureg | qureg, |
| const int | idQubit1, | ||
| const int | idQubit2, | ||
| qreal | angle | ||
| ) |
Definition at line 1405 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledPhaseShift().
◆ statevec_controlledPhaseShiftKernel()
| __global__ void statevec_controlledPhaseShiftKernel | ( | Qureg | qureg, |
| const int | idQubit1, | ||
| const int | idQubit2, | ||
| qreal | cosAngle, | ||
| qreal | sinAngle | ||
| ) |
Definition at line 1380 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_controlledUnitary()
| void statevec_controlledUnitary | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 1115 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by controlledUnitary().
◆ statevec_controlledUnitaryKernel()
| __global__ void statevec_controlledUnitaryKernel | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| ArgMatrix2 | u | ||
| ) |
fix – no necessary for GPU version
Definition at line 1057 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, QuESTEnv::numRanks, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by destroyQureg().
◆ statevec_findProbabilityOfZero()
Definition at line 1912 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, |
| const int | measureQubit, | ||
| qreal * | reducedArray | ||
| ) |
Definition at line 1798 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and reduceBlock().
◆ statevec_getImagAmp()
Definition at line 454 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, and qreal.
Referenced by getAmp(), getDensityAmp(), getImagAmp(), and statevec_getProbAmp().
◆ statevec_getRealAmp()
Definition at line 447 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, |
| const int | targetQubit | ||
| ) |
Definition at line 1670 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by hadamard().
◆ statevec_hadamardKernel()
| __global__ void statevec_hadamardKernel | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
fix – no necessary for GPU version
Definition at line 1621 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_initBlankState()
| void statevec_initBlankState | ( | Qureg | qureg | ) |
Definition at line 471 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 461 of file QuEST_gpu.cu.
◆ statevec_initClassicalState()
| void statevec_initClassicalState | ( | Qureg | qureg, |
| long long int | stateInd | ||
| ) |
Definition at line 546 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 531 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 567 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 557 of file QuEST_gpu.cu.
◆ statevec_initPlusState()
| void statevec_initPlusState | ( | Qureg | qureg | ) |
Definition at line 520 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 605 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 596 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 498 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 482 of file QuEST_gpu.cu.
◆ statevec_multiControlledMultiQubitUnitary()
| void statevec_multiControlledMultiQubitUnitary | ( | Qureg | qureg, |
| long long int | ctrlMask, | ||
| int * | targs, | ||
| const 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 917 of file QuEST_gpu.cu.
References ComplexMatrixN::imag, Qureg::numAmpsPerChunk, ComplexMatrixN::numQubits, qreal, and ComplexMatrixN::real.
Referenced by 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 858 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 1578 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 1560 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 1436 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 1416 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiControlledTwoQubitUnitary()
| void statevec_multiControlledTwoQubitUnitary | ( | Qureg | qureg, |
| long long int | ctrlMask, | ||
| const int | q1, | ||
| const 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 1050 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, | ||
| const int | q1, | ||
| const int | q2, | ||
| ArgMatrix4 | u | ||
| ) |
Definition at line 974 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, | ||
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 1183 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, | ||
| const int | targetQubit, | ||
| ArgMatrix2 | u | ||
| ) |
fix – no necessary for GPU version
Definition at line 1123 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_multiRotateZ()
Definition at line 1466 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 1449 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, getBitMaskParity(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_pauliX()
| void statevec_pauliX | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 1238 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by pauliX(), and statevec_applyPauliProd().
◆ statevec_pauliXKernel()
| __global__ void statevec_pauliXKernel | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
fix – no necessary for GPU version
Definition at line 1194 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_pauliY()
| void statevec_pauliY | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 1271 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by pauliY(), and statevec_applyPauliProd().
◆ statevec_pauliYConj()
| void statevec_pauliYConj | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 1279 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by pauliY().
◆ statevec_pauliYKernel()
| __global__ void statevec_pauliYKernel | ( | Qureg | qureg, |
| const int | targetQubit, | ||
| const int | conjFac | ||
| ) |
Definition at line 1246 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ statevec_phaseShiftByTerm()
Definition at line 1369 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, |
| const int | targetQubit, | ||
| qreal | cosAngle, | ||
| qreal | sinAngle | ||
| ) |
Definition at line 1341 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 421 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 2850 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 2818 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 1613 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 1587 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, flipBit(), insertTwoZeroBits(), Qureg::numAmpsPerChunk, and qreal.
◆ statevec_unitary()
| void statevec_unitary | ( | Qureg | qureg, |
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 850 of file QuEST_gpu.cu.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by unitary().
◆ statevec_unitaryKernel()
| __global__ void statevec_unitaryKernel | ( | Qureg | qureg, |
| const int | targetQubit, | ||
| ArgMatrix2 | u | ||
| ) |
fix – no necessary for GPU version
Definition at line 797 of file QuEST_gpu.cu.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, and qreal.
◆ swapDouble()
Definition at line 1857 of file QuEST_gpu.cu.
References qreal.
Referenced by densmatr_calcFidelity(), densmatr_calcHilbertSchmidtDistance(), densmatr_calcInnerProduct(), densmatr_calcPurity(), densmatr_findProbabilityOfZero(), statevec_calcInnerProduct(), and statevec_findProbabilityOfZero().