NESSi  v1.0.2 The NonEquilibrium Systems Simulation Library

## ◆ gregory_weights()

template<typename T = double>
 T integration::Integrator< T >::gregory_weights ( int n, int j )
inline

Returns the Gregory weights for integration.

Purpose

The Gregory integration formula of order $$k$$ is defined by

\begin{align*} \int^{x_m}_0 dx \, f(x) = \sum^{\mathrm{max}(k,m)}_{l=0} w_{m,l}\, f(x_l) \end{align*}

For $$m > 2 k$$, the weights have a simpler form:

\begin{align*} w_{m,j} = \begin{cases} \omega_j & : j \le k \\ 1 & : k < j < m-k \\ \omega_{m-j} & : j \ge m-k \end{cases} \end{align*}

Here, $$\omega_j$$ are tabulated weights for $$0 \le j \le k$$.

gregory_weights returns $$w_{n,j}$$ for given $$n, j$$.

Parameters
 n Integration runs up to $$x_n$$. j Index of the Gregory weight.

Definition at line 382 of file integration.hpp.

382  {
383  int k1=k_+1,k2=2*k1;
384  assert( j>=0 && ( j<=k_ || j<=n) );
385  if( n>=k2 ){
386  if( j > k_ && j < n-k_ ) { return 1;}
387  else if ( j<k1 ) { return gregory_omega_[j];}
388  else { return gregory_omega_[n-j]; }
389 }else{ return gregory_weights_[n*k2 + j];}
390 }