The Quantum Exact Simulation Toolkit v4.1.0
Loading...
Searching...
No Matches

Functions for applying, exponentiating or Trotterising a weigthed sum of Pauli tensors. More...

Functions

void applyTrotterizedPauliStrSumGadget (Qureg qureg, PauliStrSum sum, qreal angle, int order, int reps)
 
void multiplyPauliStrSum (Qureg qureg, PauliStrSum sum, Qureg workspace)
 

Detailed Description

Functions for applying, exponentiating or Trotterising a weigthed sum of Pauli tensors.

Function Documentation

◆ applyTrotterizedPauliStrSumGadget()

void applyTrotterizedPauliStrSumGadget ( Qureg qureg,
PauliStrSum sum,
qreal angle,
int order,
int reps )
Note
Documentation for this function or struct is under construction!
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Formulae

Let \( \hat{H} = \) sum and \( \theta = \) angle. This function approximates the action of

\[ \exp \left(\iu \, \theta \, \hat{H} \right) \]

via a Trotter-Suzuki decomposition of the specified order and number of repetitions (reps).

To be precise, let \( r = \) reps and assume sum is composed of \( T \)-many terms of the form

\[ \hat{H} = \sum\limits_j^T c_j \, \hat{\sigma}_j \]

where \( c_j \) is the (necessarily real) coefficient of the \( j \)-th PauliStr \( \hat{\sigma}_j \).

  • When order=1, this function performs first-order Trotterisation, whereby

    \[ \exp(\iu \, \theta \, \hat{H} ) \approx \prod\limits^{r} \prod\limits_{j=1}^{T} \exp \left( \iu \, \frac{\theta \, c_j}{r} \, \hat\sigma_j \right). \]

  • When order=2, this function performs the lowest order "symmetrized" Suzuki decomposition, whereby

    \[ \exp(\iu \, \theta \, \hat{H} ) \approx \prod\limits^{r} \left[ \prod\limits_{j=1}^{T} \exp \left( \iu \frac{\theta \, c_j}{2 \, r} \hat\sigma_j \right) \prod\limits_{j=T}^{1} \exp \left( \iu \frac{\theta \, c_j}{2 \, r} \hat\sigma_j \right) \right]. \]

  • Greater, even values of order (denoted by symbol \( n \)) invoke higher-order symmetrized decompositions \( S[\theta,n,r] \). Letting \( p = \left( 4 - 4^{1/(n-1)} \right)^{-1} \), these satisfy

    \begin{align*} S[\theta, n, 1] &= \left( \prod\limits^2 S[p \, \theta, n-2, 1] \right) S[ (1-4p)\,\theta, n-2, 1] \left( \prod\limits^2 S[p \, \theta, n-2, 1] \right), \\ S[\theta, n, r] &= \prod\limits^{r} S\left[\frac{\theta}{r}, n, 1\right]. \end{align*}

‍These formulations are taken from 'Finding Exponential Product Formulas of Higher Orders', Naomichi Hatano and Masuo Suzuki (2005) (arXiv).

Definition at line 1169 of file operations.cpp.

1169 {
1170 validate_quregFields(qureg, __func__);
1171 validate_pauliStrSumFields(sum, __func__);
1172 validate_pauliStrSumTargets(sum, qureg, __func__);
1173 validate_pauliStrSumIsHermitian(sum, __func__);
1174 validate_trotterParams(qureg, order, reps, __func__);
1175
1176 // exp(i angle sum) = identity when angle=0
1177 if (angle == 0)
1178 return;
1179
1180 // record validation state then disable to avoid repeated
1181 // re-validations in each invoked applyPauliGadget() below
1182 bool wasValidationEnabled = validateconfig_isEnabled();
1183 validateconfig_disable();
1184
1185 // perform sequence of applyPauliGadget()
1186 for (int r=0; r<reps; r++)
1187 applyHigherOrderTrotter(qureg, sum, angle/reps, order);
1188
1189 // potentially restore validation
1190 if (wasValidationEnabled)
1191 validateconfig_enable();
1192
1193 /// @todo
1194 /// the accuracy of Trotterisation is greatly improved by randomisation
1195 /// or (even sub-optimal) grouping into commuting terms. Should we
1196 /// implement these above or into another function?
1197}

◆ multiplyPauliStrSum()

void multiplyPauliStrSum ( Qureg qureg,
PauliStrSum sum,
Qureg workspace )
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
See also
multiplyCompMatr1()

Definition at line 1112 of file operations.cpp.

1112 {
1113 validate_quregFields(qureg, __func__);
1114 validate_quregFields(workspace, __func__);
1115 validate_quregCanBeWorkspace(qureg, workspace, __func__);
1116 validate_pauliStrSumFields(sum, __func__);
1117 validate_pauliStrSumTargets(sum, qureg, __func__);
1118
1119 // clone qureg to workspace, set qureg to blank
1120 localiser_statevec_setQuregToSuperposition(0, workspace, 1, qureg, 0, qureg);
1121 localiser_statevec_initUniformState(qureg, 0);
1122
1123 // apply each term in-turn, mixing into output qureg, then undo using idempotency
1124 for (qindex i=0; i<sum.numTerms; i++) {
1125 localiser_statevec_anyCtrlPauliTensor(workspace, {}, {}, sum.strings[i]);
1126 localiser_statevec_setQuregToSuperposition(1, qureg, sum.coeffs[i], workspace, 0, workspace);
1127 localiser_statevec_anyCtrlPauliTensor(workspace, {}, {}, sum.strings[i]);
1128 }
1129
1130 // workspace -> qureg, and qureg -> sum * qureg
1131}

Referenced by TEST_CASE().