State Handling
The Basis class has to fulfill three different methods:
Functionality
Below is a complete list of all necessary functions:
-
uint64_t danceq::internal::BasisU1::get_index(const state_class &state) const
Returns the index for a given state.
Returns the index \(i\) for a given basis state \(\vert \Psi_i\rangle\).
- Parameters:
state – Basis state
- Returns:
Index
-
uint64_t danceq::internal::BasisU1::get_index(const state_class &state) const
-
int32_t danceq::internal::BasisU1::increment(state_class &state, bool *overflow = nullptr) const
Incrementing the given state.
Incrementing a given state \(\vert\Psi_i\rangle\rightarrow\vert\Psi_{i+1}\rangle\). The last state \(\vert\Psi_{\textbf{dim}-1}\rangle\) is mapped to the first state \(\vert\Psi_0\rangle\). If the pointer overflow is set, this results in setting it to
true
. Otherwise, it isfalse
.- Parameters:
state – State
overflow – Pointer for overflow detection
- Returns:
error_code
-
int32_t danceq::internal::BasisU1::increment(state_class &state, bool *overflow = nullptr) const
-
int32_t danceq::internal::BasisU1::decrement(state_class &state, bool *underflow = nullptr) const
Decrementing the given state.
Decrementing a given state \(\vert\Psi_i\rangle\rightarrow\vert\Psi_{i-1}\rangle\). The first state \(\vert\Psi_{0}\rangle\) is mapped to the last state \(\vert\Psi_{\textbf{dim}-1}\rangle\). If the pointer underflow is set, this results in setting it to
true
. Otherwise, it isfalse
.- Parameters:
state – State
underflow – Pointer for underflow detection
- Returns:
error_code
-
int32_t danceq::internal::BasisU1::decrement(state_class &state, bool *underflow = nullptr) const
-
state_class danceq::internal::BasisU1::get_state(uint64_t index) const
Returns the state for a given index.
Returns the state \(\vert\Psi_i\rangle\) for a given index \(i\).
- Parameters:
index – Index
- Returns:
State
-
state_class danceq::internal::BasisU1::get_state(uint64_t index) const