MyNixOS website logo
Description

Fast Iterative Filtering (FIF) with Portable FFT Backend.

Provides an R interface to a C implementation of Fast Iterative Filtering (FIF) for decomposing a univariate signal into intrinsic mode functions (IMFs) and a residual. The package uses Fast Fourier Transform library FFTW, if found. If not, it provides instructions to install it for your OS. This is recommended, as R's internal fft(), while avoiding external FFT dependencies, is two orders of magnitude slower. See vignette 'Installing FFTW for RFIF' for RFIF installation instructions.

RFIF — Fast Iterative Filtering for R

RFIF provides an R interface to a C implementation of Fast Iterative Filtering (FIF) for decomposing a univariate signal into intrinsic mode functions (IMFs) plus a residual.

Installation

Install from a source tarball:

install.packages("RFIF_1.0.tar.gz", repos = NULL, type = "source")

Fast FFT backend (FFTW3)

RFIF performs many FFTs during decomposition. To guarantee portability, the package ships with a self-contained fallback FFT that works everywhere, but it can be much slower.

For best performance, RFIF can use FFTW3 when available.

Backend selection

During installation:

  • If FFTW3 is detected via pkg-config → RFIF enables the fast FFTW backend
  • Otherwise → RFIF uses the portable fallback FFT (still fully functional)

When FFTW3 is found, installation prints:

Found fftw3 via pkg-config (enabling fast FFT).

Installing FFTW3 (recommended)

macOS (MacPorts)

sudo port install pkgconfig
sudo port install fftw-3

Verify:

pkg-config --modversion fftw3

macOS (Homebrew)

brew install pkg-config fftw

Linux (Ubuntu / Debian)

sudo apt-get install libfftw3-dev pkg-config

Windows (Rtools + MSYS2)

  1. Install Rtools: https://cran.r-project.org/bin/windows/Rtools/

  2. Open the Rtools MSYS2 shell, then install FFTW and pkg-config:

pacman -S mingw-w64-x86_64-fftw
pacman -S mingw-w64-x86_64-pkg-config

Verify:

pkg-config --modversion fftw3

Then install RFIF from source in R as usual.

Basic usage

library(RFIF)

t <- seq(0, 1, length.out = 1000)
x <- sin(2*pi*5*t) + 0.5*sin(2*pi*20*t)

res <- rfif(x)

str(res)

Returned object:

  • imfs: numeric matrix (rows = IMFs, columns = time)
  • residual: numeric vector (same length as input)
  • nimf: integer number of IMFs

Reconstruction check

recon <- if (res$nimf > 0) colSums(res$imfs) + res$residual else res$residual
max(abs(x - recon))

Vignette

browseVignettes("RFIF")
Metadata

Version

1.0.2

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows