The Quantum Exact Simulation Toolkit v4.2.0
Loading...
Searching...
No Matches
PauliStrSum gadgets

Functions for using Trotterisation to approximate the action of exponentials of weighted sums of Pauli tensors upon Quregs. More...

Functions

void applyTrotterizedControlledPauliStrSumGadget (Qureg qureg, int control, PauliStrSum sum, qreal angle, int order, int reps)
 
void applyTrotterizedMultiControlledPauliStrSumGadget (Qureg qureg, int *controls, int numControls, PauliStrSum sum, qreal angle, int order, int reps)
 
void applyTrotterizedMultiStateControlledPauliStrSumGadget (Qureg qureg, int *controls, int *states, int numControls, PauliStrSum sum, qreal angle, int order, int reps)
 
void applyTrotterizedNonUnitaryPauliStrSumGadget (Qureg qureg, PauliStrSum sum, qcomp angle, int order, int reps)
 
void applyTrotterizedPauliStrSumGadget (Qureg qureg, PauliStrSum sum, qreal angle, int order, int reps)
 

Detailed Description

Functions for using Trotterisation to approximate the action of exponentials of weighted sums of Pauli tensors upon Quregs.

Function Documentation

◆ applyTrotterizedControlledPauliStrSumGadget()

void applyTrotterizedControlledPauliStrSumGadget ( Qureg qureg,
int control,
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!
See also

Definition at line 173 of file trotterisation.cpp.

173 {
174 validate_quregFields(qureg, __func__);
175 validate_pauliStrSumFields(sum, __func__);
176 validate_pauliStrSumIsHermitian(sum, __func__);
177 validate_controlAndPauliStrSumTargets(qureg, control, sum, __func__);
178 validate_trotterParams(qureg, order, reps, __func__);
179
180 bool onlyLeftApply = false;
181 internal_applyAllTrotterRepetitions(qureg, &control, nullptr, 1, sum, angle, order, reps, onlyLeftApply);
182}

◆ applyTrotterizedMultiControlledPauliStrSumGadget()

void applyTrotterizedMultiControlledPauliStrSumGadget ( Qureg qureg,
int * controls,
int numControls,
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!
See also

Definition at line 184 of file trotterisation.cpp.

184 {
185 validate_quregFields(qureg, __func__);
186 validate_pauliStrSumFields(sum, __func__);
187 validate_pauliStrSumIsHermitian(sum, __func__);
188 validate_controlsAndPauliStrSumTargets(qureg, controls, numControls, sum, __func__);
189 validate_trotterParams(qureg, order, reps, __func__);
190
191 bool onlyLeftApply = false;
192 internal_applyAllTrotterRepetitions(qureg, controls, nullptr, numControls, sum, angle, order, reps, onlyLeftApply);
193}

◆ applyTrotterizedMultiStateControlledPauliStrSumGadget()

void applyTrotterizedMultiStateControlledPauliStrSumGadget ( Qureg qureg,
int * controls,
int * states,
int numControls,
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!
See also

Definition at line 195 of file trotterisation.cpp.

195 {
196 validate_quregFields(qureg, __func__);
197 validate_pauliStrSumFields(sum, __func__);
198 validate_pauliStrSumIsHermitian(sum, __func__);
199 validate_controlsAndPauliStrSumTargets(qureg, controls, numControls, sum, __func__);
200 validate_controlStates(states, numControls, __func__); // permits states==nullptr
201 validate_trotterParams(qureg, order, reps, __func__);
202
203 bool onlyLeftApply = false;
204 internal_applyAllTrotterRepetitions(qureg, controls, states, numControls, sum, angle, order, reps, onlyLeftApply);
205}

◆ applyTrotterizedNonUnitaryPauliStrSumGadget()

void applyTrotterizedNonUnitaryPauliStrSumGadget ( Qureg qureg,
PauliStrSum sum,
qcomp angle,
int order,
int reps )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!

A generalisation of applyTrotterizedPauliStrSumGadget() which accepts a complex angle and permits sum to be non-Hermitian, thereby effecting a potentially non-unitary and non-CPTP operation.

Formulae

Let \( \hat{H} = \) sum and \( \theta = \) angle \( \in \mathbb{C} \). 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).

‍See applyTrotterizedPauliStrSumGadget() for more information about the decomposition.

Equivalences
  • When angle is set to \( \theta = \iu \, \Delta \tau \) and sum = \( \hat{H} \) is Hermitian, this function (approximately) evolves qureg in imaginary-time for duration \( \Delta \tau \), effecting non-unitary propagator

    \[ \exp(- \Delta \tau \hat{H}) \]

    as utilised by applyTrotterizedImaginaryTimeEvolution().
  • When angle is real and sum is Hermitian (i.e. has approximately real coefficients), the effected operation is unitary and this function becomes equivalent to applyTrotterizedPauliStrSumGadget().
Constraints
  • This function only ever effects \( \exp \left(\iu \, \theta \, \hat{H} \right) \) exactly when all PauliStr in sum = \( \hat{H} \) commute.
Parameters
[in,out]quregthe state to modify.
[in]suma weighted sum of Pauli strings to approximately exponentiate.
[in]anglean effective prefactor of sum in the exponent.
[in]orderthe order of the Trotter-Suzuki decomposition (e.g. 1, 2, 4, ...).
[in]repsthe number of Trotter repetitions.
Exceptions
error
  • if qureg or sum are uninitialised.
  • if sum contains non-identities on qubits beyond the size of qureg.
  • if order is not 1 nor a positive, even integer.
  • if reps is not a positive integer.
Author
Tyson Jones

Definition at line 150 of file trotterisation.cpp.

150 {
151 validate_quregFields(qureg, __func__);
152 validate_pauliStrSumFields(sum, __func__);
153 validate_pauliStrSumTargets(sum, qureg, __func__);
154 validate_trotterParams(qureg, order, reps, __func__);
155 // sum is permitted to be non-Hermitian
156
157 // |psi> -> U |psi>, rho -> U rho U^dagger
158 bool onlyLeftApply = false;
159 internal_applyAllTrotterRepetitions(qureg, nullptr, nullptr, 0, sum, angle, order, reps, onlyLeftApply);
160}

◆ applyTrotterizedPauliStrSumGadget()

void applyTrotterizedPauliStrSumGadget ( Qureg qureg,
PauliStrSum sum,
qreal angle,
int order,
int reps )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!

Effects an approximation to the exponential of sum, weighted by angle times \( i \), upon qureg, via the symmetrized Trotter-Suzuki decomposition (arXiv). Increasing reps (the number of Trotter repetitions) or order (an even, positive integer or one) improves the accuracy of the approximation by reducing the "Trotter error" due to non-commuting terms of sum, though increases the runtime linearly and exponentially respectively.

Formulae

Let \( \hat{H} = \) sum and \( \theta = \) angle \( \in \mathbb{R} \). 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). Simulation is exact, regardless of order or reps, only when all terms in sum commute.

Important
Observe that \( \theta \) lacks the \( -\frac{1}{2} \) prefactor present in other functions like applyPauliGadget().

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 coefficient of the \( j \)-th PauliStr \( \hat{\sigma}_j \).

  • When order=1, this function performs first-order Trotterisation, where the terms of sum are effected in a repeated, arbitrary but fixed order.

    \[ \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 each repetition effects the terms of sum forward then in reverse.

    \[ \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] \). These see the lower order Trotter circuits repeated twice forward, then reversed, then twice forward again, recursively. To be precise, 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).

Equivalences
  • By passing \( \theta = - \Delta t / \hbar \), this function approximates unitary time evolution of a closed system under the time-independent Hamiltonian sum = \( \hat{H} \) over a duration of \( \Delta t \), as described by propagator

    \[ \hat{U}(\Delta t) = \exp(- \iu \, \Delta t \,\hat{H} \, / \, \hbar), \]

    as utilised by the function applyTrotterizedUnitaryTimeEvolution().
  • This function is equivalent to applyTrotterizedNonUnitaryPauliStrSumGadget() when passing a qcomp instance with a zero imaginary component as the angle parameter. This latter function is useful for generalising dynamical simulation to imaginary-time evolution.
Constraints
  • Unitarity of the prescribed exponential(s) requires that sum is Hermitian, ergo containing only real coefficients. Validation will check that sum is approximately Hermitian, permitting coefficients with imaginary components smaller (in magnitude) than epsilon.

    \[ \max\limits_{i} |c_i| \le \valeps \]

    where the validation epsilon \( \valeps \) can be adjusted with setValidationEpsilon(). Otherwise, use applyTrotterizedNonUnitaryPauliStrSumGadget() to permit non-Hermitian sum and ergo effect a non-unitary exponential(s).
  • The angle parameter is necessarily real to retain unitarity, but can be relaxed to an arbitrary complex scalar (i.e. a qcomp) using applyTrotterizedNonUnitaryPauliStrSumGadget(). This permits cancelling the complex unit \( i \) to effect non-unitary \( \exp(\theta \, \hat{H}) \) as is useful for imaginary-time evolution.
  • This function only ever effects \( \exp \left(\iu \, \theta \, \hat{H} \right) \) exactly when all PauliStr in sum = \( \hat{H} \) commute, or reps \( \rightarrow \infty \).
Parameters
[in,out]quregthe state to modify.
[in]suma weighted sum of Pauli strings to approximately exponentiate.
[in]anglethe prefactor of sum times \( i \) in the exponent.
[in]orderthe order of the Trotter-Suzuki decomposition (e.g. 1, 2, 4, ...).
[in]repsthe number of Trotter repetitions.
Exceptions
error
  • if qureg or sum are uninitialised.
  • if sum is not approximately Hermitian.
  • if sum contains non-identities on qubits beyond the size of qureg.
  • if order is not 1 nor a positive, even integer.
  • if reps is not a positive integer.
See also
Author
Tyson Jones

Definition at line 162 of file trotterisation.cpp.

162 {
163 validate_quregFields(qureg, __func__);
164 validate_pauliStrSumFields(sum, __func__);
165 validate_pauliStrSumTargets(sum, qureg, __func__);
166 validate_pauliStrSumIsHermitian(sum, __func__);
167 validate_trotterParams(qureg, order, reps, __func__);
168
169 bool onlyLeftApply = false;
170 internal_applyAllTrotterRepetitions(qureg, nullptr, nullptr, 0, sum, angle, order, reps, onlyLeftApply);
171}