qutip_qtrl.tslotcomp

Timeslot Computer These classes determine which dynamics generators, propagators and evolutions are recalculated when there is a control amplitude update. The timeslot computer processes the lists held by the dynamics object

The default (UpdateAll) updates all of these each amp update, on the assumption that all amplitudes are changed each iteration. This is typical when using optimisation methods like BFGS in the GRAPE algorithm

The alternative (DynUpdate) assumes that only a subset of amplitudes are updated each iteration and attempts to minimise the number of expensive calculations accordingly. This would be the appropriate class for Krotov type methods. Note that the Stats_DynTsUpdate class must be used for stats in conjunction with this class. NOTE: AJGP 2011-10-2014: This _DynUpdate class currently has some bug, no pressing need to fix it presently

If all amplitudes change at each update, then the behavior of the classes is equivalent. _UpdateAll is easier to understand and potentially slightly faster in this situation.

Note the methods in the _DynUpdate class were inspired by: DYNAMO - Dynamic Framework for Quantum Optimal Control See Machnes et.al., arXiv.1011.4874

Classes

EvoCompSummary()

A summary of the most recent time evolution computation Used in stats calculations and for data dumping

TSlotCompDynUpdate(dynamics[, params])

Timeslot Computer - Dynamic Update

TSlotCompUpdateAll(dynamics[, params])

Timeslot Computer - Update All Updates all dynamics generators, propagators and evolutions when ctrl amplitudes are updated

TimeslotComputer(dynamics[, params])

Base class for all Timeslot Computers Note: this must be instantiated with a Dynamics object, that is the container for the data that the methods operate on

class qutip_qtrl.tslotcomp.EvoCompSummary[source]

A summary of the most recent time evolution computation Used in stats calculations and for data dumping

Attributes:
evo_dump_idxint

Index of the linked dump.EvoCompDumpItem None if no linked item

iter_numint

Iteration number of the pulse optimisation None if evolution compute outside of a pulse optimisation

fid_func_call_numint

Fidelity function call number of the pulse optimisation None if evolution compute outside of a pulse optimisation

grad_func_call_numint

Gradient function call number of the pulse optimisation None if evolution compute outside of a pulse optimisation

num_amps_changedint

Number of control timeslot amplitudes changed since previous evolution calculation

num_timeslots_changedint

Number of timeslots in which any amplitudes changed since previous evolution calculation

wall_time_dyn_gen_computefloat

Time spent computing dynamics generators (in seconds of elapsed time)

wall_time_prop_computefloat

Time spent computing propagators (including and propagator gradients) (in seconds of elapsed time)

wall_time_fwd_prop_computefloat

Time spent computing the forward evolution of the system see dynamics.fwd_evo (in seconds of elapsed time)

wall_time_onwd_prop_computefloat

Time spent computing the ‘backward’ evolution of the system see dynamics.onwd_evo and dynamics.onto_evo (in seconds of elapsed time)

class qutip_qtrl.tslotcomp.TSlotCompDynUpdate(dynamics, params=None)[source]

Timeslot Computer - Dynamic Update

Warning

CURRENTLY HAS ISSUES (AJGP 2014-10-02) and is therefore not being maintained i.e. changes made to _UpdateAll are not being implemented here

Updates only the dynamics generators, propagators and evolutions as required when a subset of the ctrl amplitudes are updated. Will update all if all amps have changed.

compare_amps(new_amps)[source]

Determine which timeslots will have changed Hamiltonians i.e. any where control amplitudes have changed for that slot and mark (using masks) them and corresponding exponentiations and time evo operators for update Returns: True if amplitudes are the same, False if they have changed

flag_all_calc_now()[source]

Flags all Hamiltonians, propagators and propagations to be calculated now

get_timeslot_for_fidelity_calc()[source]

Returns the timeslot index that will be used calculate current fidelity value. Attempts to find a timeslot where the least number of propagator calculations will be required. Flags the associated evolution operators for calculation now

init_comp()[source]

Initialise the flags

recompute_evolution()[source]

Recalculates the evo_init2t (forward) and evo_t2targ (onward) time evolution operators DynGen (Hamiltonians etc) and prop (propagator) are calculated as necessary

class qutip_qtrl.tslotcomp.TSlotCompUpdateAll(dynamics, params=None)[source]

Timeslot Computer - Update All Updates all dynamics generators, propagators and evolutions when ctrl amplitudes are updated

compare_amps(new_amps)[source]

Determine if any amplitudes have changed. If so, then mark the timeslots as needing recalculation Returns: True if amplitudes are the same, False if they have changed

get_timeslot_for_fidelity_calc()[source]

Returns the timeslot index that will be used calculate current fidelity value. This (default) method simply returns the last timeslot

recompute_evolution()[source]

Recalculates the evolution operators. Dynamics generators (e.g. Hamiltonian) and prop (propagators) are calculated as necessary

class qutip_qtrl.tslotcomp.TimeslotComputer(dynamics, params=None)[source]

Base class for all Timeslot Computers Note: this must be instantiated with a Dynamics object, that is the container for the data that the methods operate on

Attributes:
log_levelinteger

level of messaging output from the logger. Options are attributes of qutip_qtrl.logging_utils, in decreasing levels of messaging, are: DEBUG_INTENSE, DEBUG_VERBOSE, DEBUG, INFO, WARN, ERROR, CRITICAL Anything WARN or above is effectively ‘quiet’ execution, assuming everything runs as expected. The default NOTSET implies that the level will be taken from the QuTiP settings file, which by default is WARN

evo_comp_summaryEvoCompSummary

A summary of the most recent evolution computation Used in the stats and dump Will be set to None if neither stats or dump are set

apply_params(params=None)[source]

Set object attributes based on the dictionary (if any) passed in the instantiation, or passed as a parameter This is called during the instantiation automatically. The key value pairs are the attribute name and value Note: attributes are created if they do not exist already, and are overwritten if they do.

dump_current()[source]

Store a copy of the current time evolution