Class series_acc (o2scl)

O2scl : Class List

class series_acc

Series acceleration by Levin u-transform (GSL)

Given an array of terms in a sum, this attempts to evaluate the entire sum with an estimate of the error.

Todo

Future: Move the workspaces to classes? Future: Create an example

Public Functions

series_acc(size_t size = 0)

size is the number of terms in the series

virtual ~series_acc()
template<class vec_t>
inline double series_accel(size_t na, vec_t &array, double &abserr_trunc)

Return the accelerated sum of the series with a simple error estimate.

The input vector x should be an array with n values from x[0] to x[n-1].

template<class vec_t>
inline double series_accel_err(size_t na, vec_t &array, double &abserr)

Return the accelerated sum of the series with an accurate error estimate.

The input vector x should be an array with n values from x[0] to x[n-1].

void set_size(size_t new_size)

Set the number of terms.

Protected Functions

inline size_t series_index(size_t i, size_t j, size_t nmax)

An internal function reducing two matrix indices, i and j, to index of a single array.

int levin_u_step(const double term, const size_t n, const size_t nmax, double &sum_accel)

Perform a step.

int levin_utrunc_step(const double term, const size_t n, double &sum_accel)

Perform a step.

Protected Attributes

gsl_sum_levin_u_workspace *w

The GSL workspace.

gsl_sum_levin_utrunc_workspace *wt

The GSL workspace.

size_t size

The workspace size.