ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
meas_prepare Namespace Reference

Functions

template<class Matrix , class SymmGroup >
std::map< std::string, MPO
< Matrix, SymmGroup > > 
local (const Lattice &lat, std::vector< block_matrix< Matrix, SymmGroup > > const &identities, std::vector< block_matrix< Matrix, SymmGroup > > const &fillings, std::vector< std::pair< std::vector< block_matrix< Matrix, SymmGroup > >, bool > > const &ops)
 
template<class Matrix , class SymmGroup >
MPO< Matrix, SymmGroup > average (const Lattice &lat, std::vector< block_matrix< Matrix, SymmGroup > > const &identities, std::vector< block_matrix< Matrix, SymmGroup > > const &fillings, std::vector< std::pair< std::vector< block_matrix< Matrix, SymmGroup > >, bool > > const &ops)
 

Function Documentation

template<class Matrix , class SymmGroup >
MPO<Matrix, SymmGroup> meas_prepare::average ( const Lattice lat,
std::vector< block_matrix< Matrix, SymmGroup > > const &  identities,
std::vector< block_matrix< Matrix, SymmGroup > > const &  fillings,
std::vector< std::pair< std::vector< block_matrix< Matrix, SymmGroup > >, bool > > const &  ops 
)

Definition at line 85 of file meas_prepare.hpp.

89  {
90  generate_mpo::MPOMaker<Matrix, SymmGroup> mpom(lat, identities, fillings);
91 
92  for (std::size_t p = 0; p < lat.size(); ++p)
93  {
95  term.operators.push_back( std::make_pair(p, ops[0].first[lat.get_prop<int>("type", p)]) );
96  if (ops.size() == 1) {
97  mpom.add_term(term);
98  } else {
99  term.with_sign = ops[0].second;
100  std::vector<Lattice::pos_t> neighs = lat.forward(p);
101  for (typename std::vector<Lattice::pos_t>::const_iterator hopto = neighs.begin();
102  hopto != neighs.end();
103  ++hopto)
104  {
106  term2.operators.push_back( std::make_pair(*hopto, ops[1].first[lat.get_prop<int>("type", p)]) );
107  mpom.add_term(term2);
108  }
109 
110  }
111  }
112 
113  return mpom.create_mpo();
114  }
T get_prop(std::string property, pos_t site) const
Definition: lattice.h:103
std::vector< op_pair_t > operators
Definition: utils.hpp:118
std::vector< pos_t > forward(pos_t site) const
Definition: lattice.h:100
pos_t size() const
Definition: lattice.h:115
template<class Matrix , class SymmGroup >
std::map<std::string, MPO<Matrix,SymmGroup> > meas_prepare::local ( const Lattice lat,
std::vector< block_matrix< Matrix, SymmGroup > > const &  identities,
std::vector< block_matrix< Matrix, SymmGroup > > const &  fillings,
std::vector< std::pair< std::vector< block_matrix< Matrix, SymmGroup > >, bool > > const &  ops 
)

Definition at line 38 of file meas_prepare.hpp.

42  {
43  std::map<std::string, MPO<Matrix,SymmGroup> > mpos;
44 
45  for (std::size_t p = 0; p < lat.size(); ++p)
46  {
47  if (ops.size() == 1) {
48  int type = lat.get_prop<int>("type", p);
49  if (ops[0].first[type].n_blocks() > 0) {
50  generate_mpo::MPOMaker<Matrix, SymmGroup> mpom(lat, identities, fillings);
52  term.operators.push_back( std::make_pair(p, ops[0].first[type]) );
53  mpom.add_term(term);
54 
55  mpos[ lat.get_prop<std::string>("label", p) ] = mpom.create_mpo();
56  }
57  } else {
58  std::vector<Lattice::pos_t> neighs = lat.forward(p);
59  for (typename std::vector<Lattice::pos_t>::const_iterator hopto = neighs.begin();
60  hopto != neighs.end();
61  ++hopto)
62  {
63  int type1 = lat.get_prop<int>("type", p);
64  int type2 = lat.get_prop<int>("type", *hopto);
65  if (ops[0].first[type1].n_blocks() > 0 && ops[1].first[type2].n_blocks() > 0) {
66  generate_mpo::MPOMaker<Matrix, SymmGroup> mpom(lat, identities, fillings);
68  term.operators.push_back( std::make_pair(p, ops[0].first[type1]) );
69  term.operators.push_back( std::make_pair(*hopto, ops[1].first[type2]) );
70  term.with_sign = ops[0].second;
71  mpom.add_term(term);
72 
73  mpos[ lat.get_prop<std::string>("label", p, *hopto) ] = mpom.create_mpo();
74  }
75  }
76  }
77  }
78 
79  return mpos;
80  }
T get_prop(std::string property, pos_t site) const
Definition: lattice.h:103
std::vector< op_pair_t > operators
Definition: utils.hpp:118
std::vector< pos_t > forward(pos_t site) const
Definition: lattice.h:100
pos_t size() const
Definition: lattice.h:115