![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
Scalar expectation value. More...
#include <expect_val.h>
See expect_val for some general notes on this and related classes.
This class is experimental.
In the case where nperblock
is zero, the vector last is used to store the most recent measurements, copying the results to vals only when nblocks
measurements are stored in last. The variable i
is only incremented when the vector last is full and the information is copied over to vals. This ensures that vals always contains averages with an equal number of measurements. The information in last is never used by reblock_avg().
Definition at line 201 of file expect_val.h.
Public Member Functions | |
scalar_ev () | |
Create with one unspecified block. | |
scalar_ev (size_t n_blocks, size_t n_per_block) | |
Create with n_blocks blocks and n_per_block points block. | |
scalar_ev (const scalar_ev &ev) | |
Copy constructor. | |
scalar_ev & | operator= (const scalar_ev &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. | |
virtual void | reset () |
Clear all the data. | |
virtual void | add (double val) |
Add measurement of value val . | |
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. | |
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 uvector & | get_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. | |
Protected Attributes | |
uvector | vals |
The average for each block. | |
double | current |
The current rolling average. | |
uvector | last |
The most recent values for each block. |
virtual void scalar_ev::reblock_avg_stats | ( | size_t | new_blocks, |
double & | avg, | ||
double & | std_dev, | ||
double & | avg_err, | ||
size_t & | m_per_block | ||
) | const [virtual] |
uvector scalar_ev::vals [protected] |
This is a vector of length nblocks
.
Definition at line 209 of file expect_val.h.
uvector scalar_ev::last [protected] |
This is a vector of length nblocks
used for when n_per_block
is set to zero.
Definition at line 219 of file expect_val.h.
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).