Control Functions

The only requirement we have of a control function is that

Controls are implemented as subtypes of the AbstractControl abstract type.

Each control has an associated control vector length, which is included as a parameter of the control object. Some controls have half of their control parameters control the real part, while the reamaining half control the imaginary part. By convention, when this is the case we reserve the first half of the control vector for the real-associated parameters, and the second half for the imaginary-associated parameters (as opposed to alternating them).

When controls are gathered together in a vector, the collective control vector will just be the concatenation of all the individual control vectors.

QuantumGateDesign.AbstractControlType

Abstract supertype for all controls.

Every concrete subtype must have the following methods defined:

Methods

  • eval_p(control::AbstractControl, t::Real, pcof::AbstractVector{<: Real})
  • eval_q(control::AbstractControl, t::Real, pcof::AbstractVector{<: Real})

Every concrete subtype must have the following parameters:

Parameters

  • N_coeff::Int
  • tf::Float64

The following methods can also be handwritten for efficiency, but have defaults implemented using automatic differentiation (currently broken):

Optional Methods

  • eval_p_derivative
  • eval_q_derivative
  • eval_grad_p_derivative
  • eval_grad_q_derivative
source
QuantumGateDesign.HermiteControlType
HermiteControl(N_points, tf, N_derivatives; [scaling_type=:Heuristic])

Construct a control that is a Hermite interpolating polynomial of the values and first N_derivatives derivatives at N_points evenly spaced points. The control vector gives the values and the derivatives (scaled depending on scaling_type).

Notes

Working on making this non-allocating and non-repeating.

Also remember to eventually change when the 1/j! is applied, for better numerical stability

Note: I can use a high-order hermite control for a low order method, and pcof still works the same way.

And for pcof, it is convenient to just reshape a matrix whose columns are the derivatives

source
QuantumGateDesign.HermiteCarrierControlType
HermiteCarrierControl(N_points, tf, N_derivatives, carrier_wave_freqs; [scaling_type=:Heuristic])

Construct a control that is the sum of Hermite interpolating polynomials of the values and first N_derivatives derivatives at N_points evenly spaced points, multiplied by carrier waves. The control vector gives the values and the derivatives (scaled depending on scaling_type) for each of the polynomials multiplied by carrier waves.

Notes

Working on making this non-allocating and non-repeating.

Also remember to eventually change when the 1/j! is applied, for better numerical stability

Note: I can use a high-order hermite control for a low order method, and pcof still works the same way.

And for pcof, it is convenient to just reshape a matrix whose columns are the derivatives

Static arrays could be useful here. Wouldn't have such a big struct, could just construct them inline on the stack. Just need a N_derivatives struct parameter.

Idea: Have a version for which we specify N derivatives in pcof, but we use N+M derivatives, which the remainder always being 0. That way we have highly smooth controls, but we don't have as many control parameters. (right now, 3 carrier waves, 2 points each, 3 derivatives each, uses 48 parameters.)

Also, as I have more derivatives actually controlled by pcof, the more parameters I have affecting each time interval. Not sure how much that matters, but with B-splines they seemed to think it was good that each point is affected by at most 3 parameters. In my case, that number is 2*(1+N_derivatives)

source