#include "QuEST.h"
#include "QuEST_internal.h"
#include "QuEST_precision.h"
#include "QuEST_validation.h"
#include "mt19937ar.h"
#include "QuEST_cpu_internal.h"
#include <unistd.h>
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <sys/types.h>
Go to the source code of this file.
Macros | |
#define | _BSD_SOURCE |
Functions | |
static int | chunkIsUpper (int chunkId, long long int chunkSize, int targetQubit) |
Returns whether a given chunk in position chunkId is in the upper or lower half of a block. More... | |
static int | chunkIsUpperInOuterBlock (int chunkId, long long int chunkSize, int targetQubit, int numQubits) |
fix – do with masking instead More... | |
void | compressPairVectorForSingleQubitDepolarise (Qureg qureg, int targetQubit) |
void | compressPairVectorForTwoQubitDepolarise (Qureg qureg, int targetQubit, int qubit2) |
void | copyDiagOpIntoMatrixPairState (Qureg qureg, DiagonalOp op) |
void | copyVecIntoMatrixPairState (Qureg matr, Qureg vec) |
This copies/clones vec (a statevector) into every node's matr pairState. More... | |
QuESTEnv | createQuESTEnv (void) |
Create the QuEST execution environment. More... | |
static int | densityMatrixBlockFitsInChunk (long long int chunkSize, int numQubits, int targetQubit) |
void | densmatr_applyDiagonalOp (Qureg qureg, DiagonalOp op) |
Complex | densmatr_calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
qreal | densmatr_calcFidelity (Qureg qureg, Qureg pureState) |
qreal | densmatr_calcHilbertSchmidtDistance (Qureg a, Qureg b) |
qreal | densmatr_calcInnerProduct (Qureg a, Qureg b) |
qreal | densmatr_calcProbOfOutcome (Qureg qureg, int measureQubit, int outcome) |
qreal | densmatr_calcPurity (Qureg qureg) |
qreal | densmatr_calcTotalProb (Qureg qureg) |
void | densmatr_initPureState (Qureg targetQureg, Qureg copyQureg) |
void | densmatr_mixDamping (Qureg qureg, int targetQubit, qreal damping) |
void | densmatr_mixDepolarising (Qureg qureg, 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 | exchangePairStateVectorHalves (Qureg qureg, int pairRank) |
void | exchangeStateVectors (Qureg qureg, int pairRank) |
static int | getChunkIdFromIndex (Qureg qureg, long long int index) |
static int | getChunkOuterBlockPairId (int chunkIsUpper, int chunkId, long long int chunkSize, int targetQubit, int numQubits) |
static int | getChunkOuterBlockPairIdForPart3 (int chunkIsUpperSmallerQubit, int chunkIsUpperBiggerQubit, int chunkId, long long int chunkSize, int smallerQubit, int biggerQubit, int numQubits) |
static int | getChunkPairId (int chunkIsUpper, int chunkId, long long int chunkSize, int targetQubit) |
get position of corresponding chunk, holding values required to update values in my chunk (with chunkId) when rotating targetQubit. More... | |
long long int | getGlobalIndOfOddParityInChunk (Qureg qureg, int qb1, int qb2) |
returns -1 if this node contains no amplitudes where qb1 and qb2 have opposite parity, otherwise returns the global index of one of such contained amplitudes (not necessarily the first) More... | |
static void | getRotAngle (int chunkIsUpper, Complex *rot1, Complex *rot2, Complex alpha, Complex beta) |
Get rotation values for a given chunk. More... | |
static void | getRotAngleFromUnitaryMatrix (int chunkIsUpper, Complex *rot1, Complex *rot2, ComplexMatrix2 u) |
Get rotation values for a given chunk given a unitary matrix. More... | |
static int | halfMatrixBlockFitsInChunk (long long int chunkSize, int targetQubit) |
return whether the current qubit rotation will use blocks that fit within a single chunk. More... | |
static int | isChunkToSkipInFindPZero (int chunkId, long long int chunkSize, int measureQubit) |
Find chunks to skip when calculating probability of qubit being zero. More... | |
void | reportQuESTEnv (QuESTEnv env) |
Report information about the QuEST environment. More... | |
void | seedQuESTDefault () |
Seed the Mersenne Twister used for random number generation in the QuEST environment with an example defualt seed. More... | |
Complex | statevec_calcExpecDiagonalOp (Qureg qureg, DiagonalOp op) |
Complex | statevec_calcInnerProduct (Qureg bra, Qureg ket) |
qreal | statevec_calcProbOfOutcome (Qureg qureg, int measureQubit, int outcome) |
qreal | statevec_calcTotalProb (Qureg qureg) |
void | statevec_collapseToKnownProbOutcome (Qureg qureg, int measureQubit, int outcome, qreal totalStateProb) |
void | statevec_compactUnitary (Qureg qureg, int targetQubit, Complex alpha, Complex beta) |
void | statevec_controlledCompactUnitary (Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta) |
void | statevec_controlledNot (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliY (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledPauliYConj (Qureg qureg, int controlQubit, int targetQubit) |
void | statevec_controlledUnitary (Qureg qureg, int controlQubit, 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, int targetQubit) |
void | statevec_multiControlledMultiQubitUnitary (Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. More... | |
void | statevec_multiControlledTwoQubitUnitary (Qureg qureg, long long int ctrlMask, int q1, int q2, ComplexMatrix4 u) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. More... | |
void | statevec_multiControlledUnitary (Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ComplexMatrix2 u) |
void | statevec_pauliX (Qureg qureg, int targetQubit) |
void | statevec_pauliY (Qureg qureg, int targetQubit) |
void | statevec_pauliYConj (Qureg qureg, int targetQubit) |
void | statevec_swapQubitAmps (Qureg qureg, int qb1, int qb2) |
void | statevec_unitary (Qureg qureg, 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 backend in ../QuEST_ops.h for an MPI environment. Mostly pure-state wrappers for the local/distributed functions implemented in QuEST_cpu
Definition in file QuEST_cpu_distributed.c.
Macro Definition Documentation
◆ _BSD_SOURCE
#define _BSD_SOURCE |
Definition at line 20 of file QuEST_cpu_distributed.c.
Function Documentation
◆ chunkIsUpper()
|
static |
Returns whether a given chunk in position chunkId is in the upper or lower half of a block.
- Parameters
-
[in] chunkId id of chunk in state vector [in] chunkSize number of amps in chunk [in] targetQubit qubit being rotated
- Returns
- 1: chunk is in upper half of block, 0: chunk is in lower half of block fix – is this the same as isChunkToSkip?
Definition at line 227 of file QuEST_cpu_distributed.c.
Referenced by getChunkOuterBlockPairId(), getChunkPairId(), getRotAngle(), getRotAngleFromUnitaryMatrix(), statevec_compactUnitary(), statevec_controlledCompactUnitary(), statevec_controlledNot(), statevec_controlledPauliY(), statevec_controlledPauliYConj(), statevec_controlledUnitary(), statevec_hadamard(), statevec_multiControlledUnitary(), statevec_pauliX(), statevec_pauliY(), statevec_pauliYConj(), and statevec_unitary().
◆ chunkIsUpperInOuterBlock()
|
static |
fix – do with masking instead
Definition at line 236 of file QuEST_cpu_distributed.c.
Referenced by densmatr_mixDamping(), densmatr_mixDepolarising(), and densmatr_mixTwoQubitDepolarising().
◆ compressPairVectorForSingleQubitDepolarise()
void compressPairVectorForSingleQubitDepolarise | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 543 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by densmatr_mixDamping(), and densmatr_mixDepolarising().
◆ compressPairVectorForTwoQubitDepolarise()
void compressPairVectorForTwoQubitDepolarise | ( | Qureg | qureg, |
int | targetQubit, | ||
int | qubit2 | ||
) |
Definition at line 610 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, extractBit(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by densmatr_mixTwoQubitDepolarising().
◆ copyDiagOpIntoMatrixPairState()
void copyDiagOpIntoMatrixPairState | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1482 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, DiagonalOp::imag, Qureg::numChunks, DiagonalOp::numElemsPerChunk, Qureg::pairStateVec, qreal, and DiagonalOp::real.
Referenced by densmatr_applyDiagonalOp().
◆ copyVecIntoMatrixPairState()
This copies/clones vec (a statevector) into every node's matr pairState.
(where matr is a density matrix or equal number of qubits as vec)
Definition at line 371 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numChunks, Qureg::pairStateVec, qreal, and Qureg::stateVec.
Referenced by densmatr_calcFidelity(), and densmatr_initPureState().
◆ densityMatrixBlockFitsInChunk()
|
static |
Definition at line 363 of file QuEST_cpu_distributed.c.
Referenced by densmatr_mixDamping(), densmatr_mixDepolarising(), and densmatr_mixTwoQubitDepolarising().
◆ densmatr_applyDiagonalOp()
void densmatr_applyDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1517 of file QuEST_cpu_distributed.c.
References copyDiagOpIntoMatrixPairState(), and densmatr_applyDiagonalOpLocal().
◆ densmatr_calcExpecDiagonalOp()
Complex densmatr_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1541 of file QuEST_cpu_distributed.c.
References densmatr_calcExpecDiagonalOpLocal(), Complex::imag, Qureg::numChunks, qreal, and Complex::real.
◆ densmatr_calcFidelity()
Definition at line 415 of file QuEST_cpu_distributed.c.
References copyVecIntoMatrixPairState(), densmatr_calcFidelityLocal(), and qreal.
◆ densmatr_calcHilbertSchmidtDistance()
Definition at line 430 of file QuEST_cpu_distributed.c.
References densmatr_calcHilbertSchmidtDistanceSquaredLocal(), and qreal.
◆ densmatr_calcInnerProduct()
Definition at line 441 of file QuEST_cpu_distributed.c.
References densmatr_calcInnerProductLocal(), and qreal.
◆ densmatr_calcProbOfOutcome()
Definition at line 1276 of file QuEST_cpu_distributed.c.
References densmatr_findProbabilityOfZeroLocal(), and qreal.
◆ densmatr_calcPurity()
Definition at line 1288 of file QuEST_cpu_distributed.c.
References densmatr_calcPurityLocal(), and qreal.
◆ densmatr_calcTotalProb()
Definition at line 53 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, Qureg::numAmpsPerChunk, Qureg::numChunks, Qureg::numQubitsRepresented, qreal, and Qureg::stateVec.
◆ densmatr_initPureState()
Definition at line 452 of file QuEST_cpu_distributed.c.
References copyVecIntoMatrixPairState(), densmatr_initPureStateLocal(), Qureg::numChunks, Qureg::pairStateVec, qreal, and Qureg::stateVec.
◆ densmatr_mixDamping()
Definition at line 725 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpperInOuterBlock(), compressPairVectorForSingleQubitDepolarise(), densityMatrixBlockFitsInChunk(), densmatr_mixDampingDistributed(), densmatr_mixDampingLocal(), exchangePairStateVectorHalves(), getChunkOuterBlockPairId(), Qureg::numAmpsPerChunk, and Qureg::numQubitsRepresented.
◆ densmatr_mixDepolarising()
Definition at line 698 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpperInOuterBlock(), compressPairVectorForSingleQubitDepolarise(), densityMatrixBlockFitsInChunk(), densmatr_mixDepolarisingDistributed(), densmatr_mixDepolarisingLocal(), exchangePairStateVectorHalves(), getChunkOuterBlockPairId(), Qureg::numAmpsPerChunk, and Qureg::numQubitsRepresented.
◆ densmatr_mixTwoQubitDepolarising()
Definition at line 752 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpperInOuterBlock(), compressPairVectorForTwoQubitDepolarise(), densityMatrixBlockFitsInChunk(), densmatr_mixTwoQubitDephasing(), densmatr_mixTwoQubitDepolarisingDistributed(), densmatr_mixTwoQubitDepolarisingLocal(), densmatr_mixTwoQubitDepolarisingLocalPart1(), densmatr_mixTwoQubitDepolarisingQ1LocalQ2DistributedPart3(), exchangePairStateVectorHalves(), getChunkOuterBlockPairId(), getChunkOuterBlockPairIdForPart3(), Qureg::numAmpsPerChunk, Qureg::numQubitsRepresented, and qreal.
◆ exchangePairStateVectorHalves()
void exchangePairStateVectorHalves | ( | Qureg | qureg, |
int | pairRank | ||
) |
Definition at line 509 of file QuEST_cpu_distributed.c.
References Qureg::numAmpsPerChunk, and Qureg::pairStateVec.
Referenced by densmatr_mixDamping(), densmatr_mixDepolarising(), and densmatr_mixTwoQubitDepolarising().
◆ exchangeStateVectors()
void exchangeStateVectors | ( | Qureg | qureg, |
int | pairRank | ||
) |
Definition at line 479 of file QuEST_cpu_distributed.c.
References Qureg::numAmpsPerChunk, Qureg::pairStateVec, and Qureg::stateVec.
Referenced by statevec_compactUnitary(), statevec_controlledCompactUnitary(), statevec_controlledNot(), statevec_controlledPauliY(), statevec_controlledPauliYConj(), statevec_controlledUnitary(), statevec_hadamard(), statevec_multiControlledUnitary(), statevec_pauliX(), statevec_pauliY(), statevec_pauliYConj(), statevec_swapQubitAmps(), and statevec_unitary().
◆ getChunkIdFromIndex()
|
static |
Definition at line 194 of file QuEST_cpu_distributed.c.
References Qureg::numAmpsPerChunk.
Referenced by statevec_getImagAmp(), and statevec_getRealAmp().
◆ getChunkOuterBlockPairId()
|
static |
Definition at line 314 of file QuEST_cpu_distributed.c.
References chunkIsUpper().
Referenced by densmatr_mixDamping(), densmatr_mixDepolarising(), and densmatr_mixTwoQubitDepolarising().
◆ getChunkOuterBlockPairIdForPart3()
|
static |
Definition at line 325 of file QuEST_cpu_distributed.c.
Referenced by densmatr_mixTwoQubitDepolarising().
◆ getChunkPairId()
|
static |
get position of corresponding chunk, holding values required to update values in my chunk (with chunkId) when rotating targetQubit.
- Parameters
-
[in] chunkIsUpper 1: chunk is in upper half of block, 0: chunk is in lower half [in] chunkId id of chunk in state vector [in] chunkSize number of amps in chunk [in] targetQubit qubit being rotated
- Returns
- chunkId of chunk required to rotate targetQubit
Definition at line 303 of file QuEST_cpu_distributed.c.
References chunkIsUpper().
Referenced by statevec_compactUnitary(), statevec_controlledCompactUnitary(), statevec_controlledNot(), statevec_controlledPauliY(), statevec_controlledPauliYConj(), statevec_controlledUnitary(), statevec_hadamard(), statevec_multiControlledUnitary(), statevec_pauliX(), statevec_pauliY(), statevec_pauliYConj(), and statevec_unitary().
◆ getGlobalIndOfOddParityInChunk()
long long int getGlobalIndOfOddParityInChunk | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
returns -1 if this node contains no amplitudes where qb1 and qb2 have opposite parity, otherwise returns the global index of one of such contained amplitudes (not necessarily the first)
Definition at line 1335 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, extractBit(), flipBit(), and Qureg::numAmpsPerChunk.
Referenced by statevec_swapQubitAmps().
◆ getRotAngle()
|
static |
Get rotation values for a given chunk.
- Parameters
-
[in] chunkIsUpper 1: chunk is in upper half of block, 0: chunk is in lower half [out] rot1,rot2 rotation values to use, allocated for upper/lower such that stateUpper = rot1 * stateUpper + conj(rot2) * stateLower
orstateLower = rot1 * stateUpper + conj(rot2) * stateLower
[in] alpha,beta initial rotation values
Definition at line 258 of file QuEST_cpu_distributed.c.
References chunkIsUpper(), Complex::imag, and Complex::real.
Referenced by statevec_compactUnitary(), and statevec_controlledCompactUnitary().
◆ getRotAngleFromUnitaryMatrix()
|
static |
Get rotation values for a given chunk given a unitary matrix.
- Parameters
-
[in] chunkIsUpper 1: chunk is in upper half of block, 0: chunk is in lower half [out] rot1,rot2 rotation values to use, allocated for upper/lower such that stateUpper = rot1 * stateUpper + conj(rot2) * stateLower
orstateLower = rot1 * stateUpper + conj(rot2) * stateLower
[in] u unitary matrix operation
Definition at line 283 of file QuEST_cpu_distributed.c.
References chunkIsUpper(), ComplexMatrix2::imag, Complex::real, and ComplexMatrix2::real.
Referenced by statevec_controlledUnitary(), statevec_multiControlledUnitary(), and statevec_unitary().
◆ halfMatrixBlockFitsInChunk()
|
static |
return whether the current qubit rotation will use blocks that fit within a single chunk.
- Parameters
-
[in] chunkSize number of amps in chunk [in] targetQubit qubit being rotated
- Returns
- 1: one chunk fits in one block 0: chunk is larger than block fix – this should be renamed to matrixBlockFitsInChunk
Definition at line 356 of file QuEST_cpu_distributed.c.
Referenced by statevec_calcProbOfOutcome(), statevec_collapseToKnownProbOutcome(), statevec_compactUnitary(), statevec_controlledCompactUnitary(), statevec_controlledNot(), statevec_controlledPauliY(), statevec_controlledPauliYConj(), statevec_controlledUnitary(), statevec_hadamard(), statevec_multiControlledMultiQubitUnitary(), statevec_multiControlledTwoQubitUnitary(), statevec_multiControlledUnitary(), statevec_pauliX(), statevec_pauliY(), statevec_pauliYConj(), statevec_swapQubitAmps(), and statevec_unitary().
◆ isChunkToSkipInFindPZero()
|
static |
Find chunks to skip when calculating probability of qubit being zero.
When calculating probability of a bit q being zero, sum up 2^q values, then skip 2^q values, etc. This function finds if an entire chunk is in the range of values to be skipped
- Parameters
-
[in] chunkId id of chunk in state vector [in] chunkSize number of amps in chunk [in] measureQubi qubit being measured
- Returns
- int – 1: skip, 0: don't skip
Definition at line 1251 of file QuEST_cpu_distributed.c.
Referenced by statevec_calcProbOfOutcome(), and statevec_collapseToKnownProbOutcome().
◆ statevec_calcExpecDiagonalOp()
Complex statevec_calcExpecDiagonalOp | ( | Qureg | qureg, |
DiagonalOp | op | ||
) |
Definition at line 1523 of file QuEST_cpu_distributed.c.
References Complex::imag, Qureg::numChunks, qreal, Complex::real, and statevec_calcExpecDiagonalOpLocal().
◆ statevec_calcInnerProduct()
Definition at line 35 of file QuEST_cpu_distributed.c.
References Complex::imag, Qureg::numChunks, qreal, Complex::real, and statevec_calcInnerProductLocal().
◆ statevec_calcProbOfOutcome()
Definition at line 1260 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, halfMatrixBlockFitsInChunk(), isChunkToSkipInFindPZero(), Qureg::numAmpsPerChunk, qreal, statevec_findProbabilityOfZeroDistributed(), and statevec_findProbabilityOfZeroLocal().
◆ statevec_calcTotalProb()
Definition at line 88 of file QuEST_cpu_distributed.c.
References Qureg::numAmpsPerChunk, Qureg::numChunks, qreal, and Qureg::stateVec.
◆ statevec_collapseToKnownProbOutcome()
void statevec_collapseToKnownProbOutcome | ( | Qureg | qureg, |
int | measureQubit, | ||
int | outcome, | ||
qreal | totalStateProb | ||
) |
Definition at line 1298 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, halfMatrixBlockFitsInChunk(), isChunkToSkipInFindPZero(), Qureg::numAmpsPerChunk, statevec_collapseToKnownProbOutcomeDistributedRenorm(), statevec_collapseToKnownProbOutcomeLocal(), and statevec_collapseToOutcomeDistributedSetZero().
◆ statevec_compactUnitary()
Definition at line 844 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngle(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_compactUnitaryDistributed(), and statevec_compactUnitaryLocal().
◆ statevec_controlledCompactUnitary()
void statevec_controlledCompactUnitary | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
Complex | alpha, | ||
Complex | beta | ||
) |
Definition at line 920 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngle(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_controlledCompactUnitaryDistributed(), and statevec_controlledCompactUnitaryLocal().
◆ statevec_controlledNot()
void statevec_controlledNot | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1061 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_controlledNotDistributed(), and statevec_controlledNotLocal().
◆ statevec_controlledPauliY()
void statevec_controlledPauliY | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1140 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_controlledPauliYDistributed(), and statevec_controlledPauliYLocal().
◆ statevec_controlledPauliYConj()
void statevec_controlledPauliYConj | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit | ||
) |
Definition at line 1173 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_controlledPauliYDistributed(), and statevec_controlledPauliYLocal().
◆ statevec_controlledUnitary()
void statevec_controlledUnitary | ( | Qureg | qureg, |
int | controlQubit, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 958 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngleFromUnitaryMatrix(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_controlledUnitaryDistributed(), and statevec_controlledUnitaryLocal().
◆ statevec_getImagAmp()
Definition at line 208 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, getChunkIdFromIndex(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_getRealAmp()
Definition at line 198 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, getChunkIdFromIndex(), Qureg::numAmpsPerChunk, qreal, and Qureg::stateVec.
◆ statevec_hadamard()
void statevec_hadamard | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1206 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_hadamardDistributed(), and statevec_hadamardLocal().
◆ statevec_multiControlledMultiQubitUnitary()
void statevec_multiControlledMultiQubitUnitary | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int * | targs, | ||
int | numTargs, | ||
ComplexMatrixN | u | ||
) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct.
It is already gauranteed here that all target qubits can fit on each node (this is validated in the front-end)
@TODO: refactor so that the 'swap back' isn't performed; instead the qubit locations are updated.
Definition at line 1437 of file QuEST_cpu_distributed.c.
References flipBit(), getQubitBitMask(), halfMatrixBlockFitsInChunk(), maskContainsBit(), Qureg::numAmpsPerChunk, statevec_multiControlledMultiQubitUnitaryLocal(), and statevec_swapQubitAmps().
◆ statevec_multiControlledTwoQubitUnitary()
void statevec_multiControlledTwoQubitUnitary | ( | Qureg | qureg, |
long long int | ctrlMask, | ||
int | q1, | ||
int | q2, | ||
ComplexMatrix4 | u | ||
) |
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct.
Note the order of q1 and q2 in the call to twoQubitUnitaryLocal is important.
@TODO: refactor so that the 'swap back' isn't performed; instead the qubit locations are updated. @TODO: the double swap (q1,q2 to 0,1) may be possible simultaneously by a bespoke swap routine.
Definition at line 1381 of file QuEST_cpu_distributed.c.
References flipBit(), halfMatrixBlockFitsInChunk(), maskContainsBit(), Qureg::numAmpsPerChunk, statevec_multiControlledTwoQubitUnitaryLocal(), and statevec_swapQubitAmps().
◆ statevec_multiControlledUnitary()
void statevec_multiControlledUnitary | ( | Qureg | qureg, |
long long int | ctrlQubitsMask, | ||
long long int | ctrlFlipMask, | ||
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 997 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngleFromUnitaryMatrix(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_multiControlledUnitaryDistributed(), and statevec_multiControlledUnitaryLocal().
◆ statevec_pauliX()
void statevec_pauliX | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1034 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_pauliXDistributed(), and statevec_pauliXLocal().
◆ statevec_pauliY()
void statevec_pauliY | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1090 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_pauliYDistributed(), and statevec_pauliYLocal().
◆ statevec_pauliYConj()
void statevec_pauliYConj | ( | Qureg | qureg, |
int | targetQubit | ||
) |
Definition at line 1115 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_pauliYDistributed(), and statevec_pauliYLocal().
◆ statevec_swapQubitAmps()
void statevec_swapQubitAmps | ( | Qureg | qureg, |
int | qb1, | ||
int | qb2 | ||
) |
Definition at line 1354 of file QuEST_cpu_distributed.c.
References exchangeStateVectors(), flipBit(), getGlobalIndOfOddParityInChunk(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, statevec_swapQubitAmpsDistributed(), and statevec_swapQubitAmpsLocal().
Referenced by statevec_multiControlledMultiQubitUnitary(), and statevec_multiControlledTwoQubitUnitary().
◆ statevec_unitary()
void statevec_unitary | ( | Qureg | qureg, |
int | targetQubit, | ||
ComplexMatrix2 | u | ||
) |
Definition at line 881 of file QuEST_cpu_distributed.c.
References Qureg::chunkId, chunkIsUpper(), exchangeStateVectors(), getChunkPairId(), getRotAngleFromUnitaryMatrix(), halfMatrixBlockFitsInChunk(), Qureg::numAmpsPerChunk, Qureg::pairStateVec, Qureg::stateVec, statevec_unitaryDistributed(), and statevec_unitaryLocal().