Skip to content

This is a fork of numo-pocketfft solely for opening PRs against the upstream repo.

License

Notifications You must be signed in to change notification settings

mike-bourgeous/numo-pocketfft

 
 

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]]

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

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.

Code of Conduct

Everyone interacting in the Numo::Pocketfft project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

This is a fork of numo-pocketfft solely for opening PRs against the upstream repo.

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages

  • Ruby 83.2%
  • C 16.8%