MPQC  3.0.0-alpha
sc::FermionOccupationNBitString< Ns > Class Template Reference

a "dense" string represents occupancies of a set of Ns states by a fixed-width bitstring More...

#include <chemistry/qc/nbody/string.h>

Inheritance diagram for sc::FermionOccupationNBitString< Ns >:

Public Types

typedef std::bitset< Ns > parent_type
 
typedef size_t state_index_type
 

Public Member Functions

 FermionOccupationNBitString (size_t nstates=Ns)
 Constructs an empty set of states.
 
 FermionOccupationNBitString (size_t nstates, const std::vector< state_index_type > &occupied_states)
 Constructs FermionOccupationNBitString using a (possibly-empty) set of indices of occupied states. More...
 
bool empty () const
 are all states empty? More...
 
void reset ()
 empties all states
 
size_t size () const
 Reports the total number of states. More...
 
size_t count () const
 Reports the number of occupied states. More...
 
FermionOccupationNBitStringremove (size_t from)
 Removes a particle from_ state from_. More...
 
FermionOccupationNBitStringadd (size_t to)
 Adds a particle to_ state to_. More...
 
size_t count (size_t pos1, size_t pos2) const
 counts the number of bits in (pos1,pos2) (assumes pos2 >= pos1) More...
 
size_t hash_value () const
 
template<size_t M>
bool operator== (const FermionOccupationNBitString< M > &other) const
 
FermionOccupationNBitString operator+ (const FermionOccupationNBitString &other)
 

Detailed Description

template<size_t Ns = 64ul>
class sc::FermionOccupationNBitString< Ns >

a "dense" string represents occupancies of a set of Ns states by a fixed-width bitstring

Template Parameters
Nsthe number of states

Constructor & Destructor Documentation

◆ FermionOccupationNBitString()

template<size_t Ns = 64ul>
sc::FermionOccupationNBitString< Ns >::FermionOccupationNBitString ( size_t  nstates,
const std::vector< state_index_type > &  occupied_states 
)
inlineexplicit

Constructs FermionOccupationNBitString using a (possibly-empty) set of indices of occupied states.

Parameters
occupied_states

Member Function Documentation

◆ add()

template<size_t Ns = 64ul>
FermionOccupationNBitString& sc::FermionOccupationNBitString< Ns >::add ( size_t  to)
inline

Adds a particle to_ state to_.

Unsafe, but fast.

Parameters
to_the state to_ which the particle will be added. The current status of the state is not checked.
Returns
reference to_ this string, for chaining operations (e.g. a.remove(0).remove(7).add(13) etc.)

◆ count() [1/2]

template<size_t Ns = 64ul>
size_t sc::FermionOccupationNBitString< Ns >::count ( ) const
inline

Reports the number of occupied states.

Returns
the number of occupied states

Referenced by sc::FermionOccupationNBitString< Ns >::count().

◆ count() [2/2]

template<size_t Ns = 64ul>
size_t sc::FermionOccupationNBitString< Ns >::count ( size_t  pos1,
size_t  pos2 
) const
inline

counts the number of bits in (pos1,pos2) (assumes pos2 >= pos1)

Parameters
pos1
pos2
Returns

References sc::FermionOccupationNBitString< Ns >::count().

◆ empty()

template<size_t Ns = 64ul>
bool sc::FermionOccupationNBitString< Ns >::empty ( ) const
inline

are all states empty?

Returns
true if all states are empty

◆ remove()

template<size_t Ns = 64ul>
FermionOccupationNBitString& sc::FermionOccupationNBitString< Ns >::remove ( size_t  from)
inline

Removes a particle from_ state from_.

Unsafe, but fast.

Parameters
from_the state from_ which the particle will be removed. The current status of the state is not checked.
Returns
reference to_ this string, for chaining operations (e.g. a.remove(0).remove(7).add(13) etc.)

◆ size()

template<size_t Ns = 64ul>
size_t sc::FermionOccupationNBitString< Ns >::size ( ) const
inline

Reports the total number of states.

Returns
the total number states

The documentation for this class was generated from the following file:

Generated at Sun Jan 26 2020 23:24:05 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.