API

Types

Sisyphus.HamiltonianType
Hamiltonian(const_op::op,
            ops::Vector{op}),
            drives::Function) where {op<:AbstractOperator}

Structure to represent a time-dependent Hamiltonian.

NOTE: Drives are required to be real-valued functions and should be of the form drives(p::Vector{T}, t::T) where {T<:Real}, where p is a vector of real values parametrizing the control knobs and t is the time.

source
Sisyphus.StateTransformType
StateTransform(input::Ket{B,T}, output::Ket{B,T}) where {B, T}

Represents a state to state transformation between two pure states.

source
Sisyphus.UnitaryTransformType
UnitaryTransform(inputs::Vector{Ket{B, T}}, U::Matrix) where {B, T}

Represents a unitary transformation between two sets of states. The tranformation can be initialized with a vector of kets and a unitary matrix representing the desired transformation.

source
Sisyphus.CostFunctionType
CostFunction(distance, constraints)

Defines a cost function used for optimization.

Arguments

distance denotes a distance measure between quantum states, it should be a real valued function for e.g. d(x,y) = 1 - real(x'*y) where x and y are two complex valued vectors.

constraints (optional) denotes the constraints on the shapes of pulses, it should be a real valued function

NOTE: During the optimization we minimize the total cost given by the sum of average distance (considering all states in the transform) evaluated for a given set of parameters and the constraints. i.e. d(x,y) + constraints(params).

source
Sisyphus.QOCProblemType
QOCProblem(hamiltonian::Hamiltonian{T},
           transform::Transform,
           tspan::Tuple{T,T}},
           cost::CostFunction) where {T<:Real}

Defines a quantum optimal control problem to be solved.

source
Sisyphus.AdjointSolverType
AdjointSolver

Solver to evaluate gradients by solving the coupled equations, defined for compatibility with CommonSolve interface.

source
Sisyphus.SolutionType
Solution(params)

Contains the optimized parameters after solving the QOCProblem. It also contains traces of distance and constraints specified in the CostFunction. Optionally, it contains the full trace of parameters.

source

Functions

Sisyphus.master_dynamicFunction
master_dynamic(tspan, psi, h, params, J, rates; kwargs)

Wraps master_dynamic from QuantumOptics by accepting our custom Hamiltonian structure and the parameters.

source
Sisyphus.vectorizeFunction
vectorize(k::Ket)

Returns a ket representing the vectorized form of the density matrix of ket k.

source
vectorize(trans::StateTransform)

Returns a vectorized form of the state to state transformation.

source
vectorize(trans::UnitaryTransform)

Returns a vectorized form of the unitary transformation.

source
vectorize(H, J, rates)

Vectorizes the Hamiltonian and jump operators so that they can be submitted to the Schroedinger time evolution solver. Uses the vectorization identity $\text{vec}(ABC) = (C^T \otimes A)\text{vec}(B)$.

source

Utilities

Sisyphus.heavisideFunction
heaviside(t::T) where {T <: Real}

Heaviside step function

\[H(t) = \begin{cases} 1, & t > 0 \\ 0, & t \leq 0 \end{cases}.\]

source
Sisyphus.intervalFunction
interval(t::T, a::T, b::T) where {T <: Real}

Interval function

\[ I(t; a, b) = H(t - a) - H(t - b).\]

source

GPU

CUDA.cuFunction
cu(A; unified=false)

Opinionated GPU array adaptor, which may alter the element type T of arrays:

  • For T<:AbstractFloat, it makes a CuArray{Float32} for performance reasons. (Except that Float16 and BFloat16 element types are not changed.)
  • For T<:Complex{<:AbstractFloat} it makes a CuArray{ComplexF32}.
  • For other isbitstype(T), it makes a CuArray{T}.

By contrast, CuArray(A) never changes the element type.

Uses Adapt.jl to act inside some wrapper structs.

Examples

julia> cu(ones(3)')
1×3 adjoint(::CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}) with eltype Float32:
 1.0  1.0  1.0

julia> cu(zeros(1, 3); unified=true)
1×3 CuArray{Float32, 2, CUDA.Mem.UnifiedBuffer}:
 0.0  0.0  0.0

julia> cu(1:3)
1:3

julia> CuArray(ones(3)')  # ignores Adjoint, preserves Float64
1×3 CuArray{Float64, 2, CUDA.Mem.DeviceBuffer}:
 1.0  1.0  1.0

julia> adapt(CuArray, ones(3)')  # this restores Adjoint wrapper
1×3 adjoint(::CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}) with eltype Float64:
 1.0  1.0  1.0

julia> CuArray(1:3)
3-element CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}:
 1
 2
 3
cu(h::Hamiltonian)

Converts the Hamiltonian with the operators allocated on GPU memory.

source
cu(trans::UnitaryTransform)

Returns a unitary transformation with the kets allocated on GPU memory.

source
cu(trans::StateTransform)

Returns a state to state transformation with the kets allocated on GPU memory.

source
cu(prob)

Turns a quantum optimal control problem into a form suitable for running on GPU.

source

Single precision

Base.convertMethod
convert(::Type{Float32}, prob::QOCProblem)

Returns a QOCProblem with all data in single precision.

source