Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

DFT functions in AForge.Math.FourierTransform and Accord.Math.Transforms #257

@conaonda

Description

@conaonda

for simple complex array [ 3+1i 9+14i 11+7i 40+31i]..

Accord.Math.Transforms.FourierTransform2.DFT(Forward) changes the array to
[ 63+53i -25+25i -35-37i 9-37i ]

AForge.Math.FourierTransform.DFT(Forward) changes the array to
[ 0.75+0.25i 2.25+3.5i 2.75+1.75i 10+7.75i ]

In Matlab answers same value with Accord.Math.Transforms.FourierTransform2.DFT.

Their function bodies(Accord and AForge) are almost same but direction is reversed.

And backward return operation of AForge may be incorrect.

In Accord..

        for (int i = 0; i < c.Length; i++)
        {
            ...
            c[i] = new Complex(sumRe, sumIm);
        }

        if (direction == FourierTransform.Direction.Backward)
        {
            for (int i = 0; i < c.Length; i++)
                data[i] = c[i] / n;
        }
        else
        {
            ...
        }

but AForge..

        for (int i = 0; i < dst.Length; i++)
        {
            for (int j = 0; j < data.Length; j++)
            {
                ...
                dst[i] += new Complex(re, im);
            }
        }

        // copy elements
        if (direction == Direction.Forward) //<< reversed direction
        {
            // devide also for forward transform
            for (int i = 0; i < data.Length; i++)
                data[i] /= n; //<< not using "dst" array
        }
        else
        {
            ...
        }

I think it needs to be validate.

(why same functions are exist?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions