Utilities Reference

These APIs collect small but frequently useful helper routines.

EDKit.gapratioFunction
gapratio(E::AbstractVector{<:Real})

Compute adjacent-gap ratios from a sorted energy spectrum E.

For consecutive level spacings δ_n = E[n+1] - E[n], this returns the vector with entries min(δ_n, δ_{n+1}) / max(δ_n, δ_{n+1}).

The input should already be sorted in ascending order.

source
EDKit.meangapratioFunction
meangapratio(E::AbstractVector{<:Real})

Return the mean adjacent-gap ratio of a sorted spectrum E.

This is a convenience wrapper around gapratio.

source
EDKit.expmFunction
expm(A, order::Integer=10)

Approximate exp(A) using a truncated Taylor expansion of the given order.

This routine is lightweight and convenient for small matrices, but it is not intended to replace the more numerically robust algorithms in dedicated linear algebra packages.

Returns:

  • An approximation to the matrix exponential of A.
source
EDKit.expvFunction
expv(A, v::AbstractVecOrMat; order=10, λ=1)

Approximate exp(λA) * v using a truncated Taylor expansion.

This avoids explicitly constructing exp(λA) and is useful for quick tests or small problems.

Returns:

  • An approximation to the action of exp(λA) on v.
source
EDKit.covmatFunction

covmat(ol::AbstractVector, v::AbstractVecOrMat{<:Number})

Return the covariant matrix for a given list of operators: Cᵢⱼ = 1/2⟨v|{hᵢ,hⱼ}|v⟩ - ⟨v|hᵢ|v⟩⟨v|hⱼ|v⟩, or for a set of vector, Cᵢⱼ = 1/2Tr[ρ{hᵢ,hⱼ}] - Tr[ρhᵢ]Tr[ρhⱼ], where ρ = 1/N∑ₙ|vₙ⟩⟨vₙ|.

Arguments:

  • ol: List of operators, represented by matrices or Operators.
  • V : Target state represented by a vector, or target states represented by a matrix.

Returns:

  • cm: (Symmetric real) matrix.
source
EDKit.qimsolveFunction
qimsolve(ol, v; tol=1e-7)

Solve the quantum inverse method problem for a list of operators ol and target state data v by finding the small-variance directions of the covariance matrix.

Returns:

  • A simplified basis for the null or near-null space selected by tol.
source