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

Function localiser_statevec_calcInnerProduct

quest/src/core/localiser.cpp:2232–2247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2230
2231
2232qcomp 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
2250qcomp localiser_densmatr_calcFidelityWithPureState(Qureg rho, Qureg psi, bool conj) {

Callers 3

calcInnerProductFunction · 0.85
calcFidelityFunction · 0.85
calcDistanceFunction · 0.85

Tested by

no test coverage detected