Sites

General

ITensors.IndexMethod
Index(::AbstractSite)

return an ITensor.Index for the given site for pure representations

source
ITensors.SiteTypes.stateMethod
state(::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
source

The state "FullyMixed" represents the infinite temperature mixed state, that is a density matrix proportional to the identity matrix.

TensorMixedStates.FConstant
F

the Jordan-Wigner F operator for fermions, defined for all site types. It is the identity operator for non fermionic sites

source

There are seven predefined site types Qubit, Spin, Boson, Fermion, Electron, Tj and Qboson.

Qubit

To use Qubit, call

using .Qubits
TensorMixedStates.QubitType
type 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 operators
  • Sp, Sm : the $S^+$ and $S^-$ operators
  • Sx, 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 gates
  • Phase(t) : the phase gate
  • controlled(gate) : controlled gate
source
TensorMixedStates.graph_stateFunction
graph_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))
source

Spins

To use Spin, call

using .Spins
TensorMixedStates.SpinType
Spin(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^-$ operators
  • Sx, Sy, Sz, S2 : the $S_x$, $S_y$, $S_z$ operators and $S^2$
source

Boson

To use Boson, call

using .Bosons
TensorMixedStates.BosonType
Boson(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 operator
  • N : the number of bosons operator
source

Fermion

To use Fermion, call

using .Fermions
TensorMixedStates.FermionType
Fermion()

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 operator
  • A : the Jordan-Wigner transform of C (...C = FFFA)
  • N : the number of fermions operator
source

Electron

To use Electron, call

using .Electrons
TensorMixedStates.ElectronType
Eletron()

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 operators
  • Aup, 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 total
  • Sx, Sy, Sz, Sp, Sm : spin operators
  • Fup, Fdn : partial Jordan-Wigner F operators
source

Tj

To use Tj, call

using .Tjs
TensorMixedStates.TjType
Tj()

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 operators
  • Aup, Adn : the Jordan-Wigner transforms of Cup and Cdn (...C = FFFA)
  • Nup, Ndn, Ntot : the numbers operator for up, down and total
  • Sx, Sy, Sz, Sp, Sm : spin operators
  • Fup, Fdn : partial Jordan-Wigner F operators
source

Qboson

To use Qboson, call

using .Qbosons
TensorMixedStates.QbosonType
Qboson(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 operator
  • N : the number of q-bosons operator
source

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_stateFunction
generic_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.

source
TensorMixedStates.@def_statesMacro
@def_states(site, symbols)

define the given states for the given site

Example

@def_states(Fermion(),
[
    ["Emp", "0"] => [1., 0.],
    "Occ" => [0., 1.],
])
source
TensorMixedStates.@def_operatorsMacro
@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
])
source