{"id":38146142,"url":"https://github.com/kuanchihwang/fftw3_wrapper","last_synced_at":"2026-01-16T22:56:10.478Z","repository":{"id":155913532,"uuid":"591355221","full_name":"kuanchihwang/fftw3_wrapper","owner":"kuanchihwang","description":"fftw3_wrapper is a Fortran wrapper library around FFTW (https://www.fftw.org).","archived":false,"fork":false,"pushed_at":"2024-04-22T07:17:40.000Z","size":42,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-22T08:33:16.563Z","etag":null,"topics":["fast-fourier-transform","fft","fftw","fortran","fourier-transform"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuanchihwang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-01-20T14:58:03.000Z","updated_at":"2024-03-21T20:20:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"f9eca907-2d28-47bc-8d45-a1410b493c16","html_url":"https://github.com/kuanchihwang/fftw3_wrapper","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"1886e06c68a49597c964cb25a1352866936a8807"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kuanchihwang/fftw3_wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanchihwang%2Ffftw3_wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanchihwang%2Ffftw3_wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanchihwang%2Ffftw3_wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanchihwang%2Ffftw3_wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuanchihwang","download_url":"https://codeload.github.com/kuanchihwang/fftw3_wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanchihwang%2Ffftw3_wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28486939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fast-fourier-transform","fft","fftw","fortran","fourier-transform"],"created_at":"2026-01-16T22:56:10.251Z","updated_at":"2026-01-16T22:56:10.464Z","avatar_url":"https://github.com/kuanchihwang.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fftw3_wrapper\n\n- [fftw3_wrapper](#fftw3_wrapper)\n  - [Author](#author)\n  - [Generic Interfaces](#generic-interfaces)\n  - [Specific Interfaces](#specific-interfaces)\n  - [Compilation](#compilation)\n  - [Testing](#testing)\n  - [Usage](#usage)\n  - [To Do](#to-do)\n\n`fftw3_wrapper` is a Fortran wrapper library around [FFTW](https://www.fftw.org), whose official introduction states that:\n\n\u003e FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST).\n\n`fftw3_wrapper` provides easy-to-use Fortran interfaces that take the burdens of cross-language interoperability, memory management, and implementation details of FFTW away from ordinary users. `fftw3_wrapper` tries to mimic the syntax of [`fft()`](https://www.mathworks.com/help/matlab/ref/fft.html), [`ifft()`](https://www.mathworks.com/help/matlab/ref/ifft.html)... from Matlab and [`numpy.fft.fft()`](https://numpy.org/doc/stable/reference/generated/numpy.fft.fft.html), [`numpy.fft.ifft()`](https://numpy.org/doc/stable/reference/generated/numpy.fft.ifft.html)... from Python NumPy. Users familiar with those programming languages should already know how to use this library.\n\n## Author\n\nKuan-Chih \"Stargazer\" Wang\n\n## Generic Interfaces\n\n* `subroutine fft(out, inp, num)`\n\n    Compute the one-, two-, three-, or four-dimensional forward discrete Fourier transform (DFT) of input array `inp` into output array `out` by using a fast Fourier transform (FFT) algorithm.\n\n    * `out`: Array; type and kind of **complex(real32)** or **complex(real64)**; rank of **1**, **2**, **3**, or **4**; **allocatable**\n\n        Output array containing the Fourier coefficients. It has the same kind and rank as the input array `inp`. Its shape is determined by the transform length `num`.\n\n    * `inp`: Array; type and kind of **complex(real32)**, **complex(real64)**, **real(real32)**, or **real(real64)**; rank of **1**, **2**, **3**, or **4**\n\n        Input array containing the original data.\n\n    * `num`: Array; type and kind of **integer**; rank of **1**; **optional**\n\n        Transform length along each dimension of the input array `inp`. If `num` is absent, it is equivalent to specifying `shape(inp)`. If a particular dimension length in `num` is smaller than that in `inp`, the `inp` is truncated. If a particular dimension length in `num` is larger than that in `inp`, the `inp` is padded with trailing zeros.\n\n* `subroutine cfft(out, inp, num)`\n\n    Same as `subroutine fft(out, inp, num)`. However, only complex-valued input array `inp` is accepted.\n\n* `subroutine rfft(out, inp, num)`\n\n    Same as `subroutine fft(out, inp, num)`. However, only real-valued input array `inp` is accepted.\n\n* `subroutine fftshift(out, inp)`\n\n    Shift the zero-frequency component to the center of spectrum.\n\n    * `out`: Array; type and kind of **complex(real32)** or **complex(real64)**; rank of **1**, **2**, **3**, or **4**; **allocatable**\n\n        Output array.\n\n    * `inp`: Array; type and kind of **complex(real32)** or **complex(real64)**; rank of **1**, **2**, **3**, or **4**\n\n        Input array.\n\n* `subroutine ifft(out, inp, num)`\n\n    Compute the one-, two-, three-, or four-dimensional inverse discrete Fourier transform (DFT) of input array `inp` into output array `out` by using a fast Fourier transform (FFT) algorithm.\n\n    * `out`: Array; type and kind of **complex(real32)**, **complex(real64)**, **real(real32)**, or **real(real64)**; rank of **1**, **2**, **3**, or **4**; **allocatable**\n\n        Output array containing the original data. It has the same kind and rank as the input array `inp`. Its shape is determined by the transform length `num`.\n\n    * `inp`: Array; type and kind of **complex(real32)** or **complex(real64)**; rank of **1**, **2**, **3**, or **4**\n\n        Input array containing the Fourier coefficients.\n\n    * `num`: Array; type and kind of **integer**; rank of **1**; **optional**\n\n        Transform length along each dimension of the input array `inp`. If `num` is absent, it is equivalent to specifying `shape(inp)`. If a particular dimension length in `num` is smaller than that in `inp`, the `inp` is truncated. If a particular dimension length in `num` is larger than that in `inp`, the `inp` is padded with trailing zeros.\n\n* `subroutine icfft(out, inp, num)`\n\n    Same as `subroutine ifft(out, inp, num)`. However, only complex-valued output array `out` is accepted.\n\n* `subroutine irfft(out, inp, num)`\n\n    Same as `subroutine ifft(out, inp, num)`. However, only real-valued output array `out` is accepted.\n\n* `subroutine ifftshift(out, inp)`\n\n    Inverse the actions carried out by `subroutine fftshift(out, inp)`.\n\n    * `out`: Array; type and kind of **complex(real32)** or **complex(real64)**; rank of **1**, **2**, **3**, or **4**; **allocatable**\n\n        Output array.\n\n    * `inp`: Array; type and kind of **complex(real32)** or **complex(real64)**; rank of **1**, **2**, **3**, or **4**\n\n        Input array.\n\n## Specific Interfaces\n\nOrdinary users should just call generic interfaces instead of these. Anyway, specific interfaces are named according to the following patterns:\n\n`{d,s}{,i}{c,r}fft{1,2,3,4}`\n\nwhere\n\n* `d` indicates that the arguments are double precision. `s` indicates that the arguments are single precision.\n* If `i` is absent, then it is forward FFT. If `i` is present, then it is inverse FFT.\n* `c` indicates complex-input forward FFT or complex-output inverse FFT, depending on the presence of `i`. `r` indicates real-input forward FFT or real-output inverse FFT, depending on the presence of `i`.\n* `1`, `2`, `3`, and `4` indicate the dimensionality of FFT.\n\nFor example, `drfft2` is a subroutine for computing double precision, real-input, and two-dimensional forward FFT. Its inverse would be `dirfft2`.\n\n## Compilation\n\n* Dependencies: FFTW (`libfftw3`: Double precision version; `libfftw3f`: Single precision version)\n* Requirements: `gcc`, `gfortran`, `make`\n\n1. Compile and install FFTW.\n\n    ```bash\n    # Single precision version of FFTW\n    ./configure --prefix=/opt/fftw \\\n    --enable-shared --enable-static \\\n    --enable-openmp --enable-threads \\\n    --enable-avx2 --enable-single\n    make\n    make install\n\n    # Double precision version of FFTW\n    ./configure --prefix=/opt/fftw \\\n    --enable-shared --enable-static \\\n    --enable-openmp --enable-threads \\\n    --enable-avx2\n    make\n    make install\n    ```\n\n2. Type `make`. By default, `Makefile` expects that FFTW is installed at `/opt/fftw`.\n\n    * Supply `FFTWPATH=\u003cPATH\u003e` to override the path to FFTW.\n    * Supply `DEBUG=1` to compile with debugging options.\n\n    For example, suppose that you have installed FFTW under your own home directory at `$HOME/fftw`. You would invoke `make` like:\n\n    ```bash\n    make FFTWPATH=\"$HOME/fftw\"\n    ```\n\n3. Both shared (`libfftw3_wrapper.so`) and static (`libfftw3_wrapper.a`) libraries are generated along with Fortran module files (`fftw3.mod` and `fftw3_wrapper.mod`).\n\n## Testing\n\n* Additional Requirements: Python, NumPy\n\nType `make check` to run the self-tests, which check the implementation correctness of `fftw3_wrapper` against Python NumPy under different transform types, dimensions, and lengths. All results must show \"PASS\".\n\n## Usage\n\nTo use `fftw3_wrapper` in a Fortran program unit, include the following `use` statement near the beginning:\n\n```fortran\nuse :: fftw3_wrapper\n```\n\nWhen compiling, remember to specify the include paths (e.g. `-I`...) and link against (e.g. `-L`, `-l`...) the `libfftw3_wrapper`, `libfftw3`, and `libfftw3f` libraries.\n\n## To Do\n\n* Support CMake\n* Support FFTW wisdom\n* Support multi-threaded FFTW\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuanchihwang%2Ffftw3_wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuanchihwang%2Ffftw3_wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuanchihwang%2Ffftw3_wrapper/lists"}