Coupling
Describes the coupling of a local operator. A coupling can either be a string, a real/complex number or even a real/complex matrix. It allows for converting to real/complex numbers or matrices as well as strings, whenever this conversion is sensible.
Source coupling.hpp
Constructors
Methods
type
Returns the type of the Coupling, i.e. a string which either reads "string", "double", "complex", "mat", or "cx_mat"
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
Conversions
A Coupling can be converted to the values it represents, so a string, real/complex number or a real/complex matrix. Initially real values can be cast to complex.
Usage Example
auto cpl = Coupling("J");
XDIAG_SHOW(cpl.type());
XDIAG_SHOW(cpl.isexplicit());
cpl = Coupling(1.23);
XDIAG_SHOW(cpl.ismatrix());
XDIAG_SHOW(cpl.as<double>());
XDIAG_SHOW(cpl.as<complex>());
cpl = Coupling(arma::mat("1 2; -2 1"));
XDIAG_SHOW(cpl.ismatrix());
XDIAG_SHOW(cpl.isreal());
XDIAG_SHOW(cpl.as<arma::mat>());
XDIAG_SHOW(cpl.as<arma::cx_mat>());