Enumerations
Parameters
CtrlVQE.Parameters
— ModuleParameters
Standardized interface for interacting with variational parameters.
Most commonly encountered when implementing Signals
and Devices
.
CtrlVQE.Parameters.bind!
— Functionbind!(entity, x̄::AbstractVector)
Assigns new values for each variational parameter in entity
.
Implementation
This method should mutate entity
such that, for example, the expression bind!(entity, x̄); ȳ = values(entity); x̄ == ȳ
evaluates true. The method should return entity
, in accordance with Julia's style guidelines for mutating functions.
CtrlVQE.Parameters.count
— Functioncount(entity)
The number of variational parameters in entity
.
Implementation
Must return a non-negative integer.
CtrlVQE.Parameters.names
— Functionnames(entity)
An ordered list of human-readable names for each variational parameter in entity
.
Implementation
Must return a vector of strings.
CtrlVQE.Parameters.validate
— Methodvalidateparameters(entity)
Validate an entity satisfies the Parameters
interface.
CtrlVQE.Parameters.values
— Functionvalues(entity)
An ordered list of the numerical values for each variational parameter in entity
.
The resulting array should be treated as read-only, since whether it is or isn't "backed" by entity
is not enforced. That means changes to the resulting array MAY or MAY NOT modfiy entity
. So don't do it!
Implementation
Must return a vector of some float type.
If at all possible, avoid allocating a new array when calling this function.
Validation
CtrlVQE.Validation
— ModuleValidation
Standardized interface for ensuring user-defined types are consistent with the interface.
CtrlVQE.Validation.validate
— Functionvalidate(type)
Check that type
is consistent with the interface defined by its supertype.
Each abstract type defined in the core interface implements its own validate
, running a suite of interface-compliance and self-consistency checks.
Each type accepts a different collection of keyword arguments:
validate(::IntegrationType)
validate(::SignalType; grid::IntegrationType, t, rms)
validate(::DeviceType; grid::IntegrationType, t)
validate(::EvolutionType; grid::IntegrationType, device::DeviceType, skipgradient)
validate(::CostFunctionType; x, rms)
validate(::EnergyFunction; grid::IntegrationType, device::DeviceType, x, rms)
- If
grid
anddevice
are omitted, relevant tests will be skipped.- Note in particular that
validate(::EvolutionType)
requires both in order to validate any evolution at all! - Also note that
validate(::EnergyFunction)
requires both for any validations special to energy functions, and they must be consistent with those used to construct the energy function, but if omitted the usual cost function tests will still occur.
- Note in particular that
t
(a single time) andx
(a vector of parameters) determine the point at which accuracy checks are conducted.t
defaults to one when omitted, and allx
default to zero.rms
is the maximum root mean square error permitted between analytical gradients and finite differences. It defaults tonothing
, which skips the finite difference altogether.skipgradient
is a flag indicating whether to skip anlaytical gradient validation, useful for evolution types that don't bother to implementgradientsignals
.
CtrlVQE.Validation.@withresult
— Macroresult = @withresult fn(args...; kwargs...)
Validate that a function accepting an optional result
kwarg calculates the same value with and without result
, and that, with result
, the object returned is identical to the one passed.
Prototypes
CtrlVQE.Prototypes
— ModulePrototypes
Standardized interface for quickly constructing certain objects.
CtrlVQE.Prototypes.Prototype
— FunctionPrototype(::Type{T}; kwargs...)
Construct a prototypical object of type T
.
Each type accepts a different collection of keyword arguments, which is largely up to the user defining the type, depending on how flexible they'd like their prototype function to be. However, certain keyword arguments must be accepted for certain abstract types, in order for standard tests and benchmarking to work. But even these should be provided sensible default values.
Prototype(::Type{<:DeviceType}; n::Int, T::Real, kwargs...)
Prototype(::Type{<:IntegrationType}; T::Real, r::Int, kwargs...)
n
is the number of qubits.r
is the total number of time steps.T
is a default pulse duration (often but not always irrelevant inDeviceTypes
).
Operators
CtrlVQE.Operators
— ModuleOperators
Enumerates various categories of Hermitian observable related to a device.
CtrlVQE.Operators.Channel
— TypeChannel(i,t)
An individual drive term (indexed by i
) at a specific time t
.
For example, in a transmon device, Channel(q,t)
might represent $Ω_q(t) [\exp(iν_qt) a_q + \exp(-iν_qt) a_q']$, the drive for a single qubit.
Note that you are free to have multiple channels for each qubit, or channels which operate on multiple qubits.
CtrlVQE.Operators.Coupling
— TypeCoupling(), aka COUPLING
The components of the static Hamiltonian which are non-local to any one qubit.
For example, in a transmon device, Coupling()
represents the sum $∑_{p,q} g_{pq} (a_p'a_q + a_q'a_p)$.
CtrlVQE.Operators.Drive
— TypeDrive(t)
The sum of all drive terms at a specific time t
.
This represents the sum of each Channel(i,t)
, where i
iterates over each drive term in the device.
For example, in a transmon device, Drive(t)
might represent $∑_q Ω_q(t) [\exp(iν_qt) a_q + \exp(-iν_qt) a_q']$.
CtrlVQE.Operators.Gradient
— TypeGradient(j,t)
An individual gradient operator (indexed by j
) at a specific time t
.
The gradient operators appear in the derivation of each gradient signal, which are used to calculate analytical gradients of each variational parameter. The gradient operators are very closely related to individual channel operators, but sufficiently distinct that they need to be treated separately.
For example, for a transmon device, each channel operator $Ω_q(t) [\exp(iν_qt) a_q + \exp(-iν_qt) a_q']$ is associated with two gradient operators:
- $\exp(iν_qt) a_q + \exp(-iν_qt) a_q'$
- $i[\exp(iν_qt) a_q - \exp(-iν_qt) a_q']$
CtrlVQE.Operators.Hamiltonian
— TypeHamiltonian(t)
The full Hamiltonian at a specific time t
.
This represents the sum of Static()
and Drive(t)
.
CtrlVQE.Operators.Identity
— TypeIdentity(), aka IDENTITY
The identity operator.
CtrlVQE.Operators.Qubit
— TypeQubit(q)
The component of the static Hamiltonian which is local to qubit q
.
For example, in a transmon device, Qubit(2)
represents a term $ω_q a_q'a_q - δ_q/2~ a_q'a_q'a_q a_q$.
CtrlVQE.Operators.Static
— TypeStatic(), aka STATIC
All components of the static Hamiltonian.
This represents the sum of Uncoupled()
and Coupled()
CtrlVQE.Operators.Uncoupled
— TypeUncoupled(), aka UNCOUPLED
The components of the static Hamiltonian which are local to each qubit.
This represents the sum of each Qubit(q)
, where q
iterates over each qubit in the device.
For example, in a transmon device, Uncoupled()
represents the sum $∑_q (ω_q a_q'a_q - δ_q/2~ a_q'a_q'a_q a_q)$.
Bases
CtrlVQE.Bases
— ModuleBases
Enumerates various linear-algebraic bases for representing statevectors and matrices.
CtrlVQE.Bases.Bare
— TypeBare(), aka BARE
The "default" representation, defined by the localalgebra
a Device
implements.
For transmons, it is the eigenbasis of local number operators $n̂ ≡ a'a$, and generally, it is what would be called the "computational basis".
CtrlVQE.Bases.Dressed
— TypeDressed(), aka DRESSED
The eigenbasis of the static Hamiltonian associated with a Device
. Eigenvectors are ordered to maximize similarity with an identity matrix. Phases are fixed so that the diagonal is real.