|
ALPSCore reference
|
#include <core.hpp>


Public Types | |
| typedef T | value_type |
Public Member Functions | |
| virtual size_t | size () const =0 |
| virtual std::vector< size_t > | shape () const |
| virtual void | add_to (view< T > out) const =0 |
| virtual computed * | clone () |
| virtual | ~computed () |
Interface for a computed result (a result computed on-the-fly).
As a trivial example, here is a vector-valued estimator of size 2 that always adds the vector [1.0, -1.0] to the buffer:
struct trivial_computed : public computed<double>
{
size_t size() const { return 2; }
void add_to(view<T> out) { out[0] += 1.0; out[1] -= 1.0; }
}
If a computed is passed to an accumulator, the accumulator will call the add_to() method zero or more times with different buffers. This allows to avoid temporaries, as the addend can be constructed in-place, which also allows for sparse data. Also, as there is usually a bin size > 1, adding is the fundamental operation.
See also: computed_wrapper<T>
| typedef T alps::alea::computed< T >::value_type |
|
inlinevirtual |
|
pure virtual |
Add computed result data to the buffer in out. If in(i) is the i-th component of the estimator, do the equivalent of:
for (size_t i = 0; i != size(); ++i)
out[i] += in(i);
Implemented in alps::alea::computed_cmember< T, Parent >, alps::alea::eigen_adapter< T, Derived >, alps::alea::array_adapter< T, N >, alps::alea::vector_adapter< T >, and alps::alea::value_adapter< T >.
|
inlinevirtual |
|
inlinevirtual |
|
pure virtual |
Number of elements of the computed result
Implemented in alps::alea::computed_cmember< T, Parent >, alps::alea::eigen_adapter< T, Derived >, alps::alea::array_adapter< T, N >, alps::alea::vector_adapter< T >, and alps::alea::value_adapter< T >.
1.8.11