FFT for equations that have terms with different exponents

后端 未结 1 1553
误落风尘
误落风尘 2021-01-22 05:13

I am new to FFTs so I am slightly confused on some concepts. So far the FFT examples I\'ve seen for equation multiplication involve equations with consecutive exponents (i.e.

相关标签:
1条回答
  • 2021-01-22 05:41

    yes it is possible to use DFFT on non equal exponent polynomials...

    the missing exponents are just multiplied by 0 which is also a number... just rewrite your polynomials:

    A(x) = 1 + 3x^2 + 9x^8
    B(x) = 5x + 6x^3 + 10x^8
    

    to something like this:

    A(x) = 1x^0 + 0x^1 + 3x^2 + 0x^3 + 0x^4+ 0x^5+ 0x^6+ 0x^7 +  9x^8
    B(x) = 0x^0 + 5x^1 + 0x^2 + 6x^3 + 0x^4+ 0x^5+ 0x^6+ 0x^7 + 10x^8
    

    so your vectors for DFFT are:

    A = (1,0,3,0,0,0,0,0, 9)
    B = (0,5,0,6,0,0,0,0,10)
    

    add zero's so the vector is the correct result size (max A exponent +1 + max B exponent +1) and also round up to closest power of 2 for DFFT usage so original sizes are 9,9 -> 9+9 -> 18 -> round up -> 32

    A = (1,0,3,0,0,0,0,0, 9,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0)
    B = (0,5,0,6,0,0,0,0,10,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0)
    //  |    original      | correct result  |    nearest power of 2      |
    

    and do the DFFT stuff you want ... I assume you want to do something like this:

    A' = DFFT(A)
    B' = DFFT(B)
    C(i)' = A'(i) * B'(i)   // i=0..n-1
    C= IDFFT(C')
    

    which is O(n*log(n)). Do not forget that if you use DFFT (not DFT) n = 32 and not 18 !!! because n must be power of 2 for fast algorithm of DFT also if you want performance improvements than look at the DFFT weight matrices for DFFT(A),DFFT(B) they are the same so no need to compute them twice ...

    0 讨论(0)
提交回复
热议问题