mpqc::HBSparseTensor< RR, RC, Abs, T > Class Template Reference

Documentation

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
class mpqc::HBSparseTensor< RR, RC, Abs, T >

Heat-bath sparse representation of a tensor of rank RI+RO

Note
HB representation is akin to CSR of tensor matricized RI x RO, with rows sorted by magnitude
Template Parameters
RRrow rank
RCcolumn rank
Absif true, will store the absolute values of the elements only
Tthe element type

Classes

struct  Element
 
struct  Value
 

Public Types

using row_index_type = std::array< orbital_index_type, RR >
 
using col_index_type = std::array< orbital_index_type, RC >
 
using real_type = float
 
using magnitude_type = real_type
 
using empty_type = struct {}
 
using element_data_type = Element
 
using row_type = std::vector< element_data_type >
 
using row_iterator_type = typename row_type::iterator
 

Public Member Functions

template<typename Tensor >
 HBSparseTensor (const Tensor &dense_tensor, magnitude_type epsilon)
 
const auto & row (const row_index_type &idx) const
 
bool row_exists (const row_index_type &idx) const
 
const auto & maxabs_element () const
 

Friends

template<class CharT , class Traits , std::size_t RR_, std::size_t RC_, bool Abs_, typename T_ >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &, const HBSparseTensor< RR_, RC_, Abs_, T_ > &)
 

Member Typedef Documentation

◆ col_index_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::col_index_type = std::array<orbital_index_type, RC>

◆ element_data_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::element_data_type = Element

◆ empty_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::empty_type = struct {}

◆ magnitude_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::magnitude_type = real_type

◆ real_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::real_type = float

◆ row_index_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::row_index_type = std::array<orbital_index_type, RR>

◆ row_iterator_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::row_iterator_type = typename row_type::iterator

◆ row_type

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
using mpqc::HBSparseTensor< RR, RC, Abs, T >::row_type = std::vector<element_data_type>

Constructor & Destructor Documentation

◆ HBSparseTensor()

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
template<typename Tensor >
mpqc::HBSparseTensor< RR, RC, Abs, T >::HBSparseTensor ( const Tensor &  dense_tensor,
magnitude_type  epsilon 
)
inline
Template Parameters
Tensora dense tensor type
Parameters
[in]dense_tensora dense tensor, with first RC modes serving as the row modes
[in]epsilonall values in dense_tensor of magnitude smaller than this are ignored

Member Function Documentation

◆ maxabs_element()

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
const auto& mpqc::HBSparseTensor< RR, RC, Abs, T >::maxabs_element ( ) const
inline
Returns
{{row_idx,col_idx},abs_value} of the element with the largest magnitude; if all elements were screened out abs_value will be -1.

◆ row()

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
const auto& mpqc::HBSparseTensor< RR, RC, Abs, T >::row ( const row_index_type idx) const
inline
Parameters
[in]idxrow index
Returns
(reference to) the row element {col_idx,value} pairs, sorted in the order of descending magnitude
Precondition
this->row_exists(idx) == true

◆ row_exists()

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
bool mpqc::HBSparseTensor< RR, RC, Abs, T >::row_exists ( const row_index_type idx) const
inline
Parameters
[in]idxrow index
Returns
true if row idx has at least 1 nonzero value

Friends And Related Function Documentation

◆ operator<<

template<std::size_t RR, std::size_t RC, bool Abs = false, typename T = double>
template<class CharT , class Traits , std::size_t RR_, std::size_t RC_, bool Abs_, typename T_ >
std::basic_ostream<CharT, Traits>& operator<< ( std::basic_ostream< CharT, Traits > &  ,
const HBSparseTensor< RR_, RC_, Abs_, T_ > &   
)
friend

The documentation for this class was generated from the following file:
  • mpqc/math/fock/hb.h