Quantum Object Types

Schrodinger.BraType
Bra(x, dims=(length(x),))

Bra vector type. The dual vector to the Ket.

The Bra type has two fields, data and dims, which store the vector data and the subspace dimensions. A Bra, like a Ket or an Operator is parameterized by the number of subspaces it lives in. Two different kets must have the same system dimensions in order to be added together.

It is possible to normalize the bra vector after construction with the normalize! function.

source
Schrodinger.KetType
Ket(x, dims=(length(x),))

Construct a ket state vector from the vector x. A vector of length N will by default be assumed to be an element of a single Hilbert space of dimension N. If the vector is an element of a tensor product of Hilbert spaces, the dimensions can be defined manually by passing a tuple of subspace dimensions dims. In that case, prod(dims) must equal length(x). By default, the vector is stored in sparse format.

The Ket type has two fields, data and dims, which store the vector data and the subspace dimensions. A Ket, like a Bra or an Operator is parameterized by the number of subspaces it lives in. Two different kets must have the same system dimensions in order to be added together.

It is possible to normalize the ket vector after construction with the normalize! function.

Example

julia> ψ = normalize!(Ket([1,1]))
2-d Ket{Vector{Float64}, 1} with dimensions 2
0.71∠0°|0⟩ + 0.71∠0°|1⟩
source
Schrodinger.OperatorType
Operator(B, dims=(size(B,1),))

Construct a linear operator from the matrix B. An N×N matrix will by default be assumed to describe an operator that acts on a single Hilbert space of dimension N. If the matrix represents a linear operator on a tensor product of Hilbert spaces, the dimensions can be defined manually by passing a tuple of subspace dimensions dims. In that case, prod(dims) must equal size(B,1).

The Operator type has two fields, data and dims, which store the matrix data and the subspace dimensions. An Operator, like a Ket or a Bra, is parameterized by the number of subspaces it lives in. Two different density matrices must have the same system dimensions in order to be added together. An Operator may or may not be Hermitian.

Example

julia> σ = Operator([0 -im ; im 0])
2×2 Operator{Matrix{ComplexF64}, 1} with dimensions 2
 0.0+0.0im  0.0-1.0im
 0.0+1.0im  0.0+0.0im
source
Schrodinger.dataMethod
data(A::QuObject)

Extract the object storing the data; for example, a Vector or a SparseMatrix.

source