QuEST_validation.h
1// Distributed under MIT licence. See https://github.com/QuEST-Kit/QuEST/blob/master/LICENCE.txt for details
2
11# ifndef QUEST_VALIDATION_H
12# define QUEST_VALIDATION_H
13
14# include "QuEST.h"
15# include <stdio.h>
16
17# ifdef __cplusplus
18extern "C" {
19# endif
20
21void validateNumRanks(int numRanks, const char* caller);
22
23void validateNumQubitsInQureg(int numQubits, int numRanks, const char* caller);
24
25void validateNumQubitsInMatrix(int numQubits, const char* caller);
26
27void validateNumQubitsInDiagOp(int numQubits, int numRanks, const char* caller);
28
29void validateNumQubitsInSubDiagOp(int numQubits, const char* caller);
30
31void validateSubDiagOpTargets(Qureg qureg, int* qubits, int numQubits, SubDiagonalOp op, const char* caller);
32
33void validateUnitarySubDiagOp(SubDiagonalOp op, const char* caller);
34
35void validateAmpIndex(Qureg qureg, long long int ampInd, const char* caller);
36
37void validateStateIndex(Qureg qureg, long long int stateInd, const char* caller);
38
39void validateTarget(Qureg qureg, int targetQubit, const char* caller);
40
41void validateControlTarget(Qureg qureg, int controlQubit, int targetQubit, const char* caller);
42
43void validateUniqueTargets(Qureg qureg, int qubit1, int qubit2, const char* caller);
44
45void validateMultiQubits(Qureg qureg, int* qubits, int numQubits, const char* caller);
46
47void validateMultiTargets(Qureg qurge, int* targetQubits, int numTargetQubits, const char* caller);
48
49void validateMultiControls(Qureg qureg, int* controlQubits, int numControlQubits, const char* caller);
50
51void validateMultiControlsTarget(Qureg qureg, int* controlQubits, int numControlQubits, int targetQubit, const char* caller);
52
53void validateMultiControlsMultiTargets(Qureg qureg, int* controlQubits, int numControlQubits, int* targetQubits, int numTargetQubits, const char* caller);
54
55void validateControlState(int* controlState, int numControlQubits, const char* caller);
56
57void validateOneQubitUnitaryMatrix(ComplexMatrix2 u, const char* caller);
58
59void validateTwoQubitUnitaryMatrix(Qureg qureg, ComplexMatrix4 u, const char* caller);
60
61void validateMultiQubitMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char* caller);
62
63void validateMultiQubitUnitaryMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char* caller);
64
65void validateMultiQubitMatrixFitsInNode(Qureg qureg, int numTargets, const char* caller);
66
67void validateUnitaryComplexPair(Complex alpha, Complex beta, const char* caller);
68
69void validateVector(Vector vector, const char* caller);
70
71void validateStateVecQureg(Qureg qureg, const char* caller);
72
73void validateDensityMatrQureg(Qureg qureg, const char* caller);
74
75void validateOutcome(int outcome, const char* caller);
76
77void validateMeasurementProb(qreal prob, const char* caller);
78
79void validateMatchingQuregDims(Qureg qureg1, Qureg qureg2, const char *caller);
80
81void validateMatchingQuregTypes(Qureg qureg1, Qureg qureg2, const char *caller);
82
83void validateSecondQuregStateVec(Qureg qureg2, const char *caller);
84
85void validateNumAmps(Qureg qureg, long long int startInd, long long int numAmps, const char* caller);
86
87void validateNumDensityAmps(Qureg qureg, long long int startRow, long long int startCol, long long int numAmps, const char* caller);
88
89void validateFileOpened(int opened, char* fn, const char* caller);
90
91void validateProb(qreal prob, const char* caller);
92
93void validateNormProbs(qreal prob1, qreal prob2, const char* caller);
94
95void validateOneQubitDephaseProb(qreal prob, const char* caller);
96
97void validateTwoQubitDephaseProb(qreal prob, const char* caller);
98
99void validateOneQubitDepolProb(qreal prob, const char* caller);
100
101void validateTwoQubitDepolProb(qreal prob, const char* caller);
102
103void validateOneQubitPauliProbs(qreal probX, qreal probY, qreal probZ, const char* caller);
104
105void validatePauliCodes(enum pauliOpType* pauliCodes, int numPauliCodes, const char* caller);
106
107void validateNumPauliSumTerms(int numTerms, const char* caller);
108
109void validateMatrixInit(ComplexMatrixN matr, const char* caller);
110
111void validateOneQubitKrausMap(Qureg qureg, ComplexMatrix2* ops, int numOps, const char* caller);
112
113void validateTwoQubitKrausMap(Qureg qureg, ComplexMatrix4* ops, int numOps, const char* caller);
114
115void validateMultiQubitKrausMap(Qureg qureg, int numTargs, ComplexMatrixN* ops, int numOps, const char* caller);
116
117void validateOneQubitKrausMapDimensions(Qureg qureg, ComplexMatrix2* ops, int numOps, const char* caller);
118
119void validateTwoQubitKrausMapDimensions(Qureg qureg, ComplexMatrix4* ops, int numOps, const char* caller);
120
121void validateMultiQubitKrausMapDimensions(Qureg qureg, int numTargs, ComplexMatrixN* ops, int numOps, const char* caller);
122
123void validateOneQubitDampingProb(qreal prob, const char* caller);
124
125void validateHamilParams(int numQubits, int numTerms, const char* caller);
126
127void validatePauliHamil(PauliHamil hamil, const char* caller);
128
129void validateMatchingQuregPauliHamilDims(Qureg qureg, PauliHamil hamil, const char* caller);
130
131void validateHamilFileParams(int numQubits, int numTerms, FILE* file, char* fn, const char* caller);
132
133void validateHamilFileCoeffParsed(int parsed, PauliHamil h, FILE* file, char* fn, const char* caller);
134
135void validateHamilFilePauliParsed(int parsed, PauliHamil h, FILE* file, char* fn, const char* caller);
136
137void validateHamilFilePauliCode(enum pauliOpType code, PauliHamil h, FILE* file, char* fn, const char* caller);
138
139void validateTrotterParams(int order, int reps, const char* caller);
140
141void validateDiagOpInit(DiagonalOp op, const char* caller);
142
143void validateDiagonalOp(Qureg qureg, DiagonalOp op, const char* caller);
144
145void validateDiagPauliHamil(DiagonalOp op, PauliHamil hamil, const char *caller);
146
147void validateDiagPauliHamilFromFile(PauliHamil h, int numRanks, const char* caller);
148
149void validateNumElems(DiagonalOp op, long long int startInd, long long int numElems, const char* caller);
150
151void validateQubitSubregs(Qureg qureg, int* qubits, int* numQubitsPerReg, const int numReg, const char* caller);
152
153void validatePhaseFuncOverrides(const int numQubits, enum bitEncoding encoding, long long int* overrideInds, int numOverrides, const char* caller);
154
155void validateMultiVarPhaseFuncOverrides(int* numQubitsPerReg, const int numRegs, enum bitEncoding encoding, long long int* overrideInds, int numOverrides, const char* caller);
156
157void validatePhaseFuncTerms(int numQubits, enum bitEncoding encoding, qreal* coeffs, qreal* exponents, int numTerms, long long int* overrideInds, int numOverrides, const char* caller);
158
159void validateMultiVarPhaseFuncTerms(int* numQubitsPerReg, int numRegs, enum bitEncoding encoding, qreal* exponents, int* numTermsPerReg, const char* caller);
160
161void validatePhaseFuncName(enum phaseFunc funcCode, int numRegs, int numParams, const char* caller);
162
163void validateBitEncoding(int numQubits, enum bitEncoding encoding, const char* caller);
164
165void validateMultiRegBitEncoding(int* numQubitsPerReg, int numRegs, enum bitEncoding encoding, const char* caller);
166
167void validateMemoryAllocationSize(long long int numAmpsPerRank, const char* caller);
168
169void validateQuregAllocation(Qureg* qureg, QuESTEnv env, const char* caller);
170
171void validateQuregGPUAllocation(Qureg* qureg, QuESTEnv env, const char* caller);
172
173void validateDiagonalOpAllocation(DiagonalOp* op, QuESTEnv env, const char* caller);
174
175void validateDiagonalOpGPUAllocation(DiagonalOp* op, QuESTEnv env, const char* caller);
176
177void validateGPUExists(int GPUPresent, const char* caller);
178
179void validateGPUIsCuQuantumCompatible(int supportsMemPools, const char* caller);
180
181void raiseQASMBufferOverflow(const char* caller);
182
183# ifdef __cplusplus
184}
185# endif
186
187# endif // QUEST_VALIDATION_H
pauliOpType
Codes for specifying Pauli operators.
Definition: QuEST.h:113
#define qreal
A precision-agnostic floating point number, as determined by QuEST_PREC.
bitEncoding
Flags for specifying how the bits in sub-register computational basis states are mapped to indices in...
Definition: QuEST.h:288
phaseFunc
Flags for specifying named phase functions.
Definition: QuEST.h:249
Represents a 2x2 matrix of complex numbers.
Definition: QuEST.h:155
Represents a 4x4 matrix of complex numbers.
Definition: QuEST.h:193
Represents a general 2^N by 2^N matrix of complex numbers.
Definition: QuEST.h:204
Represents one complex number.
Definition: QuEST.h:121
Represents a diagonal complex operator on the full Hilbert state of a Qureg.
Definition: QuEST.h:317
A Pauli Hamiltonian, expressed as a real-weighted sum of pauli products, and which can hence represen...
Definition: QuEST.h:297
Information about the environment the program is running in.
Definition: QuEST.h:406
Represents a system of qubits.
Definition: QuEST.h:361
Represents a diagonal complex operator of a smaller dimension than the full Hilbert state of a Qureg.
Definition: QuEST.h:341
Represents a 3-vector of real numbers.
Definition: QuEST.h:216