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

#include <indexing_sorted.hpp>

Inheritance diagram for Index< SymmGroup >:

Public Types

typedef SymmGroup::charge charge
 
typedef base_t::value_type value_type
 
typedef base_t::iterator iterator
 
typedef base_t::const_iterator const_iterator
 
typedef base_t::reverse_iterator reverse_iterator
 
typedef
base_t::const_reverse_iterator 
const_reverse_iterator
 
typedef basis_iterator_
< SymmGroup > 
basis_iterator
 
typedef SymmGroup::charge charge
 
typedef data_type::value_type value_type
 
typedef data_type::iterator iterator
 
typedef data_type::const_iterator const_iterator
 
typedef data_type::reverse_iterator reverse_iterator
 
typedef
data_type::const_reverse_iterator 
const_reverse_iterator
 
typedef basis_iterator_
< SymmGroup > 
basis_iterator
 
typedef SymmGroup::charge charge
 
typedef base_t::value_type value_type
 
typedef base_t::iterator iterator
 
typedef base_t::const_iterator const_iterator
 
typedef base_t::reverse_iterator reverse_iterator
 
typedef
base_t::const_reverse_iterator 
const_reverse_iterator
 
typedef basis_iterator_
< SymmGroup > 
basis_iterator
 

Public Member Functions

Indexoperator= (Index rhs)
 
std::size_t size_of_block (charge c) const
 
std::size_t size_of_block (charge c, bool position_check) const
 
std::size_t position (charge c) const
 
std::size_t position (std::pair< charge, std::size_t > x) const
 
bool has (charge c) const
 
void sort ()
 
std::size_t insert (std::pair< charge, std::size_t > const &x)
 
void insert (std::size_t position, std::pair< charge, std::size_t > const &x)
 
void shift (charge diff)
 
bool operator== (Index const &o) const
 
bool operator!= (Index const &o) const
 
basis_iterator basis_begin () const
 
std::vector< chargecharges () const
 
std::vector< std::size_t > sizes () const
 
std::size_t sum_of_sizes () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
value_typeoperator[] (std::size_t p)
 
value_type const & operator[] (std::size_t p) const
 
boost::tuple< charge, std::size_t > element (std::size_t p) const
 
std::size_t size () const
 
iterator erase (iterator p)
 
iterator erase (iterator a, iterator b)
 
template<class Archive >
void load (Archive &ar)
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 
 Index ()
 
std::size_t size_of_block (charge c) const
 
std::size_t size_of_block (charge c, bool position_check) const
 
std::size_t position (charge c) const
 
std::size_t position (std::pair< charge, std::size_t > x) const
 
bool has (charge c) const
 
void sort ()
 
std::size_t insert (std::pair< charge, std::size_t > const &x)
 
void insert (std::size_t position, std::pair< charge, std::size_t > const &x)
 
void shift (charge diff)
 
bool operator== (Index const &o) const
 
bool operator!= (Index const &o) const
 
basis_iterator basis_begin () const
 
std::vector< chargecharges () const
 
std::vector< std::size_t > sizes () const
 
std::size_t sum_of_sizes () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
value_typeoperator[] (std::size_t p)
 
value_type const & operator[] (std::size_t p) const
 
boost::tuple< charge, std::size_t > element (std::size_t p) const
 
std::size_t size () const
 
iterator erase (iterator p)
 
iterator erase (iterator a, iterator b)
 
template<class Archive >
void load (Archive &ar)
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 
Indexoperator= (Index rhs)
 
std::size_t size_of_block (charge c) const
 
std::size_t size_of_block (charge c, bool position_check) const
 
std::size_t position (charge c) const
 
std::size_t position (std::pair< charge, std::size_t > x) const
 
bool has (charge c) const
 
void sort ()
 
std::size_t insert (std::pair< charge, std::size_t > const &x)
 
void insert (std::size_t position, std::pair< charge, std::size_t > const &x)
 
void shift (charge diff)
 
bool operator== (Index const &o) const
 
bool operator!= (Index const &o) const
 
basis_iterator basis_begin () const
 
std::vector< chargecharges () const
 
std::vector< std::size_t > sizes () const
 
std::size_t sum_of_sizes () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
value_typeoperator[] (std::size_t p)
 
value_type const & operator[] (std::size_t p) const
 
boost::tuple< charge, std::size_t > element (std::size_t p) const
 
std::size_t size () const
 
iterator erase (iterator p)
 
iterator erase (iterator a, iterator b)
 
template<class Archive >
void load (Archive &ar)
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 

Static Public Attributes

static const bool sorted = true
 

Protected Attributes

elements
 

Friends

class boost::serialization::access
 
void swap (Index &a, Index &b)
 

Detailed Description

template<class SymmGroup>
class Index< SymmGroup >

Definition at line 99 of file indexing_sorted.hpp.

Member Typedef Documentation

template<class SymmGroup>
typedef basis_iterator_<SymmGroup> Index< SymmGroup >::basis_iterator

Definition at line 113 of file indexing_stable.hpp.

template<class SymmGroup>
typedef basis_iterator_<SymmGroup> Index< SymmGroup >::basis_iterator

Definition at line 115 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef basis_iterator_<SymmGroup> Index< SymmGroup >::basis_iterator

Definition at line 115 of file indexing_sorted.hpp.

template<class SymmGroup>
typedef SymmGroup::charge Index< SymmGroup >::charge

Definition at line 104 of file indexing_stable.hpp.

template<class SymmGroup>
typedef SymmGroup::charge Index< SymmGroup >::charge

Definition at line 106 of file indexing_sorted.hpp.

template<class SymmGroup>
typedef SymmGroup::charge Index< SymmGroup >::charge

Definition at line 106 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef data_type::const_iterator Index< SymmGroup >::const_iterator

Definition at line 108 of file indexing_stable.hpp.

template<class SymmGroup>
typedef base_t::const_iterator Index< SymmGroup >::const_iterator

Definition at line 110 of file indexing_sorted.hpp.

template<class SymmGroup>
typedef base_t::const_iterator Index< SymmGroup >::const_iterator

Definition at line 110 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef data_type::const_reverse_iterator Index< SymmGroup >::const_reverse_iterator

Definition at line 111 of file indexing_stable.hpp.

template<class SymmGroup>
typedef base_t::const_reverse_iterator Index< SymmGroup >::const_reverse_iterator

Definition at line 113 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef base_t::const_reverse_iterator Index< SymmGroup >::const_reverse_iterator

Definition at line 113 of file indexing_sorted.hpp.

template<class SymmGroup>
typedef data_type::iterator Index< SymmGroup >::iterator

Definition at line 107 of file indexing_stable.hpp.

template<class SymmGroup>
typedef base_t::iterator Index< SymmGroup >::iterator

Definition at line 109 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef base_t::iterator Index< SymmGroup >::iterator

Definition at line 109 of file indexing_sorted.hpp.

template<class SymmGroup>
typedef data_type::reverse_iterator Index< SymmGroup >::reverse_iterator

Definition at line 110 of file indexing_stable.hpp.

template<class SymmGroup>
typedef base_t::reverse_iterator Index< SymmGroup >::reverse_iterator

Definition at line 112 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef base_t::reverse_iterator Index< SymmGroup >::reverse_iterator

Definition at line 112 of file indexing_sorted.hpp.

template<class SymmGroup>
typedef data_type::value_type Index< SymmGroup >::value_type

Definition at line 105 of file indexing_stable.hpp.

template<class SymmGroup>
typedef base_t::value_type Index< SymmGroup >::value_type

Definition at line 107 of file indexing_unsorted.hpp.

template<class SymmGroup>
typedef base_t::value_type Index< SymmGroup >::value_type

Definition at line 107 of file indexing_sorted.hpp.

Constructor & Destructor Documentation

template<class SymmGroup>
Index< SymmGroup >::Index ( )
inline

Definition at line 115 of file indexing_stable.hpp.

115 : sorted_(true) {}

Member Function Documentation

template<class SymmGroup>
basis_iterator Index< SymmGroup >::basis_begin ( ) const
inline

Definition at line 202 of file indexing_unsorted.hpp.

203  {
204  assert( this->size() > 0 );
205  return basis_iterator(*this);
206  }
basis_iterator_< SymmGroup > basis_iterator
std::size_t size() const
template<class SymmGroup>
basis_iterator Index< SymmGroup >::basis_begin ( ) const
inline

Definition at line 203 of file indexing_sorted.hpp.

204  {
205  assert( this->size() > 0 );
206  return basis_iterator(*this);
207  }
basis_iterator_< SymmGroup > basis_iterator
std::size_t size() const
template<class SymmGroup>
basis_iterator Index< SymmGroup >::basis_begin ( ) const
inline

Definition at line 203 of file indexing_stable.hpp.

204  {
205  assert( data_.size() > 0 );
206  return basis_iterator(*this);
207  }
basis_iterator_< SymmGroup > basis_iterator
template<class SymmGroup>
iterator Index< SymmGroup >::begin ( )
inline

Definition at line 229 of file indexing_unsorted.hpp.

229 { return base_t::begin(); }
template<class SymmGroup>
iterator Index< SymmGroup >::begin ( )
inline

Definition at line 230 of file indexing_sorted.hpp.

230 { return base_t::begin(); }
template<class SymmGroup>
iterator Index< SymmGroup >::begin ( )
inline

Definition at line 230 of file indexing_stable.hpp.

230 { return data_.begin(); }
template<class SymmGroup>
const_iterator Index< SymmGroup >::begin ( ) const
inline

Definition at line 231 of file indexing_unsorted.hpp.

231 { return base_t::begin(); }
template<class SymmGroup>
const_iterator Index< SymmGroup >::begin ( ) const
inline

Definition at line 232 of file indexing_sorted.hpp.

232 { return base_t::begin(); }
template<class SymmGroup>
const_iterator Index< SymmGroup >::begin ( ) const
inline

Definition at line 232 of file indexing_stable.hpp.

232 { return data_.begin(); }
template<class SymmGroup>
std::vector<charge> Index< SymmGroup >::charges ( ) const
inline

Definition at line 208 of file indexing_unsorted.hpp.

209  {
210  std::vector<charge> ret(this->size());
211  for (std::size_t k = 0; k < this->size(); ++k) ret[k] = (*this)[k].first;
212  return ret;
213  }
std::size_t size() const
template<class SymmGroup>
std::vector<charge> Index< SymmGroup >::charges ( ) const
inline

Definition at line 209 of file indexing_stable.hpp.

210  {
211  std::vector<charge> ret(data_.size());
212  for (std::size_t k = 0; k < data_.size(); ++k) ret[k] = (*this)[k].first;
213  return ret;
214  }
template<class SymmGroup>
std::vector<charge> Index< SymmGroup >::charges ( ) const
inline

Definition at line 209 of file indexing_sorted.hpp.

210  {
211  std::vector<charge> ret(this->size());
212  for (std::size_t k = 0; k < this->size(); ++k) ret[k] = (*this)[k].first;
213  return ret;
214  }
std::size_t size() const
template<class SymmGroup>
boost::tuple<charge, std::size_t> Index< SymmGroup >::element ( std::size_t  p) const
inline

Definition at line 242 of file indexing_unsorted.hpp.

243  {
244  std::size_t i=0;
245  while (p >= (*this)[i].second) {
246  p -= (*this)[i].second;
247  ++i;
248  }
249  return boost::make_tuple( (*this)[i].first, p );
250  }
template<class SymmGroup>
boost::tuple<charge, std::size_t> Index< SymmGroup >::element ( std::size_t  p) const
inline

Definition at line 243 of file indexing_sorted.hpp.

244  {
245  std::size_t i=0;
246  while (p >= (*this)[i].second) {
247  p -= (*this)[i].second;
248  ++i;
249  }
250  return boost::make_tuple( (*this)[i].first, p );
251  }
template<class SymmGroup>
boost::tuple<charge, std::size_t> Index< SymmGroup >::element ( std::size_t  p) const
inline

Definition at line 243 of file indexing_stable.hpp.

244  {
245  std::size_t i=0;
246  while (p >= (*this)[i].second) {
247  p -= (*this)[i].second;
248  ++i;
249  }
250  return boost::make_tuple( (*this)[i].first, p );
251  }
template<class SymmGroup>
iterator Index< SymmGroup >::end ( )
inline

Definition at line 230 of file indexing_unsorted.hpp.

230 { return base_t::end(); }
template<class SymmGroup>
iterator Index< SymmGroup >::end ( )
inline

Definition at line 231 of file indexing_sorted.hpp.

231 { return base_t::end(); }
template<class SymmGroup>
iterator Index< SymmGroup >::end ( )
inline

Definition at line 231 of file indexing_stable.hpp.

231 { return data_.end(); }
template<class SymmGroup>
const_iterator Index< SymmGroup >::end ( ) const
inline

Definition at line 232 of file indexing_unsorted.hpp.

232 { return base_t::end(); }
template<class SymmGroup>
const_iterator Index< SymmGroup >::end ( ) const
inline

Definition at line 233 of file indexing_sorted.hpp.

233 { return base_t::end(); }
template<class SymmGroup>
const_iterator Index< SymmGroup >::end ( ) const
inline

Definition at line 233 of file indexing_stable.hpp.

233 { return data_.end(); }
template<class SymmGroup>
iterator Index< SymmGroup >::erase ( iterator  p)
inline

Definition at line 254 of file indexing_unsorted.hpp.

254 { iterator r = base_t::erase(p); calc_positions(); return r; }
base_t::iterator iterator
template<class SymmGroup>
iterator Index< SymmGroup >::erase ( iterator  a,
iterator  b 
)
inline

Definition at line 255 of file indexing_unsorted.hpp.

255 { iterator r = base_t::erase(a,b); calc_positions(); return r; }
base_t::iterator iterator
template<class SymmGroup>
iterator Index< SymmGroup >::erase ( iterator  p)
inline

Definition at line 255 of file indexing_sorted.hpp.

255 { iterator r = base_t::erase(p); calc_positions(); return r; }
base_t::iterator iterator
template<class SymmGroup>
iterator Index< SymmGroup >::erase ( iterator  p)
inline

Definition at line 255 of file indexing_stable.hpp.

255 { iterator r = data_.erase(p); return r; }
base_t::iterator iterator
template<class SymmGroup>
iterator Index< SymmGroup >::erase ( iterator  a,
iterator  b 
)
inline

Definition at line 256 of file indexing_sorted.hpp.

256 { iterator r = base_t::erase(a,b); calc_positions(); return r; }
base_t::iterator iterator
template<class SymmGroup>
iterator Index< SymmGroup >::erase ( iterator  a,
iterator  b 
)
inline

Definition at line 256 of file indexing_stable.hpp.

256 { iterator r = data_.erase(a,b); return r; }
base_t::iterator iterator
template<class SymmGroup>
bool Index< SymmGroup >::has ( charge  c) const
inline

Definition at line 154 of file indexing_stable.hpp.

155  {
156  if (sorted_)
157  return std::binary_search(data_.begin(), data_.end(), std::make_pair(c,0), index_detail::gt<SymmGroup>());
158  else
159  return std::find_if(data_.begin(), data_.end(),
160  index_detail::is_first_equal<SymmGroup>(c)) != data_.end();
161  }
template<class SymmGroup>
bool Index< SymmGroup >::has ( charge  c) const
inline

Definition at line 160 of file indexing_unsorted.hpp.

161  {
162  return positions.count(c) > 0;
163  }
template<class SymmGroup>
bool Index< SymmGroup >::has ( charge  c) const
inline

Definition at line 161 of file indexing_sorted.hpp.

162  {
163  return positions.count(c) > 0;
164  }
template<class SymmGroup>
std::size_t Index< SymmGroup >::insert ( std::pair< charge, std::size_t > const &  x)
inline

Definition at line 169 of file indexing_stable.hpp.

170  {
171  if (sorted_) {
172  std::size_t d = destination(x.first);
173  data_.insert(data_.begin() + d, x);
174  return d;
175  } else {
176  push_back(x);
177  return data_.size()-1;
178  }
179  }
template<class SymmGroup>
std::size_t Index< SymmGroup >::insert ( std::pair< charge, std::size_t > const &  x)
inline

Definition at line 171 of file indexing_unsorted.hpp.

172  {
173  push_back(x);
174  std::size_t d = base_t::size()-1;
175  positions[x.first] = d;
176  return d;
177  }
template<class SymmGroup>
std::size_t Index< SymmGroup >::insert ( std::pair< charge, std::size_t > const &  x)
inline

Definition at line 172 of file indexing_sorted.hpp.

173  {
174  std::size_t d = destination(x.first);
175  std::vector<std::pair<charge, std::size_t> >::insert(this->begin() + d, x);
176  calc_positions();
177  return d;
178  }
iterator begin()
std::size_t insert(std::pair< charge, std::size_t > const &x)
template<class SymmGroup>
void Index< SymmGroup >::insert ( std::size_t  position,
std::pair< charge, std::size_t > const &  x 
)
inline

Definition at line 179 of file indexing_unsorted.hpp.

180  {
181  std::vector<std::pair<charge, std::size_t> >::insert(this->begin() + position, x);
182  calc_positions();
183  }
iterator begin()
std::size_t position(charge c) const
std::size_t insert(std::pair< charge, std::size_t > const &x)
template<class SymmGroup>
void Index< SymmGroup >::insert ( std::size_t  position,
std::pair< charge, std::size_t > const &  x 
)
inline

Definition at line 180 of file indexing_sorted.hpp.

181  {
182  std::vector<std::pair<charge, std::size_t> >::insert(this->begin() + position, x);
183  calc_positions();
184  }
iterator begin()
std::size_t position(charge c) const
std::size_t insert(std::pair< charge, std::size_t > const &x)
template<class SymmGroup>
void Index< SymmGroup >::insert ( std::size_t  position,
std::pair< charge, std::size_t > const &  x 
)
inline

Definition at line 181 of file indexing_stable.hpp.

182  {
183  data_.insert(data_.begin() + position, x);
184  sorted_ = false;
185  }
std::size_t position(charge c) const
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::load ( Archive &  ar)
inline

Definition at line 279 of file indexing_unsorted.hpp.

280  {
281  typedef std::vector<std::pair<typename SymmGroup::charge, std::size_t> > my_type;
282  ar["Index"] >> static_cast<my_type&>(*this);
283  calc_positions();
284  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::load ( Archive &  ar)
inline

Definition at line 288 of file indexing_sorted.hpp.

289  {
290  typedef std::vector<std::pair<typename SymmGroup::charge, std::size_t> > my_type;
291  ar["Index"] >> static_cast<my_type&>(*this);
292  calc_positions();
293  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::load ( Archive &  ar)
inline

Definition at line 290 of file indexing_stable.hpp.

291  {
292  ar["Index"] >> data_;
293  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::load ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 295 of file indexing_unsorted.hpp.

296  {
297  ar & boost::serialization::base_object<base_t>(*this);
298  calc_positions();
299  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::load ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 303 of file indexing_stable.hpp.

304  {
305  ar & data_;
306  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::load ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 305 of file indexing_sorted.hpp.

306  {
307  ar & boost::serialization::base_object<base_t>(*this);
308  calc_positions();
309  }
template<class SymmGroup>
bool Index< SymmGroup >::operator!= ( Index< SymmGroup > const &  o) const
inline

Definition at line 197 of file indexing_unsorted.hpp.

198  {
199  return !( *this == o );
200  }
template<class SymmGroup>
bool Index< SymmGroup >::operator!= ( Index< SymmGroup > const &  o) const
inline

Definition at line 198 of file indexing_stable.hpp.

199  {
200  return !( *this == o );
201  }
template<class SymmGroup>
bool Index< SymmGroup >::operator!= ( Index< SymmGroup > const &  o) const
inline

Definition at line 198 of file indexing_sorted.hpp.

199  {
200  return !( *this == o );
201  }
template<class SymmGroup>
Index& Index< SymmGroup >::operator= ( Index< SymmGroup >  rhs)
inline

Definition at line 120 of file indexing_unsorted.hpp.

121  {
122  std::swap(static_cast<base_t&>(*this), static_cast<base_t&>(rhs));
123  positions.swap(rhs.positions);
124  return *this;
125  }
void swap(MPSTensor< Matrix, SymmGroup > &x, MPSTensor< Matrix, SymmGroup > &y)
template<class SymmGroup>
Index& Index< SymmGroup >::operator= ( Index< SymmGroup >  rhs)
inline

Definition at line 120 of file indexing_sorted.hpp.

121  {
122  std::swap(static_cast<base_t&>(*this), static_cast<base_t&>(rhs));
123  positions.swap(rhs.positions);
124  return *this;
125  }
void swap(MPSTensor< Matrix, SymmGroup > &x, MPSTensor< Matrix, SymmGroup > &y)
template<class SymmGroup>
bool Index< SymmGroup >::operator== ( Index< SymmGroup > const &  o) const
inline

Definition at line 192 of file indexing_unsorted.hpp.

193  {
194  return (this->size() == o.size()) && std::equal(this->begin(), this->end(), o.begin());
195  }
iterator begin()
iterator end()
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
std::size_t size() const
template<class SymmGroup>
bool Index< SymmGroup >::operator== ( Index< SymmGroup > const &  o) const
inline

Definition at line 193 of file indexing_sorted.hpp.

194  {
195  return (this->size() == o.size()) && std::equal(this->begin(), this->end(), o.begin());
196  }
iterator begin()
iterator end()
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
std::size_t size() const
template<class SymmGroup>
bool Index< SymmGroup >::operator== ( Index< SymmGroup > const &  o) const
inline

Definition at line 193 of file indexing_stable.hpp.

194  {
195  return (data_.size() == o.size()) && std::equal(data_.begin(), data_.end(), o.begin());
196  }
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 SymmGroup>
value_type& Index< SymmGroup >::operator[] ( std::size_t  p)
inline

Definition at line 239 of file indexing_unsorted.hpp.

239 { return static_cast<base_t&>(*this)[p]; }
template<class SymmGroup>
value_type const& Index< SymmGroup >::operator[] ( std::size_t  p) const
inline

Definition at line 240 of file indexing_unsorted.hpp.

240 { return static_cast<base_t const&>(*this)[p]; }
template<class SymmGroup>
value_type& Index< SymmGroup >::operator[] ( std::size_t  p)
inline

Definition at line 240 of file indexing_sorted.hpp.

240 { return static_cast<base_t&>(*this)[p]; }
template<class SymmGroup>
value_type& Index< SymmGroup >::operator[] ( std::size_t  p)
inline

Definition at line 240 of file indexing_stable.hpp.

240 { return data_[p]; }
template<class SymmGroup>
value_type const& Index< SymmGroup >::operator[] ( std::size_t  p) const
inline

Definition at line 241 of file indexing_sorted.hpp.

241 { return static_cast<base_t const&>(*this)[p]; }
template<class SymmGroup>
value_type const& Index< SymmGroup >::operator[] ( std::size_t  p) const
inline

Definition at line 241 of file indexing_stable.hpp.

241 { return data_[p]; }
template<class SymmGroup>
std::size_t Index< SymmGroup >::position ( charge  c) const
inline

Definition at line 132 of file indexing_stable.hpp.

133  {
134  const_iterator match;
135  if (sorted_)
136  match = std::lower_bound(data_.begin(), data_.end(), std::make_pair(c,0), index_detail::gt<SymmGroup>());
137  else
138  match = std::find_if(data_.begin(), data_.end(), index_detail::is_first_equal<SymmGroup>(c));
139 
140  if (match != data_.end() && (*match).first != c) match = data_.end();
141  return std::distance(data_.begin(), match);
142  }
base_t::const_iterator const_iterator
template<class SymmGroup>
std::size_t Index< SymmGroup >::position ( charge  c) const
inline

Definition at line 141 of file indexing_unsorted.hpp.

142  {
143  typename pos_t::const_iterator it = positions.find(c);
144  if (it == positions.end())
145  return this->size();
146  else
147  return it->second;
148  }
std::size_t size() const
template<class SymmGroup>
std::size_t Index< SymmGroup >::position ( charge  c) const
inline

Definition at line 142 of file indexing_sorted.hpp.

143  {
144  typename pos_t::const_iterator it = positions.find(c);
145  if (it == positions.end())
146  return this->size();
147  else
148  return positions.find(c)->second;
149  }
std::size_t size() const
template<class SymmGroup>
std::size_t Index< SymmGroup >::position ( std::pair< charge, std::size_t >  x) const
inline

Definition at line 144 of file indexing_stable.hpp.

145  {
146  assert( has(x.first) );
147  assert( x.second < size_of_block(x.first) );
148  const_iterator to = data_.begin()+position(x.first);
149  return x.second + std::accumulate(data_.begin(), to, 0,
150  boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2)
151  );
152  }
base_t::const_iterator const_iterator
bool has(charge c) const
std::size_t size_of_block(charge c) const
std::size_t position(charge c) const
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Definition: bindings.hpp:44
template<class SymmGroup>
std::size_t Index< SymmGroup >::position ( std::pair< charge, std::size_t >  x) const
inline

Definition at line 150 of file indexing_unsorted.hpp.

151  {
152  assert( has(x.first) );
153  assert( x.second < size_of_block(x.first) );
154  const_iterator to = this->begin()+position(x.first);
155  return x.second + std::accumulate(this->begin(), to, 0,
156  boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2)
157  );
158  }
base_t::const_iterator const_iterator
iterator begin()
bool has(charge c) const
std::size_t size_of_block(charge c) const
std::size_t position(charge c) const
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Definition: bindings.hpp:44
template<class SymmGroup>
std::size_t Index< SymmGroup >::position ( std::pair< charge, std::size_t >  x) const
inline

Definition at line 151 of file indexing_sorted.hpp.

152  {
153  assert( has(x.first) );
154  assert( x.second < size_of_block(x.first) );
155  const_iterator to = this->begin()+position(x.first);
156  return x.second + std::accumulate(this->begin(), to, 0,
157  boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2)
158  );
159  }
base_t::const_iterator const_iterator
iterator begin()
bool has(charge c) const
std::size_t size_of_block(charge c) const
std::size_t position(charge c) const
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Definition: bindings.hpp:44
template<class SymmGroup>
reverse_iterator Index< SymmGroup >::rbegin ( )
inline

Definition at line 234 of file indexing_unsorted.hpp.

234 { return base_t::rbegin(); }
template<class SymmGroup>
reverse_iterator Index< SymmGroup >::rbegin ( )
inline

Definition at line 235 of file indexing_sorted.hpp.

235 { return base_t::rbegin(); }
template<class SymmGroup>
reverse_iterator Index< SymmGroup >::rbegin ( )
inline

Definition at line 235 of file indexing_stable.hpp.

235 { return data_.rbegin(); }
template<class SymmGroup>
const_reverse_iterator Index< SymmGroup >::rbegin ( ) const
inline

Definition at line 236 of file indexing_unsorted.hpp.

236 { return base_t::rbegin(); }
template<class SymmGroup>
const_reverse_iterator Index< SymmGroup >::rbegin ( ) const
inline

Definition at line 237 of file indexing_sorted.hpp.

237 { return base_t::rbegin(); }
template<class SymmGroup>
const_reverse_iterator Index< SymmGroup >::rbegin ( ) const
inline

Definition at line 237 of file indexing_stable.hpp.

237 { return data_.rbegin(); }
template<class SymmGroup>
reverse_iterator Index< SymmGroup >::rend ( )
inline

Definition at line 235 of file indexing_unsorted.hpp.

235 { return base_t::rend(); }
template<class SymmGroup>
reverse_iterator Index< SymmGroup >::rend ( )
inline

Definition at line 236 of file indexing_sorted.hpp.

236 { return base_t::rend(); }
template<class SymmGroup>
reverse_iterator Index< SymmGroup >::rend ( )
inline

Definition at line 236 of file indexing_stable.hpp.

236 { return data_.rend(); }
template<class SymmGroup>
const_reverse_iterator Index< SymmGroup >::rend ( ) const
inline

Definition at line 237 of file indexing_unsorted.hpp.

237 { return base_t::rend(); }
template<class SymmGroup>
const_reverse_iterator Index< SymmGroup >::rend ( ) const
inline

Definition at line 238 of file indexing_stable.hpp.

238 { return data_.rend(); }
template<class SymmGroup>
const_reverse_iterator Index< SymmGroup >::rend ( ) const
inline

Definition at line 238 of file indexing_sorted.hpp.

238 { return base_t::rend(); }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::save ( Archive &  ar) const
inline

Definition at line 286 of file indexing_unsorted.hpp.

287  {
288  typedef std::vector<std::pair<typename SymmGroup::charge, std::size_t> > my_type;
289  ar["Index"] << static_cast<my_type const &>(*this);
290  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::save ( Archive &  ar) const
inline

Definition at line 295 of file indexing_stable.hpp.

296  {
297  ar["Index"] << data_;
298  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::save ( Archive &  ar) const
inline

Definition at line 296 of file indexing_sorted.hpp.

297  {
298  typedef std::vector<std::pair<typename SymmGroup::charge, std::size_t> > my_type;
299  ar["Index"] << static_cast<my_type const &>(*this);
300  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::save ( Archive &  ar,
const unsigned int  version 
) const
inline

Definition at line 301 of file indexing_unsorted.hpp.

302  {
303  ar & boost::serialization::base_object<base_t>(*this);
304  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::save ( Archive &  ar,
const unsigned int  version 
) const
inline

Definition at line 308 of file indexing_stable.hpp.

309  {
310  ar & data_;
311  }
template<class SymmGroup>
template<class Archive >
void Index< SymmGroup >::save ( Archive &  ar,
const unsigned int  version 
) const
inline

Definition at line 311 of file indexing_sorted.hpp.

312  {
313  ar & boost::serialization::base_object<base_t>(*this);
314  }
template<class SymmGroup>
void Index< SymmGroup >::shift ( charge  diff)
inline

Definition at line 185 of file indexing_unsorted.hpp.

186  {
187  for (std::size_t k = 0; k < this->size(); ++k)
188  (*this)[k].first = SymmGroup::fuse((*this)[k].first, diff);
189  calc_positions();
190  }
std::size_t size() const
T fuse(const A &ind, T d)
Fuse indices n[i] into one p = n[i] d^i.
template<class SymmGroup>
void Index< SymmGroup >::shift ( charge  diff)
inline

Definition at line 186 of file indexing_sorted.hpp.

187  {
188  for (std::size_t k = 0; k < this->size(); ++k)
189  (*this)[k].first = SymmGroup::fuse((*this)[k].first, diff);
190  calc_positions();
191  }
std::size_t size() const
T fuse(const A &ind, T d)
Fuse indices n[i] into one p = n[i] d^i.
template<class SymmGroup>
void Index< SymmGroup >::shift ( charge  diff)
inline

Definition at line 187 of file indexing_stable.hpp.

188  {
189  for (std::size_t k = 0; k < data_.size(); ++k)
190  (*this)[k].first = SymmGroup::fuse((*this)[k].first, diff);
191  }
T fuse(const A &ind, T d)
Fuse indices n[i] into one p = n[i] d^i.
template<class SymmGroup>
std::size_t Index< SymmGroup >::size ( ) const
inline

Definition at line 252 of file indexing_unsorted.hpp.

252 { return base_t::size(); }
template<class SymmGroup>
std::size_t Index< SymmGroup >::size ( ) const
inline

Definition at line 253 of file indexing_sorted.hpp.

253 { return base_t::size(); }
template<class SymmGroup>
std::size_t Index< SymmGroup >::size ( ) const
inline

Definition at line 253 of file indexing_stable.hpp.

253 { return data_.size(); }
template<class SymmGroup>
std::size_t Index< SymmGroup >::size_of_block ( charge  c) const
inline

Definition at line 117 of file indexing_stable.hpp.

118  {
119  assert( has(c) );
120  return (*this)[position(c)].second;
121  }
bool has(charge c) const
std::size_t position(charge c) const
template<class SymmGroup>
std::size_t Index< SymmGroup >::size_of_block ( charge  c,
bool  position_check 
) const
inline

Definition at line 123 of file indexing_stable.hpp.

124  {
125  // I have to ignore the position_check argument because I can't dereference the end() iterator anyway
126  std::size_t pos = position(c);
127  if (pos == data_.size())
128  return 0;
129  return (*this)[pos].second;
130  }
std::size_t position(charge c) const
template<class SymmGroup>
std::size_t Index< SymmGroup >::size_of_block ( charge  c) const
inline

Definition at line 127 of file indexing_sorted.hpp.

128  {
129  assert( has(c) );
130  return (*this)[position(c)].second;
131  }
bool has(charge c) const
std::size_t position(charge c) const
template<class SymmGroup>
std::size_t Index< SymmGroup >::size_of_block ( charge  c) const
inline

Definition at line 127 of file indexing_unsorted.hpp.

128  {
129  assert( has(c) );
130  return (*this)[position(c)].second;
131  }
bool has(charge c) const
std::size_t position(charge c) const
template<class SymmGroup>
std::size_t Index< SymmGroup >::size_of_block ( charge  c,
bool  position_check 
) const
inline

Definition at line 133 of file indexing_unsorted.hpp.

134  {
135  typename pos_t::const_iterator it = positions.find(c);
136  if (position_check && it == positions.end())
137  return 0;
138  return (*this)[it->second].second;
139  }
template<class SymmGroup>
std::size_t Index< SymmGroup >::size_of_block ( charge  c,
bool  position_check 
) const
inline

Definition at line 133 of file indexing_sorted.hpp.

134  {
135  // I have to ignore the position_check argument because I can't dereference the end() iterator anyway
136  typename pos_t::const_iterator it = positions.find(c);
137  if (it == positions.end())
138  return 0;
139  return (*this)[it->second].second;
140  }
template<class SymmGroup>
std::vector<std::size_t> Index< SymmGroup >::sizes ( ) const
inline

Definition at line 215 of file indexing_unsorted.hpp.

216  {
217  std::vector<std::size_t> ret(this->size());
218  for (std::size_t k = 0; k < this->size(); ++k) ret[k] = (*this)[k].second;
219  return ret;
220  }
std::size_t size() const
template<class SymmGroup>
std::vector<std::size_t> Index< SymmGroup >::sizes ( ) const
inline

Definition at line 216 of file indexing_stable.hpp.

217  {
218  std::vector<std::size_t> ret(data_.size());
219  for (std::size_t k = 0; k < data_.size(); ++k) ret[k] = (*this)[k].second;
220  return ret;
221  }
template<class SymmGroup>
std::vector<std::size_t> Index< SymmGroup >::sizes ( ) const
inline

Definition at line 216 of file indexing_sorted.hpp.

217  {
218  std::vector<std::size_t> ret(this->size());
219  for (std::size_t k = 0; k < this->size(); ++k) ret[k] = (*this)[k].second;
220  return ret;
221  }
std::size_t size() const
template<class SymmGroup>
void Index< SymmGroup >::sort ( )
inline

Definition at line 163 of file indexing_stable.hpp.

164  {
165  std::sort(data_.begin(), data_.end(), index_detail::gt<SymmGroup>());
166  sorted_ = true;
167  }
template<class SymmGroup>
void Index< SymmGroup >::sort ( )
inline

Definition at line 165 of file indexing_unsorted.hpp.

166  {
167  std::sort(this->begin(), this->end(), index_detail::gt<SymmGroup>());
168  calc_positions();
169  }
iterator begin()
iterator end()
template<class SymmGroup>
void Index< SymmGroup >::sort ( )
inline

Definition at line 166 of file indexing_sorted.hpp.

167  {
168  std::sort(this->begin(), this->end(), index_detail::gt<SymmGroup>());
169  calc_positions();
170  }
iterator begin()
iterator end()
template<class SymmGroup>
std::size_t Index< SymmGroup >::sum_of_sizes ( ) const
inline

Definition at line 222 of file indexing_unsorted.hpp.

223  {
224  return std::accumulate(this->begin(), this->end(), 0,
225  boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2));
226  }
iterator begin()
iterator end()
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Definition: bindings.hpp:44
template<class SymmGroup>
std::size_t Index< SymmGroup >::sum_of_sizes ( ) const
inline

Definition at line 223 of file indexing_stable.hpp.

224  {
225  //boost::function<std::size_t (std::size_t,std::size_t)> pred = boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2);
226  return std::accumulate(data_.begin(), data_.end(), 0, boost::lambda::ret<std::size_t>(boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2)));
227  }
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Definition: bindings.hpp:44
template<class SymmGroup>
std::size_t Index< SymmGroup >::sum_of_sizes ( ) const
inline

Definition at line 223 of file indexing_sorted.hpp.

224  {
225  return std::accumulate(this->begin(), this->end(), 0,
226  boost::lambda::_1 + boost::lambda::bind(index_detail::get_second<SymmGroup>, boost::lambda::_2));
227  }
iterator begin()
iterator end()
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Definition: bindings.hpp:44

Friends And Related Function Documentation

template<class SymmGroup>
boost::serialization::access
friend

Definition at line 302 of file indexing_sorted.hpp.

template<class SymmGroup>
void swap ( Index< SymmGroup > &  a,
Index< SymmGroup > &  b 
)
friend

Definition at line 258 of file indexing_stable.hpp.

259  {
260  using std::swap;
261  swap(a.data_, b.data_);
262  swap(a.sorted_, b.sorted_);
263  }
void swap(MPSTensor< Matrix, SymmGroup > &x, MPSTensor< Matrix, SymmGroup > &y)
friend void swap(Index &a, Index &b)

Member Data Documentation

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

STL member.

template<class SymmGroup>
static const bool Index< SymmGroup >::sorted = true
static

Definition at line 117 of file indexing_sorted.hpp.


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