| 117 | } |
| 118 | |
| 119 | void destroyCachedQuregs() { |
| 120 | |
| 121 | // must not be called twice nor pre-creation |
| 122 | DEMAND( ! statevecs1.empty() ); |
| 123 | DEMAND( ! statevecs2.empty() ); |
| 124 | DEMAND( ! densmatrs1.empty() ); |
| 125 | DEMAND( ! densmatrs2.empty() ); |
| 126 | |
| 127 | auto caches = { |
| 128 | statevecs1, statevecs2, |
| 129 | densmatrs1, densmatrs2}; |
| 130 | |
| 131 | for (auto& cache : caches) |
| 132 | for (auto& [label, qureg]: cache) |
| 133 | destroyQureg(qureg); |
| 134 | |
| 135 | statevecs1.clear(); |
| 136 | statevecs2.clear(); |
| 137 | densmatrs1.clear(); |
| 138 | densmatrs2.clear(); |
| 139 | } |
| 140 | |
| 141 | quregCache getCachedStatevecs() { |
| 142 | |