mpqc::SlaterDeterminantSet< StringRange, HashMap > Class Template Reference

Documentation

template<typename StringRange, template< typename... > class HashMap>
class mpqc::SlaterDeterminantSet< StringRange, HashMap >

A (sparse) set of Slater determinants.

Template Parameters
StringRangerange of strings

Public Types

using string_range_type = StringRange
 
using ordinal_type = std::int64_t
 
using string_iterator = typename StringRange::const_iterator
 
using String = typename StringRange::value_type
 
using SlaterDeterminant = ::mpqc::SlaterDeterminant< StringRange >
 
using SDContainer = HashMap< SlaterDeterminant, ordinal_type, typename SlaterDeterminant::hash, typename SlaterDeterminant::equal_to >
 
using const_iterator = typename SDContainer::const_iterator
 

Public Member Functions

 SlaterDeterminantSet (const StringRange &astrings, const StringRange &bstrings, bool full=false)
 
 SlaterDeterminantSet (std::shared_ptr< const StringRange > astrings, std::shared_ptr< const StringRange > bstrings, bool full=false)
 
 SlaterDeterminantSet (const SlaterDeterminantSet &)=default
 
 SlaterDeterminantSet (SlaterDeterminantSet &&) noexcept=default
 
SlaterDeterminantSetoperator= (const SlaterDeterminantSet &)=default
 
SlaterDeterminantSetoperator= (SlaterDeterminantSet &&) noexcept=default
 
 ~SlaterDeterminantSet ()=default
 
std::size_t size () const
 
size_t bucket_count () const
 
const StringRange & strings (SpinCase1 s) const
 
const_iterator insert (string_iterator astr, string_iterator bstr, ordinal_type ord=-1)
 
const_iterator safe_insert (string_iterator astr, string_iterator bstr, ordinal_type ord=-1)
 
const_iterator find (string_iterator astr, string_iterator bstr) const
 
const_iterator find (std::size_t astr_hash_value, std::size_t bstr_hash_value) const
 
std::optional< const_iteratorsafe_find (string_iterator astr, string_iterator bstr) const
 
std::optional< const_iteratorsafe_find (std::size_t astr_hash_value, std::size_t bstr_hash_value) const
 
ordinal_type find_ordinal (string_iterator astr, string_iterator bstr) const
 
std::optional< ordinal_typesafe_find_ordinal (string_iterator astr, string_iterator bstr) const
 
std::tuple< ordinal_type, bool > find_or_insert (string_iterator astr, string_iterator bstr)
 
SlaterDeterminant operator[] (ordinal_type i) const
 
SlaterDeterminantSet make_product (const SlaterDeterminantSet &other, std::function< void(const const_iterator &, const const_iterator &, const const_iterator &)> op={}) const
 constructs tensor product with another SlaterDeterminantSet More...
 
bool operator== (const SlaterDeterminantSet &other) const
 
Iterator accessors
Note
iterator dereferences to std::pair<SlaterDeterminantSet::SlaterDeterminant,ordinal_type>
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 

Static Public Attributes

static constexpr bool string_range_is_random_access
 

Member Typedef Documentation

◆ const_iterator

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::const_iterator = typename SDContainer::const_iterator

◆ ordinal_type

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::ordinal_type = std::int64_t

◆ SDContainer

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::SDContainer = HashMap<SlaterDeterminant, ordinal_type, typename SlaterDeterminant::hash, typename SlaterDeterminant::equal_to>

◆ SlaterDeterminant

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::SlaterDeterminant = ::mpqc::SlaterDeterminant<StringRange>

◆ String

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::String = typename StringRange::value_type

◆ string_iterator

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::string_iterator = typename StringRange::const_iterator

◆ string_range_type

template<typename StringRange , template< typename... > class HashMap>
using mpqc::SlaterDeterminantSet< StringRange, HashMap >::string_range_type = StringRange

Constructor & Destructor Documentation

◆ SlaterDeterminantSet() [1/4]

template<typename StringRange , template< typename... > class HashMap>
mpqc::SlaterDeterminantSet< StringRange, HashMap >::SlaterDeterminantSet ( const StringRange &  astrings,
const StringRange &  bstrings,
bool  full = false 
)
inline
Parameters
[in]astringsthe spin-up string range
[in]bstringsthe spin-down string range
[in]fullif true, construct the set of all possible determinants else construct an empty set; if StringRange is a random access range then searching a full set can be significantly optimized
Warning
SlaterDeterminantSet will not manage the lifetime of astrings and bstrings

◆ SlaterDeterminantSet() [2/4]

template<typename StringRange , template< typename... > class HashMap>
mpqc::SlaterDeterminantSet< StringRange, HashMap >::SlaterDeterminantSet ( std::shared_ptr< const StringRange >  astrings,
std::shared_ptr< const StringRange >  bstrings,
bool  full = false 
)
inline
Parameters
[in]astringsshared_ptr to the spin-up string range
[in]bstringsshared_ptr to the spin-down string range
[in]fullif true, construct the set of all possible determinants else construct an empty set; if StringRange is a random access range then searching a full set can be significantly optimized
Note
SlaterDeterminantSet will manage the lifetime of astrings and bstrings

◆ SlaterDeterminantSet() [3/4]

template<typename StringRange , template< typename... > class HashMap>
mpqc::SlaterDeterminantSet< StringRange, HashMap >::SlaterDeterminantSet ( const SlaterDeterminantSet< StringRange, HashMap > &  )
default

◆ SlaterDeterminantSet() [4/4]

template<typename StringRange , template< typename... > class HashMap>
mpqc::SlaterDeterminantSet< StringRange, HashMap >::SlaterDeterminantSet ( SlaterDeterminantSet< StringRange, HashMap > &&  )
defaultnoexcept

◆ ~SlaterDeterminantSet()

template<typename StringRange , template< typename... > class HashMap>
mpqc::SlaterDeterminantSet< StringRange, HashMap >::~SlaterDeterminantSet ( )
default

Member Function Documentation

◆ begin()

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::begin ( ) const
inline

◆ bucket_count()

template<typename StringRange , template< typename... > class HashMap>
size_t mpqc::SlaterDeterminantSet< StringRange, HashMap >::bucket_count ( ) const
inline
Returns
the number of buckets holding the determinants

◆ cbegin()

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::cbegin ( ) const
inline

◆ cend()

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::cend ( ) const
inline

◆ end()

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::end ( ) const
inline

◆ find() [1/2]

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::find ( std::size_t  astr_hash_value,
std::size_t  bstr_hash_value 
) const
inline

◆ find() [2/2]

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::find ( string_iterator  astr,
string_iterator  bstr 
) const
inline

◆ find_or_insert()

template<typename StringRange , template< typename... > class HashMap>
std::tuple<ordinal_type, bool> mpqc::SlaterDeterminantSet< StringRange, HashMap >::find_or_insert ( string_iterator  astr,
string_iterator  bstr 
)
inline

Looks for the determinant, and inserts it if not found

Parameters
[in]astrspin-up string
[in]bstrspin-down string
Returns
{ordinal,inserted} where is the ordinal index and inserted is true if the determinant was inserted

◆ find_ordinal()

template<typename StringRange , template< typename... > class HashMap>
ordinal_type mpqc::SlaterDeterminantSet< StringRange, HashMap >::find_ordinal ( string_iterator  astr,
string_iterator  bstr 
) const
inline

◆ insert()

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::insert ( string_iterator  astr,
string_iterator  bstr,
ordinal_type  ord = -1 
)
inline

insert determinant defined by 2 strings, with optionally-specified ordinal value

Parameters
[in]astrspin-up string iterator
[in]bstrspin-down string iterator
[in]ordordinal value to assign to this determinant; if not given use this->size()
Returns
the iterator to the inserted determinant

◆ make_product()

template<typename StringRange , template< typename... > class HashMap>
SlaterDeterminantSet mpqc::SlaterDeterminantSet< StringRange, HashMap >::make_product ( const SlaterDeterminantSet< StringRange, HashMap > &  other,
std::function< void(const const_iterator &, const const_iterator &, const const_iterator &)>  op = {} 
) const
inline

constructs tensor product with another SlaterDeterminantSet

Parameters
otheranother SlaterDeterminantSet object
opthis callable will be called, if nonnull, for each product determinant with the iterators pointing to the determinant from *this and other sets used to construct the product, as well as the iterator to the product determinant in the result
Returns
the tensor product of this with other
Postcondition
result.size()==this->size()*other.size()

◆ operator=() [1/2]

template<typename StringRange , template< typename... > class HashMap>
SlaterDeterminantSet& mpqc::SlaterDeterminantSet< StringRange, HashMap >::operator= ( const SlaterDeterminantSet< StringRange, HashMap > &  )
default

◆ operator=() [2/2]

template<typename StringRange , template< typename... > class HashMap>
SlaterDeterminantSet& mpqc::SlaterDeterminantSet< StringRange, HashMap >::operator= ( SlaterDeterminantSet< StringRange, HashMap > &&  )
defaultnoexcept

◆ operator==()

template<typename StringRange , template< typename... > class HashMap>
bool mpqc::SlaterDeterminantSet< StringRange, HashMap >::operator== ( const SlaterDeterminantSet< StringRange, HashMap > &  other) const
inline

comparison operator

Parameters
[in]othera set of Slater determinants to be compared to *this
Returns
true if *this and other contain same determinants (not necessarily in the same order)
Note
comparison of the underlying string sets is shallow (i.e., must point to the same objects)

◆ operator[]()

template<typename StringRange , template< typename... > class HashMap>
SlaterDeterminant mpqc::SlaterDeterminantSet< StringRange, HashMap >::operator[] ( ordinal_type  i) const
inline

◆ safe_find() [1/2]

template<typename StringRange , template< typename... > class HashMap>
std::optional<const_iterator> mpqc::SlaterDeterminantSet< StringRange, HashMap >::safe_find ( std::size_t  astr_hash_value,
std::size_t  bstr_hash_value 
) const
inline

◆ safe_find() [2/2]

template<typename StringRange , template< typename... > class HashMap>
std::optional<const_iterator> mpqc::SlaterDeterminantSet< StringRange, HashMap >::safe_find ( string_iterator  astr,
string_iterator  bstr 
) const
inline

◆ safe_find_ordinal()

template<typename StringRange , template< typename... > class HashMap>
std::optional<ordinal_type> mpqc::SlaterDeterminantSet< StringRange, HashMap >::safe_find_ordinal ( string_iterator  astr,
string_iterator  bstr 
) const
inline

◆ safe_insert()

template<typename StringRange , template< typename... > class HashMap>
const_iterator mpqc::SlaterDeterminantSet< StringRange, HashMap >::safe_insert ( string_iterator  astr,
string_iterator  bstr,
ordinal_type  ord = -1 
)
inline

insert determinant defined by 2 strings, with optionally-specified ordinal value

Parameters
[in]astrspin-up string iterator
[in]bstrspin-down string iterator
[in]ordordinal value to assign to this determinant; if not given use this->size()
Returns
the iterator to the inserted determinant

◆ size()

template<typename StringRange , template< typename... > class HashMap>
std::size_t mpqc::SlaterDeterminantSet< StringRange, HashMap >::size ( ) const
inline
Returns
the number of determinants in the set

◆ strings()

template<typename StringRange , template< typename... > class HashMap>
const StringRange& mpqc::SlaterDeterminantSet< StringRange, HashMap >::strings ( SpinCase1  s) const
inline
Parameters
[in]sspin case
Returns
const reference to the set of strings of spin case s

Member Data Documentation

◆ string_range_is_random_access

template<typename StringRange , template< typename... > class HashMap>
constexpr bool mpqc::SlaterDeterminantSet< StringRange, HashMap >::string_range_is_random_access
staticconstexpr
Initial value:
= std::is_same_v<
typename std::iterator_traits<string_iterator>::iterator_category,
std::random_access_iterator_tag>

The documentation for this class was generated from the following files:
std::size_t size() const
Definition: sdseq.h:436
constexpr SpinCase1 other(SpinCase1 S)
given 1-spin return the other 1-spin
Definition: spin.cpp:61