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

Function paulis_getKeyOfSameMixedAmpsGroup

quest/src/core/paulilogic.cpp:229–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228
229PAULI_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
250std::pair<qcomp,PauliStr> paulis_getPauliStrProd(PauliStr strA, PauliStr strB) {

Calls 2

paulis_getPauliAtFunction · 0.85

Tested by

no test coverage detected