| 227 | |
| 228 | |
| 229 | PAULI_MASK_TYPE paulis_getKeyOfSameMixedAmpsGroup(PauliStr str) { |
| 230 | |
| 231 | PAULI_MASK_TYPE key = 0; |
| 232 | |
| 233 | // in theory, we can reduce the number of involved operations by bit-shifting |
| 234 | // str left by 1, XOR'ing this with str, and retaining every 2nd bit, producing |
| 235 | // e.g. key=0110 from str=IXYZ. However, this is an insignificant speedup which |
| 236 | // risks sneaky bugs related to handling str's two masks. |
| 237 | |
| 238 | int maxInd = paulis_getIndOfLefmostNonIdentityPauli(str); |
| 239 | |
| 240 | for (int i=0; i<=maxInd; i++) { |
| 241 | int pauli = paulis_getPauliAt(str, i); |
| 242 | int isXY = (pauli == 1 || pauli == 2); |
| 243 | key |= (isXY << i); |
| 244 | } |
| 245 | |
| 246 | return key; |
| 247 | } |
| 248 | |
| 249 | |
| 250 | std::pair<qcomp,PauliStr> paulis_getPauliStrProd(PauliStr strA, PauliStr strB) { |
no test coverage detected