QuEST_validation.h
Go to the documentation of this file.
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
18 extern "C" {
19 # endif
20 
21 void validateNumRanks(int numRanks, const char* caller);
22 
23 void validateNumQubitsInQureg(int numQubits, int numRanks, const char* caller);
24 
25 void validateNumQubitsInMatrix(int numQubits, const char* caller);
26 
27 void validateNumQubitsInDiagOp(int numQubits, int numRanks, const char* caller);
28 
29 void validateAmpIndex(Qureg qureg, long long int ampInd, const char* caller);
30 
31 void validateStateIndex(Qureg qureg, long long int stateInd, const char* caller);
32 
33 void validateTarget(Qureg qureg, int targetQubit, const char* caller);
34 
35 void validateControlTarget(Qureg qureg, int controlQubit, int targetQubit, const char* caller);
36 
37 void validateUniqueTargets(Qureg qureg, int qubit1, int qubit2, const char* caller);
38 
39 void validateMultiQubits(Qureg qureg, int* qubits, int numQubits, const char* caller);
40 
41 void validateMultiTargets(Qureg qurge, int* targetQubits, int numTargetQubits, const char* caller);
42 
43 void validateMultiControls(Qureg qureg, int* controlQubits, int numControlQubits, const char* caller);
44 
45 void validateMultiControlsTarget(Qureg qureg, int* controlQubits, int numControlQubits, int targetQubit, const char* caller);
46 
47 void validateMultiControlsMultiTargets(Qureg qureg, int* controlQubits, int numControlQubits, int* targetQubits, int numTargetQubits, const char* caller);
48 
49 void validateControlState(int* controlState, int numControlQubits, const char* caller);
50 
51 void validateOneQubitUnitaryMatrix(ComplexMatrix2 u, const char* caller);
52 
53 void validateTwoQubitUnitaryMatrix(Qureg qureg, ComplexMatrix4 u, const char* caller);
54 
55 void validateMultiQubitMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char* caller);
56 
57 void validateMultiQubitUnitaryMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char* caller);
58 
59 void validateMultiQubitMatrixFitsInNode(Qureg qureg, int numTargets, const char* caller);
60 
61 void validateUnitaryComplexPair(Complex alpha, Complex beta, const char* caller);
62 
63 void validateVector(Vector vector, const char* caller);
64 
65 void validateStateVecQureg(Qureg qureg, const char* caller);
66 
67 void validateDensityMatrQureg(Qureg qureg, const char* caller);
68 
69 void validateOutcome(int outcome, const char* caller);
70 
71 void validateMeasurementProb(qreal prob, const char* caller);
72 
73 void validateMatchingQuregDims(Qureg qureg1, Qureg qureg2, const char *caller);
74 
75 void validateMatchingQuregTypes(Qureg qureg1, Qureg qureg2, const char *caller);
76 
77 void validateSecondQuregStateVec(Qureg qureg2, const char *caller);
78 
79 void validateNumAmps(Qureg qureg, long long int startInd, long long int numAmps, const char* caller);
80 
81 void validateFileOpened(int opened, char* fn, const char* caller);
82 
83 void validateProb(qreal prob, const char* caller);
84 
85 void validateNormProbs(qreal prob1, qreal prob2, const char* caller);
86 
87 void validateOneQubitDephaseProb(qreal prob, const char* caller);
88 
89 void validateTwoQubitDephaseProb(qreal prob, const char* caller);
90 
91 void validateOneQubitDepolProb(qreal prob, const char* caller);
92 
93 void validateTwoQubitDepolProb(qreal prob, const char* caller);
94 
95 void validateOneQubitPauliProbs(qreal probX, qreal probY, qreal probZ, const char* caller);
96 
97 void validatePauliCodes(enum pauliOpType* pauliCodes, int numPauliCodes, const char* caller);
98 
99 void validateNumPauliSumTerms(int numTerms, const char* caller);
100 
101 void validateMatrixInit(ComplexMatrixN matr, const char* caller);
102 
103 void validateOneQubitKrausMap(Qureg qureg, ComplexMatrix2* ops, int numOps, const char* caller);
104 
105 void validateTwoQubitKrausMap(Qureg qureg, ComplexMatrix4* ops, int numOps, const char* caller);
106 
107 void validateMultiQubitKrausMap(Qureg qureg, int numTargs, ComplexMatrixN* ops, int numOps, const char* caller);
108 
109 void validateOneQubitDampingProb(qreal prob, const char* caller);
110 
111 void validateHamilParams(int numQubits, int numTerms, const char* caller);
112 
113 void validatePauliHamil(PauliHamil hamil, const char* caller);
114 
115 void validateMatchingQuregPauliHamilDims(Qureg qureg, PauliHamil hamil, const char* caller);
116 
117 void validateHamilFileParams(int numQubits, int numTerms, FILE* file, char* fn, const char* caller);
118 
119 void validateHamilFileCoeffParsed(int parsed, PauliHamil h, FILE* file, char* fn, const char* caller);
120 
121 void validateHamilFilePauliParsed(int parsed, PauliHamil h, FILE* file, char* fn, const char* caller);
122 
123 void validateHamilFilePauliCode(enum pauliOpType code, PauliHamil h, FILE* file, char* fn, const char* caller);
124 
125 void validateTrotterParams(int order, int reps, const char* caller);
126 
127 void validateDiagOpInit(DiagonalOp, const char* caller);
128 
129 void validateDiagonalOp(Qureg qureg, DiagonalOp op, const char* caller);
130 
131 void validateDiagPauliHamil(DiagonalOp op, PauliHamil hamil, const char *caller);
132 
133 void validateDiagPauliHamilFromFile(PauliHamil h, int numRanks, const char* caller);
134 
135 void validateNumElems(DiagonalOp op, long long int startInd, long long int numElems, const char* caller);
136 
137 void validateQubitSubregs(Qureg qureg, int* qubits, int* numQubitsPerReg, const int numReg, const char* caller);
138 
139 void validatePhaseFuncOverrides(const int numQubits, enum bitEncoding encoding, long long int* overrideInds, int numOverrides, const char* caller);
140 
141 void validateMultiVarPhaseFuncOverrides(int* numQubitsPerReg, const int numRegs, enum bitEncoding encoding, long long int* overrideInds, int numOverrides, const char* caller);
142 
143 void validatePhaseFuncTerms(int numQubits, enum bitEncoding encoding, qreal* coeffs, qreal* exponents, int numTerms, long long int* overrideInds, int numOverrides, const char* caller);
144 
145 void validateMultiVarPhaseFuncTerms(int* numQubitsPerReg, int numRegs, enum bitEncoding encoding, qreal* exponents, int* numTermsPerReg, const char* caller);
146 
147 void validatePhaseFuncName(enum phaseFunc funcCode, int numRegs, int numParams, const char* caller);
148 
149 void validateBitEncoding(int numQubits, enum bitEncoding encoding, const char* caller);
150 
151 void validateMultiRegBitEncoding(int* numQubitsPerReg, int numRegs, enum bitEncoding encoding, const char* caller);
152 
153 # ifdef __cplusplus
154 }
155 # endif
156 
157 # endif // QUEST_VALIDATION_H
void validateOneQubitDephaseProb(qreal prob, const char *caller)
void validateNumPauliSumTerms(int numTerms, const char *caller)
Represents a 3-vector of real numbers.
Definition: QuEST.h:198
pauliOpType
Codes for specifying Pauli operators.
Definition: QuEST.h:96
void validateMatchingQuregDims(Qureg qureg1, Qureg qureg2, const char *caller)
void validateMatchingQuregPauliHamilDims(Qureg qureg, PauliHamil hamil, const char *caller)
void validateAmpIndex(Qureg qureg, long long int ampInd, const char *caller)
void validateHamilParams(int numQubits, int numTerms, const char *caller)
void validateSecondQuregStateVec(Qureg qureg2, const char *caller)
void validateTwoQubitDephaseProb(qreal prob, const char *caller)
void validateMultiVarPhaseFuncTerms(int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, qreal *exponents, int *numTermsPerReg, const char *caller)
void validateDiagPauliHamil(DiagonalOp op, PauliHamil hamil, const char *caller)
void validateControlTarget(Qureg qureg, int controlQubit, int targetQubit, const char *caller)
void validateDiagonalOp(Qureg qureg, DiagonalOp op, const char *caller)
void validateOneQubitDepolProb(qreal prob, const char *caller)
void validateQubitSubregs(Qureg qureg, int *qubits, int *numQubitsPerReg, const int numReg, const char *caller)
void validatePhaseFuncOverrides(const int numQubits, enum bitEncoding encoding, long long int *overrideInds, int numOverrides, const char *caller)
void validateMultiControlsTarget(Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit, const char *caller)
void validateNumQubitsInDiagOp(int numQubits, int numRanks, const char *caller)
void validateStateIndex(Qureg qureg, long long int stateInd, const char *caller)
void validateNumQubitsInMatrix(int numQubits, const char *caller)
void validateNumRanks(int numRanks, const char *caller)
void validatePhaseFuncName(enum phaseFunc funcCode, int numRegs, int numParams, const char *caller)
void validateHamilFilePauliCode(enum pauliOpType code, PauliHamil h, FILE *file, char *fn, const char *caller)
void validateStateVecQureg(Qureg qureg, const char *caller)
void validateMultiQubitMatrixFitsInNode(Qureg qureg, int numTargets, const char *caller)
void validateHamilFileCoeffParsed(int parsed, PauliHamil h, FILE *file, char *fn, const char *caller)
void validateOneQubitKrausMap(Qureg qureg, ComplexMatrix2 *ops, int numOps, const char *caller)
Represents a 4x4 matrix of complex numbers.
Definition: QuEST.h:175
void validateUniqueTargets(Qureg qureg, int qubit1, int qubit2, const char *caller)
void validateOneQubitPauliProbs(qreal probX, qreal probY, qreal probZ, const char *caller)
void validateDiagPauliHamilFromFile(PauliHamil h, int numRanks, const char *caller)
Represents a general 2^N by 2^N matrix of complex numbers.
Definition: QuEST.h:186
void validateNumQubitsInQureg(int numQubits, int numRanks, const char *caller)
void validateMultiQubitUnitaryMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char *caller)
#define qreal
void validateMultiQubitMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char *caller)
void validateMultiQubitKrausMap(Qureg qureg, int numTargs, ComplexMatrixN *ops, int numOps, const char *caller)
void validateMeasurementProb(qreal prob, const char *caller)
void validateMultiRegBitEncoding(int *numQubitsPerReg, int numRegs, enum bitEncoding encoding, const char *caller)
void validateMultiQubits(Qureg qureg, int *qubits, int numQubits, const char *caller)
void validatePauliCodes(enum pauliOpType *pauliCodes, int numPauliCodes, const char *caller)
void validateUnitaryComplexPair(Complex alpha, Complex beta, const char *caller)
phaseFunc
Flags for specifying named phase functions.
Definition: QuEST.h:231
void validateControlState(int *controlState, int numControlQubits, const char *caller)
void validateMatrixInit(ComplexMatrixN matr, const char *caller)
void validateNumElems(DiagonalOp op, long long int startInd, long long int numElems, const char *caller)
void validateTarget(Qureg qureg, int targetQubit, const char *caller)
void validateOutcome(int outcome, const char *caller)
void validateMultiVarPhaseFuncOverrides(int *numQubitsPerReg, const int numRegs, enum bitEncoding encoding, long long int *overrideInds, int numOverrides, const char *caller)
Represents a diagonal complex operator on the full Hilbert state of a Qureg.
Definition: QuEST.h:297
A Pauli Hamiltonian, expressed as a real-weighted sum of pauli products, and which can hence represen...
Definition: QuEST.h:277
void validateTwoQubitKrausMap(Qureg qureg, ComplexMatrix4 *ops, int numOps, const char *caller)
void validateTwoQubitDepolProb(qreal prob, const char *caller)
void validateMultiTargets(Qureg qurge, int *targetQubits, int numTargetQubits, const char *caller)
void validatePauliHamil(PauliHamil hamil, const char *caller)
void validateTwoQubitUnitaryMatrix(Qureg qureg, ComplexMatrix4 u, const char *caller)
Represents a system of qubits.
Definition: QuEST.h:322
void validateNumAmps(Qureg qureg, long long int startInd, long long int numAmps, const char *caller)
void validateDensityMatrQureg(Qureg qureg, const char *caller)
void validateMatchingQuregTypes(Qureg qureg1, Qureg qureg2, const char *caller)
void validateHamilFilePauliParsed(int parsed, PauliHamil h, FILE *file, char *fn, const char *caller)
void validateOneQubitUnitaryMatrix(ComplexMatrix2 u, const char *caller)
void validateProb(qreal prob, const char *caller)
void validateMultiControlsMultiTargets(Qureg qureg, int *controlQubits, int numControlQubits, int *targetQubits, int numTargetQubits, const char *caller)
void validateHamilFileParams(int numQubits, int numTerms, FILE *file, char *fn, const char *caller)
void validateFileOpened(int opened, char *fn, const char *caller)
void validateTrotterParams(int order, int reps, const char *caller)
Represents one complex number.
Definition: QuEST.h:103
void validateMultiControls(Qureg qureg, int *controlQubits, int numControlQubits, const char *caller)
void validateOneQubitDampingProb(qreal prob, const char *caller)
void validateDiagOpInit(DiagonalOp, const char *caller)
void validatePhaseFuncTerms(int numQubits, enum bitEncoding encoding, qreal *coeffs, qreal *exponents, int numTerms, long long int *overrideInds, int numOverrides, const char *caller)
void validateVector(Vector vector, const char *caller)
bitEncoding
Flags for specifying how the bits in sub-register computational basis states are mapped to indices in...
Definition: QuEST.h:269
void validateNormProbs(qreal prob1, qreal prob2, const char *caller)
Represents a 2x2 matrix of complex numbers.
Definition: QuEST.h:137
void validateBitEncoding(int numQubits, enum bitEncoding encoding, const char *caller)