Abstract Operators

Abstract Operators

ED_sectors.TERMType.
TERM(prefactor,operatorName, firstSite, [repeat=0])

TERM(operatorName) = TERM(1, operatorName, 1, [repeat=1])
TERM(prefactor,operatorName) = TERM(prefactor, operatorName,1, [repeat=1])
TERM(operatorName,firstSite,[repeat=0]) = TERM(1, operatorName,1, [repeat=0])
TERM(prefactor, operatorDictionary; repeat = 0)

A struct which stores one term in a Hamiltonian. A TERM is an operator whose action maps basis vectors to basis vectors (and not superpositions thereof). For spin-half systems, a term is any string of pauli operators, such as $Z_0 Z_1$. The TERM struct can be constructed in several different ways fdepending on the situation.

Arguments

  • 'prefactor:: Number': the numerical prefactor for the term.
  • 'operatorName:: String': a string of the allowed operators. For spin-half, the allowed operators are "1", "I", "X", "Y", "Z", "+", and "-".
  • 'firstSite:: Int': the site for the first Pauli operator in the string.
  • 'repeat: Int':: the repeat period for the string of operators. If the firstSite is not specified, then the string repeats with period 1. If firstSite is specified, then the string does not repeat by default –- see examples below.

Examples

julia> TERM("ZZ")
TERM(1, Dict(0=>"Z",1=>"Z"), 1)

julia> TERM(3.0,"ZXXXZ",3)
TERM(3.0, Dict(7=>"Z",4=>"X",3=>"Z",5=>"X",6=>"X"), 0)

julia> TERM("ZXZ",5; repeat=2)
TERM(1, Dict(7=>"Z",5=>"Z",6=>"X"), 2)

julia> TERM(4.3,"ZXZ",5,repeat=2)
TERM(4.3, Dict(7=>"Z",5=>"Z",6=>"X"), 2)

julia> TERM(0.5,Dict(1=>"X", 7=>"X"))
TERM(0.5, Dict(7=>"X",1=>"X"), 0)
source
Base.:*Method.
x * TERM
*(x,TERM)

Scalar multiplication of TERM's: the scalar 'x' acts on the prefactor to 'TERM'.

Examples

julia> t1 = TERM(4,"ZXZ",5,repeat=2)
TERM(4, Dict(7=>"Z",5=>"Z",6=>"X"), 2)
julia> 3im*t1
TERM(0 + 12im, Dict(7=>"Z",5=>"Z",6=>"X"), 2)
source
ABSTRACT_OP(L; name = "abstract operator", pbc = true)
ABSTRACT_OP(L, operatorName, site; name = "abstract operator", pbc = true)
ABSTRACT_OP(L, TERM; name = "abstract operator", pbc = true)

The ABSTRACT_OP struct represents an operator as a string of operator names on sites, along with their numerical prefactors. This also encodes some details of the Hilbert space, including the number of sites L, the name for the operator name, and pbc which is true when periodic boundary conditions are employed.

ABSTRACT_OP's constitute a vector space and can be added and scalar-multiplied by (generically) complex numbers.

Examples

There are several different types of constructors available for ABSTRACT_OP, enabling the quick definition of "shells" of operators which can be used to define complex Hamiltonians, or quick constructors for simple observables.

julia> ABSTRACT_OP(10)
ABSTRACT_OP[name: "abstract operator", L: 10, type: spin half, pbc: true, #terms: 0]

julia> ABSTRACT_OP(10,"X",4)
ABSTRACT_OP[name: "abstract operator", L: 10, type: spin half, pbc: true, #terms: 1]
1.0 + 0.0im*X_4

julia> ABSTRACT_OP(10,TERM("Y",5))
ABSTRACT_OP[name: "abstract operator", L: 10, type: spin half, pbc: true, #terms: 1]
1.0 + 0.0im*Y_5

julia> ABSTRACT_OP(10,TERM("Z",7); pbc=false)
ABSTRACT_OP[name: "abstract operator", L: 10, type: spin half, pbc: false, #terms: 1]
1.0 + 0.0im*Z_7

julia> ABSTRACT_OP(10,4.3TERM("Z",7); name="S_z^7", pbc=false)
ABSTRACT_OP[name: "S_z^7", L: 10, type: spin half, pbc: false, #terms: 1]
4.3 + 0.0im*Z_7

julia> ABSTRACT_OP(4; name="Ising Model", pbc=true) + TERM("ZZ") + TERM("X")
ABSTRACT_OP[name: "Ising Model", L: 4, type: spin half, pbc: true, #terms: 8]
1.0 + 0.0im*Z_0 Z_1
1.0 + 0.0im*Z_1 Z_2
1.0 + 0.0im*Z_2 Z_3
1.0 + 0.0im*Z_0 Z_3
1.0 + 0.0im*X_0
1.0 + 0.0im*X_1
1.0 + 0.0im*X_2
1.0 + 0.0im*X_3

julia> order_parameter = ABSTRACT_OP(4,0.25*TERM("ZZ"))
ABSTRACT_OP[name: "abstract operator", L: 4, type: spin half, pbc: true, #terms: 4]
0.25 + 0.0im*Z_0 Z_1
0.25 + 0.0im*Z_1 Z_2
0.25 + 0.0im*Z_2 Z_3
0.25 + 0.0im*Z_0 Z_3

See also: TERM.

source
Base.:*Method.
x * Op
*(x, Op)

Scalar multiplication of ABSTRACT_OPs.

Examples

julia> 	Op = ABSTRACT_OP(10,TERM(2,"X",4))
ABSTRACT_OP[name: "abstract operator", L: 10, type: spin half, pbc: true, #terms: 1]
2.0 + 0.0im*X_4

julia> 3*Op
ABSTRACT_OP[name: "abstract operator", L: 10, type: spin half, pbc: true, #terms: 1]
6.0 + 0.0im*X_4
source
Base.:+Method.
O1 + O2
+(O1,O2)

Adds two ABSTRACT_OPs. Operators must have the same length, site type, and boundary conditions.

Examples

julia> 	OP1 = ABSTRACT_OP(10,"X",4); OP2 = ABSTRACT_OP(10,"Z",5);

julia> OP1+OP2
ABSTRACT_OP[name: "abstract operator + abstract operator", L: 10, type: spin half, pbc: true, #terms: 2]
1.0 + 0.0im*X_4
1.0 + 0.0im*Z_5
source
Base.:+Method.
Op + term
+(Op, term)

Adds a new TERM to an ABSTRACT_OP. The TERM must fit inside the number of sites for the operator.

Examples

julia> ABSTRACT_OP(4; name="Ising Model", pbc=true) + TERM("ZZ") + TERM("X")
ABSTRACT_OP[name: "Ising Model", L: 4, type: spin half, pbc: true, #terms: 8]
1.0 + 0.0im*Z_0 Z_1
1.0 + 0.0im*Z_1 Z_2
1.0 + 0.0im*Z_2 Z_3
1.0 + 0.0im*Z_0 Z_3
1.0 + 0.0im*X_0
1.0 + 0.0im*X_1
1.0 + 0.0im*X_2
1.0 + 0.0im*X_3
source