mpqc::utility Namespace Reference

Namespaces

 aux
 
 cxx
 
 detail
 
 meta
 

Classes

class  FilteredGenerator
 
struct  gen_seq
 
struct  gen_seq< 0, Is... >
 
class  GeneratorAdaptor
 
class  GeneratorDCIterator
 Iterator facade for a Generator. More...
 
class  GeneratorIterator
 Iterator facade for a Generator. More...
 
struct  GeneratorRangeFacade
 To make a Generator behave as a range use this as a CRTP base. More...
 
struct  hash
 
struct  intersection_sd_str
 
struct  is_tuple
 
struct  is_tuple< std::tuple< Ts... > >
 
struct  make_generator
 
struct  make_generator< FilteredGenerator< BaseGenerator, Filter > >
 
struct  make_generator< FullCreAnnGenerator< RC, RA > >
 generates FullCreAnnGenerator for a given string More...
 
struct  make_generator< FullCreAnnPairGenerator< RCa, RCb, RAa, RAb > >
 generates FullCreAnnPairGenerator for a given SlaterDeterminant More...
 
struct  make_generator< FullDeterminantReplacementGenerator< CreAnnPairGenerator > >
 
struct  make_generator< FullStringReplacementGenerator< CreAnnGenerator > >
 
struct  make_generator< HBDeterminantReplacementGenerator< RCa, RCb, RAa, RAb, StringOrStringRange, AbsHBData, T > >
 
struct  make_generator< HBStringReplacementGenerator< RC, RA, String, AbsHBData, T > >
 
struct  make_generator< HBTupleGenerator< RO, RI, AbsHBData, T > >
 
struct  make_generator< InRangeFullDeterminantReplacementGenerator< StringRange, CreAnnPairGenerator > >
 
struct  make_generator< OrbitalTupleGenerator< Rank, HostRange, Value > >
 
struct  make_generator< PrimitiveOperatorGenerator< CreAnnGenerator > >
 generates PrimitiveOperatorGenerator for a given string More...
 
struct  make_generator< PrimitiveOperatorPairGenerator< CreAnnPairGenerator > >
 generates PrimitiveOperatorGenerator for a given string More...
 
struct  make_generator< TupleOfOrbitalTuplesGenerator< Ranks... > >
 
struct  no_input_given
 thrown if no input given to the program More...
 
struct  NonrelocatableOptional
 std::optional<T> for nonrelocatable T types More...
 
class  Observable
 helps to set up messaging between objects via the Observer pattern More...
 
class  Observer
 helps to set up messaging between objects via the Observer pattern More...
 
struct  recursive_tuple_size
 
struct  recursive_tuple_size< const T >
 
struct  recursive_tuple_size< std::array< T, N > >
 
struct  recursive_tuple_size< std::pair< T1, T2 > >
 
struct  recursive_tuple_size< std::tuple< FirstType, RestOfTypes... > >
 
struct  recursive_tuple_size< std::tuple<> >
 
struct  recursive_tuple_size< T & >
 
struct  recursive_tuple_size< T, std::enable_if_t< std::is_fundamental_v< T > > >
 
struct  sdequal
 
struct  sdhashcompare
 
struct  seq
 seq and gen_seq are taken from stackoverflow's pretty print tuple answer. More...
 
struct  strequal
 
struct  strhashcompare
 
struct  TensorProductGenerator
 Tensor product of generators. More...
 
class  thread_specific
 Implements a highly-limited subset of tbb:enumerable_thread_specific using boost::thread_specific_ptr. More...
 
class  Timestampable
 
class  TimestampFactory
 Produces timestamps. More...
 
class  TRange1Engine
 Factory producing TiledRange1 objects for various orbital ranges. More...
 
class  TSPool
 A pool of thread-specific objects. More...
 
class  TupleGenerator
 

Functions

template<typename TArray = TA::DistArray<TA::TensorZ, TA::SparsePolicy>>
std::tuple< MatrixZ, double > gensqrtinv (const TArray &S, bool symmetric, double max_condition_num, int64_t k, bool print=false)
 gensqrtinv More...
 
template<typename TArray = TA::DistArray<TA::TensorZ, TA::SparsePolicy>>
std::tuple< std::vector< MatrixZ >, double > conditioned_orthogonalizer (const TArray overlap, int64_t k_size, double max_condition_num=1.0e8, int64_t print_max_item=100)
 conditioned_orthogonalizer More...
 
template<typename T >
vec_avg (std::vector< T > const &v)
 
std::array< double, 3 > vec_avg (std::vector< std::array< double, 3 >> const &v)
 
TA::TiledRange1 compute_trange1 (std::size_t range_size, std::size_t target_block_size)
 
TA::TiledRange1 replicate_trange1 (TA::TiledRange1 const &tr0, int64_t size)
 This extends 1D tiled range by repeating it multiple times. More...
 
void parallel_break_point (madness::World &world, volatile int debug)
 
void parallel_read_file (madness::World &world, const std::string &filename, std::unique_ptr< char[]> &buffer)
 
void parallel_read_file (madness::World &world, const std::string &filename, std::stringstream &output)
 
void parallel_read_file (madness::World &world, const std::string &filename, char *&buffer)
 
template<class Ch , class Tr , class... Args>
auto & operator<< (std::basic_ostream< Ch, Tr > &os, std::tuple< Args... > const &t)
 
template<typename... Args>
void print_par (madness::World &world, Args &&... args)
 
void print_file (madness::World &world, const std::string &file)
 
template<typename... Args>
constexpr std::array< meta::first_type_t< Args... >, sizeof...(Args)> make_array (Args... args)
 
template<typename... Args>
constexpr std::array< std::reference_wrapper< meta::first_type_t< Args... > >, sizeof...(Args)> make_array_of_refs (Args &... args)
 
template<typename... Args>
constexpr std::array< std::reference_wrapper< std::add_const_t< meta::first_type_t< Args... > > >, sizeof...(Args)> make_array_of_crefs (Args &... args)
 
template<typename... Args>
constexpr boost::container::small_vector< meta::first_type_t< Args... >, sizeof...(Args)> make_svector (Args... args)
 
template<typename... Args>
constexpr boost::container::small_vector< std::reference_wrapper< meta::first_type_t< Args... > >, sizeof...(Args)> make_svector_of_refs (Args &... args)
 
template<typename... Args>
constexpr std::vector< meta::first_type_t< Args... > > make_vector (Args... args)
 
template<typename... Args>
constexpr std::vector< std::reference_wrapper< meta::first_type_t< Args... > > > make_vector_of_refs (Args &... args)
 
template<typename... Args>
constexpr std::vector< std::reference_wrapper< std::add_const_t< meta::first_type_t< Args... > > > > make_vector_of_crefs (Args &... args)
 
template<typename T >
std::enable_if_t< madness::is_ostreammable< T >::value, T > to_ostream (T &&value)
 forwards value to std::ostream if possible More...
 
template<typename T >
std::string to_ostream (T &&value, std::enable_if_t<!madness::is_ostreammable< T >::value > *=nullptr)
 
template<typename Item >
std::shared_ptr< TSPool< Item > > make_pool (Item e)
 
std::wstring to_wstring (const std::string &str_utf8)
 converts an utf-8 encoded std::string to an utf-8 encoded std::wstring More...
 
std::wstring to_wstring (const std::wstring &wstr_utf8)
 dummy converter More...
 
template<typename Char , size_t N>
std::wstring to_wstring (const Char(&str_utf8)[N])
 converts an utf-8 encoded Char[] to a utf-8 encoded std::wstring More...
 
template<typename Char >
std::basic_string< char > to_string (const std::basic_string< Char > &str_utf8)
 (potentially) narrowing character converter. More...
 
template<typename Char , size_t N>
std::basic_string< char > to_string (const Char(&str_utf8)[N])
 (potentially) narrowing character converter. More...
 
std::basic_string< char > to_string (const wchar_t *str_utf8)
 (potentially) narrowing character converter. More...
 
template<typename... Args>
std::string concat (Args &&... args)
 
template<typename... Args>
std::wstring wconcat (Args &&... args)
 
template<typename... Args>
std::string concatsep (const char *separator, Args &&... args)
 
template<typename... Args>
std::wstring wconcatsep (const wchar_t *separator, Args &&... args)
 
template<typename... Args>
std::string concatcm (Args &&... args)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Timestampable< T > &x)
 
template<typename T >
constexpr decltype(auto) as_tuple (T t)
 
template<typename... Ts>
constexpr decltype(auto) as_tuple (std::tuple< Ts... > t)
 
template<typename T >
constexpr decltype(auto) flatten (T t)
 
template<typename T >
constexpr decltype(auto) flatten (std::tuple< T > t)
 
template<typename... Ts, std::enable_if_t<!(is_tuple< Ts >::value||...), bool > = false>
constexpr decltype(auto) flatten (std::tuple< Ts... > t)
 
template<std::size_t... I, typename... Args>
auto make_tuple_of_refs_impl (std::index_sequence< I... > idxs, std::tuple< Args... > &t)
 
template<std::size_t... I, typename... Args>
auto make_tuple_of_refs_impl (std::index_sequence< I... > idxs, const std::tuple< Args... > &t)
 
template<typename... Args>
auto make_tuple_of_refs (std::tuple< Args... > &t)
 
template<typename... Args>
auto make_tuple_of_refs (const std::tuple< Args... > &t)
 
template<typename T , std::size_t N>
constexpr const std::array< T, N > & make_array (const std::array< T, N > &v)
 
template<typename T , std::size_t N1>
constexpr const std::array< T, N1 > & make_array (const std::tuple< const std::array< T, N1 > & > &v)
 
template<typename T , std::size_t N1, std::size_t N2>
constexpr std::array< T, N1+N2 > make_array (const std::tuple< const std::array< T, N1 > &, const std::array< T, N2 > & > &v)
 
template<std::size_t N1, typename T >
constexpr auto make_tuple_of_arrays (const std::array< T, N1 > &v)
 
template<std::size_t N1, std::size_t N2, typename T >
constexpr auto make_tuple_of_arrays (const std::array< T, N1+N2 > &v)
 

Variables

template<typename T , typename Enabler = void>
constexpr bool is_generator_v = false
 
template<typename T >
constexpr std::size_t recursive_tuple_size_v = recursive_tuple_size<T>::value
 

Function Documentation

◆ as_tuple() [1/2]

template<typename... Ts>
constexpr decltype(auto) mpqc::utility::as_tuple ( std::tuple< Ts... >  t)
constexpr

◆ as_tuple() [2/2]

template<typename T >
constexpr decltype(auto) mpqc::utility::as_tuple ( t)
constexpr

◆ compute_trange1()

TA::TiledRange1 mpqc::utility::compute_trange1 ( std::size_t  range_size,
std::size_t  target_block_size 
)
Parameters
[in]range_sizethe range size
[in]target_block_sizethe desired block size
Returns
TiledRange1 obtained by tiling range [0,range_size) into (range_size + target_block_size - 1)/target_block_size blocks of approximately target_block_size size

◆ concat()

template<typename... Args>
std::string mpqc::utility::concat ( Args &&...  args)
Returns
a std::string obtained by streaming args to a std::ostringstream

◆ concatcm()

template<typename... Args>
std::string mpqc::utility::concatcm ( Args &&...  args)

shorthand for concatsep , with separator=","

Returns
a std::string obtained by streaming args to a std::ostringstream

◆ concatsep()

template<typename... Args>
std::string mpqc::utility::concatsep ( const char *  separator,
Args &&...  args 
)
Returns
a std::string obtained by streaming args to a std::ostringstream, separated by separator

◆ conditioned_orthogonalizer()

template<typename TArray = TA::DistArray<TA::TensorZ, TA::SparsePolicy>>
std::tuple<std::vector<MatrixZ>, double> mpqc::utility::conditioned_orthogonalizer ( const TArray  overlap,
int64_t  k_size,
double  max_condition_num = 1.0e8,
int64_t  print_max_item = 100 
)

conditioned_orthogonalizer

Parameters
overlapis rectangular overlap matrix in k_space
k_sizeis total # of k points
max_condition_numis maximum condition number allowed
Returns
{conditioned orthogonalizer, max condition number} pair

◆ flatten() [1/3]

template<typename T >
constexpr decltype(auto) mpqc::utility::flatten ( std::tuple< T >  t)
constexpr

◆ flatten() [2/3]

template<typename... Ts, std::enable_if_t<!(is_tuple< Ts >::value||...), bool > = false>
constexpr decltype(auto) mpqc::utility::flatten ( std::tuple< Ts... >  t)
constexpr

◆ flatten() [3/3]

template<typename T >
constexpr decltype(auto) mpqc::utility::flatten ( t)
constexpr

◆ gensqrtinv()

template<typename TArray = TA::DistArray<TA::TensorZ, TA::SparsePolicy>>
std::tuple<MatrixZ, double> mpqc::utility::gensqrtinv ( const TArray &  S,
bool  symmetric,
double  max_condition_num,
int64_t  k,
bool  print = false 
)

gensqrtinv

computes generalized orthogonalizer X such that Xt.S.X = I

Parameters
Sis complex overlap matrix for a specific k vector
max_condition_numthe maximum condition number allowed
Returns
{generalized orthogonalizer, condition number}

◆ make_array() [1/4]

template<typename... Args>
constexpr std::array<meta::first_type_t<Args...>, sizeof...(Args)> mpqc::utility::make_array ( Args...  args)
constexpr

◆ make_array() [2/4]

template<typename T , std::size_t N>
constexpr const std::array<T, N>& mpqc::utility::make_array ( const std::array< T, N > &  v)
constexpr

◆ make_array() [3/4]

template<typename T , std::size_t N1>
constexpr const std::array<T, N1>& mpqc::utility::make_array ( const std::tuple< const std::array< T, N1 > & > &  v)
constexpr

◆ make_array() [4/4]

template<typename T , std::size_t N1, std::size_t N2>
constexpr std::array<T, N1 + N2> mpqc::utility::make_array ( const std::tuple< const std::array< T, N1 > &, const std::array< T, N2 > & > &  v)
constexpr

◆ make_array_of_crefs()

template<typename... Args>
constexpr std::array< std::reference_wrapper<std::add_const_t<meta::first_type_t<Args...> > >, sizeof...(Args)> mpqc::utility::make_array_of_crefs ( Args &...  args)
constexpr

◆ make_array_of_refs()

template<typename... Args>
constexpr std::array<std::reference_wrapper<meta::first_type_t<Args...> >, sizeof...(Args)> mpqc::utility::make_array_of_refs ( Args &...  args)
constexpr

◆ make_pool()

template<typename Item >
std::shared_ptr<TSPool<Item> > mpqc::utility::make_pool ( Item  e)

◆ make_svector()

template<typename... Args>
constexpr boost::container::small_vector<meta::first_type_t<Args...>, sizeof...(Args)> mpqc::utility::make_svector ( Args...  args)
constexpr

◆ make_svector_of_refs()

template<typename... Args>
constexpr boost::container::small_vector< std::reference_wrapper<meta::first_type_t<Args...> >, sizeof...(Args)> mpqc::utility::make_svector_of_refs ( Args &...  args)
constexpr

◆ make_tuple_of_arrays() [1/2]

template<std::size_t N1, typename T >
constexpr auto mpqc::utility::make_tuple_of_arrays ( const std::array< T, N1 > &  v)
constexpr

◆ make_tuple_of_arrays() [2/2]

template<std::size_t N1, std::size_t N2, typename T >
constexpr auto mpqc::utility::make_tuple_of_arrays ( const std::array< T, N1+N2 > &  v)
constexpr

◆ make_tuple_of_refs() [1/2]

template<typename... Args>
auto mpqc::utility::make_tuple_of_refs ( const std::tuple< Args... > &  t)

◆ make_tuple_of_refs() [2/2]

template<typename... Args>
auto mpqc::utility::make_tuple_of_refs ( std::tuple< Args... > &  t)

◆ make_tuple_of_refs_impl() [1/2]

template<std::size_t... I, typename... Args>
auto mpqc::utility::make_tuple_of_refs_impl ( std::index_sequence< I... >  idxs,
const std::tuple< Args... > &  t 
)

◆ make_tuple_of_refs_impl() [2/2]

template<std::size_t... I, typename... Args>
auto mpqc::utility::make_tuple_of_refs_impl ( std::index_sequence< I... >  idxs,
std::tuple< Args... > &  t 
)

◆ make_vector()

template<typename... Args>
constexpr std::vector<meta::first_type_t<Args...> > mpqc::utility::make_vector ( Args...  args)
constexpr

◆ make_vector_of_crefs()

template<typename... Args>
constexpr std::vector< std::reference_wrapper<std::add_const_t<meta::first_type_t<Args...> > > > mpqc::utility::make_vector_of_crefs ( Args &...  args)
constexpr

◆ make_vector_of_refs()

template<typename... Args>
constexpr std::vector<std::reference_wrapper<meta::first_type_t<Args...> > > mpqc::utility::make_vector_of_refs ( Args &...  args)
constexpr

◆ operator<<() [1/2]

template<class Ch , class Tr , class... Args>
auto& mpqc::utility::operator<< ( std::basic_ostream< Ch, Tr > &  os,
std::tuple< Args... > const &  t 
)

◆ operator<<() [2/2]

template<typename T >
std::ostream& mpqc::utility::operator<< ( std::ostream &  os,
const Timestampable< T > &  x 
)

◆ parallel_break_point()

void mpqc::utility::parallel_break_point ( madness::World &  world,
volatile int  debug 
)
inline

◆ parallel_read_file() [1/3]

void mpqc::utility::parallel_read_file ( madness::World &  world,
const std::string &  filename,
char *&  buffer 
)

◆ parallel_read_file() [2/3]

void mpqc::utility::parallel_read_file ( madness::World &  world,
const std::string &  filename,
std::stringstream &  output 
)

◆ parallel_read_file() [3/3]

void mpqc::utility::parallel_read_file ( madness::World &  world,
const std::string &  filename,
std::unique_ptr< char[]> &  buffer 
)

◆ print_file()

void mpqc::utility::print_file ( madness::World &  world,
const std::string &  file 
)
inline

◆ print_par()

template<typename... Args>
void mpqc::utility::print_par ( madness::World &  world,
Args &&...  args 
)

◆ replicate_trange1()

TA::TiledRange1 mpqc::utility::replicate_trange1 ( TA::TiledRange1 const &  tr0,
int64_t  n 
)

This extends 1D tiled range by repeating it multiple times.

Returns
a TiledRange1 object obtained by replicating tr0 n times
Parameters
tr0the original TiledRange1 object
sizethe number of times for repeating
Returns
the extended TiledRange1 object

◆ to_ostream() [1/2]

template<typename T >
std::enable_if_t<madness::is_ostreammable<T>::value, T> mpqc::utility::to_ostream ( T &&  value)

forwards value to std::ostream if possible

◆ to_ostream() [2/2]

template<typename T >
std::string mpqc::utility::to_ostream ( T &&  value,
std::enable_if_t<!madness::is_ostreammable< T >::value > *  = nullptr 
)

◆ to_string() [1/3]

template<typename Char , size_t N>
std::basic_string<char> mpqc::utility::to_string ( const Char(&)  str_utf8[N])
inline

(potentially) narrowing character converter.

Converts a UTF-8 encoded Char[] to a UTF-8 encoded std::basic_string<char>

Template Parameters
Charcharacter type: wchar_t or char
Nthe length of str_utf8

◆ to_string() [2/3]

template<typename Char >
std::basic_string<char> mpqc::utility::to_string ( const std::basic_string< Char > &  str_utf8)
inline

(potentially) narrowing character converter.

Converts a UTF-8 encoded std::basic_string<Char> to a UTF-8 encoded std::basic_string<char>

Template Parameters
Charcharacter type: wchar_t or char

◆ to_string() [3/3]

std::basic_string<char> mpqc::utility::to_string ( const wchar_t *  str_utf8)
inline

(potentially) narrowing character converter.

Converts a UTF-8 encoded const wchar_t* to a UTF-8 encoded std::basic_string<char>

◆ to_wstring() [1/3]

template<typename Char , size_t N>
std::wstring mpqc::utility::to_wstring ( const Char(&)  str_utf8[N])

converts an utf-8 encoded Char[] to a utf-8 encoded std::wstring

Template Parameters
Charcharacter type: wchar_t or char

◆ to_wstring() [2/3]

std::wstring mpqc::utility::to_wstring ( const std::string &  str_utf8)
inline

converts an utf-8 encoded std::string to an utf-8 encoded std::wstring

◆ to_wstring() [3/3]

std::wstring mpqc::utility::to_wstring ( const std::wstring &  wstr_utf8)
inline

dummy converter

◆ vec_avg() [1/2]

std::array<double, 3> mpqc::utility::vec_avg ( std::vector< std::array< double, 3 >> const &  v)
inline

◆ vec_avg() [2/2]

template<typename T >
T mpqc::utility::vec_avg ( std::vector< T > const &  v)

◆ wconcat()

template<typename... Args>
std::wstring mpqc::utility::wconcat ( Args &&...  args)
Returns
a std::wstring obtained by streaming args to a std::wostringstream

◆ wconcatsep()

template<typename... Args>
std::wstring mpqc::utility::wconcatsep ( const wchar_t *  separator,
Args &&...  args 
)
Returns
a std::wstring obtained by streaming args to a std::wostringstream, separated by separator

Variable Documentation

◆ is_generator_v

template<typename T , typename Enabler = void>
constexpr bool mpqc::utility::is_generator_v = false
constexpr

Generator is a type that matches this concept:

template <typename T> concept Generator {
using value_type = T;
explicit operator bool() const;
Generator& operator++(); // only usable if this is true
const T& operator*() const; // only usable if this is true
};

and is comparable. Hence, Generator<T> is similar to a (constant) forward iterator.

◆ recursive_tuple_size_v

template<typename T >
constexpr std::size_t mpqc::utility::recursive_tuple_size_v = recursive_tuple_size<T>::value
constexpr
auto operator*(const double &factor, const ExprVector< E > &expr)
Definition: dist_array_vector.h:369