ALPS Project: alea library

Header file alea/simpleobseval.h

This header contains the class for evaluation of and arithmetic operations on observables.

Synopsis

namespace alps {

template <class T>
class SimpleObservableEvaluator : public AbstractSimpleObservable<T>
{
 public:
  typedef T           value_type;
  typedef ...         time_type;
  typedef std::size_t count_type;
  typedef ...         result_type;
  
  enum { version=...};

  SimpleObservableEvaluator(std::string="");
  SimpleObservableEvaluator(const Observable&,  std::string n="");

  const SimpleObservableEvaluator<T>& operator = (const AbstractSimpleObservable<T>& obs);

  SimpleObservableEvaluator<T>& operator<< (const AbstractSimpleObservable<T>&  obs) 

  template <class S>
  SimpleObservableEvaluator<typename obs_value_slice<T,S>::value_type>
    slice(S ,const std::string="") const;


  SimpleObservableEvaluator<T> operator-() const;

  template <class X> const SimpleObservableEvaluator<T>& operator+=(X);
  template <class X> const SimpleObservableEvaluator<T>& operator-=(X);
  template <class X> const SimpleObservableEvaluator<T>& operator*=(X);
  template <class X> const SimpleObservableEvaluator<T>& operator/=(X);

  const SimpleObservableEvaluator<T>& operator+=(const SimpleObservableEvaluator<T>&);
  const SimpleObservableEvaluator<T>& operator-=(const SimpleObservableEvaluator<T>&);

  template <class X>
  const SimpleObservableEvaluator<T>& operator*=(const SimpleObservableEvaluator<X>&);

  template <class X>
  const SimpleObservableEvaluator<T>& operator/=(const SimpleObservableEvaluator<X>&);
};

template <class T, class Y>
inline SimpleObservableEvaluator<T> operator+(const SimpleObservableEvaluator<T>& x, const Y& y);

template <class T, class Y>
inline SimpleObservableEvaluator<T> operator-(const SimpleObservableEvaluator<T>& x, const Y& y);

template <class T, class Y>
inline SimpleObservableEvaluator<T> operator*(const SimpleObservableEvaluator<T>& x, const Y& y);

template <class T, class Y>
inline SimpleObservableEvaluator<T> operator/(const SimpleObservableEvaluator<T>& x, const Y& y);

template <class T>
inline SimpleObservableEvaluator<T> operator+(const T& x, const SimpleObservableEvaluator<T>& y);

template <class T>
inline SimpleObservableEvaluator<T> operator-(const T& x, const SimpleObservableEvaluator<T>& y);

template <class T>
inline SimpleObservableEvaluator<T> operator*(const T& x, const SimpleObservableEvaluator<T>& y);

template <class T>
inline SimpleObservableEvaluator<T> operator/(const T& x, const SimpleObservableEvaluator<T>& y);

template <class T> alps::SimpleObservableEvaluator<T> 
exp (const alps::SimpleObservableEvaluator<T>& x);

template <class T> alps::SimpleObservableEvaluator<T> 
log (const alps::SimpleObservableEvaluator<T>& x);

template <class T> alps::SimpleObservableEvaluator<T> 
sqrt (const alps::SimpleObservableEvaluator<T>& x);

template <class T> alps::SimpleObservableEvaluator<T> 
sin (const alps::SimpleObservableEvaluator<T>& x);

template <class T> alps::SimpleObservableEvaluator<T> 
cos (const alps::SimpleObservableEvaluator<T>& x);


typedef SimpleObservableEvaluator<double> RealObsevaluator;
typedef SimpleObservableEvaluator<int32_t> IntObsevaluator;
typedef SimpleObservableEvaluator<std::complex<double> > ComplexObsevaluator;
typedef SimpleObservableEvaluator<std::valarray<double> > RealVectorObsevaluator;
}

The SimpleObservableEvaluator class

is a class for the evaluation of standard observables.

It can be constructed from any SimpleObservable.

In addition to the same evaluation interface as AbstractSimpleObservable, the SimpleObservableEvaluator objects can be merged from more than one Monte Carlo simulation, and arithmetic evaluations like sums and products can be performed.

Depending on the original binning strategy, a full and reliable error analysis using jack-knife is possible on functions of one or more variables.

In addition to the basic algebraic operations, such as addition, subtraction, multiplication and division of observables and observables and of observables and scalars (or objects of type value_type) a few basic functions are implemented for the SimpleObservableEvaluator:

It is straightforward to extend this to other functions. Look at the source code for details.

The following additional members are defined

enum { version=...};
is a compile-time constant, same as version_id().
  SimpleObservableEvaluator(std::string n="");
the default constructor with an optional argument to name the observable.
  SimpleObservableEvaluator(const Observable&,  std::string n="");
creates a SimpleObservableEvaluator from an Observable, optionally renaming it.
const SimpleObservableEvaluator<T>& operator = (const AbstractSimpleObservable<T>& obs);
assigns an observable to the SimpleObservableEvaluator.
SimpleObservableEvaluator<T>& operator<< (const AbstractSimpleObservable<T>&  obs) 
merges additional observables (e.g. from additional Monte carlo simulations for the same system) to the SimpleObservableEvaluator, to facilitate an evaluation of the combined measurements.
template <class S>
SimpleObservableEvaluator<typename obs_value_slice<T,S>::value_type>
  slice(S ,const std::string n="") const;
extracts a slice from a SimpleObservableEvaluator. E.g. for a vector-valued observable an evaluator for just one index can be extracted. The slice can optionally be given a new name.
typedef SimpleObservableEvaluator<double> RealObsevaluator;
typedef SimpleObservableEvaluator<int32_t> IntObsevaluator;
typedef SimpleObservableEvaluator<std::complex<double> > ComplexObsevaluator;
typedef SimpleObservableEvaluator<std::valarray<double> > RealVectorObsevaluator;
are typdedefs for the commonly used SimpleObservableEvaluators.

copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)