Public Types | Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
o2scl::expval_scalar Class Reference

Scalar expectation value. More...

#include <expval.h>

Inheritance diagram for o2scl::expval_scalar:
o2scl::expval_base

Public Types

typedef boost::numeric::ublas::vector< double > ubvector
 

Public Member Functions

 expval_scalar (size_t n_blocks=1, size_t n_per_block=1)
 Create with n_blocks blocks and n_per_block points block.
 
 expval_scalar (const expval_scalar &ev)
 Copy constructor.
 
expval_scalaroperator= (const expval_scalar &ev)
 Copy constructor.
 
virtual void set_blocks (size_t n_blocks, size_t n_per_block)
 Reset for n_blocks blocks and n_per_block points block.
 
virtual void free ()
 Free allocated data (but do not change the current values of n_blocks or n_per_block)
 
virtual void add (double val)
 Add measurement of value val.
 
void is_valid () const
 Internal consistency check.
 
Report statistics
virtual void current_avg_stats (double &avg, double &std_dev, double &avg_err, size_t &m_block, size_t &m_per_block) const
 Report current average, standard deviation, and the error in the average and include block information.
 
virtual void current_avg (double &avg, double &std_dev, double &avg_err) const
 Report current average, standard deviation, and the error in the average.
 
virtual void reblock_avg_stats (size_t new_blocks, double &avg, double &std_dev, double &avg_err, size_t &m_per_block) const
 Report average, standard deviation, and the error in the average assuming a new block size. More...
 
virtual void reblock_avg (size_t new_blocks, double &avg, double &std_dev, double &avg_err) const
 Report average, standard deviation, and the error in the average assuming a new block size.
 
Direct manipulation of the stored data
const ubvectorget_data () const
 Return the current data for all blocks.
 
const double & operator[] (size_t i_block) const
 Return the current data for block with index i_block.
 
double & operator[] (size_t i_block)
 Return the current data for block with index i_block.
 
template<class vec_t >
void set_data (vec_t &v)
 Set the data for all blocks.
 
- Public Member Functions inherited from o2scl::expval_base
 expval_base (size_t n_blocks=1, size_t n_per_block=1)
 Create with n_blocks blocks and n_per_block points per block. More...
 
 expval_base (const expval_base &ev)
 Copy constructor.
 
expval_baseoperator= (const expval_base &ev)
 Copy constructor with operator=()
 
virtual void get_blocks (size_t &n_blocks, size_t &n_per_block) const
 Get the number of blocks and the number of points per block.
 
virtual void get_block_indices (size_t &i_block, size_t &i_curr_block) const
 Get the block index and the index within the current block.
 
virtual bool finished () const
 Returns true if all blocks have been stored. More...
 
virtual double progress () const
 Report progress as a fraction between zero to one (inclusive) More...
 
void is_valid () const
 Internal consistency check.
 

Public Attributes

double current
 The current rolling average.
 
- Public Attributes inherited from o2scl::expval_base
std::string name
 The name of the expectation value.
 
std::string short_name
 The shortened name.
 

Protected Attributes

ubvector vals
 The average for each block. More...
 
- Protected Attributes inherited from o2scl::expval_base
size_t iblock
 Index denoting the current block number.
 
size_t i
 Index for the number of values in the current block.
 
size_t nblocks
 Total number of blocks (default 1) More...
 
size_t nperblock
 Number of measurements per block (default 1) More...
 

Friends

void o2scl_hdf::hdf_output (o2scl_hdf::hdf_file &hf, expval_scalar &t, std::string name)
 
void o2scl_hdf::hdf_input (o2scl_hdf::hdf_file &hf, expval_scalar &t, std::string name)
 

Detailed Description

See expval_base for some general notes on this and related classes.

This represents the expectation value of a scalar double-precision quantity over several measurements.

Definition at line 181 of file expval.h.

Member Function Documentation

◆ reblock_avg_stats()

virtual void o2scl::expval_scalar::reblock_avg_stats ( size_t  new_blocks,
double &  avg,
double &  std_dev,
double &  avg_err,
size_t &  m_per_block 
) const
virtual
Idea for Future:
Use recurrence relation for averages here rather than dividing at the end.

Member Data Documentation

◆ vals

ubvector o2scl::expval_scalar::vals
protected

This is a vector of length nblocks.

Definition at line 193 of file expval.h.


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

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).