Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify pulse sequence instantiation #7

Merged

Conversation

thangleiter
Copy link
Member

As far as I can tell, the optimizer only updates the control amplitudes of the solver object. In that case it's much simpler to just manually set the new amplitudes if a solver.pulse_sequence already exists. When updating, we just need to make sure to clear all cached attributes (like the eigendecomposition) of the PulseSequence object.

Furthermore, the PulseSequence constructor can handle qopt.DenseOperators and the instantiation of the object in solver.create_pulse_sequence() can be simplified a bit (once qutech/filter_functions#53 is merged).

With these changes, solver.plot_bloch_sphere can also be a bit leaner and just call the solver.create_pulse_sequence() method.

If Solver already owns a PulseSequence, only need to update the control
amplitudes (and possibly the basis). If not, can simply pass
DenseOperators to the constructor now.
The method takes care of updating the PulseSequence with new control
parameters
@thangleiter thangleiter marked this pull request as ready for review March 3, 2021 14:17
@thangleiter thangleiter changed the title WIP: Simplify pulse sequence instantiation Simplify pulse sequence instantiation Mar 3, 2021
@JDTeske
Copy link
Contributor

JDTeske commented Mar 14, 2021

The new instantiation of pulse sequences seem to treat h_drift and h_control the same way.

This will lead to inconsistencies because h_drift has one dimension less than h_control.
h_drift -> shape: (n_time)
h_ctrl -> shape: (n_ctrl, n_time)

we also only need a single label for the single drift

@thangleiter
Copy link
Member Author

This will lead to inconsistencies because h_drift has one dimension less than h_control.
h_drift -> shape: (n_time)
h_ctrl -> shape: (n_ctrl, n_time)

Ah, I see. I thought you could pass any number of drift operators. However, in the current implementation one also cannot use the 'one drift operator per transferred time step' option as only the first one is used for the PulseSequence:

h_drift: List[ControlMatrix], len num_t or 1
Drift operators in the Hamiltonian. You can either give a single element
or one for each transferred time step.

for drift_operator in [self.h_drift[0], ]:
if type(drift_operator) == matrix.DenseOperator:
drift_operator = drift_operator.data
h_c += [[drift_operator, len(self.transferred_time) * [1], 'Drift'], ]

Maybe there should be a note regarding that somewhere? I don't immediately see a way to make that option work with the PulseSequence constructor.

We now manually set the eigenvalues, -vectors, and propagators of the
PulseSequence object because we don't make it aware of the Drift
hamiltonian at all
@JDTeske JDTeske merged commit f9b64ba into qutech:master Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants