Lattice Builder Manual
Software Package for Constructing Rank-1 Lattices
LatBuilder::Accumulator< OP, VAL, ACCVAL > Class Template Reference

Accumulator template class. More...

#include <Accumulator.h>

Public Types

typedef VAL value_type
 Type of the values fed to the accumulator.
typedef ACCVAL accumulator_value_type
 Type of the accumulator value.

Public Member Functions

 Accumulator (accumulator_value_type initialValue)
void accumulate (const value_type &value)
 Feeds a new value to the accumulator.
void accumulate (Real weight, const value_type &value, Real power=1.0)
 Feeds value multiplied by weight to the accumulator. More...
const value_typevalue () const
 Returns the current value of the accumulator.
accumulator_value_typevalue ()

Static Public Member Functions

static std::string name ()
 Returns the name of the operator implemented by the accumulator.

Detailed Description

template<template< typename > class OP, typename VAL, typename ACCVAL = VAL>
class LatBuilder::Accumulator< OP, VAL, ACCVAL >

Accumulator template class.

An accumulator holds a value that can be updated by feeding it with new values with the accumulate() member function. The scalar binary operation by which new values are combined with the current value is specified with the OP template parameter. If the values are vectorial (indexable with the [] operator), the operator OP is applied to each element of the vector through the LatBuilder::Vectorize class template.

Template Parameters
OPClass template that takes that provides the implementation of a scalar binary operator. Must implement the static member functions name(), that returns a string that identifies the operator, and apply(current_accumulator_value,new_value), which returns the new accumulator value when a value new_value is fed to the accumulator while the current accumulator value is current_accumulator_value. For examples, see Functor::Sum::name() and Functor::Sum::apply().
VALType of the values that are fed to the accumulator.
ACCVALType of the accumulator value (in most cases it should be the same as VAL).
See also
Functor::Sum Functor::Max

Member Function Documentation

template<template< typename > class OP, typename VAL, typename ACCVAL = VAL>
void LatBuilder::Accumulator< OP, VAL, ACCVAL >::accumulate ( Real  weight,
const value_type value,
Real  power = 1.0 

Feeds value multiplied by weight to the accumulator.

weight is assumed to already be raised at the power power.

References LatBuilder::Accumulator< OP, VAL, ACCVAL >::value().

The documentation for this class was generated from the following file: