Autodocs

template<class Container = danceq::internal::ContainerTable<danceq::internal::State<128, 2, uint64_t>>>
class BasisU1

The class is the core part of the module as it merges the different subsystems and provides all tools to enumerate basis states.

Template parameters

  • class Container: The only template parameter is Container class that organizes the individual subsystems.

    Default: danceq:: ContainerTable <danceq::State <128,2,uint64_t>>

Things to know

  • The class has three input parameters, the system size L, the particle sector n within 0 and (Q-1) \(\cdot\) L, and the number of subsystem Npart.

  • There are three different implementations of the Container available. Pros and Cons are discussed in the paper.

  • The underlying State class can be accessed with Basis::state_class.

  • The debugging level can be adjusted from 0 (no debugging) to 10 (maximal debugging):

    #define dbug_level 10; // 10 maximal debugging, 0 is no debugging
    

Warning

The system size L has to be smaller or equal to the maximal number of sites MaxSites of the underlying State class.

Public Types

using state_class = typename Container::state_class

State class.

State class can be retrieved from the BasisU1:

// Definition of classes
using State = danceq::internal::State<256,4>;
using Container = danceq::internal::ContainerTable<State>;
using Basis = danceq::internal::BasisU1<Container>;

// This equivalent to: State state;
Basis::state_class state;  

Public Functions

BasisU1(uint64_t L_, uint64_t n_)

Constructor with a uniform partitioning.

Initiates a system of size L_ with

\[\textbf{Npart} = \texttt{std::ceil}\left(\frac{ L\cdot \textbf{Nbits}}{16} \right)\]

uniform parts.

Parameters:
  • L_ – System size

  • n_ – Particle number

BasisU1(uint64_t L_, uint64_t n_, uint64_t Npart_)

Constructor with a uniform partitioning.

Initiates a system of size L_ with Npart_ uniform parts. Npart_ has to be smaller or equal than L_ and n_ has to be within 0 and L_ \(\cdot\) (Q-1).

Parameters:
  • L_ – System size

  • n_ – Particle number

  • Npart_ – Number of subsystems

BasisU1(uint64_t n_, std::vector<uint64_t> partition_)

Constructor with a predefined partitioning.

The whole system is split according to the input vector partition_ which is a monotonously increasing. The i th subsystem ranges from partition_[i-1] to partition_[i] for i>0 and the first subsystem ranges from site 0 to partition_[0]. Hence, Npart=partition_.size() and L=partition_[partition_.size()-1]. n_ has to be within 0 and L_ \(\cdot\) (Q-1).

Parameters:
  • n_ – Particle number

  • partition_ – Partitioning

BasisU1(const BasisU1 &input)

Copy constructor.

Creates a full copy of the class including the Container classes.

Parameters:

input – Instance to be copied

~BasisU1()

Deconstructor.

Deconstructor deletes the Container instances.

uint64_t get_L(void) const

Returns system size L.

Returns:

L

uint64_t get_n(void) const

Returns particle number n.

Returns:

n

uint64_t get_Npart(void) const

Returns number of subsystems.

Returns:

Npart

uint64_t get_dim(uint64_t n_ = -1, uint64_t L_ = -1, uint64_t Q_ = state_class::template_struct::template_Q) const

Returns dimension of a specific sector.

Returns dimension of a system of size L_, particle number n_, and local Hilbert space dimension Q_. Default -1 sets length and particle number to the current length L and particle number n of this instance. The dimension is determined by Eq. (2):

\[D_{Q\_}(L\_,n\_) = \sum_{k=0}^{\lfloor n\_ / Q\_ \rfloor} (-1)^k\binom{L\_}{k}\binom{L\_-1+n\_-Q\_k}{L\_-1}\]

Parameters:
  • L_ – System size

  • n_ – Particle number

  • Q_ – Local Hilbert space dimension

Returns:

Dimension of the sector

int32_t get_dim(uint64_t *output, uint64_t n_ = -1, uint64_t L_ = -1, uint64_t Q_ = state_class::template_struct::template_Q) const

Returns dimension of a specific sector.

Returns dimension of a system of size L_, particle number n_, and local Hilbert space dimension Q_. Default -1 sets length and particle number to the current length L and particle number n of this instance. The dimension is determined by Eq. (2):

\[D_{Q\_}(L\_,n\_) = \sum_{k=0}^{\lfloor n\_ / Q\_ \rfloor} (-1)^k\binom{L\_}{k}\binom{L\_-1+n\_-Q\_k}{L\_-1}\]

Parameters:
  • output – Pointer for output

  • L_ – System size

  • n_ – Particle number

  • Q_ – Local Hilbert space dimension

Returns:

error_code

int32_t info(void) const

Prints information about the class.

Prints information about the class such as basics parameters and current memory usage.

Returns:

error_code

uint64_t 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

int32_t get_index(uint64_t *output, const state_class&) const

Returns the index for a given state.

Returns the index \(i\) for a given basis state \(\vert \Psi_i\rangle\).

Parameters:
  • output – Pointer for output

  • state – State

Returns:

error_code

int32_t 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

int32_t 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

int32_t set_state(uint64_t index, state_class &state) const

Sets the state for a given index.

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

Parameters:
  • index – Index

  • state – State to be set

Returns:

error_code

state_class 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

BasisIterator<BasisU1> begin(void)

Returns BasisIterator pointing to the first element.

Returns a BasisIterator instance pointing to the first element.

for(auto it = B.begin(); it < B.end(); ++it){
    std::cout << *it << std::endl;
}

Returns:

Iterator pointing to the first element

BasisIterator<BasisU1> end(void)

Returns BasisIterator pointing to the end.

Returns a BasisIterator instance pointing to the end which is not a physical state.

for(auto it = B.begin(); it < B.end(); ++it){
    std::cout << *it << std::endl;
}

Returns:

Iterator pointing to the end

BasisIterator<BasisU1> first(void)

Returns BasisIterator pointing to the first element.

Returns a BasisIterator instance pointing to the first element.

for(auto it = B.first(); it <= B.last(); ++it){
    std::cout << *it << std::endl;
}

Returns:

Iterator pointing to the first element

BasisIterator<BasisU1> last(void)

Returns BasisIterator pointing to the last element.

Returns a BasisIterator instance pointing to the last element.

for(auto it = B.first(); it <= B.last(); ++it){
    std::cout << *it << std::endl;
}

Returns:

Iterator pointing to the last element

Public Static Attributes

static constexpr const bool is_State = false

Needed for specification.

Private Functions

int32_t set_up_container(void)

Sets up the Container for each subsystem.

Creates a new Container for each length of the subsystem and stores the respective pointer in container_per_subsystem.

Returns:

error_code

int32_t set_up_coef(void)

Sets up the coefficients to determine the final enumeration.

Fills the coefficents offsets and strides.

Returns:

error_code

int32_t set_up_partition(void)

Sets up the uniform partition for a given number of subsystems.

Splits the whole system of size L into Npart uniform parts.

Returns:

error_code

int32_t check_data(void) const

Checks all input data.

Returns:

error_code

Private Members

uint64_t dim

Total dimension according to Eq. (7) in the paper.

const uint64_t L

System size.

const uint64_t n

Particle number.

const uint64_t Npart

Number of subsystems.

std::vector<uint64_t> partition

Partitioning of the system.

Vector of size Npart defining the subsystems. The i th subsystem ends at partition [i].

std::vector<uint64_t> length_per_subsystem

Length of the subsystems.

Vector of size Npart defining the lengths of the subsystems. The i th subsystem has the size length_per_subsystem [i].

std::vector<Container*> container_per_subsystem

Pointer to the Container of each subsystem.

Vector of size Npart pointing to the responsible Container for each subsystem.

Note

Subsystems of the same length point to the same Container instance.

std::vector<uint64_t> offsets

Coefficients defined in Eq. (12) in the paper.

Vector containing all possible coefficients from Eq. (12) in the paper. The maximal size of this vector for a uniform partition is L \(\cdot\) (Q-1) \(\cdot\) n. Elements are arranged in a non-trivial way.

std::vector<uint64_t> strides

Coefficients defined in Eq. (13) in the paper.

Vector containing all possible coefficients from Eq. (13) in the paper. The maximal size of this vector for a uniform partition is L \(\cdot\) (Q-1). Elements are arranged in a non-trivial way.