qiskit_dynamics.models.rotating_wave_approximation#
- rotating_wave_approximation(model, cutoff_freq, return_signal_map=False)[source]#
Construct a new model by performing the rotating wave approximation with a given cutoff frequency. The outputs of this function can be used in JAX-transformable functions, however this function itself cannot (see below).
Performs elementwise rotating wave approximation (RWA) with cutoff frequency
cutoff_freq
on each operator in a model, returning a new model. The new model contains a modified list of signal coefficients, and setting the optional argumentreturn_signal_map=True
results in the additional return of the functionf
which maps the signals of the input model to those of the output RWA model, such that the code blocks:model.signals = new_signals rwa_model = rotating_wave_approximation(model, cutoff_freq)
and
rwa_model, f = rotating_wave_approximation(model, cutoff_freq, return_signal_map=True) rwa_model.signals = f(new_signals)
result in an
rwa_model
with the same updated signals.Note
The
rotating_wave_approximation
function itself cannot be included in a function to-be JAX-transformed, however the resulting model andsignal_map
can. For example, the following function is not JAX-transformable:def function_with_rwa(t): operators = ... signals = ... model = GeneratorModel(operators=operators, signals=signals) rwa_model = rotating_wave_approximation(model, cutoff_freq) return rwa_model(t)
Whereas, defining:
rwa_model, signal_map = rotating_wave_approximation( model, cutoff_freq, return_signal_map=True )
The following function is JAX-transformable:
def jax_transformable_func(t): rwa_model.signals = signal_map(new_signals) return rwa_model(t)
In this way, the outputs of
rotating_wave_approximation
can be used in JAX-transformable functions, howeverrotating_wave_approximation
itself cannot.We now describe the formalism. When considering
, in the basis in which is diagonal, the element of has effective frequency , where the comes from expressing and the other term comes from the rotating frame. Define the matrix whose entries are the entries of s.t. for some cutoff frequency . Then, after the RWA, we may writeWhen we regroup these to use only the real components of the signal, we find that
where
is a signal with the same frequency and amplitude as , but with a phase shift of .- Parameters:
model (
BaseGeneratorModel
) – The model to approximate.cutoff_freq (
float
) – The cutoff frequency for the approximation.return_signal_map (
Optional
[bool
]) – Whether to also return the function for mapping pre-RWA signals to post-RWA signals.
- Return type:
BaseGeneratorModel
- Returns:
GeneratorModel
with twice as many terms, and, ifreturn_signal_map
, also the functionf
.- Raises:
ValueError – If the model has no signals.