#include "QuEST_precision.h"Go to the source code of this file.
Functions | |
| 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... | |
| qreal | densmatr_calcPurityLocal (Qureg qureg) |
| qreal | densmatr_findProbabilityOfZeroLocal (Qureg qureg, const int measureQubit) |
| void | densmatr_initPureStateLocal (Qureg targetQureg, Qureg copyQureg) |
| void | densmatr_mixDampingDistributed (Qureg qureg, const int targetQubit, qreal damping) |
| void | densmatr_mixDampingLocal (Qureg qureg, const int targetQubit, qreal damping) |
| void | densmatr_mixDepolarisingDistributed (Qureg qureg, const int targetQubit, qreal depolLevel) |
| void | densmatr_mixDepolarisingLocal (Qureg qureg, const int targetQubit, qreal depolLevel) |
| void | densmatr_mixTwoQubitDepolarisingDistributed (Qureg qureg, const int targetQubit, const 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, const int targetQubit, const int qubit2, qreal delta, qreal gamma) |
| static int | extractBit (const int locationOfBitFromRight, const long long int theEncodedNumber) |
| static long long int | flipBit (long long int number, int bitInd) |
| static long long int | insertTwoZeroBits (long long int number, int bit1, int bit2) |
| static long long int | insertZeroBit (long long int number, int index) |
| static int | isOddParity (long long int number, int qb1, int qb2) |
| static int | maskContainsBit (long long int mask, int bitInd) |
| Complex | statevec_calcInnerProductLocal (Qureg bra, Qureg ket) |
| void | statevec_collapseToKnownProbOutcomeDistributedRenorm (Qureg qureg, const int measureQubit, const 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) |
| Set all amplitudes in one chunk to 0. More... | |
| 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, const int targetQubit, Complex alpha, Complex beta) |
| void | statevec_controlledCompactUnitaryDistributed (Qureg qureg, const 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, const int controlQubit, const int targetQubit, Complex alpha, Complex beta) |
| void | statevec_controlledNotDistributed (Qureg qureg, const int controlQubit, ComplexArray stateVecIn, ComplexArray stateVecOut) |
| Rotate a single qubit by {{0,1},{1,0}. More... | |
| void | statevec_controlledNotLocal (Qureg qureg, const int controlQubit, const int targetQubit) |
| void | statevec_controlledPauliYDistributed (Qureg qureg, const int controlQubit, ComplexArray stateVecIn, ComplexArray stateVecOut, const int conjFactor) |
| void | statevec_controlledPauliYLocal (Qureg qureg, const int controlQubit, const int targetQubit, const int conjFactor) |
| void | statevec_controlledUnitaryDistributed (Qureg qureg, const 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, const int controlQubit, const 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, const 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, const int targetQubit) |
| void | statevec_multiControlledMultiQubitUnitaryLocal (Qureg qureg, long long int ctrlMask, int *targs, const int numTargs, ComplexMatrixN u) |
| void | statevec_multiControlledTwoQubitUnitaryLocal (Qureg qureg, long long int ctrlMask, const int q1, const int q2, ComplexMatrix4 u) |
| void | statevec_multiControlledUnitaryDistributed (Qureg qureg, const 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, const 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, const int targetQubit) |
| void | statevec_pauliYDistributed (Qureg qureg, ComplexArray stateVecIn, ComplexArray stateVecOut, int updateUpper, const int conjFac) |
| Rotate a single qubit by +-{{0,-i},{i,0}. More... | |
| void | statevec_pauliYLocal (Qureg qureg, const int targetQubit, const 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, const 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_calcFidelityLocal()
computes a few dens-columns-worth of (vec^*T) dens * vec
Definition at line 989 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 922 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 957 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by densmatr_calcInnerProduct().
◆ densmatr_calcPurityLocal()
Definition at line 860 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by densmatr_calcPurity().
◆ densmatr_findProbabilityOfZeroLocal()
Definition at line 3111 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 1183 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 299 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 174 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 224 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 125 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, |
| const int | targetQubit, | ||
| const int | qubit2, | ||
| qreal | delta, | ||
| qreal | gamma | ||
| ) |
Definition at line 540 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 385 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 487 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, |
| const int | targetQubit, | ||
| const int | qubit2, | ||
| qreal | delta, | ||
| qreal | gamma | ||
| ) |
Definition at line 631 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_calcInnerProductLocal()
Definition at line 1070 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, Complex::real, and Qureg::stateVec.
Referenced by statevec_calcInnerProduct().
◆ statevec_collapseToKnownProbOutcomeDistributedRenorm()
| void statevec_collapseToKnownProbOutcomeDistributedRenorm | ( | Qureg | qureg, |
| const int | measureQubit, | ||
| const 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 3422 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 3340 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_collapseToKnownProbOutcome().
◆ statevec_collapseToOutcomeDistributedSetZero()
| void statevec_collapseToOutcomeDistributedSetZero | ( | Qureg | qureg | ) |
Set all amplitudes in one chunk to 0.
Measure in Zero performs an irreversible change to the state vector: it updates the vector according to the event that a zero 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. 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 setting amplitudes to 0.
- Parameters
-
[in,out] qureg object representing the set of qubits [in] measureQubit qubit to measure
Definition at line 3461 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 1969 of file QuEST_cpu.c.
References Complex::imag, Qureg::numAmpsPerChunk, qreal, and Complex::real.
Referenced by statevec_compactUnitary().
◆ statevec_compactUnitaryLocal()
| void statevec_compactUnitaryLocal | ( | Qureg | qureg, |
| const int | targetQubit, | ||
| Complex | alpha, | ||
| Complex | beta | ||
| ) |
Definition at line 1656 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, |
| const 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 2285 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, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| Complex | alpha, | ||
| Complex | beta | ||
| ) |
Definition at line 2069 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, |
| const 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] 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 2612 of file QuEST_cpu.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_controlledNot().
◆ statevec_controlledNotLocal()
| void statevec_controlledNotLocal | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
Definition at line 2550 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, |
| const int | controlQubit, | ||
| ComplexArray | stateVecIn, | ||
| ComplexArray | stateVecOut, | ||
| const int | conjFactor | ||
| ) |
Definition at line 2793 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, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| const int | conjFactor | ||
| ) |
Definition at line 2740 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, |
| const 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 2347 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, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 2207 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 3222 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 3166 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] stateVecIn probability amplitudes in lower or upper half of a block depending on chunkId [in] updateUpper flag, 1: updating upper values, 0: updating lower values in block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2894 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_hadamard().
◆ statevec_hadamardLocal()
| void statevec_hadamardLocal | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 2834 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
Referenced by statevec_hadamard().
◆ statevec_multiControlledMultiQubitUnitaryLocal()
| void statevec_multiControlledMultiQubitUnitaryLocal | ( | Qureg | qureg, |
| long long int | ctrlMask, | ||
| int * | targs, | ||
| const int | numTargs, | ||
| ComplexMatrixN | u | ||
| ) |
Definition at line 1814 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, | ||
| const int | q1, | ||
| const int | q2, | ||
| ComplexMatrix4 | u | ||
| ) |
Definition at line 1715 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, |
| const 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 2413 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, |
| const int | targetQubit, | ||
| long long int | ctrlQubitsMask, | ||
| long long int | ctrlFlipMask, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 2140 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 2522 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_pauliX().
◆ statevec_pauliXLocal()
| void statevec_pauliXLocal | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 2464 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, | ||
| const 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 [in] updateUpper flag, 1: updating upper values, 0: updating lower values in block [out] stateVecOut array section to update (will correspond to either the lower or upper half of a block)
Definition at line 2704 of file QuEST_cpu.c.
References Qureg::numAmpsPerChunk, and qreal.
Referenced by statevec_pauliY(), and statevec_pauliYConj().
◆ statevec_pauliYLocal()
| void statevec_pauliYLocal | ( | Qureg | qureg, |
| const int | targetQubit, | ||
| const int | conjFac | ||
| ) |
Definition at line 2647 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 3539 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 3496 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] u unitary matrix to apply [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 2024 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, |
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 1900 of file QuEST_cpu.c.
References ComplexMatrix2::imag, Qureg::numAmpsPerChunk, qreal, ComplexMatrix2::real, and Qureg::stateVec.
Referenced by statevec_unitary().