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

Function applyMultiStateControlledSqrtSwap

quest/src/api/operations.cpp:739–759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

737}
738
739void applyMultiStateControlledSqrtSwap(Qureg qureg, int* controls, int* states, int numControls, int target1, int target2) {
740 validate_quregFields(qureg, __func__);
741 validate_controlsAndTwoTargets(qureg, controls, numControls, target1, target2, __func__);
742 validate_controlStates(states, numControls, __func__); // permits states==nullptr
743
744 /// @todo
745 /// this function exacts sqrtSwap as a dense 2-qubit matrix,
746 /// where as bespoke communication and simulation strategy is
747 /// clearly possible which we have not supported because the gate
748 /// is somewhat esoteric. As such, we must validate mixed-amps fit
749
750 validate_mixedAmpsFitInNode(qureg, 2, __func__); // to throw SqrtSwap error, not generic CompMatr2 error
751
752 CompMatr2 matr = getCompMatr2({
753 {1, 0, 0, 0},
754 {0, .5+.5_i, .5-.5_i, 0},
755 {0, .5-.5_i, .5+.5_i, 0},
756 {0, 0, 0, 1}});
757
758 applyMultiStateControlledCompMatr2(qureg, controls, states, numControls, target1, target2, matr);
759}
760
761} // end de-mangler
762

Callers 3

applySqrtSwapFunction · 0.85
applyControlledSqrtSwapFunction · 0.85

Calls 7

validate_quregFieldsFunction · 0.85
validate_controlStatesFunction · 0.85
getCompMatr2Function · 0.70

Tested by

no test coverage detected