The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches
Pauli gadgets

Functions for applying many-qubit rotations around arbitrary PauliStr. More...

Functions

void applyControlledPauliGadget (Qureg qureg, int control, PauliStr str, qreal angle)
 
void applyMultiControlledPauliGadget (Qureg qureg, int *controls, int numControls, PauliStr str, qreal angle)
 
void applyMultiStateControlledPauliGadget (Qureg qureg, int *controls, int *states, int numControls, PauliStr str, qreal angle)
 
void applyPauliGadget (Qureg qureg, PauliStr str, qreal angle)
 
void multiplyPauliGadget (Qureg qureg, PauliStr str, qreal angle)
 

Detailed Description

Functions for applying many-qubit rotations around arbitrary PauliStr.

Function Documentation

◆ applyControlledPauliGadget()

void applyControlledPauliGadget ( Qureg qureg,
int control,
PauliStr str,
qreal angle )
Note
Documentation for this function or struct is under construction!

Definition at line 1092 of file operations.cpp.

1092 {
1093 validate_quregFields(qureg, __func__);
1094 validate_controlAndPauliStrTargets(qureg, control, str, __func__);
1095
1096 applyMultiStateControlledPauliGadget(qureg, &control, nullptr, 1, str, angle);
1097}
void applyMultiStateControlledPauliGadget(Qureg qureg, int *controls, int *states, int numControls, PauliStr str, qreal angle)

◆ applyMultiControlledPauliGadget()

void applyMultiControlledPauliGadget ( Qureg qureg,
int * controls,
int numControls,
PauliStr str,
qreal angle )
Note
Documentation for this function or struct is under construction!

Definition at line 1099 of file operations.cpp.

1099 {
1100 validate_quregFields(qureg, __func__);
1101 validate_controlsAndPauliStrTargets(qureg, controls, numControls, str, __func__);
1102
1103 applyMultiStateControlledPauliGadget(qureg, controls, nullptr, numControls, str, angle);
1104}

◆ applyMultiStateControlledPauliGadget()

void applyMultiStateControlledPauliGadget ( Qureg qureg,
int * controls,
int * states,
int numControls,
PauliStr str,
qreal angle )
Note
Documentation for this function or struct is under construction!

Definition at line 1106 of file operations.cpp.

1106 {
1107 validate_quregFields(qureg, __func__);
1108 validate_controlsAndPauliStrTargets(qureg, controls, numControls, str, __func__);
1109 validate_controlStates(states, numControls, __func__); // permits states==nullptr
1110
1111 /// @todo
1112 /// CRUCIAL NOTE:
1113 /// exp(theta I..I) might be algorithmically ok (I'm not sure), but it WILL NOT
1114 /// effect a global phase change of theta (I think). Should validate against this
1115 /// sitaution just in case, or make the doc extremely explicit
1116
1117 qreal phase = util_getPhaseFromGateAngle(angle);
1118 auto ctrlVec = util_getVector(controls, numControls);
1119 auto stateVec = util_getVector(states, numControls); // empty if states==nullptr
1120 localiser_statevec_anyCtrlPauliGadget(qureg, ctrlVec, stateVec, str, phase);
1121
1122 if (!qureg.isDensityMatrix)
1123 return;
1124
1125 // conj(e^iXZ) = e^(-iXZ), but conj(Y)=-Y, so odd-Y undoes phase negation
1126 phase *= paulis_hasOddNumY(str) ? 1 : -1;
1127 ctrlVec = util_getBraQubits(ctrlVec, qureg);
1128 str = paulis_getShiftedPauliStr(str, qureg.numQubits);
1129 localiser_statevec_anyCtrlPauliGadget(qureg, ctrlVec, stateVec, str, phase);
1130}

Referenced by applyControlledPauliGadget(), applyMultiControlledPauliGadget(), applyMultiStateControlledRotateX(), applyMultiStateControlledRotateY(), applyMultiStateControlledRotateZ(), and applyPauliGadget().

◆ applyPauliGadget()

void applyPauliGadget ( Qureg qureg,
PauliStr str,
qreal angle )
Note
Documentation for this function or struct is under construction!

Definition at line 1085 of file operations.cpp.

1085 {
1086 validate_quregFields(qureg, __func__);
1087 validate_pauliStrTargets(qureg, str, __func__);
1088
1089 applyMultiStateControlledPauliGadget(qureg, nullptr, nullptr, 0, str, angle);
1090}

◆ multiplyPauliGadget()

void multiplyPauliGadget ( Qureg qureg,
PauliStr str,
qreal angle )
Note
Documentation for this function or struct is under construction!

Definition at line 1077 of file operations.cpp.

1077 {
1078 validate_quregFields(qureg, __func__);
1079 validate_pauliStrTargets(qureg, str, __func__);
1080
1081 qreal phase = util_getPhaseFromGateAngle(angle);
1082 localiser_statevec_anyCtrlPauliGadget(qureg, {}, {}, str, phase);
1083}