The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches
initialisations.h
1/** @file
2 * API signatures for initialising Quregs into
3 * particular states. Note when a Qureg is GPU-
4 * accelerated, these functions only update the
5 * state in GPU memory; the CPU amps are unchanged.
6 *
7 * @author Tyson Jones
8 *
9 * @defgroup initialisations Initialisations
10 * @ingroup api
11 * @brief Functions for preparing Quregs in particular states.
12 * @{
13 */
14
15#ifndef INITIALISATIONS_H
16#define INITIALISATIONS_H
17
18#include "quest/include/types.h"
19#include "quest/include/qureg.h"
20#include "quest/include/paulis.h"
21
22
23
24/*
25 * C AND C++ AGNOSTIC FUNCTIONS
26 */
27
28// enable invocation by both C and C++ binaries
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34
35/**
36 * @defgroup init_states States
37 * @brief Functions for initialising Qureg into physical states.
38 * @{
39 */
40
41
42/// @notdoced
43/// @notvalidated
44void initBlankState(Qureg qureg);
45
46
47/// @notdoced
48/// @notvalidated
49void initZeroState(Qureg qureg);
50
51
52/// @notdoced
53/// @notvalidated
54void initPlusState(Qureg qureg);
55
56
57/// @notdoced
58/// @notvalidated
59/// @nottested
60void initPureState(Qureg qureg, Qureg pure);
61
62
63/// @notdoced
64/// @notvalidated
65void initClassicalState(Qureg qureg, qindex stateInd);
66
67
68/// @notdoced
69/// @notvalidated
70void initDebugState(Qureg qureg);
71
72
73/// @notdoced
74/// @notvalidated
75void initArbitraryPureState(Qureg qureg, qcomp* amps);
76
77
78/// @notdoced
79/// @notvalidated
80void initRandomPureState(Qureg qureg);
81
82
83/// @notdoced
84/// @notvalidated
85void initRandomMixedState(Qureg qureg, qindex numPureStates);
86
87
88/** @} */
89
90
91
92/**
93 * @defgroup init_amps Amplitudes
94 * @brief Functions for overwriting Qureg amplitudes.
95 * @{
96 */
97
98
99/// @notdoced
100/// @notvalidated
101void setQuregAmps(Qureg qureg, qindex startInd, qcomp* amps, qindex numAmps);
102
103
104/// @notdoced
105/// @notvalidated
106void setDensityQuregAmps(Qureg qureg, qindex startRow, qindex startCol, qcomp** amps, qindex numRows, qindex numCols);
107
108
109/// @notdoced
110/// @notvalidated
111void setDensityQuregFlatAmps(Qureg qureg, qindex startInd, qcomp* amps, qindex numAmps);
112
113
114/// @notdoced
115/// @nottested
116void setQuregToClone(Qureg targetQureg, Qureg copyQureg);
117
118
119/// @notdoced
120/// @nottested
121void setQuregToSuperposition(qcomp facOut, Qureg out, qcomp fac1, Qureg qureg1, qcomp fac2, Qureg qureg2);
122
123
124/// @notdoced
125/// @notvalidated
126qreal setQuregToRenormalized(Qureg qureg);
127
128
129/// @notdoced
130/// @notvalidated
132
133
134/// @notdoced
135/// @nottested
136void setQuregToPartialTrace(Qureg out, Qureg in, int* traceOutQubits, int numTraceQubits);
137
138
139/// @notdoced
140/// @nottested
141void setQuregToReducedDensityMatrix(Qureg out, Qureg in, int* retainQubits, int numRetainQubits);
142
143
144/** @} */
145
146
147
148// end de-mangler
149#ifdef __cplusplus
150}
151#endif
152
153
154
155/*
156 * C++ OVERLOADS
157 *
158 * which are only accessible to C++ binaries, and accept
159 * arguments more natural to C++ (e.g. std::vector). We
160 * manually add these to their respective Doxygen doc groups.
161 */
162
163#ifdef __cplusplus
164
165#include <vector>
166
167
168/// @ingroup init_amps
169/// @nottested
170/// @notdoced
171/// @notvalidated
172/// @cpponly
173void setQuregAmps(Qureg qureg, qindex startInd, std::vector<qcomp> amps);
174
175
176/// @ingroup init_amps
177/// @nottested
178/// @notdoced
179/// @notvalidated
180/// @cpponly
181void setDensityQuregAmps(Qureg qureg, qindex startRow, qindex startCol, std::vector<std::vector<qcomp>> amps);
182
183
184/// @ingroup init_amps
185/// @nottested
186/// @notdoced
187/// @notvalidated
188/// @cpponly
189void setDensityQuregFlatAmps(Qureg qureg, qindex startInd, std::vector<qcomp> amps);
190
191
192/// @ingroup init_amps
193/// @nottested
194/// @notdoced
195/// @notvalidated
196/// @cpponly
197void setQuregToPartialTrace(Qureg out, Qureg in, std::vector<int> traceOutQubits);
198
199
200/// @ingroup init_amps
201/// @nottested
202/// @notdoced
203/// @notvalidated
204/// @cpponly
205void setQuregToReducedDensityMatrix(Qureg out, Qureg in, std::vector<int> retainQubits);
206
207
208#endif // __cplusplus
209
210
211
212#endif // INITIALISATIONS_H
213
214/** @} */ // (end file-wide doxygen defgroup)
void setDensityQuregFlatAmps(Qureg qureg, qindex startInd, qcomp *amps, qindex numAmps)
void setQuregToReducedDensityMatrix(Qureg out, Qureg in, int *retainQubits, int numRetainQubits)
void setQuregToPauliStrSum(Qureg qureg, PauliStrSum sum)
void setQuregAmps(Qureg qureg, qindex startInd, qcomp *amps, qindex numAmps)
void setQuregToPartialTrace(Qureg out, Qureg in, int *traceOutQubits, int numTraceQubits)
qreal setQuregToRenormalized(Qureg qureg)
void setQuregToClone(Qureg targetQureg, Qureg copyQureg)
void setDensityQuregAmps(Qureg qureg, qindex startRow, qindex startCol, qcomp **amps, qindex numRows, qindex numCols)
void setQuregToSuperposition(qcomp facOut, Qureg out, qcomp fac1, Qureg qureg1, qcomp fac2, Qureg qureg2)
void initArbitraryPureState(Qureg qureg, qcomp *amps)
void initRandomPureState(Qureg qureg)
void initPlusState(Qureg qureg)
void initZeroState(Qureg qureg)
void initPureState(Qureg qureg, Qureg pure)
void initDebugState(Qureg qureg)
void initRandomMixedState(Qureg qureg, qindex numPureStates)
void initClassicalState(Qureg qureg, qindex stateInd)
void initBlankState(Qureg qureg)
Definition qureg.h:49