npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-fftw

v1.0.0

Published

nodejs port for fftw

Downloads

10

Readme

node-fftw

This repo is for nodejs port and bindings with fftw, the fft library.

This repo DOES NOT contain fftw code, you need to install fftw first.

You can download fftw from http://www.fftw.org/download.html

You can install it following http://www.fftw.org/fftw3_doc/Installation-and-Customization.html

Functions:

  • discrete fourier transform(dft) using fftw

    • real-to-complex, arbitrary dimensions.
    • complex-to-complex, arbitrary dimensions.
  • inverse dft using fftw, using dft with sign=+1

  • chirp z transform, accept only 1d real number, using Bluestein's algorithm.

Examples

  • dft and idft : new fftw.dftPlan(isReal, size, sign, flags)
    • isReal: indicate real number or complex number. The result is always complex,
    • size : an array, the rank of the array indicate the dimension, the values indicate length of each dimension,
    • sign: -1 for dft, +1 for idft,
    • flags: the flags passed to fftw.
const fftw = require("./index.js");
const dftPlan = new fftw.dftPlan(true, [16], -1, fftw.flags.FFTW_DESTROY_INPUT);
for(var i = 0; i < 16; i++)
{
    dftPlan.in[i] = Math.sin(Math.PI / 4 * i) + Math.cos(Math.PI / 4 * i);
}

dftPlan.calcAsync(function(plan) {
    console.log("dft result", this.out, plan.out);
});
  • czt : new fftw.cztr1dPlan(inSize, outSize, sampleRate, fstart, fstop, flags)
    • inSize: the size of input buffer, 1d real
    • outSize: the size of output buffer, 1d complex
    • sampleRate: the sample rate
    • fstart: the frequency to start calculation,
    • fstop: the frequency to stop calculation,
    • flags: the flags passed to fftw.
      • we use w = expi(-2pi *(f2 - f1) / (outSize * sampleRate)),
      • and a = expi(2pi * f1 / sampleRate)
const fftw = require("./index.js");
const cztPlan = new fftw.cztr1dPlan(16, 8, 1, 1, 8, fftw.flags.FFTW_DESTROY_INPUT);
for(var i = 0; i < 16; i++)
{
    cztPlan.in[i] = Math.sin(Math.PI / 4 * i) + Math.cos(Math.PI / 4 * i);
}

cztPlan.calcAsync(function(plan){
    console.log("czt result", this.out, plan.out);
});

Supported flags

const fftw = require("./index.js");
const flags = fftw.flags;
  • FFTW_MEASURE
  • FFTW_DESTROY_INPUT
  • FFTW_UNALIGNED
  • FFTW_CONSERVE_MEMORY
  • FFTW_EXHAUSTIVE
  • FFTW_PRESERVE_INPUT
  • FFTW_PATIENT
  • FFTW_ESTIMATE
  • FFTW_WISDOM_ONLY

TODO

  • nodejs implementation for sid::complex compatible complex number
  • Testing and bug fix
  • fftw wisdom interface
  • discrete cos transform (DCT)
  • DST
  • DHT
  • fftw multi thread, openmp and MPI interface
  • other fftw functionalities