Giter Site home page Giter Site logo

2D FFT about fft.js HOT 2 OPEN

Bobingstern avatar Bobingstern commented on July 28, 2024
2D FFT

from fft.js.

Comments (2)

axkibe avatar axkibe commented on July 28, 2024

Certainly not the most efficient way, but you do know that 2D FFT is just a FFT over all the rows and of this intermediate result all the cols? (or the other way around, doesn't matter)?

So in that case make an Array of Arrays, perform a 1D FFT and then rearrange the contents so the array goes over cols/rows and perform the FFT another time.

If you want a more performant solution I suggest altering the library with variants with an offset and a step paramter to the core functions. Which this you can have a data array of the size rows*cols. Then call it row times with increasing i*rowlength offset, then call it another time of col times with i offset and i*rowlength as step parameter into the data. As far I remember this is how KISS did it. (It didn't need an offset parameter tough, due to C pointer arithmetic).

PS: Which brings me to, @maintainer, have you tried to use typed arrays? like Float64Array? IMO this could possible improve perfmance, @Bobingstern I think this would a way to get good perfomance without changing the library, instead of having it constructing the ComplexArrays itself, just hand it TypedArrays of Float64Array, I think it shouldn't notice, and with these basing on a Buffer you can modify offset and spread aka stepwith.. I doubt you get better performance than that.

from fft.js.

axkibe avatar axkibe commented on July 28, 2024

FYI: I experimented a little with typed arrays. fft.js gets ~25% slower simply from using them as dropin replacement for plain Arrays. (node v18.14.0). I don't understand why, has to do with some nifty js optimizations I guess.

from fft.js.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.