QuantumControlTestUtils
The QuantumControlTestUtils package collects methods that are used for testing and benchmarking within the JuliaQuantumControl organization
QuantumControlTestUtils.RandomObjects.random_dynamic_generator — Method
Construct the terms of a random dynamic generator (time-dependent Hamiltonian).
using QuantumPropagators: hamiltonian
tlist = collect(range(0, 100, length=1001))
Ĥ = hamiltonian(random_dynamic_generator(N, tlist; kwargs...)...)returns a tuple of terms that can be passed to QuantumPropagators.hamiltonian (or QuantumControl.hamiltonian) to obtain a Generator. The terms are the random drift operator followed by tuples (Ĥₗ, ϵₗ) of a random control operator Ĥₗ and a control amplitude ϵₗ. QuantumControlTestUtils does not depend on QuantumPropagators, so it does not construct the Generator itself.
By default, the terms describe a real Hermitian generator of dimension N. The generator consists of one random drift term and one random control term with a random control amplitude value ∈ [-1, 1] for each interval of the given tlist. The spectral envelope of the generator will be 1.0. That is, the largest absolute eigenvalue at any point in time should be less than 1.0. The larger N, the more tightly the envelope will fit.
Keyword arguments
number_of_controls=1: The number of control terms in the generator.density=1.0: A number > 0.0 and ≤ 1.0. Any value < 1.0 implies a sparse matrix wheredensityis the approximate fraction of non-zero elements to total elementscomplex=false: Whether the matrix should be real-valued (default) or complex-valuedhermitian=false: Whether the matrix should be Hermitian (have real eigenvalues, default) or non-Hermitian (eigenvalues in the complex plane with a circle of thespectral_envelope)spectral_envelope=1.0: An upper bound for the spectral radius for the generator evaluated at different points in time. For largeN, the spectral envelope should be approximately touched for the extremal pulse amplitudes, ±1. Note that the average spectral radius is always well within the spectral_envelope`)exact_spectral_envelope=false: If true, the spectral radius when plugging in the extremal pulse amplitudes ±1 will touch exactly the specifiedspectral_envelope. This is done via diagonalization, so it is only feasible for moderately large dimensionsN.amplitudes: If given, a vector of amplitudes to use in the generator. Must be of lengthnumber_of_controls. This can be used to supersede the creation of random control pulses.rng=Random.GLOBAL_RNG: The random number generator to use. The callRandom.rand(rng, N, N)must produces a real-valued $N×N$ matrix with elements uniformly distributed between 0 and 1
See also
random_matrix— generate a static random Hamiltonian
QuantumControlTestUtils.RandomObjects.random_matrix — Method
Construct a random matrix.
Ĥ = random_matrix(N; kwargs...)by default initializes Ĥ as a general complex $N×N$ matrix with a spectral radius of approximately 1.0. Keyword arguments allow to initialize real or complex, Hermitian or non-Hermitian, dense or sparse matrices with arbitrary spectral radius. The non-zero entries in Ĥ will be uniformly distributed around zero, with a range of values that depends on N and the desired spectral radius.
Keyword arguments
density=1.0: A number > 0.0 and ≤ 1.0. Any value < 1.0 implies a sparse matrix wheredensityis the approximate fraction of non-zero elements to total elementscomplex=true: Whether the matrix should be complex-valued (default) or real-valuedhermitian=false: Whether the matrix should be general (default) or Hermitian (real eigenvalues)spectral_radius=1.0: The approximate spectral radius, i.e. maximum absolute eigenvalue. This is according to Girko-Ginibri's circular law, in the limit of large $N$exact_spectral_radius=false: If given astrue, ensure that thespectral_radiusis exact. This is done via diagonalization, so it is only feasible for moderately large dimensionsN. On the other hand, for largeN, thespectral_radius, respectively the circular law becomes more exact anyway.rng=Random.GLOBAL_RNG: The random number generator to use. The callRandom.rand(rng, N, N)must produces a real-valued $N×N$ matrix with elements uniformly distributed between 0 and 1
See also
random_dynamic_generator— generate a time-dependent random
Hamiltonian.
QuantumControlTestUtils.RandomObjects.random_state_vector — Method
Return a random, normalized Hilbert space state vector of dimension N.
random_state_vector(N; rng=GLOBAL_RNG)