Operators

Matrix Constructors

ED_sectors.OperatorFunction.
Operator(abstract_op, basis)
Operator(term, basis)
Operator(operatorName, site, basis)

Constructs an operator in a given BASIS. One can specify a full ABSTRACT_OP or, as a shortcut for simple obserables, just a single TERM or even the name and site of the operator.

Returns a sparse matrix.

Examples

Simple observables are simple to create.

julia> L = 4; basis = BASIS(L);

julia> Sx2 = Operator("X", 2, basis)
16×16 SparseArrays.SparseMatrixCSC{Complex{Float64},Int64} with 16 stored entries:
  [5 ,  1]  =  1.0+0.0im
  [6 ,  2]  =  1.0+0.0im
  [7 ,  3]  =  1.0+0.0im
  [8 ,  4]  =  1.0+0.0im
  [1 ,  5]  =  1.0+0.0im
  [2 ,  6]  =  1.0+0.0im
  [3 ,  7]  =  1.0+0.0im
  [4 ,  8]  =  1.0+0.0im
  [13,  9]  =  1.0+0.0im
  [14, 10]  =  1.0+0.0im
  [15, 11]  =  1.0+0.0im
  [16, 12]  =  1.0+0.0im
  [9 , 13]  =  1.0+0.0im
  [10, 14]  =  1.0+0.0im
  [11, 15]  =  1.0+0.0im
  [12, 16]  =  1.0+0.0im

julia> magnetic_order_parameter = Operator((1/L)*TERM("Z"), basis)
16×16 SparseArrays.SparseMatrixCSC{Complex{Float64},Int64} with 10 stored entries:
  [1 ,  1]  =  1.0+0.0im
  [2 ,  2]  =  0.5+0.0im
  [3 ,  3]  =  0.5+0.0im
  [5 ,  5]  =  0.5+0.0im
  [8 ,  8]  =  -0.5+0.0im
  [9 ,  9]  =  0.5+0.0im
  [12, 12]  =  -0.5+0.0im
  [14, 14]  =  -0.5+0.0im
  [15, 15]  =  -0.5+0.0im
  [16, 16]  =  -1.0+0.0im

Creating more involved operators, like most Hamiltonians, is also straightforward.

julia> L = 4; basis = BASIS(L);

julia> ising = ABSTRACT_OP(L; name="Ising Model", pbc=true) + 2TERM("ZZ") + TERM("X");

julia> H = Operator(ising,basis)
16×16 SparseArrays.SparseMatrixCSC{Complex{Float64},Int64} with 68 stored entries:
  [1 ,  1]  =  8.0+0.0im
  [2 ,  1]  =  1.0+0.0im
  [3 ,  1]  =  1.0+0.0im
  [5 ,  1]  =  1.0+0.0im
  [9 ,  1]  =  1.0+0.0im
  [1 ,  2]  =  1.0+0.0im
  [4 ,  2]  =  1.0+0.0im
  [6 ,  2]  =  1.0+0.0im
  [10,  2]  =  1.0+0.0im
  ⋮
  [7 , 15]  =  1.0+0.0im
  [11, 15]  =  1.0+0.0im
  [13, 15]  =  1.0+0.0im
  [16, 15]  =  1.0+0.0im
  [8 , 16]  =  1.0+0.0im
  [12, 16]  =  1.0+0.0im
  [14, 16]  =  1.0+0.0im
  [15, 16]  =  1.0+0.0im
  [16, 16]  =  8.0+0.0im

See also: ABSTRACT_OP, BASIS.

source