ProductState
A product state of local configurations
Source product_state.hpp
Constructors
Parameter | Description | |
---|---|---|
n_sites | construct a product state on n_sites | |
local_states | the local configurations of the product state |
Iteration
A Product state can be iterated over, where at each iteration the string of the local configuration is retured. Here is an example:
Methods
n_sites
Returns the number of sites of the product state
size
Returns the number of sites of the product state. Same as "n_sites".
setindex! / operator[]
Sets the local configuration at the given site index to the given string.
getindex / operator[]
Returns the string of the local configuration at the given site index.
push! / push_back
Adds a local configuration add the end of the product state.
Usage Example
auto pstate = ProductState({"Up", "Dn", "Emp", "UpDn"});
for (auto s : pstate) {
Log("{}", s);
}
XDIAG_SHOW(to_string(pstate));
pstate = ProductState();
pstate.push_back("Dn");
pstate.push_back("Up");
pstate.push_back("Dn");
XDIAG_SHOW(pstate.n_sites());
for (auto s : pstate) {
Log("{}", s);
}
XDIAG_SHOW(to_string(pstate));