| 2319 | |
| 2320 | |
| 2321 | void localiser_statevec_multiQubitProjector(Qureg qureg, vector<int> qubits, vector<int> outcomes, qreal prob) { |
| 2322 | |
| 2323 | // this routine is always embarrassingly parallel; however, we handle the |
| 2324 | // prefix-qubits here so that the backend can receive only the suffix qubits |
| 2325 | // and ergo be agnostic to distribution (so that we can e.g. use cuQuantum). |
| 2326 | // any rank which has a prefix-qubit inconsistent with outcomes is zero'd |
| 2327 | |
| 2328 | // nodes with all basis states orthogonal to outcomes (because prefix differs) are zero'd |
| 2329 | if (!doAnyLocalStatesHaveQubitValues(qureg, qubits, outcomes)) { |
| 2330 | accel_statevec_initUniformState_sub(qureg, 0); |
| 2331 | return; |
| 2332 | } |
| 2333 | |
| 2334 | // all other nodes has some or all states consistent with suffix outcomes |
| 2335 | removePrefixQubitsAndStates(qureg, qubits, outcomes); |
| 2336 | (qubits.empty())? |
| 2337 | localiser_statevec_scaleAmps(qureg, 1/std::sqrt(prob)): |
| 2338 | accel_statevec_multiQubitProjector_sub(qureg, qubits, outcomes, prob); |
| 2339 | } |
| 2340 | |
| 2341 | |
| 2342 | void localiser_densmatr_multiQubitProjector(Qureg qureg, vector<int> qubits, vector<int> outcomes, qreal prob) { |
no test coverage detected