MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / updateIndices

Function updateIndices

tests/deprecated/test_utilities.cpp:400–415  ·  view source on GitHub ↗

(don't generate doxygen doc) * * iterates list1 (of length len1) and replaces element oldEl with newEl, which is * gauranteed to be present at most once (between list1 AND list2), though may * not be present at all. If oldEl isn't present in list1, does the same for list2. * list1 is skipped if == NULL. This is used by getFullOperatorMatrix() to ensure * that, when qubits are swapped, the

Source from the content-addressed store, hash-verified

398 * are updated.
399 */
400void updateIndices(int oldEl, int newEl, int* list1, int len1, int* list2, int len2) {
401 if (list1 != NULL) {
402 for (int i=0; i<len1; i++) {
403 if (list1[i] == oldEl) {
404 list1[i] = newEl;
405 return;
406 }
407 }
408 }
409 for (int i=0; i<len2; i++) {
410 if (list2[i] == oldEl) {
411 list2[i] = newEl;
412 return;
413 }
414 }
415}
416
417QMatrix getFullOperatorMatrix(
418 int* ctrls, int numCtrls, int *targs, int numTargs, QMatrix op, int numQubits

Callers 1

getFullOperatorMatrixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected