ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Types | List of all members
TagHandler< Matrix, SymmGroup > Class Template Reference

#include <op_handler.h>

Inheritance diagram for TagHandler< Matrix, SymmGroup >:
KronHandler< Matrix, SymmGroup >

Public Types

typedef OPTable< Matrix,
SymmGroup >::tag_type 
tag_type
 
typedef OPTable< Matrix,
SymmGroup >::op_t 
op_t
 

Public Member Functions

 TagHandler ()
 
 TagHandler (boost::shared_ptr< OPTable< Matrix, SymmGroup > > tbl_)
 
tag_type register_op (const op_t &op_, tag_detail::operator_kind kind)
 
std::pair< tag_type, value_typechecked_register (op_t const &sample, tag_detail::operator_kind kind)
 
OPTable< Matrix, SymmGroup >
::value_type
get_op (tag_type i)
 
OPTable< Matrix, SymmGroup >
::value_type const & 
get_op (tag_type i) const
 
bool is_fermionic (tag_type query_tag) const
 
std::pair< tag_type, value_typeget_product_tag (const tag_type t1, const tag_type t2)
 
tag_type prod_duplicates () const
 
tag_type get_num_products () const
 
tag_type total_size () const
 
boost::shared_ptr< OPTable
< Matrix, SymmGroup > > 
get_operator_table ()
 
template<class Map >
OPTable< Matrix, SymmGroup >
::tag_type 
duplicates_ (Map const &sample)
 

Protected Types

typedef Matrix::value_type value_type
 
typedef std::map< std::pair
< tag_type, tag_type >
, std::pair< tag_type,
value_type >
, tag_detail::pair_cmp
pair_map_t
 
typedef pair_map_t::const_iterator pair_map_it_t
 

Detailed Description

template<class Matrix, class SymmGroup>
class TagHandler< Matrix, SymmGroup >

Definition at line 58 of file op_handler.h.

Member Typedef Documentation

template<class Matrix, class SymmGroup>
typedef OPTable<Matrix, SymmGroup>::op_t TagHandler< Matrix, SymmGroup >::op_t

Definition at line 62 of file op_handler.h.

template<class Matrix, class SymmGroup>
typedef pair_map_t::const_iterator TagHandler< Matrix, SymmGroup >::pair_map_it_t
protected

Definition at line 67 of file op_handler.h.

template<class Matrix, class SymmGroup>
typedef std::map<std::pair<tag_type, tag_type>, std::pair<tag_type, value_type>, tag_detail::pair_cmp> TagHandler< Matrix, SymmGroup >::pair_map_t
protected

Definition at line 66 of file op_handler.h.

template<class Matrix, class SymmGroup>
typedef OPTable<Matrix, SymmGroup>::tag_type TagHandler< Matrix, SymmGroup >::tag_type

Definition at line 61 of file op_handler.h.

template<class Matrix, class SymmGroup>
typedef Matrix::value_type TagHandler< Matrix, SymmGroup >::value_type
protected

Definition at line 65 of file op_handler.h.

Constructor & Destructor Documentation

template<class Matrix, class SymmGroup>
TagHandler< Matrix, SymmGroup >::TagHandler ( )
inline

Definition at line 70 of file op_handler.h.

70  :
71  operator_table(new OPTable<Matrix, SymmGroup>())
72  { }
template<class Matrix, class SymmGroup>
TagHandler< Matrix, SymmGroup >::TagHandler ( boost::shared_ptr< OPTable< Matrix, SymmGroup > >  tbl_)
inline

Definition at line 74 of file op_handler.h.

74  :
75  operator_table(tbl_)
76  { }

Member Function Documentation

template<class Matrix, class SymmGroup>
std::pair<tag_type, value_type> TagHandler< Matrix, SymmGroup >::checked_register ( op_t const &  sample,
tag_detail::operator_kind  kind 
)
inline

Definition at line 80 of file op_handler.h.

80  {
81  std::pair<tag_type, value_type> ret = operator_table->checked_register(sample);
82  if (sign_table.size() < operator_table->size())
83  sign_table.push_back(kind);
84 
85  assert(sign_table.size() == operator_table->size());
86 
87  return ret;
88  }
template<class Matrix, class SymmGroup>
template<class Map >
OPTable<Matrix, SymmGroup>::tag_type TagHandler< Matrix, SymmGroup >::duplicates_ ( Map const &  sample)

Definition at line 128 of file op_handler.hpp.

128  {
129  typedef typename Map::const_iterator it_t;
130 
131  std::vector<tag_type> unique_ops;
132  for (it_t it_s = sample.begin(); it_s != sample.end(); ++it_s)
133  {
134  bool unique = true;
135  for (typename std::vector<tag_type>::iterator it_unique = unique_ops.begin(); it_unique != unique_ops.end(); ++it_unique)
136  if (equal((*operator_table)[(*it_s).second.first], (*operator_table)[*it_unique]).first)
137  {
138  unique = false;
139  break;
140  }
141 
142  if (unique)
143  unique_ops.push_back((*it_s).second.first);
144  }
145 
146  return sample.size() - unique_ops.size();
147 }
std::pair< bool, typename Matrix::value_type > equal(block_matrix< Matrix, SymmGroup > const &reference, block_matrix< Matrix, SymmGroup > const &sample)
Definition: tag_detail.h:120
template<class Matrix , class SymmGroup >
OPTable< Matrix, SymmGroup >::tag_type TagHandler< Matrix, SymmGroup >::get_num_products ( ) const

Definition at line 150 of file op_handler.hpp.

150  {
151  std::set<tag_type> utags;
152  for (pair_map_it_t it = product_tags.begin(); it != product_tags.end(); ++it)
153  utags.insert(it->second.first);
154 
155  return utags.size();
156 }
pair_map_t::const_iterator pair_map_it_t
Definition: op_handler.h:67
template<class Matrix, class SymmGroup>
OPTable<Matrix, SymmGroup>::value_type& TagHandler< Matrix, SymmGroup >::get_op ( tag_type  i)
inline

Definition at line 112 of file op_handler.h.

112 { return (*operator_table)[i]; }
template<class Matrix, class SymmGroup>
OPTable<Matrix, SymmGroup>::value_type const& TagHandler< Matrix, SymmGroup >::get_op ( tag_type  i) const
inline

Definition at line 113 of file op_handler.h.

113 { return (*operator_table)[i]; }
template<class Matrix, class SymmGroup>
boost::shared_ptr<OPTable<Matrix, SymmGroup> > TagHandler< Matrix, SymmGroup >::get_operator_table ( )
inline

Definition at line 128 of file op_handler.h.

128 { return operator_table; }
template<class Matrix, class SymmGroup>
std::pair< typename OPTable< Matrix, SymmGroup >::tag_type, typename TagHandler< Matrix, SymmGroup >::value_type > TagHandler< Matrix, SymmGroup >::get_product_tag ( const tag_type  t1,
const tag_type  t2 
)

Definition at line 88 of file op_handler.hpp.

92 {
93  assert( t1 < operator_table->size() && t2 < operator_table->size() );
94 
95  // return tag of product, if already there
96  try {
97 #if defined(__xlC__) || defined(__FCC_VERSION)
98  if (product_tags.count(std::make_pair(t1, t2)) == 0)
99  throw std::out_of_range("");
100 
101  return product_tags[std::make_pair(t1, t2)];
102 #else
103  return product_tags.at(std::make_pair(t1, t2));
104 #endif
105  }
106 
107  // compute and register the product, then return the new tag
108  catch(const std::out_of_range& e) {
109 
110  op_t product;
111  op_t& op1 = (*operator_table)[t1];
112  op_t& op2 = (*operator_table)[t2];
113 
114  gemm(op1, op2, product);
116  if (sign_table[t1] != sign_table[t2])
117  prod_kind = tag_detail::fermionic;
118 
119  std::pair<tag_type, value_type> ret = this->checked_register(product, prod_kind);
120  product_tags[std::make_pair(t1, t2)] = ret;
121  return ret;
122  }
123 }
OPTable< Matrix, SymmGroup >::op_t op_t
Definition: op_handler.h:62
std::pair< tag_type, value_type > checked_register(op_t const &sample, tag_detail::operator_kind kind)
Definition: op_handler.h:80
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
template<class Matrix, class SymmGroup>
bool TagHandler< Matrix, SymmGroup >::is_fermionic ( tag_type  query_tag) const
inline

Definition at line 115 of file op_handler.h.

115 { return sign_table[query_tag]; }
template<class Matrix, class SymmGroup>
tag_type TagHandler< Matrix, SymmGroup >::prod_duplicates ( ) const
inline

Definition at line 122 of file op_handler.h.

122 { return duplicates_(product_tags); }
template<class Matrix , class SymmGroup >
OPTable< Matrix, SymmGroup >::tag_type TagHandler< Matrix, SymmGroup >::register_op ( const op_t op_,
tag_detail::operator_kind  kind 
)

Definition at line 60 of file op_handler.hpp.

60  {
61  sign_table.push_back(kind);
62  return operator_table->register_op(op_);
63 }
template<class Matrix, class SymmGroup>
tag_type TagHandler< Matrix, SymmGroup >::total_size ( ) const
inline

Definition at line 125 of file op_handler.h.

125 { return operator_table->size(); }

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