Go to the source code of this file.
Functions | |
void | agnostic_applyTrotterCircuit (Qureg qureg, PauliHamil hamil, qreal time, int order, int reps) |
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) |
void | conjugateMatrixN (ComplexMatrixN u) |
void | densmatr_applyDiagonalOp (Qureg qureg, DiagonalOp op) |
Complex | densmatr_calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
qreal | densmatr_calcFidelity (Qureg qureg, Qureg pureState) |
qreal | densmatr_calcHilbertSchmidtDistance (Qureg a, Qureg b) |
qreal | densmatr_calcInnerProduct (Qureg a, Qureg b) |
qreal | densmatr_calcProbOfOutcome (Qureg qureg, int measureQubit, int outcome) |
qreal | densmatr_calcPurity (Qureg qureg) |
Computes the trace of the density matrix squared. More... | |
qreal | densmatr_calcTotalProb (Qureg qureg) |
void | densmatr_collapseToKnownProbOutcome (Qureg qureg, int measureQubit, int outcome, qreal outcomeProb) |
Renorms (/prob) every | * outcome * >< * outcome * | state, setting all others to zero. More... | |
void | densmatr_initClassicalState (Qureg qureg, long long int stateInd) |
void | densmatr_initPlusState (Qureg targetQureg) |
void | densmatr_initPureState (Qureg targetQureg, Qureg copyQureg) |
int | densmatr_measureWithStats (Qureg qureg, int measureQubit, qreal *outcomeProb) |
void | densmatr_mixDamping (Qureg qureg, int targetQubit, qreal damping) |
void | densmatr_mixDensityMatrix (Qureg combineQureg, qreal otherProb, Qureg otherQureg) |
void | densmatr_mixDephasing (Qureg qureg, int targetQubit, qreal dephase) |
void | densmatr_mixDepolarising (Qureg qureg, int targetQubit, qreal depolLevel) |
void | densmatr_mixKrausMap (Qureg qureg, int target, ComplexMatrix2 *ops, int numOps) |
void | densmatr_mixMultiQubitKrausMap (Qureg qureg, int *targets, int numTargets, ComplexMatrixN *ops, int numOps) |
void | densmatr_mixPauli (Qureg qureg, int qubit, qreal pX, qreal pY, qreal pZ) |
void | densmatr_mixTwoQubitDephasing (Qureg qureg, int qubit1, int qubit2, qreal dephase) |
void | densmatr_mixTwoQubitDepolarising (Qureg qureg, int qubit1, int qubit2, qreal depolLevel) |
void | densmatr_mixTwoQubitKrausMap (Qureg qureg, int target1, int target2, ComplexMatrix4 *ops, int numOps) |
void | ensureIndsIncrease (int *ind1, int *ind2) |
void | getComplexPairAndPhaseFromUnitary (ComplexMatrix2 u, Complex *alpha, Complex *beta, qreal *globalPhase) |
maps U(r0c0, r0c1, r1c0, r1c1) to exp(i globalPhase) U(alpha, beta) More... | |
void | getComplexPairFromRotation (qreal angle, Vector axis, Complex *alpha, Complex *beta) |
ComplexMatrix2 | getConjugateMatrix2 (ComplexMatrix2 src) |
ComplexMatrix4 | getConjugateMatrix4 (ComplexMatrix4 src) |
Complex | getConjugateScalar (Complex scalar) |
long long int | getControlFlipMask (int *controlQubits, int *controlState, int numControlQubits) |
long long int | getQubitBitMask (int *controlQubits, int numControlQubits) |
void | getQuESTDefaultSeedKey (unsigned long int *key) |
qreal | getVectorMagnitude (Vector vec) |
void | getZYZRotAnglesFromComplexPair (Complex alpha, Complex beta, qreal *rz2, qreal *ry, qreal *rz1) |
maps U(alpha, beta) to Rz(rz2) Ry(ry) Rz(rz1) More... | |
unsigned long int | hashString (char *str) |
void | setConjugateMatrixN (ComplexMatrixN m) |
void | shiftIndices (int *indices, int numIndices, int shift) |
void | statevec_applyDiagonalOp (Qureg qureg, DiagonalOp op) |
void | statevec_applyPauliSum (Qureg inQureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg) |
Complex | statevec_calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
qreal | statevec_calcExpecPauliProd (Qureg qureg, int *targetQubits, enum pauliOpType *pauliCodes, int numTargets, Qureg workspace) |
qreal | statevec_calcExpecPauliSum (Qureg qureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg workspace) |
qreal | statevec_calcFidelity (Qureg qureg, Qureg pureState) |
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... | |
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) |
void | statevec_compactUnitary (Qureg qureg, int targetQubit, 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) |
void | statevec_controlledMultiQubitUnitary (Qureg qureg, int ctrl, int *targets, int numTargets, ComplexMatrixN u) |
void | statevec_controlledNot (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliY (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliYConj (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPhaseFlip (Qureg qureg, int idQubit1, int idQubit2) |
void | statevec_controlledPhaseShift (Qureg qureg, int idQubit1, int idQubit2, qreal angle) |
void | statevec_controlledRotateAroundAxis (Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis) |
void | statevec_controlledRotateAroundAxisConj (Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis) |
void | statevec_controlledRotateX (Qureg qureg, int controlQubit, int targetQubit, qreal angle) |
void | statevec_controlledRotateY (Qureg qureg, int controlQubit, int targetQubit, qreal angle) |
void | statevec_controlledRotateZ (Qureg qureg, int controlQubit, int targetQubit, qreal angle) |
void | statevec_controlledTwoQubitUnitary (Qureg qureg, int controlQubit, int targetQubit1, int targetQubit2, ComplexMatrix4 u) |
void | statevec_controlledUnitary (Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u) |
void | statevec_createQureg (Qureg *qureg, int numQubits, QuESTEnv env) |
void | statevec_destroyQureg (Qureg qureg, QuESTEnv env) |
qreal | statevec_getImagAmp (Qureg qureg, long long int index) |
qreal | statevec_getProbAmp (Qureg qureg, long long int index) |
qreal | statevec_getRealAmp (Qureg qureg, long long int index) |
void | statevec_hadamard (Qureg qureg, int targetQubit) |
void | statevec_initBlankState (Qureg qureg) |
void | statevec_initClassicalState (Qureg qureg, 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... | |
void | statevec_initPlusState (Qureg qureg) |
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... | |
void | statevec_initZeroState (Qureg qureg) |
int | statevec_measureWithStats (Qureg qureg, int measureQubit, qreal *outcomeProb) |
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... | |
void | statevec_multiControlledPhaseFlip (Qureg qureg, int *controlQubits, int numControlQubits) |
void | statevec_multiControlledPhaseShift (Qureg qureg, int *controlQubits, int numControlQubits, qreal angle) |
void | statevec_multiControlledTwoQubitUnitary (Qureg qureg, long long int ctrlMask, int targetQubit1, int targetQubit2, 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... | |
void | statevec_multiControlledUnitary (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ComplexMatrix2 u) |
void | statevec_multiQubitUnitary (Qureg qureg, int *targets, int numTargets, ComplexMatrixN u) |
void | statevec_multiRotatePauli (Qureg qureg, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle, int applyConj) |
applyConj=1 will apply conjugate operation, else applyConj=0 More... | |
void | statevec_multiRotateZ (Qureg qureg, long long int mask, qreal angle) |
void | statevec_pauliX (Qureg qureg, int targetQubit) |
void | statevec_pauliY (Qureg qureg, int targetQubit) |
void | statevec_pauliYConj (Qureg qureg, int targetQubit) |
void | statevec_pauliZ (Qureg qureg, int targetQubit) |
void | statevec_phaseShift (Qureg qureg, int targetQubit, qreal angle) |
void | statevec_phaseShiftByTerm (Qureg qureg, int targetQubit, Complex term) |
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_rotateAroundAxis (Qureg qureg, int rotQubit, qreal angle, Vector axis) |
void | statevec_rotateAroundAxisConj (Qureg qureg, int rotQubit, qreal angle, Vector axis) |
void | statevec_rotateX (Qureg qureg, int rotQubit, qreal angle) |
void | statevec_rotateY (Qureg qureg, int rotQubit, qreal angle) |
void | statevec_rotateZ (Qureg qureg, int rotQubit, qreal angle) |
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) |
void | statevec_sGate (Qureg qureg, int targetQubit) |
void | statevec_sGateConj (Qureg qureg, int targetQubit) |
void | statevec_sqrtSwapGate (Qureg qureg, int qb1, int qb2) |
void | statevec_sqrtSwapGateConj (Qureg qureg, int qb1, int qb2) |
void | statevec_swapQubitAmps (Qureg qureg, int qb1, int qb2) |
void | statevec_tGate (Qureg qureg, int targetQubit) |
void | statevec_tGateConj (Qureg qureg, int targetQubit) |
void | statevec_twoQubitUnitary (Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u) |
void | statevec_unitary (Qureg qureg, int targetQubit, ComplexMatrix2 u) |
Detailed Description
General functions used internally, supplied by QuEST_common or by hardware-specific backends. Note that some bespoke functions used only internally exist in QuEST_qasm.h and QuEST_validation.h
Definition in file QuEST_internal.h.
Function Documentation
◆ agnostic_applyTrotterCircuit()
void agnostic_applyTrotterCircuit | ( | Qureg | qureg, |
PauliHamil | hamil, | ||
qreal | time, | ||
int | order, | ||
int | reps | ||
) |
Definition at line 773 of file QuEST_common.c.
References applySymmetrizedTrotterCircuit().
Referenced by applyTrotterCircuit().
◆ agnostic_createDiagonalOp()
DiagonalOp agnostic_createDiagonalOp | ( | int | numQubits, |
QuESTEnv | env | ||
) |
Definition at line 1335 of file QuEST_cpu.c.
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 1357 of file QuEST_cpu.c.
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 3842 of file QuEST_cpu.c.
References DiagonalOp::chunkId, DiagonalOp::deviceOperator, DiagonalOp::imag, DiagonalOp::numElemsPerChunk, qreal, and DiagonalOp::real.
Referenced by initDiagonalOp(), and setDiagonalOpElems().
◆ agnostic_syncDiagonalOp()
void agnostic_syncDiagonalOp | ( | DiagonalOp | op | ) |
Definition at line 1362 of file QuEST_cpu.c.
References DiagonalOp::deviceOperator, DiagonalOp::imag, DiagonalOp::numQubits, qreal, and DiagonalOp::real.
Referenced by syncDiagonalOp().
◆ conjugateMatrixN()
void conjugateMatrixN | ( | ComplexMatrixN | u | ) |
◆ densmatr_applyDiagonalOp()
void densmatr_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1517 of file QuEST_cpu_distributed.c.
References copyDiagOpIntoMatrixPairState(), densmatr_applyDiagonalOpLocal(), DiagonalOp::imag, Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, and DiagonalOp::real.
Referenced by applyDiagonalOp().
◆ densmatr_calcExpecDiagonalOp()
Complex densmatr_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1541 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), densmatr_calcExpecDiagonalOpLocal(), DiagonalOp::deviceOperator, Qureg::deviceStateVec, Qureg::firstLevelReduction, Complex::imag, Qureg::numAmpsPerChunk, Qureg::numChunks, DiagonalOp::numQubits, qreal, Complex::real, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcExpecDiagonalOp().
◆ densmatr_calcFidelity()
Definition at line 415 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), copyVecIntoMatrixPairState(), densmatr_calcFidelityLocal(), Qureg::firstLevelReduction, Qureg::numQubitsRepresented, Qureg::pairStateVec, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, Qureg::stateVec, and swapDouble().
Referenced by calcFidelity().
◆ densmatr_calcHilbertSchmidtDistance()
Definition at line 430 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), densmatr_calcHilbertSchmidtDistanceSquaredLocal(), Qureg::deviceStateVec, Qureg::firstLevelReduction, Qureg::numAmpsPerChunk, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcHilbertSchmidtDistance().
◆ densmatr_calcInnerProduct()
Definition at line 441 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), densmatr_calcInnerProductLocal(), Qureg::firstLevelReduction, Qureg::numAmpsTotal, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcDensityInnerProduct().
◆ densmatr_calcProbOfOutcome()
Definition at line 1276 of file QuEST_cpu_distributed.c.
References densmatr_findProbabilityOfZero(), densmatr_findProbabilityOfZeroLocal(), and qreal.
Referenced by calcProbOfOutcome(), collapseToOutcome(), and densmatr_measureWithStats().
◆ densmatr_calcPurity()
Computes the trace of the density matrix squared.
Definition at line 1288 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), densmatr_calcPurityLocal(), Qureg::deviceStateVec, Qureg::firstLevelReduction, Qureg::numAmpsPerChunk, qreal, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, and swapDouble().
Referenced by calcPurity().
◆ densmatr_calcTotalProb()
Definition at line 53 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, copyStateFromGPU(), Qureg::numAmpsPerChunk, Qureg::numChunks, 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 | ||
) |
Renorms (/prob) every | * outcome * >< * outcome * | state, setting all others to zero.
Renorms (/prob) every | * outcome * >< * outcome * | state, setting all others to zero.
Definition at line 785 of file QuEST_cpu.c.
References alternateNormZeroingSomeAmpBlocks(), Qureg::chunkId, Qureg::deviceStateVec, extractBit(), normaliseSomeAmps(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and zeroSomeAmps().
Referenced by collapseToOutcome(), and densmatr_measureWithStats().
◆ densmatr_initClassicalState()
void densmatr_initClassicalState | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 1115 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by initClassicalState().
◆ densmatr_initPlusState()
void densmatr_initPlusState | ( | Qureg | targetQureg | ) |
Definition at line 1154 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by initPlusState().
◆ densmatr_initPureState()
Definition at line 452 of file QuEST_cpu_distributed.c.
References copyVecIntoMatrixPairState(), densmatr_initPureStateLocal(), Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numChunks, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by initPureState().
◆ densmatr_measureWithStats()
Definition at line 369 of file QuEST_common.c.
References densmatr_calcProbOfOutcome(), densmatr_collapseToKnownProbOutcome(), generateMeasurementOutcome(), and qreal.
Referenced by measure(), and measureWithStats().
◆ densmatr_mixDamping()
Definition at line 725 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpperInOuterBlock(), compressPairVectorForSingleQubitDepolarise(), densityMatrixBlockFitsInChunk(), densmatr_mixDampingDistributed(), densmatr_mixDampingLocal(), densmatr_oneQubitDegradeOffDiagonal(), Qureg::deviceStateVec, exchangePairStateVectorHalves(), getChunkOuterBlockPairId(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by mixDamping().
◆ densmatr_mixDensityMatrix()
Definition at line 890 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by mixDensityMatrix().
◆ densmatr_mixDephasing()
Definition at line 79 of file QuEST_cpu.c.
References densmatr_oneQubitDegradeOffDiagonal(), and qreal.
Referenced by densmatr_mixDepolarising(), densmatr_mixDepolarisingDistributed(), and mixDephasing().
◆ densmatr_mixDepolarising()
Definition at line 698 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpperInOuterBlock(), compressPairVectorForSingleQubitDepolarise(), densityMatrixBlockFitsInChunk(), densmatr_mixDephasing(), densmatr_mixDepolarisingDistributed(), densmatr_mixDepolarisingLocal(), Qureg::deviceStateVec, exchangePairStateVectorHalves(), getChunkOuterBlockPairId(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by mixDepolarising().
◆ densmatr_mixKrausMap()
void densmatr_mixKrausMap | ( | Qureg | qureg, |
int | target, | ||
ComplexMatrix2 * | ops, | ||
int | numOps | ||
) |
Definition at line 600 of file QuEST_common.c.
References densmatr_applyKrausSuperoperator(), and populateKrausSuperOperator2().
Referenced by densmatr_mixPauli(), and mixKrausMap().
◆ densmatr_mixMultiQubitKrausMap()
void densmatr_mixMultiQubitKrausMap | ( | Qureg | qureg, |
int * | targets, | ||
int | numTargets, | ||
ComplexMatrixN * | ops, | ||
int | numOps | ||
) |
Definition at line 643 of file QuEST_common.c.
References createComplexMatrixN(), densmatr_applyMultiQubitKrausSuperoperator(), destroyComplexMatrixN(), macro_allocStackComplexMatrixN, and populateKrausSuperOperatorN().
Referenced by mixMultiQubitKrausMap().
◆ densmatr_mixPauli()
Definition at line 676 of file QuEST_common.c.
References densmatr_mixKrausMap(), ComplexMatrix2::imag, qreal, and ComplexMatrix2::real.
Referenced by mixPauli().
◆ densmatr_mixTwoQubitDephasing()
Definition at line 84 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_mixTwoQubitDepolarising(), and mixTwoQubitDephasing().
◆ densmatr_mixTwoQubitDepolarising()
Definition at line 752 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpperInOuterBlock(), compressPairVectorForTwoQubitDepolarise(), densityMatrixBlockFitsInChunk(), densmatr_mixTwoQubitDephasing(), densmatr_mixTwoQubitDepolarisingDistributed(), densmatr_mixTwoQubitDepolarisingLocal(), densmatr_mixTwoQubitDepolarisingLocalPart1(), densmatr_mixTwoQubitDepolarisingQ1LocalQ2DistributedPart3(), Qureg::deviceStateVec, exchangePairStateVectorHalves(), getChunkOuterBlockPairId(), getChunkOuterBlockPairIdForPart3(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
Referenced by mixTwoQubitDepolarising().
◆ densmatr_mixTwoQubitKrausMap()
void densmatr_mixTwoQubitKrausMap | ( | Qureg | qureg, |
int | target1, | ||
int | target2, | ||
ComplexMatrix4 * | ops, | ||
int | numOps | ||
) |
Definition at line 635 of file QuEST_common.c.
References densmatr_applyTwoQubitKrausSuperoperator(), macro_allocStackComplexMatrixN, and populateKrausSuperOperator4().
Referenced by mixTwoQubitKrausMap().
◆ ensureIndsIncrease()
void ensureIndsIncrease | ( | int * | ind1, |
int * | ind2 | ||
) |
Definition at line 64 of file QuEST_common.c.
Referenced by mixTwoQubitDephasing(), and mixTwoQubitDepolarising().
◆ getComplexPairAndPhaseFromUnitary()
void getComplexPairAndPhaseFromUnitary | ( | ComplexMatrix2 | u, |
Complex * | alpha, | ||
Complex * | beta, | ||
qreal * | globalPhase | ||
) |
maps U(r0c0, r0c1, r1c0, r1c1) to exp(i globalPhase) U(alpha, beta)
Definition at line 136 of file QuEST_common.c.
References Complex::imag, ComplexMatrix2::imag, qreal, Complex::real, and ComplexMatrix2::real.
Referenced by qasm_recordControlledUnitary(), qasm_recordMultiControlledUnitary(), and qasm_recordUnitary().
◆ getComplexPairFromRotation()
Definition at line 114 of file QuEST_common.c.
References getUnitVector(), Complex::imag, Complex::real, Vector::x, Vector::y, and Vector::z.
Referenced by qasm_recordAxisRotation(), qasm_recordControlledAxisRotation(), statevec_controlledRotateAroundAxis(), statevec_controlledRotateAroundAxisConj(), statevec_rotateAroundAxis(), and statevec_rotateAroundAxisConj().
◆ getConjugateMatrix2()
ComplexMatrix2 getConjugateMatrix2 | ( | ComplexMatrix2 | src | ) |
Definition at line 99 of file QuEST_common.c.
References macro_setConjugateMatrix.
Referenced by controlledUnitary(), multiControlledUnitary(), multiStateControlledUnitary(), and unitary().
◆ getConjugateMatrix4()
ComplexMatrix4 getConjugateMatrix4 | ( | ComplexMatrix4 | src | ) |
Definition at line 104 of file QuEST_common.c.
References macro_setConjugateMatrix.
Referenced by controlledTwoQubitUnitary(), multiControlledTwoQubitUnitary(), and twoQubitUnitary().
◆ getConjugateScalar()
Definition at line 85 of file QuEST_common.c.
References Complex::imag, and Complex::real.
Referenced by compactUnitary(), and controlledCompactUnitary().
◆ getControlFlipMask()
long long int getControlFlipMask | ( | int * | controlQubits, |
int * | controlState, | ||
int | numControlQubits | ||
) |
◆ getQubitBitMask()
long long int getQubitBitMask | ( | int * | controlQubits, |
int | numControlQubits | ||
) |
Definition at line 44 of file QuEST_common.c.
Referenced by applyMultiControlledMatrixN(), multiControlledMultiQubitUnitary(), multiControlledTwoQubitUnitary(), multiControlledUnitary(), multiRotateZ(), multiStateControlledUnitary(), statevec_multiControlledMultiQubitUnitary(), statevec_multiControlledPhaseFlip(), statevec_multiControlledPhaseShift(), statevec_multiRotatePauli(), and validateMultiControlsMultiTargets().
◆ getQuESTDefaultSeedKey()
void getQuESTDefaultSeedKey | ( | unsigned long int * | key | ) |
Definition at line 182 of file QuEST_common.c.
Referenced by seedQuESTDefault().
◆ getVectorMagnitude()
Definition at line 73 of file QuEST_common.c.
References Vector::x, Vector::y, and Vector::z.
Referenced by getUnitVector(), and validateVector().
◆ getZYZRotAnglesFromComplexPair()
void getZYZRotAnglesFromComplexPair | ( | Complex | alpha, |
Complex | beta, | ||
qreal * | rz2, | ||
qreal * | ry, | ||
qreal * | rz1 | ||
) |
maps U(alpha, beta) to Rz(rz2) Ry(ry) Rz(rz1)
Definition at line 124 of file QuEST_common.c.
References Complex::imag, qreal, and Complex::real.
Referenced by qasm_recordAxisRotation(), qasm_recordCompactUnitary(), qasm_recordControlledAxisRotation(), qasm_recordControlledCompactUnitary(), qasm_recordControlledUnitary(), qasm_recordMultiControlledUnitary(), and qasm_recordUnitary().
◆ hashString()
unsigned long int hashString | ( | char * | str | ) |
Definition at line 172 of file QuEST_common.c.
◆ setConjugateMatrixN()
void setConjugateMatrixN | ( | ComplexMatrixN | m | ) |
Definition at line 109 of file QuEST_common.c.
References macro_setConjugateMatrix, and ComplexMatrixN::numQubits.
Referenced by controlledMultiQubitUnitary(), multiControlledMultiQubitUnitary(), and multiQubitUnitary().
◆ shiftIndices()
void shiftIndices | ( | int * | indices, |
int | numIndices, | ||
int | shift | ||
) |
Definition at line 150 of file QuEST_common.c.
Referenced by controlledMultiQubitUnitary(), multiControlledMultiQubitUnitary(), multiControlledPhaseFlip(), multiControlledPhaseShift(), multiQubitUnitary(), and multiRotatePauli().
◆ statevec_applyDiagonalOp()
void statevec_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 3661 of file QuEST_cpu.c.
References DiagonalOp::imag, Qureg::numAmpsPerChunk, qreal, DiagonalOp::real, and Qureg::stateVec.
Referenced by applyDiagonalOp().
◆ statevec_applyPauliSum()
void statevec_applyPauliSum | ( | Qureg | inQureg, |
enum pauliOpType * | allCodes, | ||
qreal * | termCoeffs, | ||
int | numSumTerms, | ||
Qureg | outQureg | ||
) |
Definition at line 494 of file QuEST_common.c.
References Qureg::numQubitsRepresented, Complex::real, statevec_applyPauliProd(), statevec_initBlankState(), and statevec_setWeightedQureg().
Referenced by applyPauliHamil(), and applyPauliSum().
◆ statevec_calcExpecDiagonalOp()
Complex statevec_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1523 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), DiagonalOp::deviceOperator, Qureg::deviceStateVec, Qureg::firstLevelReduction, Complex::imag, Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, Complex::real, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, statevec_calcExpecDiagonalOpLocal(), and swapDouble().
Referenced by calcExpecDiagonalOp().
◆ statevec_calcExpecPauliProd()
qreal statevec_calcExpecPauliProd | ( | Qureg | qureg, |
int * | targetQubits, | ||
enum pauliOpType * | pauliCodes, | ||
int | numTargets, | ||
Qureg | workspace | ||
) |
Definition at line 465 of file QuEST_common.c.
References densmatr_calcTotalProb(), Qureg::isDensityMatrix, qreal, Complex::real, statevec_applyPauliProd(), statevec_calcInnerProduct(), and statevec_cloneQureg().
Referenced by calcExpecPauliProd(), and statevec_calcExpecPauliSum().
◆ statevec_calcExpecPauliSum()
qreal statevec_calcExpecPauliSum | ( | Qureg | qureg, |
enum pauliOpType * | allCodes, | ||
qreal * | termCoeffs, | ||
int | numSumTerms, | ||
Qureg | workspace | ||
) |
Definition at line 480 of file QuEST_common.c.
References Qureg::numQubitsRepresented, qreal, and statevec_calcExpecPauliProd().
Referenced by calcExpecPauliHamil(), and calcExpecPauliSum().
◆ statevec_calcFidelity()
Definition at line 377 of file QuEST_common.c.
References Complex::imag, qreal, Complex::real, and statevec_calcInnerProduct().
Referenced by calcFidelity().
◆ 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 35 of file QuEST_cpu_distributed.c.
References copySharedReduceBlock(), Qureg::deviceStateVec, Qureg::firstLevelReduction, Complex::imag, Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, Complex::real, REDUCE_SHARED_SIZE, Qureg::secondLevelReduction, statevec_calcInnerProductLocal(), and swapDouble().
Referenced by calcInnerProduct(), statevec_calcExpecPauliProd(), and statevec_calcFidelity().
◆ statevec_calcProbOfOutcome()
Definition at line 1260 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, halfMatrixBlockFitsInChunk(), isChunkToSkipInFindPZero(), Qureg::numAmpsPerChunk, qreal, statevec_findProbabilityOfZero(), statevec_findProbabilityOfZeroDistributed(), and statevec_findProbabilityOfZeroLocal().
Referenced by calcProbOfOutcome(), collapseToOutcome(), and statevec_measureWithStats().
◆ statevec_calcTotalProb()
Definition at line 88 of file QuEST_cpu_distributed.c.
References copyStateFromGPU(), Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
Referenced by calcTotalProb().
◆ statevec_cloneQureg()
works for both statevectors and density matrices
Definition at line 1506 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by cloneQureg(), createCloneQureg(), initPureState(), and statevec_calcExpecPauliProd().
◆ statevec_collapseToKnownProbOutcome()
void statevec_collapseToKnownProbOutcome | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | outcomeProb | ||
) |
Definition at line 1298 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, halfMatrixBlockFitsInChunk(), isChunkToSkipInFindPZero(), Qureg::numAmpsPerChunk, qreal, statevec_collapseToKnownProbOutcomeDistributedRenorm(), statevec_collapseToKnownProbOutcomeLocal(), and statevec_collapseToOutcomeDistributedSetZero().
Referenced by collapseToOutcome(), and statevec_measureWithStats().
◆ statevec_compactUnitary()
Definition at line 844 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngle(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_compactUnitaryDistributed(), and statevec_compactUnitaryLocal().
Referenced by compactUnitary(), statevec_multiRotatePauli(), statevec_rotateAroundAxis(), and statevec_rotateAroundAxisConj().
◆ statevec_compareStates()
Definition at line 1675 of file QuEST_cpu.c.
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 920 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngle(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_controlledCompactUnitaryDistributed(), and statevec_controlledCompactUnitaryLocal().
Referenced by controlledCompactUnitary(), statevec_controlledRotateAroundAxis(), and statevec_controlledRotateAroundAxisConj().
◆ statevec_controlledMultiQubitUnitary()
void statevec_controlledMultiQubitUnitary | ( | Qureg | qureg, |
int | ctrl, | ||
int * | targets, | ||
int | numTargets, | ||
ComplexMatrixN | u | ||
) |
Definition at line 535 of file QuEST_common.c.
References statevec_multiControlledMultiQubitUnitary().
Referenced by controlledMultiQubitUnitary().
◆ statevec_controlledNot()
void statevec_controlledNot | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1061 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_controlledNotDistributed(), and statevec_controlledNotLocal().
Referenced by controlledNot().
◆ statevec_controlledPauliY()
void statevec_controlledPauliY | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1140 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_controlledPauliYDistributed(), and statevec_controlledPauliYLocal().
Referenced by controlledPauliY().
◆ statevec_controlledPauliYConj()
void statevec_controlledPauliYConj | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1173 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_controlledPauliYDistributed(), and statevec_controlledPauliYLocal().
Referenced by controlledPauliY().
◆ statevec_controlledPhaseFlip()
void statevec_controlledPhaseFlip | ( | Qureg | qureg, |
int | idQubit1, | ||
int | idQubit2 | ||
) |
Definition at line 3300 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by controlledPhaseFlip().
◆ statevec_controlledPhaseShift()
Definition at line 3019 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by controlledPhaseShift().
◆ statevec_controlledRotateAroundAxis()
void statevec_controlledRotateAroundAxis | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
qreal | angle, | ||
Vector | axis | ||
) |
Definition at line 327 of file QuEST_common.c.
References getComplexPairFromRotation(), and statevec_controlledCompactUnitary().
Referenced by controlledRotateAroundAxis(), statevec_controlledRotateX(), statevec_controlledRotateY(), and statevec_controlledRotateZ().
◆ statevec_controlledRotateAroundAxisConj()
void statevec_controlledRotateAroundAxisConj | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
qreal | angle, | ||
Vector | axis | ||
) |
Definition at line 334 of file QuEST_common.c.
References getComplexPairFromRotation(), Complex::imag, and statevec_controlledCompactUnitary().
Referenced by controlledRotateAroundAxis().
◆ statevec_controlledRotateX()
Definition at line 343 of file QuEST_common.c.
References statevec_controlledRotateAroundAxis().
Referenced by controlledRotateX().
◆ statevec_controlledRotateY()
Definition at line 349 of file QuEST_common.c.
References statevec_controlledRotateAroundAxis().
Referenced by controlledRotateY().
◆ statevec_controlledRotateZ()
Definition at line 355 of file QuEST_common.c.
References statevec_controlledRotateAroundAxis().
Referenced by controlledRotateZ().
◆ statevec_controlledTwoQubitUnitary()
void statevec_controlledTwoQubitUnitary | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit1, | ||
int | targetQubit2, | ||
ComplexMatrix4 | u | ||
) |
Definition at line 523 of file QuEST_common.c.
References statevec_multiControlledTwoQubitUnitary().
Referenced by controlledTwoQubitUnitary().
◆ statevec_controlledUnitary()
void statevec_controlledUnitary | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 958 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngleFromUnitaryMatrix(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_controlledUnitaryDistributed(), and statevec_controlledUnitaryLocal().
Referenced by controlledUnitary().
◆ statevec_createQureg()
Definition at line 1279 of file QuEST_cpu.c.
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 1317 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::firstLevelReduction, Qureg::numAmpsPerChunk, Qureg::numAmpsTotal, Qureg::numQubitsInStateVec, QuESTEnv::numRanks, Qureg::pairStateVec, Qureg::secondLevelReduction, and Qureg::stateVec.
Referenced by destroyQureg().
◆ statevec_getImagAmp()
Definition at line 208 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, Qureg::deviceStateVec, getChunkIdFromIndex(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by getAmp(), getDensityAmp(), getImagAmp(), and statevec_getProbAmp().
◆ statevec_getProbAmp()
Definition at line 245 of file QuEST_common.c.
References qreal, statevec_getImagAmp(), and statevec_getRealAmp().
Referenced by getProbAmp().
◆ statevec_getRealAmp()
Definition at line 198 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, Qureg::deviceStateVec, getChunkIdFromIndex(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by getAmp(), getDensityAmp(), getRealAmp(), and statevec_getProbAmp().
◆ statevec_hadamard()
void statevec_hadamard | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1206 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_hadamardDistributed(), and statevec_hadamardLocal().
Referenced by hadamard().
◆ statevec_initBlankState()
void statevec_initBlankState | ( | Qureg | qureg | ) |
Definition at line 1398 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by initBlankState(), statevec_applyPauliSum(), and statevec_initZeroState().
◆ statevec_initClassicalState()
void statevec_initClassicalState | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 1470 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by initClassicalState().
◆ 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 1591 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by initDebugState().
◆ statevec_initPlusState()
void statevec_initPlusState | ( | Qureg | qureg | ) |
Definition at line 1438 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
Referenced by initPlusState().
◆ statevec_initStateFromSingleFile()
Definition at line 1625 of file QuEST_cpu.c.
References Qureg::chunkId, copyStateToGPU(), Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, Qureg::stateVec, and syncQuESTEnv().
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 1545 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, extractBit(), Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
Referenced by initStateOfSingleQubit().
◆ statevec_initZeroState()
void statevec_initZeroState | ( | Qureg | qureg | ) |
Definition at line 1428 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, Qureg::stateVec, and statevec_initBlankState().
Referenced by initZeroState().
◆ statevec_measureWithStats()
Definition at line 361 of file QuEST_common.c.
References generateMeasurementOutcome(), qreal, statevec_calcProbOfOutcome(), and statevec_collapseToKnownProbOutcome().
Referenced by measure(), and measureWithStats().
◆ 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 1437 of file QuEST_cpu_distributed.c.
References flipBit(), getQubitBitMask(), halfMatrixBlockFitsInChunk(), ComplexMatrixN::imag, maskContainsBit(), Qureg::numAmpsPerChunk, ComplexMatrixN::numQubits, qreal, ComplexMatrixN::real, statevec_multiControlledMultiQubitUnitaryLocal(), and statevec_swapQubitAmps().
Referenced by applyMultiControlledMatrixN(), densmatr_applyMultiQubitKrausSuperoperator(), densmatr_applyTwoQubitKrausSuperoperator(), multiControlledMultiQubitUnitary(), statevec_controlledMultiQubitUnitary(), and statevec_multiQubitUnitary().
◆ statevec_multiControlledPhaseFlip()
void statevec_multiControlledPhaseFlip | ( | Qureg | qureg, |
int * | controlQubits, | ||
int | numControlQubits | ||
) |
Definition at line 3331 of file QuEST_cpu.c.
References Qureg::chunkId, getQubitBitMask(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by multiControlledPhaseFlip().
◆ statevec_multiControlledPhaseShift()
void statevec_multiControlledPhaseShift | ( | Qureg | qureg, |
int * | controlQubits, | ||
int | numControlQubits, | ||
qreal | angle | ||
) |
Definition at line 3059 of file QuEST_cpu.c.
References Qureg::chunkId, getQubitBitMask(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by multiControlledPhaseShift().
◆ 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 1381 of file QuEST_cpu_distributed.c.
References flipBit(), halfMatrixBlockFitsInChunk(), maskContainsBit(), Qureg::numAmpsPerChunk, qreal, statevec_multiControlledTwoQubitUnitaryLocal(), and statevec_swapQubitAmps().
Referenced by densmatr_applyKrausSuperoperator(), multiControlledTwoQubitUnitary(), statevec_controlledTwoQubitUnitary(), and statevec_twoQubitUnitary().
◆ statevec_multiControlledUnitary()
void statevec_multiControlledUnitary | ( | Qureg | qureg, |
long long int | ctrlQubitsMask, | ||
long long int | ctrlFlipMask, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 997 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngleFromUnitaryMatrix(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_multiControlledUnitaryDistributed(), and statevec_multiControlledUnitaryLocal().
Referenced by multiControlledUnitary(), and multiStateControlledUnitary().
◆ statevec_multiQubitUnitary()
void statevec_multiQubitUnitary | ( | Qureg | qureg, |
int * | targets, | ||
int | numTargets, | ||
ComplexMatrixN | u | ||
) |
Definition at line 529 of file QuEST_common.c.
References statevec_multiControlledMultiQubitUnitary().
Referenced by applyMatrixN(), and multiQubitUnitary().
◆ statevec_multiRotatePauli()
void statevec_multiRotatePauli | ( | Qureg | qureg, |
int * | targetQubits, | ||
enum pauliOpType * | targetPaulis, | ||
int | numTargets, | ||
qreal | angle, | ||
int | applyConj | ||
) |
applyConj=1 will apply conjugate operation, else applyConj=0
Definition at line 411 of file QuEST_common.c.
References getQubitBitMask(), Complex::imag, PAULI_I, PAULI_X, PAULI_Y, qreal, Complex::real, statevec_compactUnitary(), and statevec_multiRotateZ().
Referenced by applyExponentiatedPauliHamil(), and multiRotatePauli().
◆ statevec_multiRotateZ()
Definition at line 3109 of file QuEST_cpu.c.
References Qureg::chunkId, getBitMaskParity(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by multiRotateZ(), and statevec_multiRotatePauli().
◆ statevec_pauliX()
void statevec_pauliX | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1034 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_pauliXDistributed(), and statevec_pauliXLocal().
Referenced by pauliX(), and statevec_applyPauliProd().
◆ statevec_pauliY()
void statevec_pauliY | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1090 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_pauliYDistributed(), and statevec_pauliYLocal().
Referenced by pauliY(), and statevec_applyPauliProd().
◆ statevec_pauliYConj()
void statevec_pauliYConj | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1115 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_pauliYDistributed(), and statevec_pauliYLocal().
Referenced by pauliY().
◆ statevec_pauliZ()
void statevec_pauliZ | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 258 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by pauliZ(), and statevec_applyPauliProd().
◆ statevec_phaseShift()
Definition at line 251 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by phaseShift().
◆ statevec_phaseShiftByTerm()
Definition at line 2978 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, and Qureg::stateVec.
Referenced by statevec_pauliZ(), statevec_phaseShift(), statevec_sGate(), statevec_sGateConj(), statevec_tGate(), and statevec_tGateConj().
◆ 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 1366 of file QuEST_cpu.c.
References Qureg::chunkId, copyStateFromGPU(), Qureg::numAmpsPerChunk, Qureg::numChunks, Qureg::numQubitsInStateVec, Qureg::stateVec, and syncQuESTEnv().
Referenced by reportStateToScreen().
◆ statevec_rotateAroundAxis()
Definition at line 311 of file QuEST_common.c.
References getComplexPairFromRotation(), and statevec_compactUnitary().
Referenced by rotateAroundAxis(), statevec_rotateX(), statevec_rotateY(), and statevec_rotateZ().
◆ statevec_rotateAroundAxisConj()
Definition at line 318 of file QuEST_common.c.
References getComplexPairFromRotation(), Complex::imag, and statevec_compactUnitary().
Referenced by rotateAroundAxis().
◆ statevec_rotateX()
Definition at line 293 of file QuEST_common.c.
References statevec_rotateAroundAxis().
Referenced by rotateX().
◆ statevec_rotateY()
Definition at line 299 of file QuEST_common.c.
References statevec_rotateAroundAxis().
Referenced by rotateY().
◆ statevec_rotateZ()
Definition at line 305 of file QuEST_common.c.
References statevec_rotateAroundAxis().
Referenced by rotateZ().
◆ statevec_setAmps()
void statevec_setAmps | ( | Qureg | qureg, |
long long int | startInd, | ||
qreal * | reals, | ||
qreal * | imags, | ||
long long int | numAmps | ||
) |
Definition at line 1237 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::deviceStateVec, Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
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 3619 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, and Qureg::stateVec.
Referenced by setWeightedQureg(), and statevec_applyPauliSum().
◆ statevec_sGate()
void statevec_sGate | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 265 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by sGate().
◆ statevec_sGateConj()
void statevec_sGateConj | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 279 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by sGate().
◆ statevec_sqrtSwapGate()
void statevec_sqrtSwapGate | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
Definition at line 384 of file QuEST_common.c.
References ComplexMatrix4::imag, ComplexMatrix4::real, and statevec_twoQubitUnitary().
Referenced by sqrtSwapGate().
◆ statevec_sqrtSwapGateConj()
void statevec_sqrtSwapGateConj | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
Definition at line 397 of file QuEST_common.c.
References ComplexMatrix4::imag, ComplexMatrix4::real, and statevec_twoQubitUnitary().
Referenced by sqrtSwapGate().
◆ statevec_swapQubitAmps()
void statevec_swapQubitAmps | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
Definition at line 1354 of file QuEST_cpu_distributed.c.
References exchangeStateVectors(), flipBit(), getGlobalIndOfOddParityInChunk(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, qreal, statevec_swapQubitAmpsDistributed(), and statevec_swapQubitAmpsLocal().
Referenced by statevec_multiControlledMultiQubitUnitary(), statevec_multiControlledTwoQubitUnitary(), and swapGate().
◆ statevec_tGate()
void statevec_tGate | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 272 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by tGate().
◆ statevec_tGateConj()
void statevec_tGateConj | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 286 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by tGate().
◆ statevec_twoQubitUnitary()
void statevec_twoQubitUnitary | ( | Qureg | qureg, |
int | targetQubit1, | ||
int | targetQubit2, | ||
ComplexMatrix4 | u | ||
) |
Definition at line 517 of file QuEST_common.c.
References statevec_multiControlledTwoQubitUnitary().
Referenced by applyMatrix4(), statevec_sqrtSwapGate(), statevec_sqrtSwapGateConj(), and twoQubitUnitary().
◆ statevec_unitary()
void statevec_unitary | ( | Qureg | qureg, |
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 881 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngleFromUnitaryMatrix(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_unitaryDistributed(), and statevec_unitaryLocal().
Referenced by applyMatrix2(), and unitary().