https://github.com/yoshoku/numo-pocketfft
Numo::Pocketfft provides functions for descrete Fourier Transform based on pocketfft
https://github.com/yoshoku/numo-pocketfft
fft numo ruby
Last synced: about 2 months ago
JSON representation
Numo::Pocketfft provides functions for descrete Fourier Transform based on pocketfft
- Host: GitHub
- URL: https://github.com/yoshoku/numo-pocketfft
- Owner: yoshoku
- License: bsd-3-clause
- Created: 2019-08-09T16:43:36.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T12:04:16.000Z (9 months ago)
- Last Synced: 2025-04-03T19:51:12.522Z (6 months ago)
- Topics: fft, numo, ruby
- Language: C
- Homepage: https://rubygems.org/gems/numo-pocketfft
- Size: 127 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Numo::Pocketfft
[](https://github.com/yoshoku/numo-pocketfft/actions?query=workflow%3Abuild)
[](https://badge.fury.io/rb/numo-pocketfft)
[](https://github.com/yoshoku/numo-pocketfft/blob/main/LICENSE.txt)
[](https://yoshoku.github.io/numo-pocketfft/doc/)Numo::Pocketfft provides functions for performing descrete Fourier Transform with
[Numo::NArray](https://github.com/ruby-numo/numo-narray) by using
[pocketfft](https://gitlab.mpcdf.mpg.de/mtr/pocketfft) as backgroud library.Note: There are other useful Ruby gems perform descrete Fourier Transform with Numo::NArray:
[Numo::FFTW](https://github.com/ruby-numo/numo-fftw) and [Numo::FFTE](https://github.com/ruby-numo/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:```ruby
gem 'numo-pocketfft'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install numo-pocketfft
## Usage
```ruby
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](https://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause).