Class expval_vector (o2scl)

O2scl : Class List

class expval_vector : public o2scl::expval_base

Vector expectation value.

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

This is a similar to expval_scalar, except that it allows updating and statistics for a set of scalars en masse. The data is stored internally in ublas vector and matrix object, but the public member functions operate with template types which are compatible with any vector class which provides double &operator[]. It is assumed that each call to add() contains a new measurement for all of the vector indices.

Report statistics

template<class vec_t, class vec2_t, class vec3_t>
inline void current_avg_stats(vec_t &avg, vec2_t &std_dev, vec3_t &avg_err, size_t &m_block, size_t &m_per_block)

Report current average, standard deviation, and the error in the average and include block information.

Idea for Future:

This can’t be const because of ubmatrix_row, but should be made const later.

template<class vec_t, class vec2_t, class vec3_t>
inline void current_avg(vec_t &avg, vec2_t &std_dev, vec3_t &avg_err)

Report current average, standard deviation, and the error in the average.

Idea for Future:

This can’t be const because of ubmatrix_row in current_avg_stats(), but should be made const later.

template<class vec_t, class vec2_t, class vec3_t>
inline void reblock_avg_stats(size_t new_blocks, vec_t &avg, vec2_t &std_dev, vec3_t &avg_err, size_t &m_per_block) const

Report average, standard deviation, and the error in the average assuming a new block size.

template<class vec_t, class vec2_t, class vec3_t>
inline void reblock_avg(size_t new_blocks, vec_t &avg, vec2_t &std_dev, vec3_t &avg_err) const

Report average, standard deviation, and the error in the average assuming a new block size.

const ubmatrix &get_data() const

Return the current data for all blocks.

friend void hdf_output(o2scl_hdf::hdf_file &hf, expval_vector &t, std::string name)
friend void hdf_input_n(o2scl_hdf::hdf_file &hf, expval_vector &t, std::string &name)

Public Types

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

Public Functions

expval_vector()
expval_vector(size_t n, size_t n_blocks = 1, size_t n_per_block = 1)

Create for a vector of size n with n_blocks blocks and n_per_block points block.

virtual ~expval_vector()
expval_vector(const expval_vector &ev)

Copy constructor.

expval_vector &operator=(const expval_vector &ev)

Copy constructor.

virtual void set_blocks_vec(size_t n, size_t n_blocks, size_t n_per_block)

Set for a vector of size n with 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)

template<class vec_t>
inline void add(vec_t &val)

Add measurement of value val.

Protected Attributes

ubmatrix vals

The average for each block.

The first (row) index is the user-specified vector index and the second (column) index as the block index.

ubvector current

The current rolling average.

size_t nvec

The size of the vector.