Public Member Functions | Public Attributes | Protected Attributes | List of all members
o2scl::expval_base Class Reference

Expectation value base class. More...

#include <expval.h>

Inheritance diagram for o2scl::expval_base:
o2scl::expval_matrix o2scl::expval_scalar o2scl::expval_vector

Public Member Functions

 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 set_blocks (size_t n_blocks, size_t n_per_block)
 Reset for n_blocks blocks and n_per_block points per block. More...
 
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 free ()
 Free allocated data (but do not change the current values of n_blocks or n_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

std::string name
 The name of the expectation value.
 
std::string short_name
 The shortened name.
 

Protected Attributes

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...
 

Detailed Description

See the Analysis of results from numerical simulations section of the User's guide for basic information about this class and its children.

This base class need not be directly instantiated by the casual end-user, but provides basic functionality for expval_scalar, expval_vector, and expval_matrix.


Internally, neither nblocks nor nperblock should ever be zero. This is checked by is_valid() .

Definition at line 74 of file expval.h.

Constructor & Destructor Documentation

◆ expval_base()

o2scl::expval_base::expval_base ( size_t  n_blocks = 1,
size_t  n_per_block = 1 
)

If this is called with a value of zero for either n_blocks or n_per_block, then the error handler is called.

Member Function Documentation

◆ finished()

virtual bool o2scl::expval_base::finished ( ) const
virtual

This reports true when exactly n_blocks times n_per_block data points have been added.

◆ progress()

virtual double o2scl::expval_base::progress ( ) const
virtual

When n_per_block is nonzero, this reports the total progress on all blocks, reporting 1.0 only when all n_blocks times n_per_block data points have been added. If more data is added after this function reports 1.0, then the blocks are rearranged and progress() will report something near 0.5 again.

◆ set_blocks()

virtual void o2scl::expval_base::set_blocks ( size_t  n_blocks,
size_t  n_per_block 
)
virtual

This function resets the currently stored data to zero by calling free(). If this is called with a value of zero for n_blocks, then the value 1 is assumed.

Reimplemented in o2scl::expval_scalar.

Member Data Documentation

◆ nblocks

size_t o2scl::expval_base::nblocks
protected

This should never be zero.

Definition at line 88 of file expval.h.

◆ nperblock

size_t o2scl::expval_base::nperblock
protected

This should never be zero.

Definition at line 94 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).