#include "QuEST.h"#include "QuEST_internal.h"#include "QuEST_precision.h"#include "mt19937ar.h"#include "QuEST_cpu_internal.h"#include <stdlib.h>#include <stdio.h>#include <math.h>#include <time.h>#include <sys/types.h>Go to the source code of this file.
Functions | |
| QuESTEnv | createQuESTEnv (void) |
| Create the QuEST execution environment. More... | |
| qreal | densmatr_calcFidelity (Qureg qureg, Qureg pureState) |
| qreal | densmatr_calcHilbertSchmidtDistance (Qureg a, Qureg b) |
| qreal | densmatr_calcInnerProduct (Qureg a, Qureg b) |
| qreal | densmatr_calcProbOfOutcome (Qureg qureg, const int measureQubit, int outcome) |
| qreal | densmatr_calcPurity (Qureg qureg) |
| qreal | densmatr_calcTotalProb (Qureg qureg) |
| void | densmatr_initPureState (Qureg qureg, Qureg pureState) |
| void | densmatr_mixDamping (Qureg qureg, const int targetQubit, qreal damping) |
| void | densmatr_mixDepolarising (Qureg qureg, const int targetQubit, qreal depolLevel) |
| void | densmatr_mixTwoQubitDepolarising (Qureg qureg, int qubit1, int qubit2, qreal depolLevel) |
| void | destroyQuESTEnv (QuESTEnv env) |
| Destroy the QuEST environment. More... | |
| void | reportQuESTEnv (QuESTEnv env) |
| Report information about the QuEST environment. More... | |
| void | seedQuESTDefault (void) |
| Seed the Mersenne Twister used for random number generation in the QuEST environment with an example defualt seed. More... | |
| Complex | statevec_calcInnerProduct (Qureg bra, Qureg ket) |
| qreal | statevec_calcProbOfOutcome (Qureg qureg, const int measureQubit, int outcome) |
| qreal | statevec_calcTotalProb (Qureg qureg) |
| void | statevec_collapseToKnownProbOutcome (Qureg qureg, const int measureQubit, int outcome, qreal stateProb) |
| void | statevec_compactUnitary (Qureg qureg, const int targetQubit, Complex alpha, Complex beta) |
| void | statevec_controlledCompactUnitary (Qureg qureg, const int controlQubit, const int targetQubit, Complex alpha, Complex beta) |
| void | statevec_controlledNot (Qureg qureg, const int controlQubit, const int targetQubit) |
| void | statevec_controlledPauliY (Qureg qureg, const int controlQubit, const int targetQubit) |
| void | statevec_controlledPauliYConj (Qureg qureg, const int controlQubit, const int targetQubit) |
| void | statevec_controlledUnitary (Qureg qureg, const int controlQubit, const int targetQubit, ComplexMatrix2 u) |
| qreal | statevec_getImagAmp (Qureg qureg, long long int index) |
| qreal | statevec_getRealAmp (Qureg qureg, long long int index) |
| void | statevec_hadamard (Qureg qureg, const int targetQubit) |
| void | statevec_multiControlledMultiQubitUnitary (Qureg qureg, long long int ctrlMask, int *targs, const int numTargs, ComplexMatrixN u) |
| This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. More... | |
| void | statevec_multiControlledTwoQubitUnitary (Qureg qureg, long long int ctrlMask, const int q1, const int q2, ComplexMatrix4 u) |
| This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. More... | |
| void | statevec_multiControlledUnitary (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, const int targetQubit, ComplexMatrix2 u) |
| void | statevec_pauliX (Qureg qureg, const int targetQubit) |
| void | statevec_pauliY (Qureg qureg, const int targetQubit) |
| void | statevec_pauliYConj (Qureg qureg, const int targetQubit) |
| void | statevec_swapQubitAmps (Qureg qureg, int qb1, int qb2) |
| void | statevec_unitary (Qureg qureg, const int targetQubit, ComplexMatrix2 u) |
| void | syncQuESTEnv (QuESTEnv env) |
| Guarantees that all code up to the given point has been executed on all nodes (if running in distributed mode) More... | |
| int | syncQuESTSuccess (int successCode) |
| Performs a logical AND on all successCodes held by all processes. More... | |
Detailed Description
An implementation of the pure backend in ../QuEST_ops_pure.h for a local (non-MPI, non-GPU) environment. Mostly pure-state wrappers for the local/distributed functions implemented in QuEST_cpu
Definition in file QuEST_cpu_local.c.
Function Documentation
◆ densmatr_calcFidelity()
Definition at line 74 of file QuEST_cpu_local.c.
References densmatr_calcFidelityLocal(), Qureg::pairStateVec, qreal, and Qureg::stateVec.
◆ densmatr_calcHilbertSchmidtDistance()
Definition at line 61 of file QuEST_cpu_local.c.
References densmatr_calcHilbertSchmidtDistanceSquaredLocal(), and qreal.
◆ densmatr_calcInnerProduct()
Definition at line 68 of file QuEST_cpu_local.c.
References densmatr_calcInnerProductLocal(), and qreal.
◆ densmatr_calcProbOfOutcome()
Definition at line 287 of file QuEST_cpu_local.c.
References densmatr_findProbabilityOfZeroLocal(), and qreal.
◆ densmatr_calcPurity()
Definition at line 57 of file QuEST_cpu_local.c.
References densmatr_calcPurityLocal().
◆ densmatr_calcTotalProb()
Definition at line 116 of file QuEST_cpu_local.c.
References Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
◆ densmatr_initPureState()
Definition at line 94 of file QuEST_cpu_local.c.
References densmatr_initPureStateLocal(), Qureg::pairStateVec, qreal, and Qureg::stateVec.
◆ densmatr_mixDamping()
◆ densmatr_mixDepolarising()
◆ densmatr_mixTwoQubitDepolarising()
Definition at line 44 of file QuEST_cpu_local.c.
References densmatr_mixTwoQubitDephasing(), densmatr_mixTwoQubitDepolarisingLocal(), and qreal.
◆ statevec_calcInnerProduct()
Definition at line 112 of file QuEST_cpu_local.c.
References statevec_calcInnerProductLocal().
◆ statevec_calcProbOfOutcome()
Definition at line 279 of file QuEST_cpu_local.c.
References qreal, and statevec_findProbabilityOfZeroLocal().
◆ statevec_calcTotalProb()
Definition at line 139 of file QuEST_cpu_local.c.
References Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_collapseToKnownProbOutcome()
| void statevec_collapseToKnownProbOutcome | ( | Qureg | qureg, |
| const int | measureQubit, | ||
| int | outcome, | ||
| qreal | stateProb | ||
| ) |
Definition at line 295 of file QuEST_cpu_local.c.
References statevec_collapseToKnownProbOutcomeLocal().
◆ statevec_compactUnitary()
Definition at line 215 of file QuEST_cpu_local.c.
References statevec_compactUnitaryLocal().
◆ statevec_controlledCompactUnitary()
| void statevec_controlledCompactUnitary | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| Complex | alpha, | ||
| Complex | beta | ||
| ) |
Definition at line 225 of file QuEST_cpu_local.c.
References statevec_controlledCompactUnitaryLocal().
◆ statevec_controlledNot()
| void statevec_controlledNot | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
Definition at line 274 of file QuEST_cpu_local.c.
References statevec_controlledNotLocal().
◆ statevec_controlledPauliY()
| void statevec_controlledPauliY | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
◆ statevec_controlledPauliYConj()
| void statevec_controlledPauliYConj | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit | ||
| ) |
◆ statevec_controlledUnitary()
| void statevec_controlledUnitary | ( | Qureg | qureg, |
| const int | controlQubit, | ||
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 230 of file QuEST_cpu_local.c.
References statevec_controlledUnitaryLocal().
◆ statevec_getImagAmp()
Definition at line 211 of file QuEST_cpu_local.c.
References Qureg::stateVec.
◆ statevec_getRealAmp()
Definition at line 207 of file QuEST_cpu_local.c.
References Qureg::stateVec.
◆ statevec_hadamard()
| void statevec_hadamard | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 269 of file QuEST_cpu_local.c.
References statevec_hadamardLocal().
◆ statevec_multiControlledMultiQubitUnitary()
| void statevec_multiControlledMultiQubitUnitary | ( | Qureg | qureg, |
| long long int | ctrlMask, | ||
| int * | targs, | ||
| const int | numTargs, | ||
| ComplexMatrixN | u | ||
| ) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct.
It is already gauranteed here that all target qubits can fit on each node (this is validated in the front-end)
@TODO: refactor so that the 'swap back' isn't performed; instead the qubit locations are updated.
Definition at line 315 of file QuEST_cpu_local.c.
References statevec_multiControlledMultiQubitUnitaryLocal().
◆ statevec_multiControlledTwoQubitUnitary()
| void statevec_multiControlledTwoQubitUnitary | ( | Qureg | qureg, |
| long long int | ctrlMask, | ||
| const int | q1, | ||
| const int | q2, | ||
| ComplexMatrix4 | u | ||
| ) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct.
Note the order of q1 and q2 in the call to twoQubitUnitaryLocal is important.
@TODO: refactor so that the 'swap back' isn't performed; instead the qubit locations are updated. @TODO: the double swap (q1,q2 to 0,1) may be possible simultaneously by a bespoke swap routine.
Definition at line 310 of file QuEST_cpu_local.c.
References statevec_multiControlledTwoQubitUnitaryLocal().
◆ statevec_multiControlledUnitary()
| void statevec_multiControlledUnitary | ( | Qureg | qureg, |
| long long int | ctrlQubitsMask, | ||
| long long int | ctrlFlipMask, | ||
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 235 of file QuEST_cpu_local.c.
References statevec_multiControlledUnitaryLocal().
◆ statevec_pauliX()
| void statevec_pauliX | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 240 of file QuEST_cpu_local.c.
References statevec_pauliXLocal().
◆ statevec_pauliY()
| void statevec_pauliY | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 245 of file QuEST_cpu_local.c.
References statevec_pauliYLocal().
◆ statevec_pauliYConj()
| void statevec_pauliYConj | ( | Qureg | qureg, |
| const int | targetQubit | ||
| ) |
Definition at line 251 of file QuEST_cpu_local.c.
References statevec_pauliYLocal().
◆ statevec_swapQubitAmps()
| void statevec_swapQubitAmps | ( | Qureg | qureg, |
| int | qb1, | ||
| int | qb2 | ||
| ) |
Definition at line 320 of file QuEST_cpu_local.c.
References statevec_swapQubitAmpsLocal().
◆ statevec_unitary()
| void statevec_unitary | ( | Qureg | qureg, |
| const int | targetQubit, | ||
| ComplexMatrix2 | u | ||
| ) |
Definition at line 220 of file QuEST_cpu_local.c.
References statevec_unitaryLocal().