State Handling

The Basis class has to fulfill three different methods:

Functionality

  1. Retrieve basis index \(i\) from a given state \(\vert \Psi_i \rangle\)

  2. An efficient iteration by mapping \(\vert \Psi_i \rangle\) to \(\vert \Psi_{i+1} \rangle\)

  3. Generate the state \(\vert \Psi_i \rangle\) for a given index \(i\)

Below is a complete list of all necessary functions:

  1. 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

  1. 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 is false.

    Parameters:
    • state – State

    • overflow – Pointer for overflow detection

    Returns:

    error_code

  1. 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 is false.

    Parameters:
    • state – State

    • underflow – Pointer for underflow detection

    Returns:

    error_code

  1. 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