Spectral::filtering Namespace Reference

Matrices for filtering spectral coefficients. More...

## Functions

Matrix exponential_filter (const Mesh< 1 > &mesh, double alpha, unsigned half_power) noexcept
Returns a Matrix by which to multiply the nodal coefficients to apply a stable exponential filter. More...

## Detailed Description

Matrices for filtering spectral coefficients.

## ◆ exponential_filter()

 Matrix Spectral::filtering::exponential_filter ( const Mesh< 1 > & mesh, double alpha, unsigned half_power )
noexcept

Returns a Matrix by which to multiply the nodal coefficients to apply a stable exponential filter.

The exponential filter rescales the modal coefficients according to:

\begin{align*} c_i\to c_i \exp\left[-\alpha \left(\frac{i}{N}\right)^{2m}\right] \end{align*}

where $c_i$ are the zero-indexed modal coefficients, $N$ is the basis order, $\alpha$ determines how much the coefficients are rescaled, and $m$ determines how aggressive/broad the filter is (lower values means filtering more coefficients). Setting $\alpha=36$ results in setting the highest coefficient to machine precision, effectively zeroing it out.

Note
The filter matrix is not cached by the function because it depends on a double, an integer, and the mesh, which could make caching very memory intensive. The caller of this function is responsible for determining whether or not the matrix should be cached.