ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
term_descriptor< T > Class Template Reference

#include <term_descriptor.h>

Inheritance diagram for term_descriptor< T >:

Public Types

typedef int pos_type
 
typedef unsigned int tag_type
 
typedef boost::tuple< pos_type,
tag_type
value_type
 
typedef std::vector< value_typebase
 
typedef base::size_type size_type
 
typedef base::iterator iterator
 
typedef base::const_iterator const_iterator
 

Public Member Functions

 term_descriptor ()
 
pos_type position (size_type i) const
 
tag_type operator_tag (size_type i) const
 
void canonical_order ()
 
bool operator< (term_descriptor const &rhs) const
 
bool site_match (term_descriptor const &rhs) const
 
bool overlap (term_descriptor const &rhs) const
 

Public Attributes

coeff
 
bool is_fermionic
 
elements
 

Detailed Description

template<typename T>
class term_descriptor< T >

Definition at line 46 of file term_descriptor.h.

Member Typedef Documentation

template<typename T>
typedef std::vector<value_type> term_descriptor< T >::base

Definition at line 52 of file term_descriptor.h.

template<typename T>
typedef base::const_iterator term_descriptor< T >::const_iterator

Definition at line 55 of file term_descriptor.h.

template<typename T>
typedef base::iterator term_descriptor< T >::iterator

Definition at line 54 of file term_descriptor.h.

template<typename T>
typedef int term_descriptor< T >::pos_type

Definition at line 48 of file term_descriptor.h.

template<typename T>
typedef base::size_type term_descriptor< T >::size_type

Definition at line 53 of file term_descriptor.h.

template<typename T>
typedef unsigned int term_descriptor< T >::tag_type

Definition at line 49 of file term_descriptor.h.

template<typename T>
typedef boost::tuple<pos_type, tag_type> term_descriptor< T >::value_type

Definition at line 50 of file term_descriptor.h.

Constructor & Destructor Documentation

template<typename T>
term_descriptor< T >::term_descriptor ( )
inline

Definition at line 59 of file term_descriptor.h.

59 : coeff(1.), is_fermionic(false) { }

Member Function Documentation

template<typename T>
void term_descriptor< T >::canonical_order ( )
inline

utilities

Definition at line 65 of file term_descriptor.h.

66  {
67  std::sort(begin(), end(), detail::pos_tag_lt());
68  }
template<typename T>
bool term_descriptor< T >::operator< ( term_descriptor< T > const &  rhs) const
inline

Definition at line 70 of file term_descriptor.h.

71  {
72  if (this->size() == 0) return true;
73  if (rhs.size() == 0) return false;
74 
75  if (this->position(0) == rhs.position(0))
76  return this->size() >= rhs.size();
77  return this->position(0) < rhs.position(0);
78  }
pos_type position(size_type i) const
template<typename T>
tag_type term_descriptor< T >::operator_tag ( size_type  i) const
inline

Definition at line 62 of file term_descriptor.h.

62 { return boost::get<1>((*this)[i]); }
template<typename T>
bool term_descriptor< T >::overlap ( term_descriptor< T > const &  rhs) const
inline

Definition at line 100 of file term_descriptor.h.

101  {
102  return !( (boost::get<0>(*this->rbegin()) < boost::get<0>(*rhs.begin())) || (boost::get<0>(*rhs.rbegin()) < boost::get<0>(*this->begin())) );
103  }
template<typename T>
pos_type term_descriptor< T >::position ( size_type  i) const
inline

Definition at line 61 of file term_descriptor.h.

61 { return boost::get<0>((*this)[i]); }
template<typename T>
bool term_descriptor< T >::site_match ( term_descriptor< T > const &  rhs) const
inline

Definition at line 80 of file term_descriptor.h.

81  {
82  if (this->size() == rhs.size())
83  {
84  bool ret = true;
85  for (std::size_t p=0; p<this->size() && ret; ++p)
86  ret = (this->position(p) == rhs.position(p));
87  return ret;
88  } else if (this->size() == 2 && rhs.size() == 1)
89  return (this->position(0) == rhs.position(0) || this->position(1) == rhs.position(0));
90  else if (this->size() == 1 && rhs.size() == 2)
91  return (this->position(0) == rhs.position(0) || this->position(0) == rhs.position(1));
92  else
93  {
94  throw std::runtime_error("site_match not implemented for this type of operator." );
95  return false;
96  }
97 
98  }
pos_type position(size_type i) const

Member Data Documentation

template<typename T>
T term_descriptor< T >::coeff

Definition at line 57 of file term_descriptor.h.

T std::vector< T >::elements
inherited

STL member.

template<typename T>
bool term_descriptor< T >::is_fermionic

Definition at line 58 of file term_descriptor.h.


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