The Quantum Exact Simulation Toolkit v4.2.0
Loading...
Searching...
No Matches

Testing utilities which evolve a reference state (qvector or qmatrix) under the action of a reference operation. These are slow, serial, un-optimised, defensively-designed routines. More...

Functions

void applyReferenceOperator (qmatrix &state, qmatrix matrix)
 
void applyReferenceOperator (qmatrix &state, vector< int > ctrls, vector< int > states, vector< int > targs, qmatrix matrix)
 
void applyReferenceOperator (qmatrix &state, vector< int > ctrls, vector< int > targs, qmatrix matrix)
 
void applyReferenceOperator (qmatrix &state, vector< int > targs, qmatrix matrix)
 
void applyReferenceOperator (qmatrix &state, vector< int > targs, vector< qmatrix > matrices)
 
void applyReferenceOperator (qvector &state, qmatrix matrix)
 
void applyReferenceOperator (qvector &state, vector< int > ctrls, vector< int > states, vector< int > targs, qmatrix matrix)
 
void applyReferenceOperator (qvector &state, vector< int > ctrls, vector< int > targs, qmatrix matrix)
 
void applyReferenceOperator (qvector &state, vector< int > targs, qmatrix matrix)
 
void leftapplyReferenceOperator (qmatrix &state, qmatrix matrix)
 
void leftapplyReferenceOperator (qmatrix &state, vector< int > ctrls, vector< int > states, vector< int > targs, qmatrix matrix)
 
void leftapplyReferenceOperator (qmatrix &state, vector< int > ctrls, vector< int > targs, qmatrix matrix)
 
void leftapplyReferenceOperator (qmatrix &state, vector< int > targs, qmatrix matrix)
 
void leftapplyReferenceOperator (qvector &state, qmatrix matrix)
 
void leftapplyReferenceOperator (qvector &state, vector< int > ctrls, vector< int > states, vector< int > targs, qmatrix matrix)
 
void leftapplyReferenceOperator (qvector &state, vector< int > ctrls, vector< int > targs, qmatrix matrix)
 
void leftapplyReferenceOperator (qvector &state, vector< int > targs, qmatrix matrix)
 
void rightapplyReferenceOperator (qmatrix &state, qmatrix matrix)
 
void rightapplyReferenceOperator (qmatrix &state, vector< int > ctrls, vector< int > states, vector< int > targs, qmatrix matrix)
 
void rightapplyReferenceOperator (qmatrix &state, vector< int > ctrls, vector< int > targs, qmatrix matrix)
 
void rightapplyReferenceOperator (qmatrix &state, vector< int > targs, qmatrix matrix)
 

Detailed Description

Testing utilities which evolve a reference state (qvector or qmatrix) under the action of a reference operation. These are slow, serial, un-optimised, defensively-designed routines.

Function Documentation

◆ applyReferenceOperator() [1/9]

void applyReferenceOperator ( qmatrix & state,
qmatrix matrix )

Definition at line 163 of file evolve.cpp.

163 {
164 DEMAND( state.size() == matrix.size() );
165
166 state = matrix * state * getConjugateTranspose(matrix);
167}
qmatrix getConjugateTranspose(qmatrix m)
Definition linalg.cpp:291

◆ applyReferenceOperator() [2/9]

void applyReferenceOperator ( qmatrix & state,
vector< int > ctrls,
vector< int > states,
vector< int > targs,
qmatrix matrix )

Definition at line 199 of file evolve.cpp.

199 {
200
201 qmatrix fullOp = getFullStateOperator(ctrls, ctrlStates, targs, matrix, getLog2(state.size()));
202 applyReferenceOperator(state, fullOp);
203}

◆ applyReferenceOperator() [3/9]

void applyReferenceOperator ( qmatrix & state,
vector< int > ctrls,
vector< int > targs,
qmatrix matrix )

Definition at line 229 of file evolve.cpp.

229 {
230
231 applyReferenceOperator(state, ctrls, {}, targs, matrix);
232}

◆ applyReferenceOperator() [4/9]

void applyReferenceOperator ( qmatrix & state,
vector< int > targs,
qmatrix matrix )

Definition at line 253 of file evolve.cpp.

253 {
254
255 applyReferenceOperator(state, {}, {}, targs, matrix);
256}

◆ applyReferenceOperator() [5/9]

void applyReferenceOperator ( qmatrix & state,
vector< int > targs,
vector< qmatrix > matrices )

Definition at line 273 of file evolve.cpp.

273 {
274
275 qmatrix in = state;
276 qmatrix out = getZeroMatrix(state.size());
277
278 for (auto& matrix : matrices) {
279 state = in;
280 applyReferenceOperator(state, targs, matrix);
281 out += state;
282 }
283
284 state = out;
285}
qmatrix getZeroMatrix(size_t dim)
Definition qmatrix.cpp:18

◆ applyReferenceOperator() [6/9]

void applyReferenceOperator ( qvector & state,
qmatrix matrix )

Definition at line 158 of file evolve.cpp.

158 {
159 DEMAND( state.size() == matrix.size() );
160
161 state = matrix * state;
162}

◆ applyReferenceOperator() [7/9]

void applyReferenceOperator ( qvector & state,
vector< int > ctrls,
vector< int > states,
vector< int > targs,
qmatrix matrix )

Definition at line 193 of file evolve.cpp.

193 {
194
195 qmatrix fullOp = getFullStateOperator(ctrls, ctrlStates, targs, matrix, getLog2(state.size()));
196 applyReferenceOperator(state, fullOp);
197}

◆ applyReferenceOperator() [8/9]

void applyReferenceOperator ( qvector & state,
vector< int > ctrls,
vector< int > targs,
qmatrix matrix )

Definition at line 225 of file evolve.cpp.

225 {
226
227 applyReferenceOperator(state, ctrls, {}, targs, matrix);
228}

◆ applyReferenceOperator() [9/9]

void applyReferenceOperator ( qvector & state,
vector< int > targs,
qmatrix matrix )

Definition at line 249 of file evolve.cpp.

249 {
250
251 applyReferenceOperator(state, {}, {}, targs, matrix);
252}

◆ leftapplyReferenceOperator() [1/8]

void leftapplyReferenceOperator ( qmatrix & state,
qmatrix matrix )

Definition at line 176 of file evolve.cpp.

176 {
177 DEMAND( state.size() == matrix.size() );
178
179 // we left-multiply upon density matrices only
180 state = matrix * state;
181}

◆ leftapplyReferenceOperator() [2/8]

void leftapplyReferenceOperator ( qmatrix & state,
vector< int > ctrls,
vector< int > states,
vector< int > targs,
qmatrix matrix )

Definition at line 210 of file evolve.cpp.

210 {
211
212 qmatrix left = getFullStateOperator(ctrls, ctrlStates, targs, matrix, getLog2(state.size()));
213 leftapplyReferenceOperator(state, left);
214}

◆ leftapplyReferenceOperator() [3/8]

void leftapplyReferenceOperator ( qmatrix & state,
vector< int > ctrls,
vector< int > targs,
qmatrix matrix )

Definition at line 237 of file evolve.cpp.

237 {
238
239 leftapplyReferenceOperator(state, ctrls, {}, targs, matrix);
240}

◆ leftapplyReferenceOperator() [4/8]

void leftapplyReferenceOperator ( qmatrix & state,
vector< int > targs,
qmatrix matrix )

Definition at line 261 of file evolve.cpp.

261 {
262
263 leftapplyReferenceOperator(state, {}, {}, targs, matrix);
264}

◆ leftapplyReferenceOperator() [5/8]

void leftapplyReferenceOperator ( qvector & state,
qmatrix matrix )

Definition at line 169 of file evolve.cpp.

169 {
170 DEMAND( state.size() == matrix.size() );
171
172 // for statevectors, multiplying is the same as applying
173 applyReferenceOperator(state, matrix);
174}

◆ leftapplyReferenceOperator() [6/8]

void leftapplyReferenceOperator ( qvector & state,
vector< int > ctrls,
vector< int > states,
vector< int > targs,
qmatrix matrix )

Definition at line 205 of file evolve.cpp.

205 {
206
207 applyReferenceOperator(state, ctrls, ctrlStates, targs, matrix);
208}

◆ leftapplyReferenceOperator() [7/8]

void leftapplyReferenceOperator ( qvector & state,
vector< int > ctrls,
vector< int > targs,
qmatrix matrix )

Definition at line 233 of file evolve.cpp.

233 {
234
235 leftapplyReferenceOperator(state, ctrls, {}, targs, matrix);
236}

◆ leftapplyReferenceOperator() [8/8]

void leftapplyReferenceOperator ( qvector & state,
vector< int > targs,
qmatrix matrix )

Definition at line 257 of file evolve.cpp.

257 {
258
259 leftapplyReferenceOperator(state, {}, {}, targs, matrix);
260}

◆ rightapplyReferenceOperator() [1/4]

void rightapplyReferenceOperator ( qmatrix & state,
qmatrix matrix )

Definition at line 183 of file evolve.cpp.

183 {
184 DEMAND( state.size() == matrix.size() );
185
186 // we right-multiply upon density matrices only
187 state = state * matrix;
188}

◆ rightapplyReferenceOperator() [2/4]

void rightapplyReferenceOperator ( qmatrix & state,
vector< int > ctrls,
vector< int > states,
vector< int > targs,
qmatrix matrix )

Definition at line 216 of file evolve.cpp.

216 {
217
218 qmatrix left = getFullStateOperator(ctrls, ctrlStates, targs, matrix, getLog2(state.size()));
219 rightapplyReferenceOperator(state, left);
220}

◆ rightapplyReferenceOperator() [3/4]

void rightapplyReferenceOperator ( qmatrix & state,
vector< int > ctrls,
vector< int > targs,
qmatrix matrix )

Definition at line 241 of file evolve.cpp.

241 {
242
243 rightapplyReferenceOperator(state, ctrls, {}, targs, matrix);
244}

◆ rightapplyReferenceOperator() [4/4]

void rightapplyReferenceOperator ( qmatrix & state,
vector< int > targs,
qmatrix matrix )

Definition at line 265 of file evolve.cpp.

265 {
266
267 rightapplyReferenceOperator(state, {}, {}, targs, matrix);
268}