GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
fft_v.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2007,2008,2012,2018,2020 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_FFT_FFT_V_H
12 #define INCLUDED_FFT_FFT_V_H
13 
14 #include <gnuradio/fft/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace fft {
19 
20 /*!
21  * \brief Compute forward or reverse FFT. complex vector in / complex vector out.
22  * \ingroup fourier_analysis_blk
23  *
24  * The FFT operation is defined for a vector \f$x\f$ with \f$N\f$ uniformly
25  * sampled points by
26  *
27  * \f[ X(a) = \sum_{k=0}^{N-1} x(a) \cdot e^{-j 2\pi k a / N} \f]
28  *
29  * \f$ X = FFT\{x\} \f$ is the the FFT transform of \f$x(a)\f$, \f$j\f$ is
30  * the imaginary unit, \f$k\f$ and \f$a\f$ range from \f$0\f$ to \f$N-1\f$.
31  *
32  * The IFFT operation is defined for a vector \f$y\f$ with \f$N\f$
33  * uniformly sampled points by
34  *
35  * \f[ Y(b) = \sum_{k=0}^{N-1} y(b) \cdot e^{j 2\pi k b / N} \f]
36  *
37  * \f$Y = IFFT\{y\}\f$ is the the inverse FFT transform of \f$y(b)\f$,
38  * \f$j\f$ is the imaginary unit, \f$k\f$ and \f$b\f$ range from \f$0\f$ to
39  * \f$N-1\f$.
40  *
41  * \b Note, that due to the underlying FFTW library, the output of a FFT
42  * followed by an IFFT (or the other way around) will be scaled i.e.
43  * \f$FFT\{ \, IFFT\{x\} \,\} = N \cdot x \neq x\f$.
44  *
45  * \see http://www.fftw.org/faq/section3.html#whyscaled
46  */
47 template <class T, bool forward>
48 class FFT_API fft_v : virtual public sync_block
49 {
50 public:
51  typedef std::shared_ptr<fft_v<T, forward>> sptr;
52  /*! \brief
53  * \param[in] fft_size N.
54  * \param[in] window Window function to be used.
55  * \param[in] shift True moves DC carrier to the middle.
56  * \param[in] nthreads Number of underlying threads.
57  */
58  static sptr make(int fft_size,
59  const std::vector<float>& window,
60  bool shift = false,
61  int nthreads = 1);
62 
63  virtual void set_nthreads(int n) = 0;
64 
65  virtual int nthreads() const = 0;
66 
67  virtual bool set_window(const std::vector<float>& window) = 0;
68 };
69 
70 } /* namespace fft */
71 } /* namespace gr */
72 
73 #endif /* INCLUDED_FFT_FFT_V_H */
Compute forward or reverse FFT. complex vector in / complex vector out.
Definition: fft_v.h:49
std::shared_ptr< fft_v< T, forward > > sptr
Definition: fft_v.h:51
virtual void set_nthreads(int n)=0
virtual bool set_window(const std::vector< float > &window)=0
static sptr make(int fft_size, const std::vector< float > &window, bool shift=false, int nthreads=1)
virtual int nthreads() const =0
Definition: window.h:23
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define FFT_API
Definition: gr-fft/include/gnuradio/fft/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29