{"id":29651496,"url":"https://github.com/alexbuccheri/ffts","last_synced_at":"2026-02-06T03:32:13.712Z","repository":{"id":299509419,"uuid":"1000860763","full_name":"AlexBuccheri/ffts","owner":"AlexBuccheri","description":"Example calls to FFTW3 with fortran","archived":false,"fork":false,"pushed_at":"2025-06-16T22:29:04.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-22T05:50:13.333Z","etag":null,"topics":["fft","fftw3","fortran"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexBuccheri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-12T12:38:14.000Z","updated_at":"2025-06-16T22:29:07.000Z","dependencies_parsed_at":"2025-06-16T23:39:00.373Z","dependency_job_id":null,"html_url":"https://github.com/AlexBuccheri/ffts","commit_stats":null,"previous_names":["alexbuccheri/ffts"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlexBuccheri/ffts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBuccheri%2Fffts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBuccheri%2Fffts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBuccheri%2Fffts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBuccheri%2Fffts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexBuccheri","download_url":"https://codeload.github.com/AlexBuccheri/ffts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexBuccheri%2Fffts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29148156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T02:39:25.012Z","status":"ssl_error","status_checked_at":"2026-02-06T02:37:22.784Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["fft","fftw3","fortran"],"created_at":"2025-07-22T05:35:46.409Z","updated_at":"2026-02-06T03:32:13.695Z","avatar_url":"https://github.com/AlexBuccheri.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FFTs and Poisson Prototyping\n\n**Disclaimer:** This repository currently makes no effort to support any environment other than\nthe my local machine.\n\nBuilding the fortran code:\n\n```shell\nexport CMAKE_PREFIX_PATH=\"/opt/homebrew/Cellar/fftw/3.3.10_2/:${CMAKE_PREFIX_PATH}\"\n$ cmake -B ./build -G Ninja --fresh\n$ cmake --build ./build\n```\n\n\u003c!-- TODO: Configure such that the test binaries are run by ctest\n$ ctest --test-dir ./build --\u003e\n\n## Part 1. Fast Fourier Transforms Theory and Code Examples\n\nExamples of 1D, 2D and 3D FFTs using scipy in python, and FFTW3 called from fortran, respectively.\n\n### Normalisation and Amplitudes with Scipy\n\nScipy defines their forward transform as:\n$$\nY[k] = \\sum_{n=0}^{N-1} x[n]\\;e^{-2\\pi i\\,k n/N}.\n$$  \nGiven a sin wave at $k_0$:\n$$\nx[n] = A\\,\\sin\\!\\Bigl(\\frac{2\\pi\\,k_0\\,n}{N}\\Bigr),\n$$\nwhich can equivalently be expressed in terms of exponentials: \n$$\nx[n] = \\frac{A}{2i}\\Bigl(e^{2\\pi i\\,k_0 n/N} - e^{-2\\pi i\\,k_0 n/N}\\Bigr).\n$$\n\nSubstituting this into the definition of the forward transform gives:\n\n\\[\n\\begin{aligned}\n  Y[k]\n  \u0026= \\sum_{n=0}^{N-1}\n     \\frac{A}{2i}\\bigl(e^{2\\pi i\\,k_0 n/N}-e^{-2\\pi i\\,k_0 n/N}\\bigr)\\,\n     e^{-2\\pi i\\,k n/N},\\\\\n  \u0026= \\frac{A}{2i}\\Bigl[\n      \\sum_{n=0}^{N-1} e^{-2\\pi i\\,n\\,(k - k_0)/N}\n     -\\sum_{n=0}^{N-1} e^{-2\\pi i\\,n\\,(k + k_0)/N}\n    \\Bigr].\n\\end{aligned}\n\\]\n\nUsing the geometric‐series identity:\n   $$\n     \\sum_{n=0}^{N-1} e^{-2\\pi i\\,n\\,m/N}\n     =\n     \\begin{cases}\n       N, \u0026 m \\equiv 0 \\pmod N,\\\\\n       0, \u0026 \\text{otherwise}\n     \\end{cases}\n   $$\none can rewrite the forward transform in terms of delta functions (note $k_0 \\equiv N-k_0$):\n\n   $$\n     Y[k]\n     = \\frac{A}{2i}\\bigl(N\\,\\delta_{k,k_0} - N\\,\\delta_{k,N-k_0}\\bigr)\n     = \\frac{N A}{2i}\\,\\bigl(\\delta_{k,k_0} - \\delta_{k,N-k_0}\\bigr).\n   $$\n\nThe magnitudes at $k_0$ and $-k_0$ are therefore: \n\n- At $k = k_0$:\n  $$\n    Y[k_0] = \\frac{NA}{2i}\n    \\quad\\Longrightarrow\\quad\n    \\bigl|Y[k_0]\\bigr| = \\frac{NA}{2},\n  $$\n\n- At $k = N - k_0$:\n  $$\n    Y[N-k_0] = -\\frac{NA}{2i}\n    \\quad\\Longrightarrow\\quad\n    \\bigl|Y[N-k_0]\\bigr| = \\frac{NA}{2},\n  $$\n\nhence the need to multiply by $2/N$ to correctly normalise with $A$. \n\n### 1D Real Example\n\nPython:\n\n```shell\npython python/real1d.py\n```\n\nFortran:\n\n```shell\n./build/real1d\n```\n\n### 2D Example\n\n### 3D Real Example\n\n### 1D Complex Example\n\n### 3D Complex Example\n\n### Batched 3D Complex Example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexbuccheri%2Fffts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexbuccheri%2Fffts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexbuccheri%2Fffts/lists"}