Sites
General
TensorMixedStates.AbstractSite
— Typeabstract type AbstractSite
An abstract type which is the super type of all site types
NDTensors.dim
— Methoddim(::AbstractSite)
return the dimension of the given site
ITensors.Index
— MethodIndex(::AbstractSite)
return an ITensor.Index for the given site for pure representations
ITensors.SiteTypes.state
— Methodstate(::AbstractSite, ::String)
return the local state (as a vector or matrix) corresponding to the site and name given
Examples
julia> using TensorMixedStates, .Qubits, .Fermions
julia> state(Qubit(), "+")
2-element Vector{Float64}:
0.7071067811865475
0.7071067811865475
julia> state(Fermion(), "FullyMixed")
2×2 Matrix{Float64}:
0.5 0.0
0.0 0.5
The state "FullyMixed"
represents the infinite temperature mixed state, that is a density matrix proportional to the identity matrix.
TensorMixedStates.Id
— ConstantId
the identity operator defined for all site types
TensorMixedStates.F
— ConstantF
the Jordan-Wigner F operator for fermions, defined for all site types. It is the identity operator for non fermionic sites
There are seven predefined site types Qubit
, Spin
, Boson
, Fermion
, Electron
, Tj
and Qboson
.
Qubit
To use Qubit
, call
using .Qubits
TensorMixedStates.Qubit
— Typetype Qubit
A site type for representing qubit sites, that is a two level system.
Example
Qubit()
States
"Up", "Z+", "↑", "0"
: the up state"Dn", "Z-", "↓", "1"
: the down state"+", "X+"
: the + state (+1 eigenvector of X)"-", "X-"
: the - state (-1 eigenvector of X)"i", "Y+"
: the i state (+1 eigenvector of Y)"-i", "Y-"
: the -i state (-1 eigenvector of Y)
Operators
X, Y, Z
: the Pauli operatorsSp, Sm
: the $S^+$ and $S^-$ operatorsSx, Sy, Sz, S2
: the $S_x$, $S_y$, $S_z$ operators (half the Pauli operators) and $S^2$H, S, T, Swap
: the Hadamard, S, T and Swap gatesPhase(t)
: the phase gatecontrolled(gate)
: controlled gate
TensorMixedStates.Phase
— FunctionPhase(t)
the phase gate for qubits
TensorMixedStates.controlled
— Functioncontrolled(op)
the controlled gate constructor
Examples
CZ = controlled(Z)
Toffoli = controlled(controlled(X))
TensorMixedStates.graph_state
— Functiongraph_state(Pure()|Mixed(), graph::Vector{Tuple{Int, Int}}; limits)
create a graph state corresponding to the given graph
Examples
graph_state(Pure(), complete_graph(10); limits = Limits(maxdim = 10))
TensorMixedStates.create_graph_state
— Functioncreate_graph_state(Pure()|Mixed(), graph::Vector{Tuple{Int, Int}}; limits)
create a phase for building a graph state to use in SimData
and runTMS
Spins
To use Spin
, call
using .Spins
TensorMixedStates.Spin
— TypeSpin(spin)
A site type for representing spin sites (dim is 2 spin + 1
)
Example
Spin(3/2)
Spin(2)
States
"0", "1", "-1"... for integer spins "1/2", "-1/2", "3/2", "-3/2"... for half integer spins
"X0", "X1/2", "X-1/2", ... for eigenstate of Sx
"Y0", "Y1/2", "Y-1/2", ... for eigenstate of Sy
"Z0", "Z1/2", "Z-1/2", ... for eigenstate of Sz
(same as "0", "1/2" ...)
Operators
Sp, Sm
: the $S^+$ and $S^-$ operatorsSx, Sy, Sz, S2
: the $S_x$, $S_y$, $S_z$ operators and $S^2$
Boson
To use Boson
, call
using .Bosons
TensorMixedStates.Boson
— TypeBoson(dim)
a site type to represent boson sites, it is parametred by the dimension of the Hilbert space (maximum occupancy is dim - 1
)
Examples
Boson(4)
States
"0", "1", ...
Operators
A
: the destruction operatorN
: the number of bosons operator
Fermion
To use Fermion
, call
using .Fermions
TensorMixedStates.Fermion
— TypeFermion()
a site type to represent fermion sites (dim is 2)
Examples
Fermion()
States
"0", "Emp"
: empty state"1", "Occ"
: occupied state
Operators
C
: the destruction operatorA
: the Jordan-Wigner transform of C (...C = FFFA)N
: the number of fermions operator
Electron
To use Electron
, call
using .Electrons
TensorMixedStates.Electron
— TypeEletron()
a site type to represent electron sites (dim is 4)
Examples
Electron()
States
"0", "Emp"
: empty state"Up", "↑"
: up state"Dn", "↓"
: down state"UpDn", "↑↓"
: up and down state
Operators
Cup, Cdn
: the destruction operatorsAup, Adn
: the Jordan-Wigner transforms of Cup and Cdn (...C = FFFA)Nup, Ndn, Nupdn, Ntot
: the numbers operator for up, down, up and down, and totalSx, Sy, Sz, Sp, Sm
: spin operatorsFup, Fdn
: partial Jordan-Wigner F operators
Tj
To use Tj
, call
using .Tjs
TensorMixedStates.Tj
— TypeTj()
a site type to represent Tj sites (like Electron sites without the up and down state, dim is 3)
Examples
Electron()
States
"0", "Emp"
: empty state"Up", "↑"
: up state"Dn", "↓"
: down state
Operators
Cup, Cdn
: the destruction operatorsAup, Adn
: the Jordan-Wigner transforms of Cup and Cdn (...C = FFFA)Nup, Ndn, Ntot
: the numbers operator for up, down and totalSx, Sy, Sz, Sp, Sm
: spin operatorsFup, Fdn
: partial Jordan-Wigner F operators
Qboson
To use Qboson
, call
using .Qbosons
TensorMixedStates.Qboson
— TypeQboson(q, dim)
a site type to represent q-boson sites, it is parametred by q
and the dimension of the Hilbert space (maximum occupancy is dim - 1
).
$a|n\rangle = \sqrt{1-q^n} |n-1\rangle$ and $a^\dagger |n\rangle = \sqrt{1 - q^{n+1}} |n+1\rangle$
Examples
Qboson(0.1, 4)
States
"0", "1", ...
Operators
A
: the destruction operatorN
: the number of q-bosons operator
Defining new site types
To define a new site type, you need to define a new subtype of AbstractSite
and define dim
and possibly generic_state
on it (to overload do not forget to use the full name e.g. TensorMixedStates.dim
). Then define its specific states and operators using @def_states
and @def_operators
. Don't forget to define the F
operator for fermionic sites.
TensorMixedStates.generic_state
— Functiongeneric_state(::AbstractSite, ::String)
Do not call directly. It returns a local state corresponding to the string, this is tried first before trying specifically defined states.
The default implementation returns the first state for "0", the second for "1" and so on.
This should be overloaded if necessary when defining new site types. It may return an error when not needed.
TensorMixedStates.@def_states
— Macro@def_states(site, symbols)
define the given states for the given site
Example
@def_states(Fermion(),
[
["Emp", "0"] => [1., 0.],
"Occ" => [0., 1.],
])
TensorMixedStates.@def_operators
— Macro@def_operators(site, symbols, fermionic=false)
define the given operator for the given site
Examples
@def_operators(Fermion(),
[
C = [0. 1. ; 0. 0.],
],
true)
@def_operators(Fermion(),
[
F = [1. 0. ; 0. -1.],
A = C,
N = dag(C)*C
])