N-Level

N = 3
b = NLevelBasis(N)
psi1 = nlevelstate(b, 1)
psi2 = nlevelstate(b, 2)
@assert psi1 == transition(b, 1, 2) * psi2

N-Level systems are mostly used as idealized model when the relevant physics can be captured in a small subspace of the complete Hilbert space. For example an atom can often be represented by a few relevant levels.

For these kinds of systems the NLevelBasis can be used. Essentially it is defined just as:

struct NLevelBasis <: Basis
    shape::Vector{Int}
    N::Int
end

States

We can create a state $|m\rangle$ with

Operators

With the transition operator, we can create projectors of the form $|m\rangle\langle n|$ describing a transition from the state $|n\rangle$ to $|m\rangle$.

Examples