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

#include <custom.h>

Inheritance diagram for measurements::custom< Matrix, SymmGroup >:
measurement< Matrix, SymmGroup >

Public Types

typedef Matrix::value_type value_type
 

Public Member Functions

 custom (std::string const &name_, const Lattice &lat, std::vector< block_matrix< Matrix, SymmGroup > > const &identities, std::vector< block_matrix< Matrix, SymmGroup > > const &fillings, std::vector< std::vector< std::pair< int, block_matrix< Matrix, SymmGroup > > > > const &ops)
 
void evaluate (MPS< Matrix, SymmGroup > const &mps, boost::optional< reduced_mps< Matrix, SymmGroup > const & > rmps=boost::none)
 
template<class Archive >
void save (Archive &) const
 
void write_xml (alps::oxstream &) const
 
virtual void print (std::ostream &os) const
 
std::string const & name () const
 
int & eigenstate_index ()
 
int eigenstate_index () const
 
void set_super_meas (Index< SymmGroup > const &phys_psi_)
 
measurementclone () const
 

Protected Member Functions

measurement< Matrix, SymmGroup > * do_clone () const
 

Protected Attributes

bool cast_to_real
 
bool is_super_meas
 
std::vector< std::string > labels
 
value_type result
 
std::vector< typename MPS
< Matrix, SymmGroup >
::scalar_type > 
vector_results
 
Index< SymmGroup > phys_psi
 

Detailed Description

template<class Matrix, class SymmGroup>
class measurements::custom< Matrix, SymmGroup >

Definition at line 37 of file custom.h.

Member Typedef Documentation

template<class Matrix, class SymmGroup>
typedef Matrix::value_type measurement< Matrix, SymmGroup >::value_type
inherited

Definition at line 55 of file measurement.h.

Constructor & Destructor Documentation

template<class Matrix , class SymmGroup >
measurements::custom< Matrix, SymmGroup >::custom ( std::string const &  name_,
const Lattice lat,
std::vector< block_matrix< Matrix, SymmGroup > > const &  identities,
std::vector< block_matrix< Matrix, SymmGroup > > const &  fillings,
std::vector< std::vector< std::pair< int, block_matrix< Matrix, SymmGroup > > > > const &  ops 
)
inline

Definition at line 40 of file custom.h.

45  : base(name_)
46  {
47  generate_mpo::MPOMaker<Matrix, SymmGroup> mpom(lat, identities, fillings);
48 
49  for (int k = 0; k < ops.size(); ++k) {
51  term.operators = ops[k];
52  term.with_sign = true;
53  mpom.add_term(term);
54  }
55 
56  mpo = mpom.create_mpo();
57 
58  this->cast_to_real = false;
59  }
std::vector< op_pair_t > operators
Definition: utils.hpp:118
bool cast_to_real
Definition: measurement.h:77

Member Function Documentation

template<class Matrix, class SymmGroup>
measurement* measurement< Matrix, SymmGroup >::clone ( ) const
inlineinherited

Definition at line 72 of file measurement.h.

72 { return do_clone(); }
virtual measurement * do_clone() const =0
template<class Matrix , class SymmGroup >
measurement<Matrix, SymmGroup>* measurements::custom< Matrix, SymmGroup >::do_clone ( ) const
inlineprotectedvirtual

Implements measurement< Matrix, SymmGroup >.

Definition at line 67 of file custom.h.

68  {
69  return new custom(*this);
70  }
custom(std::string const &name_, const Lattice &lat, std::vector< block_matrix< Matrix, SymmGroup > > const &identities, std::vector< block_matrix< Matrix, SymmGroup > > const &fillings, std::vector< std::vector< std::pair< int, block_matrix< Matrix, SymmGroup > > > > const &ops)
Definition: custom.h:40
template<class Matrix, class SymmGroup>
int& measurement< Matrix, SymmGroup >::eigenstate_index ( )
inlineinherited

Definition at line 67 of file measurement.h.

67 { return eigenstate; }
template<class Matrix, class SymmGroup>
int measurement< Matrix, SymmGroup >::eigenstate_index ( ) const
inlineinherited

Definition at line 68 of file measurement.h.

68 { return eigenstate; }
template<class Matrix , class SymmGroup >
void measurements::custom< Matrix, SymmGroup >::evaluate ( MPS< Matrix, SymmGroup > const &  mps,
boost::optional< reduced_mps< Matrix, SymmGroup > const & >  rmps = boost::none 
)
inlinevirtual

Implements measurement< Matrix, SymmGroup >.

Definition at line 61 of file custom.h.

62  {
63  this->result = expval(mps, mpo);
64  }
double expval(MPS< Matrix, SymmGroup > const &mps, MPO< Matrix, SymmGroup > const &mpo, int d)
Definition: mps_mpo_ops.h:72
value_type result
Definition: measurement.h:79
template<class Matrix, class SymmGroup>
std::string const& measurement< Matrix, SymmGroup >::name ( ) const
inlineinherited

Definition at line 66 of file measurement.h.

66 { return name_; }
template<class Matrix , class SymmGroup >
void measurement< Matrix, SymmGroup >::print ( std::ostream &  os) const
virtualinherited

Definition at line 160 of file measurement.h.

161 {
162  os << "MEASURE[" << name_ << "]";
163 }
template<class Matrix , class SymmGroup >
template<class Archive >
void measurement< Matrix, SymmGroup >::save ( Archive &  ar) const
inherited

Definition at line 107 of file measurement.h.

108 {
109  if (vector_results.size() > 0) {
110  if (cast_to_real) {
111  save_val_at_index(ar, storage::encode(name()) + std::string("/mean/value"), maquis::real(vector_results), eigenstate_index());
112  } else {
113  save_val_at_index(ar, storage::encode(name()) + std::string("/mean/value"), vector_results, eigenstate_index());
114  }
115  if (labels.size() > 0)
116  ar[storage::encode(name()) + std::string("/labels")] << labels;
117  } else {
118  if (cast_to_real) {
119  save_val_at_index(ar, storage::encode(name()) + std::string("/mean/value"), maquis::real(result), eigenstate_index());
120  } else {
121  save_val_at_index(ar, storage::encode(name()) + std::string("/mean/value"), result, eigenstate_index());
122  }
123  }
124 }
std::vector< std::string > labels
Definition: measurement.h:78
value_type result
Definition: measurement.h:79
std::string encode(std::string const &s)
Definition: archive.h:82
void save_val_at_index(Archive &ar, std::string const &archive_path, T const &val, std::size_t eig)
Definition: measurement.h:96
std::vector< typename MPS< Matrix, SymmGroup >::scalar_type > vector_results
Definition: measurement.h:80
int & eigenstate_index()
Definition: measurement.h:67
bool cast_to_real
Definition: measurement.h:77
alps::numeric::real_type< T >::type real(T f)
Definition: bindings.hpp:38
std::string const & name() const
Definition: measurement.h:66
template<class Matrix , class SymmGroup >
void measurement< Matrix, SymmGroup >::set_super_meas ( Index< SymmGroup > const &  phys_psi_)
inherited

Definition at line 153 of file measurement.h.

154 {
155  phys_psi = phys_psi_;
156  is_super_meas = true;
157 }
bool is_super_meas
Definition: measurement.h:77
Index< SymmGroup > phys_psi
Definition: measurement.h:82
template<class Matrix , class SymmGroup >
void measurement< Matrix, SymmGroup >::write_xml ( alps::oxstream &  out) const
inherited

Definition at line 127 of file measurement.h.

128 {
129  if (labels.size() > 0) {
130  out << alps::start_tag("VECTOR_AVERAGE") << alps::attribute("name", name());
131  for (int i=0; i<labels.size(); ++i) {
132  out << alps::start_tag("SCALAR_AVERAGE");
133  out << alps::attribute("indexvalue",labels[i]) << alps::no_linebreak;
134 
135  if (cast_to_real) {
136  out << alps::start_tag("MEAN") << alps::no_linebreak << maquis::real(vector_results[i]) << alps::end_tag("MEAN");
137  } else {
138  out << alps::start_tag("MEAN") << alps::no_linebreak << vector_results[i] << alps::end_tag("MEAN");
139  }
140  out << alps::end_tag("SCALAR_AVERAGE");
141 
142  }
143  out << alps::end_tag("VECTOR_AVERAGE");
144  } else {
145  out << alps::start_tag("SCALAR_AVERAGE") << alps::attribute("name", name()) << alps::no_linebreak;
146  out << alps::start_tag("MEAN") << alps::no_linebreak << ((cast_to_real) ? maquis::real(result) : result) << alps::end_tag("MEAN");
147  out << alps::end_tag("SCALAR_AVERAGE");
148  }
149 }
std::vector< std::string > labels
Definition: measurement.h:78
value_type result
Definition: measurement.h:79
std::vector< typename MPS< Matrix, SymmGroup >::scalar_type > vector_results
Definition: measurement.h:80
bool cast_to_real
Definition: measurement.h:77
alps::numeric::real_type< T >::type real(T f)
Definition: bindings.hpp:38
std::string const & name() const
Definition: measurement.h:66

Member Data Documentation

template<class Matrix, class SymmGroup>
bool measurement< Matrix, SymmGroup >::cast_to_real
protectedinherited

Definition at line 77 of file measurement.h.

template<class Matrix, class SymmGroup>
bool measurement< Matrix, SymmGroup >::is_super_meas
protectedinherited

Definition at line 77 of file measurement.h.

template<class Matrix, class SymmGroup>
std::vector<std::string> measurement< Matrix, SymmGroup >::labels
protectedinherited

Definition at line 78 of file measurement.h.

template<class Matrix, class SymmGroup>
Index<SymmGroup> measurement< Matrix, SymmGroup >::phys_psi
protectedinherited

Definition at line 82 of file measurement.h.

template<class Matrix, class SymmGroup>
value_type measurement< Matrix, SymmGroup >::result
protectedinherited

Definition at line 79 of file measurement.h.

template<class Matrix, class SymmGroup>
std::vector<typename MPS<Matrix, SymmGroup>::scalar_type> measurement< Matrix, SymmGroup >::vector_results
protectedinherited

Definition at line 80 of file measurement.h.


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