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

Function applyForcedQubitMeasurement

quest/src/api/operations.cpp:1634–1651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1632}
1633
1634qreal applyForcedQubitMeasurement(Qureg qureg, int target, int outcome) {
1635 validate_quregFields(qureg, __func__);
1636 validate_target(qureg, target, __func__);
1637 validate_measurementOutcomeIsValid(outcome, __func__);
1638
1639 // note that we do not merely invoke applyForcedMultiQubitMeasurement()
1640 // because we must validate the renormalising probability and
1641 // report this function's name during the error message
1642 qreal prob = calcProbOfQubitOutcome(qureg, target, outcome); // harmlessly re-validates
1643 validate_measurementOutcomeProbNotZero(outcome, prob, __func__);
1644
1645 // project to the outcome, renormalising the surviving states
1646 (qureg.isDensityMatrix)?
1647 localiser_densmatr_multiQubitProjector(qureg, {target}, {outcome}, prob):
1648 localiser_statevec_multiQubitProjector(qureg, {target}, {outcome}, prob);
1649
1650 return prob;
1651}
1652
1653qindex applyMultiQubitMeasurement(Qureg qureg, int* qubits, int numQubits) {
1654 validate_quregFields(qureg, __func__);

Callers 1

SECTIONFunction · 0.85

Tested by

no test coverage detected