mpqc::FermionOccupationBlockString Class Reference

Documentation

A block-"sparse" nullable string represents occupancies of an arbitrarily-large set of states as a set of alternating unoccupied/occupied blocks. The null string is distinct from a string in space of 0 states.

Classes

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

Public Types

using state_index_type = orbital_index_type
 
typedef std::set< BlockBlocks
 
using vectorofbool_t = boost::container::small_vector< bool, 128 >
 

Public Member Functions

 FermionOccupationBlockString ()=default
 constructs a null string More...
 
 FermionOccupationBlockString (const FermionOccupationBlockString &other)
 
 FermionOccupationBlockString (FermionOccupationBlockString &&)=default
 move ctor More...
 
FermionOccupationBlockStringoperator= (const FermionOccupationBlockString &other)
 
FermionOccupationBlockStringoperator= (FermionOccupationBlockString &&)=default
 move assignment More...
 
 ~FermionOccupationBlockString ()=default
 
 FermionOccupationBlockString (size_t Ns, bool default_to_occupied=false)
 
 FermionOccupationBlockString (size_t Ns, unsigned long ulong_bitset)
 
template<typename IntegralRange , typename = std::enable_if_t< TiledArray::detail::is_integral_range_v<IntegralRange>>>
 FermionOccupationBlockString (size_t Ns, IntegralRange &&occupied_states)
 
template<typename Integer , typename = std::enable_if_t<std::is_integral_v<Integer>>>
 FermionOccupationBlockString (size_t Ns, const std::initializer_list< Integer > &occupied_states)
 
 FermionOccupationBlockString (size_t Ns, Blocks &blocks)
 
 operator bool () const
 
bool empty () const
 
void reset ()
 
size_t size () const
 
size_t count () const
 
bool operator[] (size_t i) const
 
auto occupied_states () const
 
auto unoccupied_states () const
 
const PopulatedSparseOrbitalRangepopulated_states () const
 
FermionOccupationBlockStringremove (size_t from)
 
FermionOccupationBlockStringadd (size_t to)
 
size_t count (std::int64_t pos1, size_t pos2) const
 
boost::dynamic_bitset to_bitset () const
 
vectorofbool_t to_vectorofbool () const
 
unsigned long to_ulong () const
 
FermionOccupationBlockString operator^ (const FermionOccupationBlockString &other) const
 
size_t hash_value () const
 
bool operator== (const FermionOccupationBlockString &other) const
 
bool operator!= (const FermionOccupationBlockString &other) const
 
FermionOccupationBlockStringappend (const FermionOccupationBlockString &other)
 

Member Typedef Documentation

◆ Blocks

◆ state_index_type

◆ vectorofbool_t

using mpqc::FermionOccupationBlockString::vectorofbool_t = boost::container::small_vector<bool, 128>

Constructor & Destructor Documentation

◆ FermionOccupationBlockString() [1/8]

mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( )
default

constructs a null string

◆ FermionOccupationBlockString() [2/8]

mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( const FermionOccupationBlockString other)
inline

copy ctor

Note
does not copy memoized part of state

◆ FermionOccupationBlockString() [3/8]

mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( FermionOccupationBlockString &&  )
default

move ctor

◆ ~FermionOccupationBlockString()

mpqc::FermionOccupationBlockString::~FermionOccupationBlockString ( )
default

◆ FermionOccupationBlockString() [4/8]

mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns,
bool  default_to_occupied = false 
)
inlineexplicit

Constructs a set of Ns states

Parameters
Nsnumber of states
[in]default_to_occupiedif true, will make all states occupied

◆ FermionOccupationBlockString() [5/8]

mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns,
unsigned long  ulong_bitset 
)
inlineexplicit

Constructs a string of N states using bits encoded by an unsigned long

Parameters
[in]Nsnumber of states represented by this string, asserted to be less than or equal to Ns
[in]ulong_bitsetan unsigned long encoding the string

◆ FermionOccupationBlockString() [6/8]

template<typename IntegralRange , typename = std::enable_if_t< TiledArray::detail::is_integral_range_v<IntegralRange>>>
mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns,
IntegralRange &&  occupied_states 
)
inline

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

Template Parameters
IntegralRangea range of integers
Parameters
[in]Nsnumber of states represented by this string
occupied_statesthe sequence of occupied states

◆ FermionOccupationBlockString() [7/8]

template<typename Integer , typename = std::enable_if_t<std::is_integral_v<Integer>>>
mpqc::FermionOccupationBlockString::FermionOccupationBlockString ( size_t  Ns,
const std::initializer_list< Integer > &  occupied_states 
)
inline

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

Template Parameters
Integeran integral type
Parameters
[in]Nsnumber of states represented by this string
occupied_statesthe sequence of occupied states

◆ FermionOccupationBlockString() [8/8]

mpqc::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& mpqc::FermionOccupationBlockString::add ( size_t  to)
inline

Adds a particle to state to_.

Parameters
tothe state to_which the particle will be added.
Returns
reference to this string, for chaining operations (e.g. a.remove(0).remove(7).add(13) etc.)
Note
if this object is null, this is noop

◆ append()

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

appends other to the end of this

Parameters
otherthe string to be appended
Returns
*this
Note
asserts that this and other other is nonnull

◆ count() [1/2]

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

Reports the number of occupied states

Returns
the number of occupied states
Note
asserts that this is nonnull

◆ count() [2/2]

size_t mpqc::FermionOccupationBlockString::count ( std::int64_t  pos1,
size_t  pos2 
) const
inline

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

Parameters
pos1integer in [-1,Ns), set to -1 to count bits in [0,pos2)
pos2integer in [0,Ns)
Returns
the number of bits in (pos1,pos2)
Note
asserts that this is nonnull

◆ empty()

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

are all states empty?

Returns
true if all states are empty
Note
asserts that this is nonnull

◆ hash_value()

size_t mpqc::FermionOccupationBlockString::hash_value ( ) const
inline

◆ occupied_states()

auto mpqc::FermionOccupationBlockString::occupied_states ( ) const
inline

Reports the states that are occupied in this string

Returns
a range with the indices of all occupied states (in increasing order)
Note
asserts that this is nonnull

◆ operator bool()

mpqc::FermionOccupationBlockString::operator bool ( ) const
inlineexplicit

◆ operator!=()

bool mpqc::FermionOccupationBlockString::operator!= ( const FermionOccupationBlockString other) const
inline
Parameters
[in]otheranother string
Returns
true if (*this)==other is false

◆ operator=() [1/2]

FermionOccupationBlockString& mpqc::FermionOccupationBlockString::operator= ( const FermionOccupationBlockString other)
inline

copy assignment

Note
does not copy memoized part of state

◆ operator=() [2/2]

FermionOccupationBlockString& mpqc::FermionOccupationBlockString::operator= ( FermionOccupationBlockString &&  )
default

move assignment

◆ operator==()

bool mpqc::FermionOccupationBlockString::operator== ( const FermionOccupationBlockString other) const
inline
Parameters
[in]otheranother string
Returns
true if both are null or are equal

◆ operator[]()

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

Returns the occupancy of state i

Parameters
ithe state
Returns
true is the state is occupied
Note
asserts that this is nonnull

◆ operator^()

FermionOccupationBlockString mpqc::FermionOccupationBlockString::operator^ ( const FermionOccupationBlockString other) const
inline

XORs two strings

Parameters
[in]otheranother string with which this will be XORed
Note
asserts that this and other other is nonnull

◆ populated_states()

const PopulatedSparseOrbitalRange& mpqc::FermionOccupationBlockString::populated_states ( ) const
inline

Reports the states in the order of their occupancy (occupied first, unoccupied second)

Returns
a const reference to (memoized) PopulatedSparseOrbitalRange object, with occupied orbitals preceding occupied orbitals
Note
asserts that this is nonnull

◆ remove()

FermionOccupationBlockString& mpqc::FermionOccupationBlockString::remove ( size_t  from)
inline

Removes a particle from_ state from_.

Parameters
from_the state from_ which the particle will be removed.
Returns
reference to this string, for chaining operations (e.g. a.remove(0).remove(7).add(13) etc.)
Note
if this object is null, this is noop

◆ reset()

void mpqc::FermionOccupationBlockString::reset ( )
inline

empties all states

◆ size()

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

Reports the total number of states

Returns
the total number states
Note
asserts that this is nonnull

◆ to_bitset()

boost::dynamic_bitset mpqc::FermionOccupationBlockString::to_bitset ( ) const
inline

converts to bitset

Returns
return bitset
Note
asserts that this is nonnull

◆ to_ulong()

unsigned long mpqc::FermionOccupationBlockString::to_ulong ( ) const
inline

converts to unsigned long

Returns
unsigned long representation of this string
Note
asserts that this is nonnull

◆ to_vectorofbool()

vectorofbool_t mpqc::FermionOccupationBlockString::to_vectorofbool ( ) const
inline

converts to the vector-of-bool representation of this string

Returns
vector-of-bool representation of this string
Note
asserts that this is nonnull

◆ unoccupied_states()

auto mpqc::FermionOccupationBlockString::unoccupied_states ( ) const
inline

Reports the states that are unoccupied in this string

Returns
a range with the indices of all unoccupied states (in increasing order)
Note
asserts that this is nonnull

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