Function reference

The following functions are exported by the FourierSeriesEvaluators package

FourierSeriesEvaluators.fourier_contract!Method
fourier_contract!(r::AbstractArray{T,N-1}, C::AbstractArray{T,N}, x, [k=1, a=0, shift=0, dim=Val(N)]) where {T,N}

Contract dimension dim of array C and write it to the array r, whose axes must match C's (excluding dimension dim). This function uses the indices in axes(C,N) to evaluate the phase factors, which makes it compatible with OffsetArrays as inputs. Optionally, a shift can be provided to manually offset the indices. Also, a represents the order of derivative of the series and must be a Number. The formula for what this routine calculates is:

\[r_{i_{1},\dots,i_{N-1}} = \sum_{i_{N}\in\text{axes}(C,N)} C_{i_{1},\dots,i_{N-1},i_{N}+m+1} (ik (i_{N} + \text{shift}))^{a} \exp(ik x (i_{N} + \text{shift}))\]

FourierSeriesEvaluators.fourier_evaluateMethod
fourier_evaluate(C::AbstractArray{T,N}, x::NTuple{N}, [k=1, a=0, shift=0]) where {T,N}

Evaluates a N-D Fourier series C. This function uses the indices in axes(C) to evaluate the phase factors, which makes it compatible with OffsetArrays as inputs. Optionally, a shift can be provided to manually offset the indices. Also, a represents the order(s) of derivative of the series. The arguments x, k, a, shift must all be tuples of length N, the same as the array dimension. The 1-D formula for what this routine calculates is:

\[r = \sum_{n\in\text{axes}(C,1)} C_{n} (ik (n + \text{shift}))^{a} \exp(ik x (n + \text{shift}))\]

Multi-dimensional performance hit

This routine is allocation-free, but using it for multidimensional evaluation can be slower than allocating because it always computes the Fourier coefficients on the fly. Thus, it is typically more efficient to compute the outermost dimensions of the series with fourier_contract! and then use this routine for the innermost dimension, which is faster because it doesn't use inplace operations. FourierSeries implements this behavior.