Go to the source code of this file.
Functions | |
void | agnostic_applyQFT (Qureg qureg, int *qubits, int numQubits) |
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_initDiagonalOpFromPauliHamil (DiagonalOp op, PauliHamil hamil) |
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) |
void | densmatr_calcProbOfAllOutcomes (qreal *retProbs, Qureg qureg, int *qubits, int numQubits) |
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 | shiftSubregIndices (int *allInds, int *numIndsPerReg, int numRegs, int shift) |
void | statevec_applyDiagonalOp (Qureg qureg, DiagonalOp op) |
void | statevec_applyMultiVarPhaseFuncOverrides (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, qreal *coeffs, qreal *exponents, int *numTermsPerReg, long long int *overrideInds, qreal *overridePhases, int numOverrides, int conj) |
void | statevec_applyParamNamedPhaseFuncOverrides (Qureg qureg, int *qubits, int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, enum phaseFunc functionNameCode, qreal *params, int numParams, long long int *overrideInds, qreal *overridePhases, int numOverrides, int conj) |
void | statevec_applyPauliSum (Qureg inQureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg) |
void | statevec_applyPhaseFuncOverrides (Qureg qureg, int *qubits, int numQubits, enum bitEncoding encoding, qreal *coeffs, qreal *exponents, int numTerms, long long int *overrideInds, qreal *overridePhases, int numOverrides, int conj) |
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... | |
void | statevec_calcProbOfAllOutcomes (qreal *retProbs, Qureg qureg, int *qubits, int numQubits) |
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_multiControlledMultiQubitNot (Qureg qureg, int ctrlMask, int targMask) |
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_multiControlledMultiRotatePauli (Qureg qureg, long long int ctrlMask, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle, int applyConj) |
void | statevec_multiControlledMultiRotateZ (Qureg qureg, long long int ctrlMask, long long int targMask, qreal angle) |
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_applyQFT()
void agnostic_applyQFT | ( | Qureg | qureg, |
int * | qubits, | ||
int | numQubits | ||
) |
Definition at line 849 of file QuEST_common.c.
References GATE_HADAMARD, GATE_SWAP, Qureg::isDensityMatrix, M_PI, Qureg::numQubitsRepresented, qasm_recordControlledGate(), qasm_recordGate(), qasm_recordNamedPhaseFunc(), qreal, SCALED_PRODUCT, shiftSubregIndices(), statevec_applyParamNamedPhaseFuncOverrides(), statevec_hadamard(), statevec_swapQubitAmps(), and UNSIGNED.
Referenced by applyFullQFT(), and applyQFT().
◆ agnostic_applyTrotterCircuit()
void agnostic_applyTrotterCircuit | ( | Qureg | qureg, |
PauliHamil | hamil, | ||
qreal | time, | ||
int | order, | ||
int | reps | ||
) |
Definition at line 840 of file QuEST_common.c.
References applySymmetrizedTrotterCircuit().
Referenced by applyTrotterCircuit().
◆ agnostic_createDiagonalOp()
DiagonalOp agnostic_createDiagonalOp | ( | int | numQubits, |
QuESTEnv | env | ||
) |
Definition at line 1346 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(), and createDiagonalOpFromPauliHamilFile().
◆ agnostic_destroyDiagonalOp()
void agnostic_destroyDiagonalOp | ( | DiagonalOp | op | ) |
Definition at line 1368 of file QuEST_cpu.c.
References DiagonalOp::deviceOperator, DiagonalOp::imag, and DiagonalOp::real.
Referenced by destroyDiagonalOp().
◆ agnostic_initDiagonalOpFromPauliHamil()
void agnostic_initDiagonalOpFromPauliHamil | ( | DiagonalOp | op, |
PauliHamil | hamil | ||
) |
Definition at line 1377 of file QuEST_cpu.c.
References DiagonalOp::chunkId, extractBit(), DiagonalOp::imag, DiagonalOp::numElemsPerChunk, PauliHamil::numQubits, DiagonalOp::numQubits, PauliHamil::numSumTerms, PAULI_Z, PauliHamil::pauliCodes, qreal, DiagonalOp::real, and PauliHamil::termCoeffs.
Referenced by createDiagonalOpFromPauliHamilFile(), and initDiagonalOpFromPauliHamil().
◆ agnostic_setDiagonalOpElems()
void agnostic_setDiagonalOpElems | ( | DiagonalOp | op, |
long long int | startInd, | ||
qreal * | real, | ||
qreal * | imag, | ||
long long int | numElems | ||
) |
Definition at line 4228 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 1373 of file QuEST_cpu.c.
References DiagonalOp::deviceOperator, DiagonalOp::imag, DiagonalOp::numElemsPerChunk, and DiagonalOp::real.
Referenced by syncDiagonalOp().
◆ conjugateMatrixN()
void conjugateMatrixN | ( | ComplexMatrixN | u | ) |
◆ densmatr_applyDiagonalOp()
void densmatr_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1594 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 1618 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 429 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 444 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 455 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_calcProbOfAllOutcomes()
Definition at line 1349 of file QuEST_cpu_distributed.c.
References densmatr_calcProbOfAllOutcomesLocal(), Qureg::numQubitsRepresented, and qreal.
Referenced by calcProbOfAllOutcomes().
◆ densmatr_calcProbOfOutcome()
Definition at line 1328 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 1358 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 791 of file QuEST_cpu.c.
References alternateNormZeroingSomeAmpBlocks(), Qureg::chunkId, Qureg::deviceStateVec, extractBit(), normaliseSomeAmps(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and zeroSomeAmps().
Referenced by applyProjector(), collapseToOutcome(), and densmatr_measureWithStats().
◆ densmatr_initClassicalState()
void densmatr_initClassicalState | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 1126 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 1165 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by initPlusState().
◆ densmatr_initPureState()
Definition at line 466 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 372 of file QuEST_common.c.
References densmatr_calcProbOfOutcome(), densmatr_collapseToKnownProbOutcome(), generateMeasurementOutcome(), and qreal.
Referenced by measure(), and measureWithStats().
◆ densmatr_mixDamping()
Definition at line 739 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 901 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by mixDensityMatrix().
◆ densmatr_mixDephasing()
Definition at line 85 of file QuEST_cpu.c.
References densmatr_oneQubitDegradeOffDiagonal(), and qreal.
Referenced by densmatr_mixDepolarising(), densmatr_mixDepolarisingDistributed(), and mixDephasing().
◆ densmatr_mixDepolarising()
Definition at line 712 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 644 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 701 of file QuEST_common.c.
References createComplexMatrixN(), densmatr_applyMultiQubitKrausSuperoperator(), destroyComplexMatrixN(), macro_allocStackComplexMatrixN, and populateKrausSuperOperatorN().
Referenced by mixMultiQubitKrausMap().
◆ densmatr_mixPauli()
Definition at line 743 of file QuEST_common.c.
References densmatr_mixKrausMap(), ComplexMatrix2::imag, qreal, and ComplexMatrix2::real.
Referenced by mixPauli().
◆ densmatr_mixTwoQubitDephasing()
Definition at line 90 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 766 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 682 of file QuEST_common.c.
References createComplexMatrixN(), densmatr_applyTwoQubitKrausSuperoperator(), destroyComplexMatrixN(), macro_allocStackComplexMatrixN, and populateKrausSuperOperator4().
Referenced by mixTwoQubitKrausMap().
◆ ensureIndsIncrease()
void ensureIndsIncrease | ( | int * | ind1, |
int * | ind2 | ||
) |
Definition at line 70 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 142 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 120 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 105 of file QuEST_common.c.
References macro_setConjugateMatrix.
Referenced by controlledUnitary(), multiControlledUnitary(), multiStateControlledUnitary(), and unitary().
◆ getConjugateMatrix4()
ComplexMatrix4 getConjugateMatrix4 | ( | ComplexMatrix4 | src | ) |
Definition at line 110 of file QuEST_common.c.
References macro_setConjugateMatrix.
Referenced by controlledTwoQubitUnitary(), multiControlledTwoQubitUnitary(), and twoQubitUnitary().
◆ getConjugateScalar()
Definition at line 91 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 50 of file QuEST_common.c.
Referenced by applyMultiControlledMatrixN(), multiControlledMultiQubitNot(), multiControlledMultiQubitUnitary(), multiControlledMultiRotatePauli(), multiControlledMultiRotateZ(), multiControlledTwoQubitUnitary(), multiControlledUnitary(), multiQubitNot(), multiRotateZ(), multiStateControlledUnitary(), statevec_multiControlledMultiQubitUnitary(), statevec_multiControlledMultiRotatePauli(), statevec_multiControlledPhaseFlip(), statevec_multiControlledPhaseShift(), statevec_multiRotatePauli(), and validateMultiControlsMultiTargets().
◆ getQuESTDefaultSeedKey()
void getQuESTDefaultSeedKey | ( | unsigned long int * | key | ) |
Definition at line 195 of file QuEST_common.c.
Referenced by seedQuESTDefault().
◆ getVectorMagnitude()
Definition at line 79 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 130 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 185 of file QuEST_common.c.
◆ setConjugateMatrixN()
void setConjugateMatrixN | ( | ComplexMatrixN | m | ) |
Definition at line 115 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 156 of file QuEST_common.c.
Referenced by applyPhaseFunc(), applyPhaseFuncOverrides(), controlledMultiQubitUnitary(), multiControlledMultiQubitUnitary(), multiControlledMultiRotatePauli(), multiControlledPhaseFlip(), multiControlledPhaseShift(), multiQubitUnitary(), and multiRotatePauli().
◆ shiftSubregIndices()
void shiftSubregIndices | ( | int * | allInds, |
int * | numIndsPerReg, | ||
int | numRegs, | ||
int | shift | ||
) |
Definition at line 161 of file QuEST_common.c.
Referenced by agnostic_applyQFT(), applyMultiVarPhaseFunc(), applyMultiVarPhaseFuncOverrides(), applyNamedPhaseFunc(), applyNamedPhaseFuncOverrides(), applyParamNamedPhaseFunc(), and applyParamNamedPhaseFuncOverrides().
◆ statevec_applyDiagonalOp()
void statevec_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 4047 of file QuEST_cpu.c.
References DiagonalOp::imag, Qureg::numAmpsPerChunk, qreal, DiagonalOp::real, and Qureg::stateVec.
Referenced by applyDiagonalOp().
◆ statevec_applyMultiVarPhaseFuncOverrides()
void statevec_applyMultiVarPhaseFuncOverrides | ( | Qureg | qureg, |
int * | qubits, | ||
int * | numQubitsPerReg, | ||
int | numRegs, | ||
enum bitEncoding | encoding, | ||
qreal * | coeffs, | ||
qreal * | exponents, | ||
int * | numTermsPerReg, | ||
long long int * | overrideInds, | ||
qreal * | overridePhases, | ||
int | numOverrides, | ||
int | conj | ||
) |
Definition at line 4345 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), MAX_NUM_REGS_APPLY_ARBITRARY_PHASE, Qureg::numAmpsPerChunk, qreal, Qureg::stateVec, TWOS_COMPLEMENT, and UNSIGNED.
Referenced by applyMultiVarPhaseFunc(), and applyMultiVarPhaseFuncOverrides().
◆ statevec_applyParamNamedPhaseFuncOverrides()
void statevec_applyParamNamedPhaseFuncOverrides | ( | Qureg | qureg, |
int * | qubits, | ||
int * | numQubitsPerReg, | ||
int | numRegs, | ||
enum bitEncoding | encoding, | ||
enum phaseFunc | functionNameCode, | ||
qreal * | params, | ||
int | numParams, | ||
long long int * | overrideInds, | ||
qreal * | overridePhases, | ||
int | numOverrides, | ||
int | conj | ||
) |
Definition at line 4446 of file QuEST_cpu.c.
References Qureg::chunkId, DISTANCE, extractBit(), INVERSE_DISTANCE, INVERSE_NORM, INVERSE_PRODUCT, MAX_NUM_REGS_APPLY_ARBITRARY_PHASE, NORM, Qureg::numAmpsPerChunk, PRODUCT, qreal, SCALED_DISTANCE, SCALED_INVERSE_DISTANCE, SCALED_INVERSE_NORM, SCALED_INVERSE_PRODUCT, SCALED_INVERSE_SHIFTED_DISTANCE, SCALED_INVERSE_SHIFTED_NORM, SCALED_NORM, SCALED_PRODUCT, Qureg::stateVec, TWOS_COMPLEMENT, and UNSIGNED.
Referenced by agnostic_applyQFT(), applyNamedPhaseFunc(), applyNamedPhaseFuncOverrides(), applyParamNamedPhaseFunc(), and applyParamNamedPhaseFuncOverrides().
◆ statevec_applyPauliSum()
void statevec_applyPauliSum | ( | Qureg | inQureg, |
enum pauliOpType * | allCodes, | ||
qreal * | termCoeffs, | ||
int | numSumTerms, | ||
Qureg | outQureg | ||
) |
Definition at line 538 of file QuEST_common.c.
References Qureg::numQubitsRepresented, Complex::real, statevec_applyPauliProd(), statevec_initBlankState(), and statevec_setWeightedQureg().
Referenced by applyPauliHamil(), and applyPauliSum().
◆ statevec_applyPhaseFuncOverrides()
void statevec_applyPhaseFuncOverrides | ( | Qureg | qureg, |
int * | qubits, | ||
int | numQubits, | ||
enum bitEncoding | encoding, | ||
qreal * | coeffs, | ||
qreal * | exponents, | ||
int | numTerms, | ||
long long int * | overrideInds, | ||
qreal * | overridePhases, | ||
int | numOverrides, | ||
int | conj | ||
) |
Definition at line 4268 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, Qureg::stateVec, TWOS_COMPLEMENT, and UNSIGNED.
Referenced by applyPhaseFunc(), and applyPhaseFuncOverrides().
◆ statevec_calcExpecDiagonalOp()
Complex statevec_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1600 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 509 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 524 of file QuEST_common.c.
References Qureg::numQubitsRepresented, qreal, and statevec_calcExpecPauliProd().
Referenced by calcExpecPauliHamil(), and calcExpecPauliSum().
◆ statevec_calcFidelity()
Definition at line 380 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_calcProbOfAllOutcomes()
Definition at line 1340 of file QuEST_cpu_distributed.c.
References Qureg::numAmpsPerChunk, qreal, and statevec_calcProbOfAllOutcomesLocal().
Referenced by calcProbOfAllOutcomes().
◆ statevec_calcProbOfOutcome()
Definition at line 1312 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 1572 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 1368 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, halfMatrixBlockFitsInChunk(), isChunkToSkipInFindPZero(), Qureg::numAmpsPerChunk, qreal, statevec_collapseToKnownProbOutcomeDistributedRenorm(), statevec_collapseToKnownProbOutcomeLocal(), and statevec_collapseToOutcomeDistributedSetZero().
Referenced by applyProjector(), collapseToOutcome(), and statevec_measureWithStats().
◆ statevec_compactUnitary()
Definition at line 858 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 1741 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 934 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 579 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 1075 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 1192 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 1225 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 3687 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by controlledPhaseFlip().
◆ statevec_controlledPhaseShift()
Definition at line 3226 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 330 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 337 of file QuEST_common.c.
References getComplexPairFromRotation(), Complex::imag, and statevec_controlledCompactUnitary().
Referenced by controlledRotateAroundAxis().
◆ statevec_controlledRotateX()
Definition at line 346 of file QuEST_common.c.
References statevec_controlledRotateAroundAxis().
Referenced by controlledRotateX().
◆ statevec_controlledRotateY()
Definition at line 352 of file QuEST_common.c.
References statevec_controlledRotateAroundAxis().
Referenced by controlledRotateY().
◆ statevec_controlledRotateZ()
Definition at line 358 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 567 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 972 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 1290 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 1328 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 222 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 248 of file QuEST_common.c.
References qreal, statevec_getImagAmp(), and statevec_getRealAmp().
Referenced by getProbAmp().
◆ statevec_getRealAmp()
Definition at line 212 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 1258 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 agnostic_applyQFT(), and hadamard().
◆ statevec_initBlankState()
void statevec_initBlankState | ( | Qureg | qureg | ) |
Definition at line 1464 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 1536 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 1657 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 1504 of file QuEST_cpu.c.
References Qureg::deviceStateVec, Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
Referenced by initPlusState().
◆ statevec_initStateFromSingleFile()
Definition at line 1691 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] outcome of qubit 'qubitId'
Definition at line 1611 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 1494 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 364 of file QuEST_common.c.
References generateMeasurementOutcome(), qreal, statevec_calcProbOfOutcome(), and statevec_collapseToKnownProbOutcome().
Referenced by measure(), and measureWithStats().
◆ statevec_multiControlledMultiQubitNot()
void statevec_multiControlledMultiQubitNot | ( | Qureg | qureg, |
int | ctrlMask, | ||
int | targMask | ||
) |
Definition at line 1097 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, exchangeStateVectors(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, Qureg::stateVec, statevec_multiControlledMultiQubitNotDistributed(), and statevec_multiControlledMultiQubitNotLocal().
Referenced by multiControlledMultiQubitNot(), and multiQubitNot().
◆ 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 1514 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_multiControlledMultiRotatePauli()
void statevec_multiControlledMultiRotatePauli | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int * | targetQubits, | ||
enum pauliOpType * | targetPaulis, | ||
int | numTargets, | ||
qreal | angle, | ||
int | applyConj | ||
) |
Definition at line 453 of file QuEST_common.c.
References getQubitBitMask(), ComplexMatrix2::imag, PAULI_I, PAULI_X, PAULI_Y, qreal, ComplexMatrix2::real, statevec_multiControlledMultiRotateZ(), and statevec_multiControlledUnitary().
Referenced by multiControlledMultiRotatePauli().
◆ statevec_multiControlledMultiRotateZ()
void statevec_multiControlledMultiRotateZ | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
long long int | targMask, | ||
qreal | angle | ||
) |
Definition at line 3358 of file QuEST_cpu.c.
References Qureg::chunkId, getBitMaskParity(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by multiControlledMultiRotateZ(), and statevec_multiControlledMultiRotatePauli().
◆ statevec_multiControlledPhaseFlip()
void statevec_multiControlledPhaseFlip | ( | Qureg | qureg, |
int * | controlQubits, | ||
int | numControlQubits | ||
) |
Definition at line 3718 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 3266 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.
the double swap (q1,q2 to 0,1) may be possible simultaneously by a bespoke swap routine.
Definition at line 1458 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 1011 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(), multiStateControlledUnitary(), and statevec_multiControlledMultiRotatePauli().
◆ statevec_multiQubitUnitary()
void statevec_multiQubitUnitary | ( | Qureg | qureg, |
int * | targets, | ||
int | numTargets, | ||
ComplexMatrixN | u | ||
) |
Definition at line 573 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 414 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 3316 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 1048 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 1142 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 1167 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 261 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by pauliZ(), and statevec_applyPauliProd().
◆ statevec_phaseShift()
Definition at line 254 of file QuEST_common.c.
References Complex::imag, Complex::real, and statevec_phaseShiftByTerm().
Referenced by phaseShift().
◆ statevec_phaseShiftByTerm()
Definition at line 3185 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 1439 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 314 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 321 of file QuEST_common.c.
References getComplexPairFromRotation(), Complex::imag, and statevec_compactUnitary().
Referenced by rotateAroundAxis().
◆ statevec_rotateX()
Definition at line 296 of file QuEST_common.c.
References statevec_rotateAroundAxis().
Referenced by rotateX().
◆ statevec_rotateY()
Definition at line 302 of file QuEST_common.c.
References statevec_rotateAroundAxis().
Referenced by rotateY().
◆ statevec_rotateZ()
Definition at line 308 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 1248 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 4005 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 268 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 282 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 387 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 400 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 1431 of file QuEST_cpu_distributed.c.
References exchangeStateVectors(), flipBit(), getGlobalIndOfOddParityInChunk(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, qreal, statevec_swapQubitAmpsDistributed(), and statevec_swapQubitAmpsLocal().
Referenced by agnostic_applyQFT(), statevec_multiControlledMultiQubitUnitary(), statevec_multiControlledTwoQubitUnitary(), and swapGate().
◆ statevec_tGate()
void statevec_tGate | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 275 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 289 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 561 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 895 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().