Skip to content

Functions to create and modify states

Source create_state.hpp

product

Creates a filled product state.

product(block::Block, local_states::Vector{String}, real::Bool=true)
State product(Block const &block, std::vector<std::string> const &local_state, bool real = true);

Parameters

Name Description
block block on which the state is defined
local_states local configurations of the product state
real flag whether real state is created

rand

Create a filled random state with normal distributed coefficients.

rand(block::Block, real::Bool=true, seed::Int64=42, normalized::Bool=true
State rand(Block const &block, bool real = true, int64_t seed = 42, bool normalized = true);

Parameters

Name Description
block block on which the state is defined
real flag whether real state is created
seed random seed determining the precise random numbers
normalized flag whether the state is normalized

zeros

Create a filled state with all zero entries.

zeros(block::Block, real::Bool=true, n_col::Int64=1)
State zeros(Block const &block, bool real = true, int64_t n_cols = 1);

Parameters

Name Description
block block on which the state is defined
real flag whether real state is created
n_col number of columns in the state

zero

Set all coefficients of a given state to zero.

zero(state::State)
void zero(State &state);

Usage Example

block = Spinhalf(2)
state = product(block, ["Up", "Dn"])
display(vector(state))

zero(state)
display(vector(state))

state = rand(block, false, 1234, true)
display(vector(state))

state = zeros(block, true, 2)
display(matrix(state))
auto block = Spinhalf(2);
auto state = product(block, {"Up", "Dn"});
XDIAG_SHOW(state.vector());

zero(state);
XDIAG_SHOW(state.vector());

state = rand(block, false, 1234, true);
XDIAG_SHOW(state.vectorC());

state = zeros(block, true, 2);
XDIAG_SHOW(state.vector());