#include "QuEST.h"
#include "QuEST_internal.h"
#include "QuEST_precision.h"
#include "mt19937ar.h"
#include "QuEST_cpu_internal.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
Go to the source code of this file.
Functions | |
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 | alternateNormZeroingSomeAmpBlocks (Qureg qureg, qreal norm, int normFirst, long long int startAmpInd, long long int numAmps, long long int blockSize) |
void | copyStateFromGPU (Qureg qureg) |
In GPU mode, this copies the state-vector (or density matrix) from GPU memory (qureg.deviceStateVec) to RAM (qureg.stateVec), where it can be accessed/modified by the user. More... | |
void | copyStateToGPU (Qureg qureg) |
In GPU mode, this copies the state-vector (or density matrix) from RAM (qureg.stateVec) to VRAM / GPU-memory (qureg.deviceStateVec), which is the version operated upon by other calls to the API. More... | |
void | densmatr_applyDiagonalOpLocal (Qureg qureg, DiagonalOp op) |
Complex | densmatr_calcExpecDiagonalOpLocal (Qureg qureg, DiagonalOp op) |
qreal | densmatr_calcFidelityLocal (Qureg qureg, Qureg pureState) |
computes a few dens-columns-worth of (vec^*T) dens * vec More... | |
qreal | densmatr_calcHilbertSchmidtDistanceSquaredLocal (Qureg a, Qureg b) |
computes Tr((a-b) conjTrans(a-b)) = sum of abs values of (a-b) More... | |
qreal | densmatr_calcInnerProductLocal (Qureg a, Qureg b) |
computes Tr(conjTrans(a) b) = sum of (a_ij^* b_ij) More... | |
void | densmatr_calcProbOfAllOutcomesLocal (qreal *outcomeProbs, Qureg qureg, int *qubits, int numQubits) |
qreal | densmatr_calcPurityLocal (Qureg qureg) |
void | densmatr_collapseToKnownProbOutcome (Qureg qureg, int measureQubit, int outcome, qreal totalStateProb) |
Renorms (/prob) every | * outcome * >< * outcome * | state, setting all others to zero. More... | |
qreal | densmatr_findProbabilityOfZeroLocal (Qureg qureg, int measureQubit) |
void | densmatr_initClassicalState (Qureg qureg, long long int stateInd) |
void | densmatr_initPlusState (Qureg qureg) |
void | densmatr_initPureStateLocal (Qureg targetQureg, Qureg copyQureg) |
void | densmatr_mixDampingDistributed (Qureg qureg, int targetQubit, qreal damping) |
void | densmatr_mixDampingLocal (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_mixDepolarisingDistributed (Qureg qureg, int targetQubit, qreal depolLevel) |
void | densmatr_mixDepolarisingLocal (Qureg qureg, int targetQubit, qreal depolLevel) |
void | densmatr_mixTwoQubitDephasing (Qureg qureg, int qubit1, int qubit2, qreal dephase) |
void | densmatr_mixTwoQubitDepolarisingDistributed (Qureg qureg, int targetQubit, int qubit2, qreal delta, qreal gamma) |
void | densmatr_mixTwoQubitDepolarisingLocal (Qureg qureg, int qubit1, int qubit2, qreal delta, qreal gamma) |
void | densmatr_mixTwoQubitDepolarisingLocalPart1 (Qureg qureg, int qubit1, int qubit2, qreal delta) |
void | densmatr_mixTwoQubitDepolarisingQ1LocalQ2DistributedPart3 (Qureg qureg, int targetQubit, int qubit2, qreal delta, qreal gamma) |
void | densmatr_oneQubitDegradeOffDiagonal (Qureg qureg, int targetQubit, qreal retain) |
int | getBitMaskParity (long long int mask) |
void | normaliseSomeAmps (Qureg qureg, qreal norm, long long int startInd, long long int numAmps) |
int | qsortComp (const void *a, const void *b) |
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 phaseFuncName, qreal *params, int numParams, long long int *overrideInds, qreal *overridePhases, int numOverrides, int conj) |
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_calcExpecDiagonalOpLocal (Qureg qureg, DiagonalOp op) |
Complex | statevec_calcInnerProductLocal (Qureg bra, Qureg ket) |
void | statevec_calcProbOfAllOutcomesLocal (qreal *outcomeProbs, Qureg qureg, int *qubits, int numQubits) |
void | statevec_cloneQureg (Qureg targetQureg, Qureg copyQureg) |
void | statevec_collapseToKnownProbOutcomeDistributedRenorm (Qureg qureg, int measureQubit, qreal totalProbability) |
Renormalise parts of the state vector where measureQubit=0 or 1, based on the total probability of that qubit being in state 0 or 1. More... | |
void | statevec_collapseToKnownProbOutcomeLocal (Qureg qureg, int measureQubit, int outcome, qreal totalProbability) |
Update the state vector to be consistent with measuring measureQubit=0 if outcome=0 and measureQubit=1 if outcome=1. More... | |
void | statevec_collapseToOutcomeDistributedSetZero (Qureg qureg) |
void | statevec_compactUnitaryDistributed (Qureg qureg, Complex rot1, Complex rot2, ComplexArray stateVecUp, ComplexArray stateVecLo, ComplexArray stateVecOut) |
Rotate a single qubit in the state vector of probability amplitudes, given two complex numbers alpha and beta, and a subset of the state vector with upper and lower block values stored seperately. More... | |
void | statevec_compactUnitaryLocal (Qureg qureg, int targetQubit, Complex alpha, Complex beta) |
int | statevec_compareStates (Qureg mq1, Qureg mq2, qreal precision) |
void | statevec_controlledCompactUnitaryDistributed (Qureg qureg, int controlQubit, Complex rot1, Complex rot2, ComplexArray stateVecUp, ComplexArray stateVecLo, ComplexArray stateVecOut) |
Rotate a single qubit in the state vector of probability amplitudes, given two complex numbers alpha and beta and a subset of the state vector with upper and lower block values stored seperately. More... | |
void | statevec_controlledCompactUnitaryLocal (Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta) |
void | statevec_controlledNotDistributed (Qureg qureg, int controlQubit, ComplexArray stateVecIn, ComplexArray stateVecOut) |
Rotate a single qubit by {{0,1},{1,0}. More... | |
void | statevec_controlledNotLocal (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliYDistributed (Qureg qureg, int controlQubit, ComplexArray stateVecIn, ComplexArray stateVecOut, int conjFac) |
void | statevec_controlledPauliYLocal (Qureg qureg, int controlQubit, int targetQubit, int conjFac) |
void | statevec_controlledPhaseFlip (Qureg qureg, int idQubit1, int idQubit2) |
void | statevec_controlledPhaseShift (Qureg qureg, int idQubit1, int idQubit2, qreal angle) |
void | statevec_controlledUnitaryDistributed (Qureg qureg, int controlQubit, Complex rot1, Complex rot2, ComplexArray stateVecUp, ComplexArray stateVecLo, ComplexArray stateVecOut) |
Rotate a single qubit in the state vector of probability amplitudes, given two complex numbers alpha and beta and a subset of the state vector with upper and lower block values stored seperately. More... | |
void | statevec_controlledUnitaryLocal (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_findProbabilityOfZeroDistributed (Qureg qureg) |
Measure the probability of a specified qubit being in the zero state across all amplitudes held in this chunk. More... | |
qreal | statevec_findProbabilityOfZeroLocal (Qureg qureg, int measureQubit) |
Measure the total probability of a specified qubit being in the zero state across all amplitudes in this chunk. More... | |
void | statevec_hadamardDistributed (Qureg qureg, ComplexArray stateVecUp, ComplexArray stateVecLo, ComplexArray stateVecOut, int updateUpper) |
Rotate a single qubit by {{1,1},{1,-1}}/sqrt2. More... | |
void | statevec_hadamardLocal (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) |
void | statevec_multiControlledMultiQubitNotDistributed (Qureg qureg, int ctrlMask, int targMask, ComplexArray stateVecIn, ComplexArray stateVecOut) |
void | statevec_multiControlledMultiQubitNotLocal (Qureg qureg, int ctrlMask, int targMask) |
void | statevec_multiControlledMultiQubitUnitaryLocal (Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u) |
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_multiControlledTwoQubitUnitaryLocal (Qureg qureg, long long int ctrlMask, int q1, int q2, ComplexMatrix4 u) |
void | statevec_multiControlledUnitaryDistributed (Qureg qureg, int targetQubit, long long int ctrlQubitsMask, long long int ctrlFlipMask, Complex rot1, Complex rot2, ComplexArray stateVecUp, ComplexArray stateVecLo, ComplexArray stateVecOut) |
Apply a unitary operation to a single qubit in the state vector of probability amplitudes, given a subset of the state vector with upper and lower block values stored seperately. More... | |
void | statevec_multiControlledUnitaryLocal (Qureg qureg, int targetQubit, long long int ctrlQubitsMask, long long int ctrlFlipMask, ComplexMatrix2 u) |
void | statevec_multiRotateZ (Qureg qureg, long long int mask, qreal angle) |
void | statevec_pauliXDistributed (Qureg qureg, ComplexArray stateVecIn, ComplexArray stateVecOut) |
Rotate a single qubit by {{0,1},{1,0}. More... | |
void | statevec_pauliXLocal (Qureg qureg, int targetQubit) |
void | statevec_pauliYDistributed (Qureg qureg, ComplexArray stateVecIn, ComplexArray stateVecOut, int updateUpper, int conjFac) |
Rotate a single qubit by +-{{0,-i},{i,0}. More... | |
void | statevec_pauliYLocal (Qureg qureg, int targetQubit, int conjFac) |
void | statevec_phaseShiftByTerm (Qureg qureg, int targetQubit, Complex term) |
void | statevec_reportStateToScreen (Qureg qureg, QuESTEnv env, int reportRank) |
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_swapQubitAmpsDistributed (Qureg qureg, int pairRank, int qb1, int qb2) |
qureg.pairStateVec contains the entire set of amplitudes of the paired node which includes the set of all amplitudes which need to be swapped between |..0..1..> and |..1..0..> More... | |
void | statevec_swapQubitAmpsLocal (Qureg qureg, int qb1, int qb2) |
It is ensured that all amplitudes needing to be swapped are on this node. More... | |
void | statevec_unitaryDistributed (Qureg qureg, Complex rot1, Complex rot2, ComplexArray stateVecUp, ComplexArray stateVecLo, ComplexArray stateVecOut) |
Apply a unitary operation to a single qubit given a subset of the state vector with upper and lower block values stored seperately. More... | |
void | statevec_unitaryLocal (Qureg qureg, int targetQubit, ComplexMatrix2 u) |
void | zeroSomeAmps (Qureg qureg, long long int startInd, long long int numAmps) |
Detailed Description
The core of the CPU backend functionality. The CPU/MPI implementations of the pure state functions in ../QuEST_ops_pure.h are in QuEST_cpu_local.c and QuEST_cpu_distributed.c which mostly wrap the core functions defined here. Some additional hardware-agnostic functions are defined here
Definition in file QuEST_cpu.c.
Function Documentation
◆ agnostic_createDiagonalOp()
DiagonalOp agnostic_createDiagonalOp | ( | int | numQubits, |
QuESTEnv | env | ||
) |
Definition at line 1346 of file QuEST_cpu.c.
References DiagonalOp::chunkId, DiagonalOp::imag, DiagonalOp::numChunks, DiagonalOp::numElemsPerChunk, DiagonalOp::numQubits, QuESTEnv::numRanks, qreal, QuESTEnv::rank, and DiagonalOp::real.
◆ agnostic_destroyDiagonalOp()
void agnostic_destroyDiagonalOp | ( | DiagonalOp | op | ) |
Definition at line 1368 of file QuEST_cpu.c.
References DiagonalOp::imag, and DiagonalOp::real.
◆ 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, PauliHamil::numSumTerms, PAULI_Z, PauliHamil::pauliCodes, qreal, DiagonalOp::real, and PauliHamil::termCoeffs.
◆ 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::imag, DiagonalOp::numElemsPerChunk, qreal, and DiagonalOp::real.
◆ agnostic_syncDiagonalOp()
void agnostic_syncDiagonalOp | ( | DiagonalOp | op | ) |
Definition at line 1373 of file QuEST_cpu.c.
◆ alternateNormZeroingSomeAmpBlocks()
void alternateNormZeroingSomeAmpBlocks | ( | Qureg | qureg, |
qreal | norm, | ||
int | normFirst, | ||
long long int | startAmpInd, | ||
long long int | numAmps, | ||
long long int | blockSize | ||
) |
Definition at line 760 of file QuEST_cpu.c.
References normaliseSomeAmps(), and zeroSomeAmps().
Referenced by densmatr_collapseToKnownProbOutcome().
◆ densmatr_applyDiagonalOpLocal()
void densmatr_applyDiagonalOpLocal | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 4082 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, DiagonalOp::numQubits, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by densmatr_applyDiagonalOp().
◆ densmatr_calcExpecDiagonalOpLocal()
Complex densmatr_calcExpecDiagonalOpLocal | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 4167 of file QuEST_cpu.c.
References Qureg::chunkId, Complex::imag, DiagonalOp::imag, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, Complex::real, DiagonalOp::real, and Qureg::stateVec.
Referenced by densmatr_calcExpecDiagonalOp().
◆ densmatr_calcFidelityLocal()
computes a few dens-columns-worth of (vec^*T) dens * vec
Definition at line 1001 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numAmpsTotal, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by densmatr_calcFidelity().
◆ densmatr_calcHilbertSchmidtDistanceSquaredLocal()
computes Tr((a-b) conjTrans(a-b)) = sum of abs values of (a-b)
Definition at line 934 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by densmatr_calcHilbertSchmidtDistance().
◆ densmatr_calcInnerProductLocal()
computes Tr(conjTrans(a) b) = sum of (a_ij^* b_ij)
Definition at line 969 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by densmatr_calcInnerProduct().
◆ densmatr_calcProbOfAllOutcomesLocal()
void densmatr_calcProbOfAllOutcomesLocal | ( | qreal * | outcomeProbs, |
Qureg | qureg, | ||
int * | qubits, | ||
int | numQubits | ||
) |
Definition at line 3616 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_calcProbOfAllOutcomes().
◆ densmatr_calcPurityLocal()
Definition at line 872 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by densmatr_calcPurity().
◆ densmatr_collapseToKnownProbOutcome()
void densmatr_collapseToKnownProbOutcome | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | totalStateProb | ||
) |
Renorms (/prob) every | * outcome * >< * outcome * | state, setting all others to zero.
Definition at line 791 of file QuEST_cpu.c.
References alternateNormZeroingSomeAmpBlocks(), Qureg::chunkId, extractBit(), normaliseSomeAmps(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and zeroSomeAmps().
◆ densmatr_findProbabilityOfZeroLocal()
Definition at line 3402 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_calcProbOfOutcome().
◆ densmatr_initClassicalState()
void densmatr_initClassicalState | ( | Qureg | qureg, |
long long int | stateInd | ||
) |
Definition at line 1126 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
◆ densmatr_initPlusState()
void densmatr_initPlusState | ( | Qureg | qureg | ) |
Definition at line 1165 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
◆ densmatr_initPureStateLocal()
Definition at line 1195 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numAmpsTotal, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by densmatr_initPureState().
◆ densmatr_mixDampingDistributed()
Definition at line 306 of file QuEST_cpu.c.
References Qureg::chunkId, densmatr_oneQubitDegradeOffDiagonal(), extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by densmatr_mixDamping().
◆ densmatr_mixDampingLocal()
Definition at line 180 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_mixDamping().
◆ densmatr_mixDensityMatrix()
Definition at line 901 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ densmatr_mixDephasing()
Definition at line 85 of file QuEST_cpu.c.
References densmatr_oneQubitDegradeOffDiagonal(), and qreal.
Referenced by densmatr_mixDepolarisingDistributed().
◆ densmatr_mixDepolarisingDistributed()
Definition at line 230 of file QuEST_cpu.c.
References Qureg::chunkId, densmatr_mixDephasing(), extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by densmatr_mixDepolarising().
◆ densmatr_mixDepolarisingLocal()
Definition at line 131 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_mixDepolarising().
◆ densmatr_mixTwoQubitDephasing()
Definition at line 90 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
◆ densmatr_mixTwoQubitDepolarisingDistributed()
void densmatr_mixTwoQubitDepolarisingDistributed | ( | Qureg | qureg, |
int | targetQubit, | ||
int | qubit2, | ||
qreal | delta, | ||
qreal | gamma | ||
) |
Definition at line 547 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by densmatr_mixTwoQubitDepolarising().
◆ densmatr_mixTwoQubitDepolarisingLocal()
void densmatr_mixTwoQubitDepolarisingLocal | ( | Qureg | qureg, |
int | qubit1, | ||
int | qubit2, | ||
qreal | delta, | ||
qreal | gamma | ||
) |
Definition at line 393 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_mixTwoQubitDepolarising().
◆ densmatr_mixTwoQubitDepolarisingLocalPart1()
void densmatr_mixTwoQubitDepolarisingLocalPart1 | ( | Qureg | qureg, |
int | qubit1, | ||
int | qubit2, | ||
qreal | delta | ||
) |
Definition at line 494 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
Referenced by densmatr_mixTwoQubitDepolarising().
◆ densmatr_mixTwoQubitDepolarisingQ1LocalQ2DistributedPart3()
void densmatr_mixTwoQubitDepolarisingQ1LocalQ2DistributedPart3 | ( | Qureg | qureg, |
int | targetQubit, | ||
int | qubit2, | ||
qreal | delta, | ||
qreal | gamma | ||
) |
Definition at line 638 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by densmatr_mixTwoQubitDepolarising().
◆ densmatr_oneQubitDegradeOffDiagonal()
Definition at line 54 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and Qureg::stateVec.
Referenced by densmatr_mixDampingDistributed(), and densmatr_mixDephasing().
◆ getBitMaskParity()
int getBitMaskParity | ( | long long int | mask | ) |
Definition at line 3307 of file QuEST_cpu.c.
Referenced by statevec_multiControlledMultiRotateZ(), and statevec_multiRotateZ().
◆ normaliseSomeAmps()
Definition at line 750 of file QuEST_cpu.c.
References Qureg::stateVec.
Referenced by alternateNormZeroingSomeAmpBlocks(), and densmatr_collapseToKnownProbOutcome().
◆ qsortComp()
int qsortComp | ( | const void * | a, |
const void * | b | ||
) |
Definition at line 1908 of file QuEST_cpu.c.
Referenced by statevec_multiControlledMultiQubitUnitaryLocal().
◆ 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.
◆ 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.
◆ statevec_applyParamNamedPhaseFuncOverrides()
void statevec_applyParamNamedPhaseFuncOverrides | ( | Qureg | qureg, |
int * | qubits, | ||
int * | numQubitsPerReg, | ||
int | numRegs, | ||
enum bitEncoding | encoding, | ||
enum phaseFunc | phaseFuncName, | ||
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.
◆ 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.
◆ statevec_calcExpecDiagonalOpLocal()
Complex statevec_calcExpecDiagonalOpLocal | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 4124 of file QuEST_cpu.c.
References Complex::imag, DiagonalOp::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, DiagonalOp::real, and Qureg::stateVec.
Referenced by statevec_calcExpecDiagonalOp().
◆ statevec_calcInnerProductLocal()
Definition at line 1082 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, and Qureg::stateVec.
Referenced by statevec_calcInnerProduct().
◆ statevec_calcProbOfAllOutcomesLocal()
void statevec_calcProbOfAllOutcomesLocal | ( | qreal * | outcomeProbs, |
Qureg | qureg, | ||
int * | qubits, | ||
int | numQubits | ||
) |
Definition at line 3549 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_calcProbOfAllOutcomes().
◆ statevec_cloneQureg()
Definition at line 1572 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_collapseToKnownProbOutcomeDistributedRenorm()
void statevec_collapseToKnownProbOutcomeDistributedRenorm | ( | Qureg | qureg, |
int | measureQubit, | ||
qreal | totalProbability | ||
) |
Renormalise parts of the state vector where measureQubit=0 or 1, based on the total probability of that qubit being in state 0 or 1.
Measure in Zero performs an irreversible change to the state vector: it updates the vector according to the event that the value 'outcome' has been measured on the qubit indicated by measureQubit (where this label starts from 0, of course). It achieves this by setting all inconsistent amplitudes to 0 and then renormalising based on the total probability of measuring measureQubit=0 if outcome=0 and measureQubit=1 if outcome=1. In the distributed version, one block (with measureQubit=0 in the first half of the block and measureQubit=1 in the second half of the block) is spread over multiple chunks, meaning that each chunks performs only renormalisation or only setting amplitudes to 0. This function handles the renormalisation.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] measureQubit qubit to measure [in] totalProbability probability of qubit measureQubit being zero
Definition at line 3849 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_collapseToKnownProbOutcome().
◆ statevec_collapseToKnownProbOutcomeLocal()
void statevec_collapseToKnownProbOutcomeLocal | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | totalProbability | ||
) |
Update the state vector to be consistent with measuring measureQubit=0 if outcome=0 and measureQubit=1 if outcome=1.
Performs an irreversible change to the state vector: it updates the vector according to the event that an outcome have been measured on the qubit indicated by measureQubit (where this label starts from 0, of course). It achieves this by setting all inconsistent amplitudes to 0 and then renormalising based on the total probability of measuring measureQubit=0 or 1 according to the value of outcome. In the local version, one or more blocks (with measureQubit=0 in the first half of the block and measureQubit=1 in the second half of the block) fit entirely into one chunk.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] measureQubit qubit to measure [in] totalProbability probability of qubit measureQubit being either zero or one [in] outcome to measure the probability of and set the state to – either zero or one
Definition at line 3767 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_collapseToKnownProbOutcome().
◆ statevec_collapseToOutcomeDistributedSetZero()
void statevec_collapseToOutcomeDistributedSetZero | ( | Qureg | qureg | ) |
Definition at line 3887 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_collapseToKnownProbOutcome().
◆ statevec_compactUnitaryDistributed()
void statevec_compactUnitaryDistributed | ( | Qureg | qureg, |
Complex | rot1, | ||
Complex | rot2, | ||
ComplexArray | stateVecUp, | ||
ComplexArray | stateVecLo, | ||
ComplexArray | stateVecOut | ||
) |
Rotate a single qubit in the state vector of probability amplitudes, given two complex numbers alpha and beta, and a subset of the state vector with upper and lower block values stored seperately.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] rot1 rotation angle [in] rot2 rotation angle [in] stateVecUp probability amplitudes in upper half of a block [in] stateVecLo probability amplitudes in lower half of a block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2095 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_compactUnitary().
◆ statevec_compactUnitaryLocal()
Definition at line 1754 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, and Qureg::stateVec.
Referenced by statevec_compactUnitary().
◆ statevec_compareStates()
Definition at line 1741 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_controlledCompactUnitaryDistributed()
void statevec_controlledCompactUnitaryDistributed | ( | Qureg | qureg, |
int | controlQubit, | ||
Complex | rot1, | ||
Complex | rot2, | ||
ComplexArray | stateVecUp, | ||
ComplexArray | stateVecLo, | ||
ComplexArray | stateVecOut | ||
) |
Rotate a single qubit in the state vector of probability amplitudes, given two complex numbers alpha and beta and a subset of the state vector with upper and lower block values stored seperately.
Only perform the rotation where the control qubit is one.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] controlQubit qubit to determine whether or not to perform a rotation [in] rot1 rotation angle [in] rot2 rotation angle [in] stateVecUp probability amplitudes in upper half of a block [in] stateVecLo probability amplitudes in lower half of a block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2414 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_controlledCompactUnitary().
◆ statevec_controlledCompactUnitaryLocal()
void statevec_controlledCompactUnitaryLocal | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
Complex | alpha, | ||
Complex | beta | ||
) |
Definition at line 2196 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, and Qureg::stateVec.
Referenced by statevec_controlledCompactUnitary().
◆ statevec_controlledNotDistributed()
void statevec_controlledNotDistributed | ( | Qureg | qureg, |
int | controlQubit, | ||
ComplexArray | stateVecIn, | ||
ComplexArray | stateVecOut | ||
) |
Rotate a single qubit by {{0,1},{1,0}.
Operate on a subset of the state vector with upper and lower block values stored seperately. This rotation is just swapping upper and lower values, and stateVecIn must already be the correct section for this chunk. Only perform the rotation for elements where controlQubit is one.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] controlQubit the control qubit [in] stateVecIn probability amplitudes in lower or upper half of a block depending on chunkId [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2742 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_controlledNot().
◆ statevec_controlledNotLocal()
void statevec_controlledNotLocal | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 2679 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_controlledNot().
◆ statevec_controlledPauliYDistributed()
void statevec_controlledPauliYDistributed | ( | Qureg | qureg, |
int | controlQubit, | ||
ComplexArray | stateVecIn, | ||
ComplexArray | stateVecOut, | ||
int | conjFac | ||
) |
Definition at line 3036 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_controlledPauliY(), and statevec_controlledPauliYConj().
◆ statevec_controlledPauliYLocal()
void statevec_controlledPauliYLocal | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
int | conjFac | ||
) |
Definition at line 2982 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_controlledPauliY(), and statevec_controlledPauliYConj().
◆ 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.
◆ statevec_controlledPhaseShift()
Definition at line 3226 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_controlledUnitaryDistributed()
void statevec_controlledUnitaryDistributed | ( | Qureg | qureg, |
int | controlQubit, | ||
Complex | rot1, | ||
Complex | rot2, | ||
ComplexArray | stateVecUp, | ||
ComplexArray | stateVecLo, | ||
ComplexArray | stateVecOut | ||
) |
Rotate a single qubit in the state vector of probability amplitudes, given two complex numbers alpha and beta and a subset of the state vector with upper and lower block values stored seperately.
Only perform the rotation where the control qubit is one.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] controlQubit qubit to determine whether or not to perform a rotation [in] rot1 rotation angle [in] rot2 rotation angle [in] stateVecUp probability amplitudes in upper half of a block [in] stateVecLo probability amplitudes in lower half of a block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2476 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_controlledUnitary().
◆ statevec_controlledUnitaryLocal()
void statevec_controlledUnitaryLocal | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 2336 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), ComplexMatrix2::imag, Qureg::numAmpsPerChunk, qreal, ComplexMatrix2::real, and Qureg::stateVec.
Referenced by statevec_controlledUnitary().
◆ statevec_createQureg()
Definition at line 1290 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::isDensityMatrix, Qureg::numAmpsPerChunk, Qureg::numAmpsTotal, Qureg::numChunks, Qureg::numQubitsInStateVec, QuESTEnv::numRanks, Qureg::pairStateVec, QuESTEnv::rank, and Qureg::stateVec.
◆ statevec_destroyQureg()
Definition at line 1328 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, Qureg::numAmpsTotal, Qureg::numQubitsInStateVec, QuESTEnv::numRanks, Qureg::pairStateVec, and Qureg::stateVec.
◆ statevec_findProbabilityOfZeroDistributed()
Measure the probability of a specified qubit being in the zero state across all amplitudes held in this chunk.
Size of regions to skip is a multiple of chunkSize. The results are communicated and aggregated by the caller
- Parameters
-
[in] qureg object representing the set of qubits
- Returns
- probability of qubit measureQubit being zero
Definition at line 3513 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_calcProbOfOutcome().
◆ statevec_findProbabilityOfZeroLocal()
Measure the total probability of a specified qubit being in the zero state across all amplitudes in this chunk.
Size of regions to skip is less than the size of one chunk.
- Parameters
-
[in] qureg object representing the set of qubits [in] measureQubit qubit to measure
- Returns
- probability of qubit measureQubit being zero
Definition at line 3457 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_calcProbOfOutcome().
◆ statevec_hadamardDistributed()
void statevec_hadamardDistributed | ( | Qureg | qureg, |
ComplexArray | stateVecUp, | ||
ComplexArray | stateVecLo, | ||
ComplexArray | stateVecOut, | ||
int | updateUpper | ||
) |
Rotate a single qubit by {{1,1},{1,-1}}/sqrt2.
Operate on a subset of the state vector with upper and lower block values stored seperately. This rotation is just swapping upper and lower values, and stateVecIn must already be the correct section for this chunk
- Parameters
-
[in,out] qureg object representing the set of qubits [in] stateVecUp probability amplitudes in upper half of a block depending on chunkId [in] stateVecLo probability amplitudes in lower half of a block depending on chunkId [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block) [in] updateUpper flag, 1: updating upper values, 0: updating lower values in block
Definition at line 3139 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_hadamard().
◆ statevec_hadamardLocal()
void statevec_hadamardLocal | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 3078 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_hadamard().
◆ statevec_initBlankState()
void statevec_initBlankState | ( | Qureg | qureg | ) |
Definition at line 1464 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by 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::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ 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::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_initPlusState()
void statevec_initPlusState | ( | Qureg | qureg | ) |
Definition at line 1504 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
◆ statevec_initStateFromSingleFile()
Definition at line 1691 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, Qureg::stateVec, and syncQuESTEnv().
◆ 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, extractBit(), Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
◆ statevec_initZeroState()
void statevec_initZeroState | ( | Qureg | qureg | ) |
Definition at line 1494 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::stateVec, and statevec_initBlankState().
◆ statevec_multiControlledMultiQubitNotDistributed()
void statevec_multiControlledMultiQubitNotDistributed | ( | Qureg | qureg, |
int | ctrlMask, | ||
int | targMask, | ||
ComplexArray | stateVecIn, | ||
ComplexArray | stateVecOut | ||
) |
Definition at line 2834 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_multiControlledMultiQubitNot().
◆ statevec_multiControlledMultiQubitNotLocal()
void statevec_multiControlledMultiQubitNotLocal | ( | Qureg | qureg, |
int | ctrlMask, | ||
int | targMask | ||
) |
Definition at line 2778 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_multiControlledMultiQubitNot().
◆ statevec_multiControlledMultiQubitUnitaryLocal()
void statevec_multiControlledMultiQubitUnitaryLocal | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int * | targs, | ||
int | numTargs, | ||
ComplexMatrixN | u | ||
) |
Definition at line 1912 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), flipBit(), ComplexMatrixN::imag, insertZeroBit(), Qureg::numAmpsPerChunk, ComplexMatrixN::numQubits, qreal, qsortComp(), ComplexMatrixN::real, and Qureg::stateVec.
Referenced by statevec_multiControlledMultiQubitUnitary().
◆ 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.
◆ 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.
◆ 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.
◆ statevec_multiControlledTwoQubitUnitaryLocal()
void statevec_multiControlledTwoQubitUnitaryLocal | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int | q1, | ||
int | q2, | ||
ComplexMatrix4 | u | ||
) |
Definition at line 1813 of file QuEST_cpu.c.
References Qureg::chunkId, flipBit(), ComplexMatrix4::imag, insertTwoZeroBits(), Qureg::numAmpsPerChunk, qreal, ComplexMatrix4::real, and Qureg::stateVec.
Referenced by statevec_multiControlledTwoQubitUnitary().
◆ statevec_multiControlledUnitaryDistributed()
void statevec_multiControlledUnitaryDistributed | ( | Qureg | qureg, |
int | targetQubit, | ||
long long int | ctrlQubitsMask, | ||
long long int | ctrlFlipMask, | ||
Complex | rot1, | ||
Complex | rot2, | ||
ComplexArray | stateVecUp, | ||
ComplexArray | stateVecLo, | ||
ComplexArray | stateVecOut | ||
) |
Apply a unitary operation to a single qubit in the state vector of probability amplitudes, given a subset of the state vector with upper and lower block values stored seperately.
Only perform the rotation where all the control qubits are 1.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] targetQubit qubit to rotate [in] ctrlQubitsMask a bit mask indicating whether each qubit is a control (1) or not (0) [in] ctrlFlipMask a bit mask indicating whether each qubit (only controls are relevant) should be flipped when checking the control condition [in] rot1 rotation angle [in] rot2 rotation angle [in] stateVecUp probability amplitudes in upper half of a block [in] stateVecLo probability amplitudes in lower half of a block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2542 of file QuEST_cpu.c.
References Qureg::chunkId, Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_multiControlledUnitary().
◆ statevec_multiControlledUnitaryLocal()
void statevec_multiControlledUnitaryLocal | ( | Qureg | qureg, |
int | targetQubit, | ||
long long int | ctrlQubitsMask, | ||
long long int | ctrlFlipMask, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 2268 of file QuEST_cpu.c.
References Qureg::chunkId, ComplexMatrix2::imag, Qureg::numAmpsPerChunk, qreal, ComplexMatrix2::real, and Qureg::stateVec.
Referenced by statevec_multiControlledUnitary().
◆ statevec_multiRotateZ()
Definition at line 3316 of file QuEST_cpu.c.
References Qureg::chunkId, getBitMaskParity(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_pauliXDistributed()
void statevec_pauliXDistributed | ( | Qureg | qureg, |
ComplexArray | stateVecIn, | ||
ComplexArray | stateVecOut | ||
) |
Rotate a single qubit by {{0,1},{1,0}.
Operate on a subset of the state vector with upper and lower block values stored seperately. This rotation is just swapping upper and lower values, and stateVecIn must already be the correct section for this chunk
- Remarks
- Qubits are zero-based and the
the first qubit is the rightmost
- Parameters
-
[in,out] qureg object representing the set of qubits [in] stateVecIn probability amplitudes in lower or upper half of a block depending on chunkId [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2651 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_pauliX().
◆ statevec_pauliXLocal()
void statevec_pauliXLocal | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 2593 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_pauliX().
◆ statevec_pauliYDistributed()
void statevec_pauliYDistributed | ( | Qureg | qureg, |
ComplexArray | stateVecIn, | ||
ComplexArray | stateVecOut, | ||
int | updateUpper, | ||
int | conjFac | ||
) |
Rotate a single qubit by +-{{0,-i},{i,0}.
Operate on a subset of the state vector with upper and lower block values stored seperately. This rotation is just swapping upper and lower values, and stateVecIn must already be the correct section for this chunk
- Remarks
- Qubits are zero-based and the
the first qubit is the rightmost
- Parameters
-
[in,out] qureg object representing the set of qubits [in] stateVecIn probability amplitudes in lower or upper half of a block depending on chunkId [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block) [in] updateUpper flag, 1: updating upper values, 0: updating lower values in block [in] conjFac 1: apply conj(pauliY), 0: apply pauliY
Definition at line 2945 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_pauliY(), and statevec_pauliYConj().
◆ statevec_pauliYLocal()
void statevec_pauliYLocal | ( | Qureg | qureg, |
int | targetQubit, | ||
int | conjFac | ||
) |
Definition at line 2887 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_pauliY(), and statevec_pauliYConj().
◆ 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.
◆ statevec_reportStateToScreen()
Definition at line 1439 of file QuEST_cpu.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numChunks, Qureg::numQubitsInStateVec, Qureg::stateVec, and syncQuESTEnv().
◆ 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::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ 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.
◆ statevec_swapQubitAmpsDistributed()
void statevec_swapQubitAmpsDistributed | ( | Qureg | qureg, |
int | pairRank, | ||
int | qb1, | ||
int | qb2 | ||
) |
qureg.pairStateVec contains the entire set of amplitudes of the paired node which includes the set of all amplitudes which need to be swapped between |..0..1..> and |..1..0..>
Definition at line 3965 of file QuEST_cpu.c.
References Qureg::chunkId, flipBit(), isOddParity(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by statevec_swapQubitAmps().
◆ statevec_swapQubitAmpsLocal()
void statevec_swapQubitAmpsLocal | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
It is ensured that all amplitudes needing to be swapped are on this node.
This means that amplitudes for |a 0..0..> to |a 1..1..> all exist on this node and each node has a different bit-string prefix "a". The prefix 'a' (and ergo, the chunkID) don't enter the calculations for the offset of |a 0..1..> and |a 1..0..> from |a 0..0..> and ergo are not featured below.
Definition at line 3922 of file QuEST_cpu.c.
References flipBit(), insertTwoZeroBits(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_swapQubitAmps().
◆ statevec_unitaryDistributed()
void statevec_unitaryDistributed | ( | Qureg | qureg, |
Complex | rot1, | ||
Complex | rot2, | ||
ComplexArray | stateVecUp, | ||
ComplexArray | stateVecLo, | ||
ComplexArray | stateVecOut | ||
) |
Apply a unitary operation to a single qubit given a subset of the state vector with upper and lower block values stored seperately.
- Remarks
- Qubits are zero-based and the first qubit is the rightmost
- Parameters
-
[in,out] qureg object representing the set of qubits [in] rot1 [in] rot2 [in] stateVecUp probability amplitudes in upper half of a block [in] stateVecLo probability amplitudes in lower half of a block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2151 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_unitary().
◆ statevec_unitaryLocal()
void statevec_unitaryLocal | ( | Qureg | qureg, |
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 2026 of file QuEST_cpu.c.
References ComplexMatrix2::imag, Qureg::numAmpsPerChunk, qreal, ComplexMatrix2::real, and Qureg::stateVec.
Referenced by statevec_unitary().
◆ zeroSomeAmps()
void zeroSomeAmps | ( | Qureg | qureg, |
long long int | startInd, | ||
long long int | numAmps | ||
) |
Definition at line 740 of file QuEST_cpu.c.
References Qureg::stateVec.
Referenced by alternateNormZeroingSomeAmpBlocks(), and densmatr_collapseToKnownProbOutcome().