MPQC  3.0.0-alpha
sc::FermionOccupationBlockString Class Reference

a block-"sparse" string represents occupancies of an arbitrarily-large set of states as a set of alternating unoccupied/occupied blocks. More...

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

Classes

struct  Block
 represents a continuous block of states of same occupancy More...
 

Public Types

typedef size_t state_index_type
 
typedef std::set< BlockBlocks
 

Public Member Functions

 FermionOccupationBlockString (size_t Ns)
 Constructs an empty set of Ns states. More...
 
 FermionOccupationBlockString (size_t Ns, const std::vector< state_index_type > &occupied_states)
 Constructs FermionOccupationBlockString using a (possibly-empty) set of indices of occupied states. More...
 
 FermionOccupationBlockString (size_t Ns, Blocks &blocks)
 Constructs FermionOccupationBlockString 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...
 
bool operator[] (size_t i) const
 Returns the occupancy of state i. More...
 
FermionOccupationBlockStringremove (size_t from)
 Removes a particle from_ state from_. More...
 
FermionOccupationBlockStringadd (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...
 
boost::dynamic_bitset to_bitset () const
 
FermionOccupationBlockString operator^ (const FermionOccupationBlockString &other) const
 XORs two strings.
 
size_t hash_value () const
 
bool operator== (const FermionOccupationBlockString &other) const
 
FermionOccupationBlockStringappend (const FermionOccupationBlockString &other)
 appends other to the end of this More...
 

Detailed Description

a block-"sparse" string represents occupancies of an arbitrarily-large set of states as a set of alternating unoccupied/occupied blocks.

Constructor & Destructor Documentation

◆ FermionOccupationBlockString() [1/3]

sc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns)
inlineexplicit

Constructs an empty set of Ns states.

Parameters
Nsnumber of states

◆ FermionOccupationBlockString() [2/3]

sc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns,
const std::vector< state_index_type > &  occupied_states 
)
inlineexplicit

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

Parameters
occupied_states

References add().

◆ FermionOccupationBlockString() [3/3]

sc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns,
Blocks &  blocks 
)
inlineexplicit

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

Parameters
occupied_states

Member Function Documentation

◆ add()

FermionOccupationBlockString& sc::FermionOccupationBlockString::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.)

Referenced by FermionOccupationBlockString().

◆ append()

FermionOccupationBlockString& sc::FermionOccupationBlockString::append ( const FermionOccupationBlockString other)
inline

appends other to the end of this

Parameters
otherthe string to be appended
Returns
*this

References sc::other().

◆ count() [1/2]

size_t sc::FermionOccupationBlockString::count ( ) const
inline

Reports the number of occupied states.

Returns
the number of occupied states

Referenced by empty().

◆ count() [2/2]

size_t sc::FermionOccupationBlockString::count ( size_t  pos1,
size_t  pos2 
) const
inline

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

Parameters
pos1
pos2
Returns

◆ empty()

bool sc::FermionOccupationBlockString::empty ( ) const
inline

are all states empty?

Returns
true if all states are empty

References count().

◆ operator[]()

bool sc::FermionOccupationBlockString::operator[] ( size_t  i) const
inline

Returns the occupancy of state i.

Parameters
ithe state
Returns
true is the state is occupied

◆ remove()

FermionOccupationBlockString& sc::FermionOccupationBlockString::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()

size_t sc::FermionOccupationBlockString::size ( ) const
inline

Reports the total number of states.

Returns
the total number states

Referenced by operator^().


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.