(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
| 398 | * are updated. |
| 399 | */ |
| 400 | void 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 | |
| 417 | QMatrix getFullOperatorMatrix( |
| 418 | int* ctrls, int numCtrls, int *targs, int numTargs, QMatrix op, int numQubits |
no outgoing calls
no test coverage detected