Fast Fourier Transform for Power of 3

In summary, the conversation discusses writing a version of the Fast Fourier Transform (FFT) for the case that N is a power of 3. The proposed method involves separating the input vector into 3 subvectors and recursively solving the problem at each subvector before combining the solutions. The conversation also touches on the assumption that N is a power of 3 and the need to calculate the Fourier Transform of $f_0, f_1$ and $f_2$. The conversation also discusses the general formula for the Discrete Fourier Transform and how it applies to the case of N being a power of 3. Finally, the conversation mentions an algorithm that may not be correctly split up yet.
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! (Wave)

I want to write a version of [m]FastFourierTransform(fft)[/m] for the case that $N$ is a power of $3$, seperating the input-vector into $3$ subvectors, solving the problem recursively at them and combining the solutions of the subproblems.

I have tried the following:

We assume that $N$ is a power of $3$ ($N=3^m$)

$f(x)=a_0+a_1x+ \dots +a_{N-1}x^{N-1}$

$f_0=a_0+a_3x^3+a_6x^6+ \dots +a_{N-3}x^{N-3}$

$f_1=a_1+a_4x^3+a_7x^6+ \dots +a_{N-2}x^{N-3}$

$f_2=a_2+a_5x^3+a_8x^6+ \dots +a_{N-1}x^{N-3}$

$f(x)=f_0(x)+xf_1(x)+x^2f(x)$

Now do we have to calculate the Fourier Transform of $f_0, f_1$ and $f_2$? (Thinking)Is the dicrete Fourier transform of $f$ the following? $$\sum_{m=0}^{N-1}fe^{\frac{-2\pi i km}{N}}=\sum_{m=0}^{\frac{N}{3}-1}f_{3m}e^{-\frac{2\pi ik(3m)}{N}}+\sum_{m=0}^{\frac{N}{3}}f_{3m+1}e^{-\frac{2\pi ik(3m+1)}{N}}+\sum_{m=0}^{\frac{N}{3}-1}f_{3m+2}e^{-\frac{2\pi ik(3m+2)}{N}}$$

So do we have to calculate the following sums?

  • $\sum_{m=0}^{\frac{N}{3}-1}f_{3m}e^{-\frac{2\pi ik(3m)}{N}}$
  • $\sum_{m=0}^{\frac{N}{3}}f_{3m+1}e^{-\frac{2\pi ik(3m+1)}{N}}$
  • $\sum_{m=0}^{\frac{N}{3}-1}f_{3m+2}e^{-\frac{2\pi ik(3m+2)}{N}}$
 
Technology news on Phys.org
  • #2
evinda said:
I want to write a version of [m]FastFourierTransform(fft)[/m] for the case that $N$ is a power of $3$, seperating the input-vector into $3$ subvectors, solving the problem recursively at them and combining the solutions of the subproblems.

I have tried the following:

We assume that $N$ is a power of $3$ ($N=3^m$)

$f(x)=a_0+a_1x+ \dots +a_{N-1}x^{N-1}$

$f_0=a_0+a_3x^3+a_6x^6+ \dots +a_{N-3}x^{N-3}$

$f_1=a_1+a_4x^3+a_7x^6+ \dots +a_{N-2}x^{N-3}$

$f_2=a_2+a_5x^3+a_8x^6+ \dots +a_{N-1}x^{N-3}$

$f(x)=f_0(x)+xf_1(x)+x^2f(x)$

Now do we have to calculate the Fourier Transform of $f_0, f_1$ and $f_2$? (Thinking)

Hi! (Wink)

Yes.
Btw, I think there is no need to assume that $f$ is a polynomial.
The process works for any $f$. (Wasntme)
Is the dicrete Fourier transform of $f$ the following? $$\sum_{m=0}^{N-1}fe^{\frac{-2\pi i km}{N}}=\sum_{m=0}^{\frac{N}{3}-1}f_{3m}e^{-\frac{2\pi ik(3m)}{N}}+\sum_{m=0}^{\frac{N}{3}}f_{3m+1}e^{-\frac{2\pi ik(3m+1)}{N}}+\sum_{m=0}^{\frac{N}{3}-1}f_{3m+2}e^{-\frac{2\pi ik(3m+2)}{N}}$$

So do we have to calculate the following sums?

  • $\sum_{m=0}^{\frac{N}{3}-1}f_{3m}e^{-\frac{2\pi ik(3m)}{N}}$
  • $\sum_{m=0}^{\frac{N}{3}}f_{3m+1}e^{-\frac{2\pi ik(3m+1)}{N}}$
  • $\sum_{m=0}^{\frac{N}{3}-1}f_{3m+2}e^{-\frac{2\pi ik(3m+2)}{N}}$

Yes. (Nod)

It appears your $f_{3m}$ here is different from the $f_0, f_1, f_2$ you previously defined. (Worried)
Apparently $f_{3m} = f(x_{3m}) = f(a + \frac{3m}{N}(b-a))$, where $[a,b]$ is the interval that $f$ is defined.

For the next step, I suggest to substitute $N=3M$. (Wasntme)
 
  • #3
I like Serena said:
Hi! (Wink)

Yes.
Btw, I think there is no need to assume that $f$ is a polynomial.
The process works for any $f$. (Wasntme)

So do we assume that $f$ is any function? (Thinking)
I like Serena said:
It appears your $f_{3m}$ here is different from the $f_0, f_1, f_2$ you previously defined. (Worried)
Apparently $f_{3m} = f(x_{3m}) = f(a + \frac{3m}{N}(b-a))$, where $[a,b]$ is the interval that $f$ is defined.

For the next step, I suggest to substitute $N=3M$. (Wasntme)

Could you explain it further to me? I haven't understood it.. (Worried)
 
  • #4
Is the general formula of the Discrete Fourier transform the following?

$$y_j= \sum_{i=0}^{n-1} a_i \omega^{ij}$$

So if $N$ is a power of $3$, do we write it as follows?$$y_j= \sum_{i=0}^{\frac{n}{3}-1} a_{3m} \omega^{(3m)j}+ \sum_{i=0}^{\frac{n}{3}-1} a_{3m+1} \omega^{(3m+1)j}+ \sum_{i=0}^{\frac{n}{3}-1} a_{3m+2} \omega^{(3m+2)j}$$
 
  • #5
Should the algorithm look like that?
http://pastebin.com/4vuudvgt
 
  • #6
evinda said:
So do we assume that $f$ is any function? (Thinking)

The input for an FFT is usually an array f_n = f(x_n), where $x_0, ..., x_{N-1}$ is equally spaced division of the domain of $f$.
For this, $f$ can be any function.

It's not usually a set of polynomial coefficients, as you have.
Are you supposed to use those polynomial coefficients as input instead? (Wondering)
Could you explain it further to me? I haven't understood it.. (Worried)

All I'm saying is that the discrete Fourier transform is:
$$F_k = \sum_{n=0}^{N-1} f(x_n) e^{-2\pi i kn/N}$$
where $f(x_n)$ are function values. The result $F_k$ is an array of transformed values.
evinda said:
Is the general formula of the Discrete Fourier transform the following?

$$y_j= \sum_{i=0}^{n-1} a_i \omega^{ij}$$

So if $N$ is a power of $3$, do we write it as follows?

$$y_j= \sum_{i=0}^{\frac{n}{3}-1} a_{3m} \omega^{(3m)j}+ \sum_{i=0}^{\frac{n}{3}-1} a_{3m+1} \omega^{(3m+1)j}+ \sum_{i=0}^{\frac{n}{3}-1} a_{3m+2} \omega^{(3m+2)j}$$

It's the right formula with a different notation, assuming $\omega = e^{-2\pi i /n}$.
But I don't think it works like that if $a_i$ are the coefficients of a polynomial. :confused:

You can rewrite it into 3 transforms though, but then the individual terms should be written as transforms.
As yet the first term contains $3m$ instead of something like $m$.
And the second term has $\omega^{(3m+1)j}$ when it should be something like $\eta^{mj}\eta$, where $\eta = e^{-2\pi i / (n/3)}$. (Wasntme)
evinda said:
Should the algorithm look like that?
http://pastebin.com/4vuudvgt

I believe that your formula for the transform has not been split up correctly yet. (Wasntme)
 
  • #7
I like Serena said:
The input for an FFT is usually an array f_n = f(x_n), where $x_0, ..., x_{N-1}$ is equally spaced division of the domain of $f$.
For this, $f$ can be any function.

It's not usually a set of polynomial coefficients, as you have.
Are you supposed to use those polynomial coefficients as input instead? (Wondering)

All I'm saying is that the discrete Fourier transform is:
$$F_k = \sum_{n=0}^{N-1} f(x_n) e^{-2\pi i kn/N}$$
where $f(x_n)$ are function values. The result $F_k$ is an array of transformed values.It's the right formula with a different notation, assuming $\omega = e^{-2\pi i /n}$.
But I don't think it works like that if $a_i$ are the coefficients of a polynomial. :confused:

You can rewrite it into 3 transforms though, but then the individual terms should be written as transforms.
As yet the first term contains $3m$ instead of something like $m$.
And the second term has $\omega^{(3m+1)j}$ when it should be something like $\eta^{mj}\eta$, where $\eta = e^{-2\pi i / (n/3)}$. (Wasntme)

Is it like that?

$$F_k=\sum_{m=0}^{N-1}f(x_n)e^{-\frac{2\pi ikn}{N}} \\ =\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n})e^{-\frac{2\pi ik(3n)}{N}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+1})e^{-\frac{2\pi ik(3n+1)}{N}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+2})e^{-\frac{2\pi ik(3n+2)}{N}} \\ =\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n})e^{-\frac{2\pi ikn}{\frac{N}{3}}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+1})e^{-\frac{2\pi ikn}{\frac{N}{3}}}e^{-\frac{2\pi ik}{N}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+2})e^{-\frac{2\pi ikn}{\frac{N}{3}}}e^{-\frac{4\pi ik}{N}}$$

(Thinking)
I like Serena said:
I believe that your formula for the transform has not been split up correctly yet. (Wasntme)

Should it look like that: http://pastebin.com/gZKfqyYG ?
 
  • #8
evinda said:
Is it like that?

$$F_k=\sum_{m=0}^{N-1}f(x_n)e^{-\frac{2\pi ikn}{N}} \\ =\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n})e^{-\frac{2\pi ik(3n)}{N}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+1})e^{-\frac{2\pi ik(3n+1)}{N}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+2})e^{-\frac{2\pi ik(3n+2)}{N}} \\ =\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n})e^{-\frac{2\pi ikn}{\frac{N}{3}}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+1})e^{-\frac{2\pi ikn}{\frac{N}{3}}}e^{-\frac{2\pi ik}{N}}+\sum_{n=0}^{\frac{N}{3}-1}f(x_{3n+2})e^{-\frac{2\pi ikn}{\frac{N}{3}}}e^{-\frac{4\pi ik}{N}}$$

(Thinking)

Should it look like that: http://pastebin.com/gZKfqyYG ?

Yep. (Nod)

We should make a recursive call to [m]FFT3[/m] instead of [m]FFT[/m] though.
And we should give [m]N[/m] a value somewhere. (Doh)

Btw, the return value for N=2 is incorrect.
It's a good thing this cannot happen if the initial N is a power of 3.
And if it could happen, we should detect that N is not a power of 3 and return an error, since I think the algorithm won't work properly. (Nerd)
 
  • #9
I like Serena said:
Yep. (Nod)

We should make a recursive call to [m]FFT3[/m] instead of [m]FFT[/m] though.
And we should give [m]N[/m] a value somewhere. (Doh)

Btw, the return value for N=2 is incorrect.
It's a good thing this cannot happen if the initial N is a power of 3.
And if it could happen, we should detect that N is not a power of 3 and return an error, since I think the algorithm won't work properly. (Nerd)

I changed the algorithm: http://pastebin.com/gZKfqyYG
Is it right now? (Thinking)
 
  • #10
evinda said:
I changed the algorithm: http://pastebin.com/gZKfqyYG
Is it right now? (Thinking)

One more thing, most of the algorithm refers to $n$, but in the last line it refers to $m$, which is not consistent.
And actually, I think we might simply call them f_0, f_1, f_2, y_0, y_1, y_2, which I think is less confusing. (Wasntme)
 
  • #11
I like Serena said:
One more thing, most of the algorithm refers to $n$, but in the last line it refers to $m$, which is not consistent.
And actually, I think we might simply call them f_0, f_1, f_2, y_0, y_1, y_2, which I think is less confusing. (Wasntme)

I changed it again: http://pastebin.com/gZKfqyYG
Is it right? (Thinking)
 
  • #12
evinda said:
I changed it again: http://pastebin.com/gZKfqyYG
Is it right? (Thinking)

Hmm, you have:
Code:
         for i=0 to N/3-1
             y(i)=y(i)_0+y(i)_1+y(i)_2
         return y
For instance y(i)_0 looks a bit weird. It seems to me that it should be y_0(i). (Thinking)

Then again, how about making it:
Code:
         y = y_0 + y_1 + y_2
         return y
Or just:
Code:
         return y_0 + y_1 + y_2
(Wondering)
 
  • #13
I like Serena said:
Hmm, you have:
Code:
         for i=0 to N/3-1
             y(i)=y(i)_0+y(i)_1+y(i)_2
         return y
For instance y(i)_0 looks a bit weird. It seems to me that it should be y_0(i). (Thinking)

Then again, how about making it:
Code:
         y = y_0 + y_1 + y_2
         return y
Or just:
Code:
         return y_0 + y_1 + y_2
(Wondering)

So should it look like that http://pastebin.com/gZKfqyYG ? (Thinking)
 
Last edited:
  • #14
evinda said:
So should it looks like that http://pastebin.com/gZKfqyYG ? (Thinking)

That seems fine to me. (Happy)
 

Related to Fast Fourier Transform for Power of 3

What is the Fast Fourier Transform (FFT) for Power of 3?

The Fast Fourier Transform for Power of 3 is a specialized version of the FFT algorithm used for efficiently computing the Discrete Fourier Transform (DFT) for sequences of length that are powers of 3. It is a faster and more efficient way of calculating the DFT compared to the traditional DFT algorithm.

How does the FFT for Power of 3 differ from the traditional FFT algorithm?

The FFT for Power of 3 is specifically designed for sequences of length that are powers of 3, while the traditional FFT algorithm can be used for sequences of any length. Additionally, the FFT for Power of 3 uses a different set of complex roots of unity compared to the traditional FFT, resulting in a more efficient computation for these specific sequence lengths.

What are the applications of the FFT for Power of 3?

The FFT for Power of 3 is commonly used in signal processing, digital filtering, and spectral analysis. It is also used in other fields such as image processing, audio processing, and data compression. It is particularly useful when dealing with sequences of length that are powers of 3, as it can significantly reduce the computation time compared to the traditional FFT algorithm.

What are the advantages of using the FFT for Power of 3?

The main advantage of using the FFT for Power of 3 is its efficiency in computing the DFT for sequences of length that are powers of 3. It can also be easily implemented and is more stable than the traditional FFT algorithm. Additionally, its specialized design allows for better parallelization, making it suitable for use in high-performance computing systems.

Are there any limitations or drawbacks to using the FFT for Power of 3?

While the FFT for Power of 3 is highly efficient for sequences of length that are powers of 3, it is not suitable for sequences of other lengths. This means that it cannot be used as a general-purpose FFT algorithm and may not be applicable to all types of data or signals. Additionally, its specialized design may be more complex to understand and implement compared to the traditional FFT algorithm.

Similar threads

  • Programming and Computer Science
Replies
2
Views
2K
Replies
26
Views
5K
  • Differential Equations
Replies
4
Views
2K
Replies
4
Views
382
  • Calculus and Beyond Homework Help
Replies
1
Views
582
  • Advanced Physics Homework Help
Replies
1
Views
867
  • Calculus and Beyond Homework Help
Replies
3
Views
478
  • Calculus and Beyond Homework Help
Replies
20
Views
1K
  • Topology and Analysis
Replies
4
Views
360
  • Quantum Physics
Replies
4
Views
858
Back
Top