Op
A local operator acting on several lattice sites.
Source op.hpp
Constructors
Op(type::String, coupling::String, sites::Vector{Int64})
Op(type::String, coupling::String, site::Int64)
Op(type::String, coupling::Float64, sites::Vector{Int64})
Op(type::String, coupling::Float64, site::Int64)
Op(type::String, coupling::ComplexF64, sites::Vector{Int64})
Op(type::String, coupling::ComplexF64, site::Int64)
Op(type::String, coupling::Matrix{Float64}, sites::Vector{Int64})
Op(type::String, coupling::Matrix{Float64}, site::Int64)
Op(type::String, coupling::Matrix{ComplexF64}, sites::Vector{Int64})
Op(type::String, coupling::Matrix{ComplexF64}, site::Int64)
Op(std::string type, std::string coupling, std::vector<int64_t> const &sites)
Op(std::string type, std::string coupling, int64_t site)
Op(std::string type, double coupling, std::vector<int64_t> const &sites)
Op(std::string type, double coupling, int64_t site)
Op(std::string type, complex coupling, std::vector<int64_t> const &sites)
Op(std::string type, complex coupling, int64_t site)
Op(std::string type, arma::mat const &coupling, std::vector<int64_t> const &sites)
Op(std::string type, arma::mat const &coupling, int64_t site)
Op(std::string type, arma::cx_mat const &coupling, std::vector<int64_t> const &sites)
Op(std::string type, arma::cx_mat const &coupling, int64_t site)
Parameter | Description | |
---|---|---|
type | a string which denotes what kind of operator is represented | |
coupling | sets the coefficients neded to specify the coupling. Further details below | |
sites | defines on which site(s) of the lattice the operator acts on. |
1-indexing in Julia / 0-indexing in C++
To enumerate the sites of an Op, we start counting at 1 in Julia and 0 in C++.
The coupling can take on several types and allow some flexibility in defining operators.
type | Description | |
---|---|---|
string | the coupling is represented as a string, e.g. "\(t\)" or "\(J\)" in a \(t-J\) model | |
real/cplx number | the actual numerical value of the coupling | |
real/cplx matrix | more generic interactions can be specified as matrices |
Methods
coupling
Returns the coupling of the operator
This returns an object of type Coupling, which can then be converted to an appropriate type.
getindex / operator[]
Returns the site with the given index.
sites
Returns all the sites the operator is defined on
isreal
Returns whether or not the coupling is real. Throws an error if the coupling is given as a string, since then it cannot be determined whether the operator is real.
ismatrix
Returns whether or not the coupling is defined as a matrix. Throws an error if the coupling is given as a string, since then it cannot be determined whether the operator is real.
isexplicit
Returns false if the coupling is defined as a string, otherwise true
Usage Example
op = Op("HOP", "T", [1, 2])
@show op
@show type(op)
@show convert(String, coupling(op))
@show size(op), op[1], op[2]
@show sites(op) == [1, 2]
@show isexplicit(op)
op = Op("HOP", 1.23, [1, 2])
@show op
@show isreal(op)
@show ismatrix(op)
@show isexplicit(op)
op = Op("SY", [0 -im; im 0], 1)
@show op
@show isreal(op)
@show ismatrix(op)
@show isexplicit(op)
auto op = Op("HOP", "T", {0, 1});
XDIAG_SHOW(op);
XDIAG_SHOW(op.type());
XDIAG_SHOW(op.coupling().as<std::string>());
XDIAG_SHOW(op.size());
XDIAG_SHOW(op[0]);
XDIAG_SHOW(op[1]);
XDIAG_SHOW(op.isexplicit());
op = Op("HOP", 1.23, {0, 1});
XDIAG_SHOW(op);
XDIAG_SHOW(op.isreal());
XDIAG_SHOW(op.ismatrix());
XDIAG_SHOW(op.isexplicit());
arma::cx_mat m(arma::mat("0 0; 0 0"), arma::mat("0 -1; 1 0"));
op = Op("SY", m, 0);
XDIAG_SHOW(op);
XDIAG_SHOW(op.isreal());
XDIAG_SHOW(op.ismatrix());
XDIAG_SHOW(op.isexplicit());