From 4ef752ed9e2569beac8b4e39f7a2ce215a724190 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 11 Jun 2024 17:22:12 +0000 Subject: [PATCH] build based on ac4d768 --- dev/.documenter-siteinfo.json | 2 +- dev/api/index.html | 4 ++-- dev/examples/index.html | 2 +- dev/externals/index.html | 2 +- dev/index.html | 2 +- dev/objects.inv | Bin 2219 -> 2219 bytes dev/overview/index.html | 2 +- dev/references/index.html | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 474be39..143a49f 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-05-24T07:25:03","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-11T17:22:06","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index ba0065d..98a84b6 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,3 +1,3 @@ -API · Krotov.jl

API

Krotov.KrotovResultType

Result object returned by optimize_krotov.

Attributes

The attributes of a KrotovResult object include

  • iter: The number of the current iteration
  • J_T: The value of the final-time functional in the current iteration
  • J_T_prev: The value of the final-time functional in the previous iteration
  • tlist: The time grid on which the control are discetized.
  • guess_controls: A vector of the original control fields (each field discretized to the points of tlist)
  • optimized_controls: A vector of the optimized control fileds in the current iterations
  • records: A vector of tuples with values returned by an info_hook routine passed to optimize
  • converged: A boolean flag on whether the optimization is converged. This may be set to true by a check_convergence function.
  • message: A message string to explain the reason for convergence. This may be set by a check_convergence function.

All of the above attributes may be referenced in a check_convergence function passed to optimize(problem; method=Krotov)

source
Krotov.print_tableMethod

Print optimization progress as a table.

This functions serves as the default info_hook for an optimization with Krotov's method.

source
QuantumControlBase.optimizeMethod
using Krotov
-result = optimize(problem; method=Krotov, kwargs...)

optimizes the given control problem using Krotov's method, returning a KrotovResult.

Keyword arguments that control the optimization are taken from the keyword arguments used in the instantiation of problem; any of these can be overriden with explicit keyword arguments to optimize.

Required problem keyword arguments

  • J_T: A function J_T(ϕ, trajectories) that evaluates the final time functional from a list ϕ of forward-propagated states and problem.trajectories.

Recommended problem keyword arguments

  • lambda_a=1.0: The inverse Krotov step width λ_a for every pulse.
  • update_shape=(t->1.0): A function S(t) for the "update shape" that scales the update for every pulse

If different controls require different lambda_a or update_shape, a dict pulse_options must be given instead of a global lambda_a and update_shape, see below.

Optional problem keyword arguments

The following keyword arguments are supported (with default values):

  • pulse_options: A dictionary that maps every control (as obtained by get_controls from the problem.trajectories) to the following dict:

    • :lambda_a: The value for inverse Krotov step width λₐ
    • :update_shape: A function S(t) for the "update shape" that scales the Krotov pulse update.

    This overrides the global lambda_a and update_shape arguments.

  • chi: A function chi!(χ, ϕ, trajectories) what receives a list ϕ of the forward propagated states and must set $|χₖ⟩ = -∂J_T/∂⟨ϕₖ|$. If not given, it will be automatically determined from J_T via make_chi with the default parameters.

  • sigma=nothing: Function that calculate the second-order contribution. If not given, the first-order Krotov method is used.

  • iter_start=0: the initial iteration number

  • iter_stop=5000: the maximum iteration number

  • prop_method: The propagation method to use for each trajectory, see below.

  • update_hook: A function that receives the Krotov workspace, the iteration number, the list of updated pulses and the list of guess pulses as positional arguments. The function may mutate any of its arguments. This may be used e.g. to apply a spectral filter to the updated pulses or to perform similar manipulations.

  • info_hook: A function (or tuple of functions) that receives the same arguments as update_hook, in order to write information about the current iteration to the screen or to a file. The default info_hook prints a table with convergence information to the screen. Runs after update_hook. The info_hook function may return a tuple, which is stored in the list of records inside the KrotovResult object.

  • check_convergence: a function to check whether convergence has been reached. Receives a KrotovResult object result, and should set result.converged to true and result.message to an appropriate string in case of convergence. Multiple convergence checks can be performed by chaining functions with . The convergence check is performed after any calls to update_hook and info_hook.

  • verbose=false: If true, print information during initialization

  • rethrow_exceptions: By default, any exception ends the optimization, but still returns a KrotovResult that captures the message associated with the exception. This is to avoid losing results from a long-running optimization when an exception occurs in a later iteration. If rethrow_exceptions=true, instead of capturing the exception, it will be thrown normally.

Trajectory propagation

Krotov's method involves the forward and backward propagation for every Trajectory in the problem. The keyword arguments for each propagation (see propagate) are determined from any properties of each Trajectory that have a prop_ prefix, cf. init_prop_trajectory.

In situations where different parameters are required for the forward and backward propagation, instead of the prop_ prefix, the fw_prop_ and bw_prop_ prefix can be used, respectively. These override any setting with the prop_ prefix. This applies both to the properties of each Trajectory and the problem keyword arguments.

Note that the propagation method for each propagation must be specified. In most cases, it is sufficient (and recommended) to pass a global prop_method problem keyword argument.

source
+API · Krotov.jl

API

Krotov.KrotovResultType

Result object returned by optimize_krotov.

Attributes

The attributes of a KrotovResult object include

  • iter: The number of the current iteration
  • J_T: The value of the final-time functional in the current iteration
  • J_T_prev: The value of the final-time functional in the previous iteration
  • tlist: The time grid on which the control are discetized.
  • guess_controls: A vector of the original control fields (each field discretized to the points of tlist)
  • optimized_controls: A vector of the optimized control fileds in the current iterations
  • records: A vector of tuples with values returned by an info_hook routine passed to optimize
  • converged: A boolean flag on whether the optimization is converged. This may be set to true by a check_convergence function.
  • message: A message string to explain the reason for convergence. This may be set by a check_convergence function.

All of the above attributes may be referenced in a check_convergence function passed to optimize(problem; method=Krotov)

source
Krotov.print_tableMethod

Print optimization progress as a table.

This functions serves as the default info_hook for an optimization with Krotov's method.

source
QuantumControlBase.optimizeMethod
using Krotov
+result = optimize(problem; method=Krotov, kwargs...)

optimizes the given control problem using Krotov's method, returning a KrotovResult.

Keyword arguments that control the optimization are taken from the keyword arguments used in the instantiation of problem; any of these can be overriden with explicit keyword arguments to optimize.

Required problem keyword arguments

  • J_T: A function J_T(ϕ, trajectories) that evaluates the final time functional from a list ϕ of forward-propagated states and problem.trajectories.

Recommended problem keyword arguments

  • lambda_a=1.0: The inverse Krotov step width λ_a for every pulse.
  • update_shape=(t->1.0): A function S(t) for the "update shape" that scales the update for every pulse

If different controls require different lambda_a or update_shape, a dict pulse_options must be given instead of a global lambda_a and update_shape, see below.

Optional problem keyword arguments

The following keyword arguments are supported (with default values):

  • pulse_options: A dictionary that maps every control (as obtained by get_controls from the problem.trajectories) to the following dict:

    • :lambda_a: The value for inverse Krotov step width λₐ
    • :update_shape: A function S(t) for the "update shape" that scales the Krotov pulse update.

    This overrides the global lambda_a and update_shape arguments.

  • chi: A function chi!(χ, ϕ, trajectories) what receives a list ϕ of the forward propagated states and must set $|χₖ⟩ = -∂J_T/∂⟨ϕₖ|$. If not given, it will be automatically determined from J_T via make_chi with the default parameters.

  • sigma=nothing: Function that calculate the second-order contribution. If not given, the first-order Krotov method is used.

  • iter_start=0: the initial iteration number

  • iter_stop=5000: the maximum iteration number

  • prop_method: The propagation method to use for each trajectory, see below.

  • update_hook: A function that receives the Krotov workspace, the iteration number, the list of updated pulses and the list of guess pulses as positional arguments. The function may mutate any of its arguments. This may be used e.g. to apply a spectral filter to the updated pulses or to perform similar manipulations.

  • info_hook: A function (or tuple of functions) that receives the same arguments as update_hook, in order to write information about the current iteration to the screen or to a file. The default info_hook prints a table with convergence information to the screen. Runs after update_hook. The info_hook function may return a tuple, which is stored in the list of records inside the KrotovResult object.

  • check_convergence: a function to check whether convergence has been reached. Receives a KrotovResult object result, and should set result.converged to true and result.message to an appropriate string in case of convergence. Multiple convergence checks can be performed by chaining functions with . The convergence check is performed after any calls to update_hook and info_hook.

  • verbose=false: If true, print information during initialization

  • rethrow_exceptions: By default, any exception ends the optimization, but still returns a KrotovResult that captures the message associated with the exception. This is to avoid losing results from a long-running optimization when an exception occurs in a later iteration. If rethrow_exceptions=true, instead of capturing the exception, it will be thrown normally.

Trajectory propagation

Krotov's method involves the forward and backward propagation for every Trajectory in the problem. The keyword arguments for each propagation (see propagate) are determined from any properties of each Trajectory that have a prop_ prefix, cf. init_prop_trajectory.

In situations where different parameters are required for the forward and backward propagation, instead of the prop_ prefix, the fw_prop_ and bw_prop_ prefix can be used, respectively. These override any setting with the prop_ prefix. This applies both to the properties of each Trajectory and the problem keyword arguments.

Note that the propagation method for each propagation must be specified. In most cases, it is sufficient (and recommended) to pass a global prop_method problem keyword argument.

source
diff --git a/dev/examples/index.html b/dev/examples/index.html index 8ee83c0..a443a11 100644 --- a/dev/examples/index.html +++ b/dev/examples/index.html @@ -1,2 +1,2 @@ -Examples · Krotov.jl
+Examples · Krotov.jl
diff --git a/dev/externals/index.html b/dev/externals/index.html index 9d7ef34..d1599ff 100644 --- a/dev/externals/index.html +++ b/dev/externals/index.html @@ -267,4 +267,4 @@ norm_min=1e-15, enlarge=true )

uses Arnoldi iteration with state as the starting vector. It approximates the eigenvalues of H with between m_min and m_max Ritz values, until the lowest and highest eigenvalue are stable to a relative precision of prec. The norm_min parameter is passed to the underlying arnoldi!.

If enlarge=true (default) the returned E_min and E_max will be enlarged via a heuristic to slightly over-estimate the spectral radius instead of under-estimating it.

source
QuantumPropagators.SpectralRange.specrangeMethod
E_min, E_max = specrange(H, :diag)

uses exact diagonization via the standard eigvals function to obtain the smallest and largest eigenvalue. This should only be used for relatively small matrices.

source
QuantumPropagators.SpectralRange.specrangeMethod
E_min, E_max = specrange(H, :manual; E_min, E_max)

directly returns the given E_min and E_max without considering H.

source
QuantumPropagators.SpectralRange.specrangeMethod

Calculate the spectral range of a Hamiltonian H on the real axis.

E_min, E_max = specrange(H; method=:auto, kwargs...)

calculates the approximate lowest and highest eigenvalues of H. Any imaginary part in the eigenvalues is ignored: the routine is intended for (although not strictly limited to) a Hermitian H.

This delegates to

specrange(H, method; kwargs...)

for the different methods.

The default method=:auto chooses the best method for the given H. This is :diag for small matrices, and :arnoldi otherwise. If both E_min and E_max are given in the kwargs, those will be returned directly (method=:manual).

Keyword arguments not relevant to the underlying implementation will be ignored.

source
QuantumPropagators.Newton.NewtonWrkType
NewtonWrk(v0, m_max=10)

Workspace for the Newton-with-restarted-Arnoldi propagation routine.

Initializes the workspace for the propagation of a vector v0, using a maximum Krylov dimension of m_max in each restart iteration. Note that m_max should be smaller than the length of v0.

source
QuantumPropagators.Newton.extend_leja!Method
extend_leja!(leja, n, newpoints, n_use)

Given an array of n (ordered) Leja points, extract n_use points from newpoints, and append them to the existing Leja points. The array leja should be sufficiently large to hold the new Leja points, which are appended after index n_old. It will be re-allocated if necessary and may have a size of up to 2*(n+n_use).

Arguments

  • leja: Array of leja values. Must contain the "old" leja values to be kept in leja(0:n-1). On output, n_use new leja points will be in leja(n+:n+n_use-1), for the original value of n. The leja array must use zero-based indexing.
  • n: On input, number of "old" leja points in leja. On output, total number of leja points (i.e. n=n+n_use)
  • newpoints: On input, candidate points for new leja points. The n_use best values will be chosen and added to leja. On output, the values of new_points are undefined.
  • n_use: Number of points that should be added to leja
source
QuantumPropagators.Newton.extend_newton_coeffs!Method
extend_newton_coeffs!(a, n_a, leja, func, n_leja, radius)

Extend the array a of existing Newton coefficients for the expansion of the func from n_a coefficients to n_leja coefficients. Return a new value n_a=n_a+n_leja with the total number of Newton coefficients in the updated a.

Arguments

  • a: On input, a zero-based array of length n_a or greater, containing Newton coefficients. On output, array containing a total n_leja coefficients. The array a will be resized if necessary, and may have a length greater than n_leja on output
  • n_a: The number of Newton coefficients in a, on input. Elements of a beyond the first n_a elements will be overwritten.
  • leja: Array of normalized Leja points, containing at least n_leja elements.
  • func: Function for which to calculate Newton coefficients
  • n_leja: The number of elements in leja to use for calculating new coefficients, and the total number of Newton coefficients on output
  • radius: Normalization radius for divided differences
source
QuantumPropagators.Newton.newton!Method
newton!(Ψ, H, dt, wrk; func=(z -> exp(-1im*z)), norm_min=1e-14, relerr=1e-12,
-        max_restarts=50, _...)

Evaluate Ψ = func(H*dt) Ψ using a Newton-with-restarted-Arnoldi scheme.

Arguments

  • Ψ: The state to propagate, will be overwritten in-place with the propagated state
  • H: Operator acting on Ψ. Together with dt, this is the argument to func
  • dt: Implicit time step. Together with H, this is the argument to func
  • wkr: Work array, initialized with NewtonWrk
  • func: The function to apply to H dt, taking a single (scalar) complex-valued argument z in place of H dt. The default func is to evaluate the time evaluations operator for the Schrödinger equation
  • norm_min: the minimum norm at which to consider a state similar to Ψ as zero
  • relerr: The relative error defining the convergence condition for the restart iteration. Propagation stops when the norm of the accumulated Ψ is stable up to the given relative error
  • max_restarts: The maximum number of restart iterations. Exceeding max_restarts will throw an AssertionError.

All other keyword arguments are ignored.

source
QuantumPropagators.Cheby.ChebyWrkType

Workspace for the Chebychev propagation routine.

ChebyWrk(Ψ, Δ, E_min, dt; limit=1e-12)

initializes the workspace for the propagation of a state similar to Ψ under a Hamiltonian with eigenvalues between E_min and E_min + Δ, and a time step dt. Chebychev coefficients smaller than the given limit are discarded.

source
QuantumPropagators.Cheby.cheby!Method

Evaluate Ψ = exp(-𝕚 * H * dt) Ψ in-place.

cheby!(Ψ, H, dt, wrk; E_min=nothing, check_normalization=false)

Arguments

  • Ψ: on input, initial vector. Will be overwritten with result.
  • H: Hermitian operator
  • dt: time step
  • wrk: internal workspace
  • E_min: minimum eigenvalue of H, to be used instead of the E_min from the initialization of wrk. The same wrk may be used for different values E_min, as long as the spectra radius Δ and the time step dt are the same as those used for the initialization of wrk.
  • check_normalizataion: perform checks that the H does not exceed the spectral radius for which the the workspace was initialized.

The routine will not allocate any internal storage. This implementation requires copyto! lmul!, and axpy! to be implemented for Ψ, and the three-argument mul! for Ψ and H.

source
QuantumPropagators.Cheby.chebyMethod

Evaluate Ψ = exp(-𝕚 * H * dt) Ψ.

Ψ_out = cheby(Ψ, H, dt, wrk; E_min=nothing, check_normalization=false)

acts like cheby! but does not modify Ψ in-place.

source
QuantumPropagators.Cheby.cheby_coeffs!Function

Calculate Chebychev coefficients in-place.

n::Int = cheby_coeffs!(coeffs, Δ, dt, limit=1e-12)

overwrites the first n values in coeffs with new coefficients larger than limit for the given new spectral radius Δ and time step dt. The coeffs array will be resized if necessary, and may have a length > n on exit.

See also cheby_coeffs for an non-in-place version.

source
QuantumPropagators.Cheby.cheby_coeffsMethod

Calculate Chebychev coefficients.

a::Vector{Float64} = cheby_coeffs(Δ, dt; limit=1e-12)

return an array of coefficiencts larger than limit.

Arguments

  • Δ: the spectral radius of the underlying operator
  • dt: the time step

See also cheby_coeffs! for an in-place version.

source
+ max_restarts=50, _...)

Evaluate Ψ = func(H*dt) Ψ using a Newton-with-restarted-Arnoldi scheme.

Arguments

All other keyword arguments are ignored.

source
QuantumPropagators.Cheby.ChebyWrkType

Workspace for the Chebychev propagation routine.

ChebyWrk(Ψ, Δ, E_min, dt; limit=1e-12)

initializes the workspace for the propagation of a state similar to Ψ under a Hamiltonian with eigenvalues between E_min and E_min + Δ, and a time step dt. Chebychev coefficients smaller than the given limit are discarded.

source
QuantumPropagators.Cheby.cheby!Method

Evaluate Ψ = exp(-𝕚 * H * dt) Ψ in-place.

cheby!(Ψ, H, dt, wrk; E_min=nothing, check_normalization=false)

Arguments

  • Ψ: on input, initial vector. Will be overwritten with result.
  • H: Hermitian operator
  • dt: time step
  • wrk: internal workspace
  • E_min: minimum eigenvalue of H, to be used instead of the E_min from the initialization of wrk. The same wrk may be used for different values E_min, as long as the spectra radius Δ and the time step dt are the same as those used for the initialization of wrk.
  • check_normalizataion: perform checks that the H does not exceed the spectral radius for which the the workspace was initialized.

The routine will not allocate any internal storage. This implementation requires copyto! lmul!, and axpy! to be implemented for Ψ, and the three-argument mul! for Ψ and H.

source
QuantumPropagators.Cheby.chebyMethod

Evaluate Ψ = exp(-𝕚 * H * dt) Ψ.

Ψ_out = cheby(Ψ, H, dt, wrk; E_min=nothing, check_normalization=false)

acts like cheby! but does not modify Ψ in-place.

source
QuantumPropagators.Cheby.cheby_coeffs!Function

Calculate Chebychev coefficients in-place.

n::Int = cheby_coeffs!(coeffs, Δ, dt, limit=1e-12)

overwrites the first n values in coeffs with new coefficients larger than limit for the given new spectral radius Δ and time step dt. The coeffs array will be resized if necessary, and may have a length > n on exit.

See also cheby_coeffs for an non-in-place version.

source
QuantumPropagators.Cheby.cheby_coeffsMethod

Calculate Chebychev coefficients.

a::Vector{Float64} = cheby_coeffs(Δ, dt; limit=1e-12)

return an array of coefficiencts larger than limit.

Arguments

  • Δ: the spectral radius of the underlying operator
  • dt: the time step

See also cheby_coeffs! for an in-place version.

source
diff --git a/dev/index.html b/dev/index.html index 109397e..360aece 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · Krotov.jl
+Home · Krotov.jl
diff --git a/dev/objects.inv b/dev/objects.inv index 7c45e533da4b098fbf3d89f7978e4ee1b060f0a7..96598af9069e577d88e97993e6b2bd3a072d77e3 100644 GIT binary patch delta 12 TcmZ22xLR<6Bct&~r%Vn28^QzP delta 12 TcmZ22xLR<6Bcstqr%Vn28@&VJ diff --git a/dev/overview/index.html b/dev/overview/index.html index f2dab44..2fb416b 100644 --- a/dev/overview/index.html +++ b/dev/overview/index.html @@ -1,2 +1,2 @@ -Overview · Krotov.jl
+Overview · Krotov.jl
diff --git a/dev/references/index.html b/dev/references/index.html index 327a9cd..d4b22f1 100644 --- a/dev/references/index.html +++ b/dev/references/index.html @@ -1,2 +1,2 @@ -References · Krotov.jl

References

[1]
V. F. Krotov. Global Methods in Optimal Control (Dekker, New York, NY, USA, 1996).
[2]
J. Somlói, V. A. Kazakov and D. J. Tannor. Controlled dissociation of I$_2$ via optical transitions between the X and B electronic states. Chem. Phys. 172, 85 (1993).
[3]
A. Bartana, R. Kosloff and D. J. Tannor. Laser cooling of internal degrees of freedom. II. J. Chem. Phys. 106, 1435 (1997).
[4]
J. P. Palao and R. Kosloff. Optimal control theory for unitary transformations. Phys. Rev. A 68, 062308 (2003).
[5]
D. M. Reich, M. Ndong and C. P. Koch. Monotonically convergent optimization in quantum control using Krotov's method. J. Chem. Phys. 136, 104103 (2012).
[6]
M. H. Goerz, D. Basilewitsch, F. Gago-Encinas, M. G. Krauss, K. P. Horn, D. M. Reich and C. P. Koch. Krotov: A Python implementation of Krotov's method for quantum optimal control. SciPost Phys. 7, 080 (2019).
[7]
M. H. Goerz, S. C. Carrasco and V. S. Malinovsky. Quantum Optimal Control via Semi-Automatic Differentiation. Quantum 6, 871 (2022).
[8]
M. H. Goerz, D. M. Reich and C. P. Koch. Optimal control theory for a unitary operation under dissipative evolution. New J. Phys. 16, 055012 (2014).
[9]
S. Machnes, E. Assémat, D. Tannor and F. K. Wilhelm. Tunable, Flexible, and Efficient Optimization of Control Pulses for Practical Qubits. Phys. Rev. Lett. 120, 150401 (2018).
[10]
T. Caneva, T. Calarco and S. Montangero. Chopped random-basis quantum optimization. Phys. Rev. A 84, 022326 (2011).
+References · Krotov.jl

References

[1]
V. F. Krotov. Global Methods in Optimal Control (Dekker, New York, NY, USA, 1996).
[2]
J. Somlói, V. A. Kazakov and D. J. Tannor. Controlled dissociation of I$_2$ via optical transitions between the X and B electronic states. Chem. Phys. 172, 85 (1993).
[3]
A. Bartana, R. Kosloff and D. J. Tannor. Laser cooling of internal degrees of freedom. II. J. Chem. Phys. 106, 1435 (1997).
[4]
J. P. Palao and R. Kosloff. Optimal control theory for unitary transformations. Phys. Rev. A 68, 062308 (2003).
[5]
D. M. Reich, M. Ndong and C. P. Koch. Monotonically convergent optimization in quantum control using Krotov's method. J. Chem. Phys. 136, 104103 (2012).
[6]
M. H. Goerz, D. Basilewitsch, F. Gago-Encinas, M. G. Krauss, K. P. Horn, D. M. Reich and C. P. Koch. Krotov: A Python implementation of Krotov's method for quantum optimal control. SciPost Phys. 7, 080 (2019).
[7]
M. H. Goerz, S. C. Carrasco and V. S. Malinovsky. Quantum Optimal Control via Semi-Automatic Differentiation. Quantum 6, 871 (2022).
[8]
M. H. Goerz, D. M. Reich and C. P. Koch. Optimal control theory for a unitary operation under dissipative evolution. New J. Phys. 16, 055012 (2014).
[9]
S. Machnes, E. Assémat, D. Tannor and F. K. Wilhelm. Tunable, Flexible, and Efficient Optimization of Control Pulses for Practical Qubits. Phys. Rev. Lett. 120, 150401 (2018).
[10]
T. Caneva, T. Calarco and S. Montangero. Chopped random-basis quantum optimization. Phys. Rev. A 84, 022326 (2011).