Difference between revisions of "Aufgaben:Exercise 5.5Z: Complexity of the FFT"

From LNTwww
 
(27 intermediate revisions by 6 users not shown)
Line 1: Line 1:
  
{{quiz-Header|Buchseite=Signaldarstellung/Fast-Fouriertransformation (FFT)
+
{{quiz-Header|Buchseite=Signal_Representation/Fast_Fourier_Transform_(FFT)
 
}}
 
}}
  
[[File:P_ID1179__Sig_Z_5_5.png|right]]
+
[[File:P_ID1179__Sig_Z_5_5.png|right|frame|Final step of the FFT for N=8]]
Der FFT–Algorithmus realisiert eine Diskrete Fouriertransformation mit dem kleinstmöglichen Rechenaufwand, wenn der Parameter '''N''' eine Zweierpotenz ist. Im einzelnen sind zur Durchführung einer FFT folgende Rechenschritte notwendig:
+
The  FFT  algorithm  ("Fast Fourier Transform")  realises a  "Discrete Fourier Transform"  (DFT)  with the smallest possible computational effort if the parameter  N  is a power of two.  In detail, the following calculation steps are necessary to carry out an FFT:
:*Die FFT geschieht in ld ''N'' Stufen, wobei in jeder Stufe die genau gleiche Anzahl an Rechenoperationen durchzuführen ist. „ld” steht hier als Abkürzung für den Logarithmus zur Basis 2.
+
*The FFT occurs in  log2 N  stages, whereby the exact same number of arithmetic operations must be carried out in each stage.
 +
*The diagram shows the third and last stage for the example  N=8.  It can be seen that  N/2  basic operations have to be carried out in this and the other stages.
 +
*In each basic operation called  '''butterfly''',  two complex outputs are calculated from the two complex input variables  E1  and  E2 :
 +
:$$ A_1  = E_1 + E_2 \cdot w^{\hspace{0.04cm}\mu}, $$
 +
:A2=E1E2wμ.
 +
*Here  w=ej2π/N  denotes the complex rotation factor.  For   N=8  the value  w=ejπ/4=cos(45)jsin(45) is obtained.
 +
*The exponent  μ  for this complex rotation factor can take all integer values between  0  and  N/21.  For  $N = 8$  it is:
 +
:$$w^0 = 1,\hspace{0.2cm}w^1 = {1}/{\sqrt{2}}- {\rm j}
 +
\cdot{1}/{\sqrt{2}},\hspace{0.2cm}w^2 = - {\rm
 +
j},\hspace{0.2cm}w^3 = -{1}/{\sqrt{2}}- {\rm j}
 +
\cdot{1}/{\sqrt{2}} \hspace{0.05cm}.$$
  
:*Die Grafik zeigt die dritte und letzte Stufe für das Beispiel ''N'' = 8. Man erkennt, dass in dieser und auch den anderen Stufen jeweils ''N''/2 Basisoperationen durchzuführen sind.
+
The purpose of this task is to determine the number of arithmetic operations  (OFFT)  required for the FFT and compare it with the value  $\mathcal{O}_{\rm DFT} ≈ 8\cdot N^2$  that can be specified for the DFT.
  
:*In jeder Basisoperation, die man häufig auch als '''Butterfly''' bezeichnet, werden aus den beiden komplexen Eingangsgrößen E1 und E2 zwei komplexe Ausgänge berechnet:
 
  
===Fragebogen===
+
 
 +
 
 +
 
 +
''Hints:''
 +
*This task belongs to the chapter  [[Signal_Representation/Fast_Fourier_Transform_(FFT)|Fast Fourier Transform (FFT)]].
 +
*It makes sense to calculate the powers of  w  before the actual algorithm and store them in a lookup table.  The operations necessary for this are to be disregarded.
 +
*The  "bit reversal operation"  – a rearrangement that has to be carried out before the first stage – is also not to be taken into account in this estimation.
 +
 +
 
 +
 
 +
 
 +
 
 +
===Questions===
  
 
<quiz display=simple>
 
<quiz display=simple>
{Multiple-Choice Frage
+
{How many real additions&nbsp; (AA)&nbsp; does a complex addition require?
|type="[]"}
+
|type="{}"}
- Falsch
+
AA=  { 2 }
+ Richtig
+
 
 +
{How many real additions&nbsp; (AM)&nbsp; and multiplications&nbsp; (MM)&nbsp; are required for a complex multiplication?
 +
|type="{}"}
 +
AM=  { 2 }
 +
MM=  { 4 }
  
 +
{How many complex additions/subtractions&nbsp; (aB)&nbsp; does a single basic operationn&nbsp; ("butterfly")&nbsp; require?
 +
<br>How many complex multiplications&nbsp; (mB)&nbsp; are required per basic operation?
 +
|type="{}"}
 +
aB=   { 2 }
 +
mB=   { 1 }
  
{Input-Box Frage
+
{How many arithmetic operations&nbsp; (additions, subtractions, multiplications alike)&nbsp; does a basic operation require?
 
|type="{}"}
 
|type="{}"}
$\alpha$ = { 0.3 }
+
$\mathcal{O}_{\rm B} \ = \ $ { 10 }
  
 +
{How many real operations&nbsp; (OFFT)&nbsp; does the entire FFT&ndash;algorithm require?&nbsp; What are the values for&nbsp; N=16&nbsp; und&nbsp; N=1024?
 +
|type="{}"}
 +
N=16:OFFT =  { 320 3% }
 +
N=1024:OFFT =  { 51200 3% }
  
 +
{What is the time gain&nbsp; GFFT=ODFTOFFT&nbsp; for&nbsp; N=16&nbsp; and&nbsp; N=1024?
 +
|type="{}"}
 +
N=16:GFFT =  { 6.4 3% }
 +
N=1024:GFFT =  { 164 3% }
  
 
</quiz>
 
</quiz>
  
===Musterlösung===
+
===Solution===
 
{{ML-Kopf}}
 
{{ML-Kopf}}
'''1.'''
+
'''(1)'''&nbsp; Each complex addition requires two real additions:
'''2.'''
+
:$$(R_1 + {\rm j} \cdot I_1) + (R_2 + {\rm j} \cdot I_2) = (R_1 +
'''3.'''
+
R_2) + {\rm j} \cdot (I_1 + I_2)\hspace{0.3cm}\Rightarrow \hspace{0.3cm}
'''4.'''
+
\hspace{0.15 cm}\underline{ A_{\rm A} =
'''5.'''
+
2}\hspace{0.05cm}.$$
'''6.'''
+
 
'''7.'''
+
 
 +
'''(2)'''&nbsp; Any complex multiplication requires four real multiplications and two real additions:
 +
:$$(R_1 + {\rm j} \cdot I_1)  (R_2 + {\rm j} \cdot I_2) = (R_1 \cdot
 +
R_2 - I_1 \cdot I_2) + {\rm j} \cdot (R_1 \cdot I_2 + R_2 \cdot
 +
I_1)\hspace{0.3cm}
 +
\Rightarrow \hspace{0.3cm}\hspace{0.15 cm}\underline{A_{\rm M} = 2,\hspace{0.3cm}M_{\rm M} =
 +
4} \hspace{0.05cm}.$$
 +
 
 +
 
 +
'''(3)'''&nbsp; The basic operations with complex inputs&nbsp; E1,&nbsp; E2&nbsp; and&nbsp; wμ are:
 +
:A1=E1+E2wμ,A2=E1E2wμ.
 +
*This means one complex multiplication and two complex additions: &nbsp; $\hspace{0.15 cm}\underline{a_{\rm B} = 2, \hspace{0.2cm}m_{\rm B} = 1}
 +
\hspace{0.05cm}.$
 +
 
 +
 
 +
'''(4)'''&nbsp; In contrast to the first computers, a multiplication today does not take much more computing time than an addition or subtraction.
 +
 
 +
*Using the results of subtasks&nbsp; '''(1)''',&nbsp; '''(2)'''&nbsp; and&nbsp; '''(3)'''&nbsp; we obtain for the total number of arithmetic operations:
 +
:$$ \mathcal{O}_{\rm B} = a_{\rm B}\cdot A_{\rm A} + a_{\rm B}\cdot (A_{\rm M}
 +
+M_{\rm M} ) = 2 \cdot 2 + 1 \cdot 6\hspace{0.15 cm}\underline{ = 10}
 +
\hspace{0.05cm}.$$
 +
 
 +
 
 +
'''(5)'''&nbsp; There are&nbsp; log2 N stages in total, each of which requires&nbsp; N/2&nbsp; basic operations to be performed:
 +
:$$\mathcal{O}_{\rm FFT} = {\rm log_2}\hspace{0.1cm}N \cdot \frac{N}{2}\cdot
 +
\mathcal{O}_{\rm B} = 5 \cdot N \cdot {\rm log_2}\hspace{0.1cm}N$$
 +
:$$\Rightarrow \hspace{0.3cm}\mathcal{O}_{\rm FFT}\hspace{0.1cm}(N=16)  =  5\cdot 16 \cdot
 +
4 \hspace{0.15 cm}\underline{= 320}, \hspace{0.5cm}\mathcal{O}_{\rm FFT}\hspace{0.1cm}(N=1024)  =  5\cdot 1024
 +
\cdot 10 \hspace{0.15 cm}\underline{= 51200}
 +
\hspace{0.05cm}.$$
 +
 
 +
 
 +
'''(6)'''&nbsp; The computational time gain of the FFT over the conventional DFT is given by:
 +
:$$G_{\rm FFT} = \frac{\mathcal{O}_{\rm DFT}}{\mathcal{O}_{\rm FFT}} = \frac{8 \cdot N^2} {5 \cdot
 +
N \cdot {\rm log_2}\hspace{0.1cm}N }= 1.6 \cdot \frac{N}{ {\rm
 +
log_2}\hspace{0.1cm}N}$$
 +
:$$\Rightarrow \hspace{0.3cm}G_{\rm FFT} \hspace{0.1cm}(N=16)  =  1.6 \cdot
 +
\frac{16}{ 4} \hspace{0.15 cm}\underline{= 6.4}, \hspace{0.5cm}G_{\rm FFT} \hspace{0.1cm}(N=1024)  =  1.6 \cdot\frac{1024}{ 10}\hspace{0.15 cm}\underline{ \approx 164}
 +
\hspace{0.05cm}.$$
 +
 
 +
 
 
{{ML-Fuß}}
 
{{ML-Fuß}}
  
  
  
[[Category:Aufgaben zu Signaldarstellung|^5. Zeit- und frequenzdiskrete Signaldarstellung^]]
+
[[Category:Signal Representation: Exercises|^5.5 Fast Fourier Transform ^]]

Latest revision as of 16:48, 24 May 2021

Final step of the FFT for N=8

The  FFT  algorithm  ("Fast Fourier Transform")  realises a  "Discrete Fourier Transform"  (DFT)  with the smallest possible computational effort if the parameter  N  is a power of two.  In detail, the following calculation steps are necessary to carry out an FFT:

  • The FFT occurs in  log2 N  stages, whereby the exact same number of arithmetic operations must be carried out in each stage.
  • The diagram shows the third and last stage for the example  N=8.  It can be seen that  N/2  basic operations have to be carried out in this and the other stages.
  • In each basic operation called  butterfly,  two complex outputs are calculated from the two complex input variables  E1  and  E2 :
A1=E1+E2wμ,
A2=E1E2wμ.
  • Here  w=ej2π/N  denotes the complex rotation factor.  For  N=8  the value  w=ejπ/4=cos(45)jsin(45) is obtained.
  • The exponent  μ  for this complex rotation factor can take all integer values between  0  and  N/21.  For  N=8  it is:
w0=1,w1=1/2j1/2,w2=j,w3=1/2j1/2.

The purpose of this task is to determine the number of arithmetic operations  (OFFT)  required for the FFT and compare it with the value  ODFT8N2  that can be specified for the DFT.



Hints:

  • This task belongs to the chapter  Fast Fourier Transform (FFT).
  • It makes sense to calculate the powers of  w  before the actual algorithm and store them in a lookup table.  The operations necessary for this are to be disregarded.
  • The  "bit reversal operation"  – a rearrangement that has to be carried out before the first stage – is also not to be taken into account in this estimation.



Questions

1

How many real additions  (AA)  does a complex addition require?

AA= 

2

How many real additions  (AM)  and multiplications  (MM)  are required for a complex multiplication?

AM= 

MM= 

3

How many complex additions/subtractions  (aB)  does a single basic operationn  ("butterfly")  require?
How many complex multiplications  (mB)  are required per basic operation?

aB= 

mB= 

4

How many arithmetic operations  (additions, subtractions, multiplications alike)  does a basic operation require?

OB = 

5

How many real operations  (OFFT)  does the entire FFT–algorithm require?  What are the values for  N=16  und  N=1024?

N=16:OFFT = 

N=1024:OFFT = 

6

What is the time gain  GFFT=ODFTOFFT  for  N=16  and  N=1024?

N=16:GFFT = 

N=1024:GFFT = 


Solution

(1)  Each complex addition requires two real additions:

(R1+jI1)+(R2+jI2)=(R1+R2)+j(I1+I2)AA=2_.


(2)  Any complex multiplication requires four real multiplications and two real additions:

(R1+jI1)(R2+jI2)=(R1R2I1I2)+j(R1I2+R2I1)AM=2,MM=4_.


(3)  The basic operations with complex inputs  E1E2  and  wμ are:

A1=E1+E2wμ,A2=E1E2wμ.
  • This means one complex multiplication and two complex additions:   aB=2,mB=1_.


(4)  In contrast to the first computers, a multiplication today does not take much more computing time than an addition or subtraction.

  • Using the results of subtasks  (1)(2)  and  (3)  we obtain for the total number of arithmetic operations:
OB=aBAA+aB(AM+MM)=22+16=10_.


(5)  There are  log2 N stages in total, each of which requires  N/2  basic operations to be performed:

OFFT=log2NN2OB=5Nlog2N
OFFT(N=16)=5164=320_,OFFT(N=1024)=5102410=51200_.


(6)  The computational time gain of the FFT over the conventional DFT is given by:

GFFT=ODFTOFFT=8N25Nlog2N=1.6Nlog2N
GFFT(N=16)=1.6164=6.4_,GFFT(N=1024)=1.6102410164_.