Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Function partial_sum

boost::time_series::partial_sum — Like std::partial_sum(), time_series::partial_sum() calculates a series of sums such that the result at offset i is the sum of the input from offsets [-inf,i].

Synopsis

// In header: <boost/time_series/numeric/partial_sum.hpp>


template<typename Series, typename Out> 
  ordered_inserter< Out > 
  partial_sum(Series const & series, ordered_inserter< Out > out);
template<typename Series> 
  piecewise_constant_series< typename concepts::TimeSeries< Series const  >::value_type typename concepts::TimeSeries< Series const  >::discretization_type > 
  partial_sum(Series const & series);

Description

Like std::partial_sum(), time_series::partial_sum() calculates a series of sums such that the result at offset i is the sum of the input from offsets [0,i].

This function assumes that zero value of the series does not contribute to the sums, and that the series does not have non-zero positive or negative infinite runs.

Parameters:
out

The ordered inserter to receive the adjacent difference result.

series

The input series.

Requires:

Series is a model of the TimeSeries concept.

Out is a model of the OrderedInserter concept.

The offset_type of the Series is integral.

For variaibles x and y of the series' value_type, the expression (x+=y) must be convertible to value_type.

For a variable x of the series' value_type, x == (x + range_run_storage::zero(series)).

series[-inf] == range_run_storage::zero(series)

series[inf] == range_run_storage::zero(series)

Returns:

A piecewise_constant_series<> if no ordered inserter is specified; otherwise, the ordered inserter.

Notes:

If using the version that takes an OrderedInserter, you must call .commit() on the returned OrderedInserter when you are done with it.


PrevUpHomeNext