Class expval_base (o2scl)

O2scl : Class List

class expval_base

Expectation value base class.

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

Subclassed by o2scl::expval_matrix, o2scl::expval_scalar, o2scl::expval_vector

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

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

virtual ~expval_base()
expval_base(const expval_base &ev)

Copy constructor.

expval_base &operator=(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.

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.

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.

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

virtual double progress() const

Report progress as a fraction between zero to one (inclusive)

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.

inline void is_valid() const

Internal consistency check.

Public Members

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)

This should never be zero.

size_t nperblock

Number of measurements per block (default 1)

This should never be zero.