Skip to content

Question Regarding Twiddle Factor in Catch22 Function #39

@ceap29

Description

@ceap29

I reached out to Ben via email, and he suggested that I open an issue regarding the following.

My question is: shouldn’t the tmp section inside the twiddle function use the formula 0.0 - 2.0 * PI * i / size to calculate a twiddle factor, instead of 0.0 - PI * i / size?

Here’s the function I’m referring to:
https://github.com/DynamicsAndNeuralSystems/catch22/blob/main/C/fft.c

void twiddles(cplx a[], int size)
{
    double PI = 3.14159265359;

    for (int i = 0; i < size; i++) {
        // cplx tmp = { 0, -PI * i / size };
        #if defined(__GNUC__) || defined(__GNUG__)
   cplx tmp = 0.0  - PI * i / size * I;
        #elif defined(_MSC_VER)
   cplx tmp = {0.0, -PI * i / size };
        #endif
        a[i] = cexp(tmp);
        //a[i] = cexp(-I * M_PI * i / size);
    }
}

Thank you in advance for your clarification. I really appreciate it. Also, thanks for creating such an amazing package; it has been incredibly helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions