Skip to content

fill

Fills a State with a given model state, e.g. a ProductState or a RandomState.

Source fill.hpp

Definition

fill(state::State, pstate::ProductState, ncol::Int64 = 1)
fill(state::State, rstate::RandomState, ncol::Int64 = 1)
void fill(State &state, ProductState const &pstate, int64_t ncol = 0);
void fill(State &state, RandomState const &rstate, int64_t ncol = 0);

Parameters

Name Description
state State object to be filled
pstate ProductState object
rstate RandomState object
ncol integer deciding which column of the State is filled (default: 1/0 (Julia/C++))

Usage Example

block = Spinhalf(2)
state = State(block)
pstate = ProductState(["Up", "Dn"])
fill(state, pstate)
display(vector(state))

rstate = RandomState(1234)
fill(state, rstate)
display(vector(state))
auto block = Spinhalf(2);
auto state = State(block);  
auto pstate = ProductState({"Up", "Dn"});
fill(state, pstate);
XDIAG_SHOW(state.vector());

auto rstate = RandomState(1234);
fill(state, rstate);
XDIAG_SHOW(state.vector());