yoshoku / numo-pocketfft

Numo::Pocketfft provides functions for descrete Fourier Transform based on pocketfft

Home Page:https://rubygems.org/gems/numo-pocketfft

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numo::Pocketfft

Build Status Gem Version BSD 3-Clause License Documentation

Numo::Pocketfft provides functions for performing descrete Fourier Transform with Numo::NArray by using pocketfft as backgroud library.

Note: There are other useful Ruby gems perform descrete Fourier Transform with Numo::NArray: Numo::FFTW and Numo::FFTE by Masahiro Tanaka.

Installation

Numo::Pocketfft bundles pocketfft codes, so there is no need to install another external library in advance. Add this line to your application's Gemfile:

gem 'numo-pocketfft'

And then execute:

$ bundle

Or install it yourself as:

$ gem install numo-pocketfft

Usage

require 'numo/narray'
require 'numo/pocketfft'

a = Numo::DFloat[1, 1, 1, 1]
# => Numo::DFloat#shape=[4]
# [1, 1, 1, 1]

b = Numo::Pocketfft.rfft(a)
# => Numo::DComplex#shape=[3]
# [4+0i, 0+0i, 0+0i]

Numo::Pocketfft.irfft(b)
# => Numo::DFloat#shape=[4]
# [1, 1, 1, 1]

c = Numo::DFloat.new(2, 2).rand + Complex::I * Numo::DFloat.new(2, 2).rand
# => Numo::DComplex#shape=[2,2]
# [[0.0617545+0.116041i, 0.373067+0.344032i],
#  [0.794815+0.539948i, 0.201042+0.737815i]]

Numo::Pocketfft.ifft2(Numo::Pocketfft.fft2(c))
#=> Numo::DComplex#shape=[2,2]
#[[0.0617545+0.116041i, 0.373067+0.344032i],
# [0.794815+0.539948i, 0.201042+0.737815i]]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/numo-pocketfft. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the BSD-3-Clause License.

About

Numo::Pocketfft provides functions for descrete Fourier Transform based on pocketfft

https://rubygems.org/gems/numo-pocketfft

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C 69.1%Language:Ruby 30.8%Language:Shell 0.1%Language:JavaScript 0.1%