Quantum States
Hilbert spaces
PastaQ.qubits
— Functionqubits(n::Int)
Generate a $n$-qubit Hilbert space spanned by a basis $\{\sigma_j\}_{j=1}^n$. Each local degree of freedom is represented by an ITensors.Index
object, which encode the local Hilbert space dimension and a unique identifier for automated tensor contractions.
q = qubits(3)
# 3-element Vector{ITensors.Index{Int64}}:
# (dim=2|id=114|"Qubit,Site,n=1")
# (dim=2|id=142|"Qubit,Site,n=2")
# (dim=2|id=830|"Qubit,Site,n=3")
PastaQ.qudits
— Functionqudits(n::Int; dim::Int = 3)
qudits(d⃗::Vector)
Generate a $n$-qudit Hilbert space spanned by a basis $\{\sigma_j\}_{j=1}^n$. Each local degree of freedom is represented by an ITensors.Index
object with dimension $d_j$. Accepted inputs are either the number of qudits (with the same local dimension $d$), or a vector of local dimensions $\mathrm{d}=(d_1,\dots,d_n)$.
q = qudits([3,5,3])
# 3-element Vector{ITensors.Index{Int64}}:
# (dim=3|id=639|"Qudit,Site,n=1")
# (dim=5|id=212|"Qudit,Site,n=2")
# (dim=3|id=372|"Qudit,Site,n=3")
Product states
PastaQ.productstate
— Functionproductstate(hilbert::Vector{<:Index})
productstate(n::Int; dim = 2)
Generate an MPS wavefunction correponsponding to the product state
$|\psi\rangle = |0\rangle_1\otimes|0\rangle_2\otimes\dots|0\rangle_n$
It accepts both a Hilbert space or the number of modes and local dimension.
productstate(N::Int, states::Vector{T})
productstate(hilbert::Vector{<:Index}, states::Vector{T})
Generate an MPS wavefunction for a given input product state states
. The state T
can be specified either with bit values $|\psi\rangle = |1\rangle\otimes|0\rangle\otimes|1\rangle$
ψ = productstate(q, [1,0,1])
# MPS
# [1] ((dim=2|id=717|"Qubit,Site,n=1"),)
# [2] ((dim=2|id=89|"Qubit,Site,n=2"),)
# [3] ((dim=2|id=895|"Qubit,Site,n=3"),)
or with String
$|\psi\rangle = |+\rangle\otimes|0\rangle\otimes|-i\rangle$
ψ = productstate(q, ["X+","Z+","Y-"]);
By default, the product states that can be built ouf ot the box are based on the single-qubit Pauli eigenstates $\{|0\rangle,|1\rangle,|+\rangle,|-\rangle,|i\rangle,|-i\rangle\}$. A different set of elementary quantum states can be easily defined as follows:
import ITensors: state
state(::StateName"mystate", ::SiteType"Qubit") = [1/√3, √2/√3]