Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ fft() [2/2]

template<typename V , require_eigen_vector_vt< is_complex, V > * = nullptr, require_var_t< base_type_t< value_type_t< V > > > * = nullptr>
plain_type_t< V > stan::math::fft ( const V &  x)
inline

Return the discrete Fourier transform of the specified complex vector.

Given an input complex vector x[0:N-1] of size N, the discrete Fourier transform computes entries of the resulting complex vector y[0:N-1] by

y[n] = SUM_{i < N} x[i] * exp(-n * i * 2 * pi * sqrt(-1) / N)
fvar< T > sqrt(const fvar< T > &x)
Definition sqrt.hpp:18
static constexpr double pi()
Return the value of pi.
Definition constants.hpp:36
fvar< T > exp(const fvar< T > &x)
Definition exp.hpp:15

The adjoint computation is given by

adjoint(x) += length(y) * inv_fft(adjoint(y))
Eigen::Matrix< scalar_type_t< V >, -1, 1 > inv_fft(const V &y)
Return the inverse discrete Fourier transform of the specified complex vector.
Definition fft.hpp:66

If the input is of size zero, the result is a size zero vector.

Template Parameters
Vtype of complex vector argument
Parameters
[in]xvector to transform
Returns
discrete Fourier transform of x

Definition at line 41 of file fft.hpp.