#include "QuEST_precision.h"
Go to the source code of this file.
Functions | |
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 *retProbs, Qureg qureg, int *qubits, int numQubits) |
qreal | densmatr_calcPurityLocal (Qureg qureg) |
qreal | densmatr_findProbabilityOfZeroLocal (Qureg qureg, int measureQubit) |
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_mixDepolarisingDistributed (Qureg qureg, int targetQubit, qreal depolLevel) |
void | densmatr_mixDepolarisingLocal (Qureg qureg, int targetQubit, qreal depolLevel) |
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) |
static int | extractBit (const int locationOfBitFromRight, const long long int theEncodedNumber) |
static long long int | flipBit (const long long int number, const int bitInd) |
static long long int | insertTwoZeroBits (const long long int number, const int bit1, const int bit2) |
static long long int | insertZeroBit (const long long int number, const int index) |
static int | isOddParity (const long long int number, const int qb1, const int qb2) |
static int | maskContainsBit (const long long int mask, const int bitInd) |
Complex | statevec_calcExpecDiagonalOpLocal (Qureg qureg, DiagonalOp op) |
Complex | statevec_calcInnerProductLocal (Qureg bra, Qureg ket) |
void | statevec_calcProbOfAllOutcomesLocal (qreal *retProbs, Qureg qureg, int *qubits, int numQubits) |
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) |
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 conjFactor) |
void | statevec_controlledPauliYLocal (Qureg qureg, int controlQubit, int targetQubit, int conjFactor) |
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) |
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_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_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_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_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) |
Detailed Description
Internal functions used to implement the pure backend in ../QuEST_ops_pure.h. Do not call these functions directly. In general, qubits_cpu_local.c and qubits_cpu_mpi.c will implement the pure backend by choosing the correct function or combination of functions to use from those included here, which are defined in QuEST_cpu.c
Definition in file QuEST_cpu_internal.h.
Function Documentation
◆ 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 * | retProbs, |
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_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_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_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_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().
◆ extractBit()
|
inlinestatic |
◆ flipBit()
|
inlinestatic |
Definition at line 30 of file QuEST_cpu_internal.h.
◆ insertTwoZeroBits()
|
inlinestatic |
◆ insertZeroBit()
|
inlinestatic |
◆ isOddParity()
|
inlinestatic |
Definition at line 38 of file QuEST_cpu_internal.h.
References extractBit().
Referenced by statevec_swapQubitAmpsDistributed().
◆ maskContainsBit()
|
inlinestatic |
Definition at line 34 of file QuEST_cpu_internal.h.
Referenced by statevec_multiControlledMultiQubitUnitary(), and statevec_multiControlledTwoQubitUnitary().
◆ 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 * | retProbs, |
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_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_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 | conjFactor | ||
) |
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 | conjFactor | ||
) |
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_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_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_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_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_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_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().