| 2230 | |
| 2231 | |
| 2232 | qcomp localiser_statevec_calcInnerProduct(Qureg quregA, Qureg quregB) { |
| 2233 | |
| 2234 | // trivial when identically distributed |
| 2235 | if (quregA.isDistributed == quregB.isDistributed) |
| 2236 | return calcInnerProdOfSameDistribQuregs(quregA, quregB); // broadcasts |
| 2237 | |
| 2238 | // when only one qureg is distributed, we spoof a distributed |
| 2239 | // qureg from the local one, offsetting its amp pointers. In |
| 2240 | // defensive design, we modify a copy of quregA or quregB (even |
| 2241 | // though they themselves are mere copies of the user structs), |
| 2242 | // in case this function is modified in the future to mutate args |
| 2243 | Qureg copyA = (quregA.isDistributed)? quregA : getSpoofedDistributedBufferlessQuregFromLocalQureg(quregA, quregB); |
| 2244 | Qureg copyB = (quregB.isDistributed)? quregB : getSpoofedDistributedBufferlessQuregFromLocalQureg(quregB, quregA); |
| 2245 | |
| 2246 | return calcInnerProdOfSameDistribQuregs(copyA, copyB); // broadcasts |
| 2247 | } |
| 2248 | |
| 2249 | |
| 2250 | qcomp localiser_densmatr_calcFidelityWithPureState(Qureg rho, Qureg psi, bool conj) { |
no test coverage detected