{"id":21054654,"url":"https://github.com/bemasher/genfft","last_synced_at":"2026-03-14T06:05:52.373Z","repository":{"id":23174535,"uuid":"26530529","full_name":"bemasher/genfft","owner":"bemasher","description":"A code parser/generator to generate Go from annotated lists created with the FFTW tool genfft.","archived":false,"fork":false,"pushed_at":"2021-04-26T06:06:36.000Z","size":12,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2025-04-03T16:12:57.215Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/bemasher.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}},"created_at":"2014-11-12T10:19:37.000Z","updated_at":"2023-02-23T03:23:10.000Z","dependencies_parsed_at":"2022-07-25T09:47:06.579Z","dependency_job_id":null,"html_url":"https://github.com/bemasher/genfft","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemasher%2Fgenfft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemasher%2Fgenfft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemasher%2Fgenfft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemasher%2Fgenfft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bemasher","download_url":"https://codeload.github.com/bemasher/genfft/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254433553,"owners_count":22070492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-19T16:15:54.890Z","updated_at":"2026-03-14T06:05:52.327Z","avatar_url":"https://github.com/bemasher.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# genfft\r\n\r\nA tool to generate short, hard-coded DFT's in Go from annotated lists created with the FFTW tool genfft.\r\n\r\n[![AGPL License](http://img.shields.io/badge/license-AGPL-blue.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.html)\r\n\r\n## Install\r\n\r\nDownload and install the tool:\r\n\r\n    go get github.com/bemasher/genfft\r\n\r\nBuild the FFTW genfft tool found in the FFTW source:\r\n\r\n    cd fftw3/genfft\r\n    ocamlbuild -classic-display -libs unix,nums gen_notw.native gen_notw_c.native\r\n\r\n## Usage\r\n\r\nTwo flavors of DFT's are supported. Both compute short fixed-length complex-to-complex no-twiddle DFT's. One takes real and imaginary input as separate arrays, one set each for input and output. The other takes complex arrays for input and output. The transform signature is determined from the annotated list generated by each tool.\r\n\r\n```go\r\nfunc DFT(ri, ii, ro, io []float64) // gen_notw.native\r\n```\r\n\r\n```go\r\nfunc DFT(xi, xo []complex128)      // gen_notw_c.native\r\n```\r\n\r\nGenerate an annotated transform:\r\n\r\n```\r\nN=3; gen_notw_c.native -n ${N} -with-istride 1 -with-ostride 1 -standalone -dump-asched cmplx_${N}.alst cmplx_${N}.cout\r\n```\r\n\r\nThis will generate and write the transform's operations and constants to the file `cmplx_3.alst`:\r\n\r\n```\r\n(:= T1 xi[0])\r\n(:= T2 xi[1])\r\n(:= T3 xi[2])\r\n(:= T4 (+ T2 T3))\r\n(:= T6 (* I (* KP866025403 (+ T3 (- T2)))))\r\n(:= xo[0] (+ T1 T4))\r\n(:= T5 (+ T1 (- (* KP500000000 T4))))\r\n(:= xo[2] (+ T5 (- T6)))\r\n(:= xo[1] (+ T5 T6))\r\n```\r\n\r\nConstants required for the transform are found in `cmplx_3.cout`, which is parsed only for lines prefixed by DK and DVK.\r\n\r\n```\r\nDVK(KP500000000, +0.500000000000000000000000000000000000000000000);\r\nDVK(KP866025403, +0.866025403784438646763723170752936183471402627);\r\n```\r\n\r\nThe tool reads information about DFT's to transform from `config.json`. To transform the size 3 complex DFT, `config.json` should contain:\r\n\r\n```json\r\n[{ \"prefix\": \"cmplx_3\", \"func\": \"DftCmplx3\" }]\r\n```\r\n\r\nExecuting `genfft` with this config produces the output file `cmplx_3.go` containing a function named `DftCmplx3`:\r\n\r\n```go\r\npackage dft\r\n\r\nfunc DftCmplx3(xi, xo []complex128) {\r\n\tconst (\r\n\t\tI           = 1i\r\n\t\tKP500000000 = +0.500000000000000000000000000000000000000000000\r\n\t\tKP866025403 = +0.866025403784438646763723170752936183471402627\r\n\t)\r\n\r\n\tT1 := xi[0]\r\n\tT2 := xi[1]\r\n\tT3 := xi[2]\r\n\tT4 := T2 + T3\r\n\tT6 := I * (KP866025403 * (T3 - T2))\r\n\txo[0] = T1 + T4\r\n\tT5 := T1 - KP500000000*T4\r\n\txo[2] = T5 - T6\r\n\txo[1] = T5 + T6\r\n}\r\n```\r\n\r\nTransforms safely perform in-place and out-of-place transforms depending on the function arguments.\r\n\r\nTests compare output of a naive DFT to output of the generated DFT's. DFT's pass when they are error is within a specified tolerance. See `dft/dft_test.go` for more details.\r\n\r\nA benchmark is also provided to compare performance of the various transforms.\r\n\r\n11th Gen Intel(R) Core(TM) i5-11600K @ 3.90GHz + 32GB DDR4:\r\n\r\n```\r\ngoos: windows\r\ngoarch: amd64\r\npkg: github.com/bemasher/genfft/dft\r\ncpu: 11th Gen Intel(R) Core(TM) i5-11600K @ 3.90GHz\r\nBenchmarkFloatDFT/Naive_DFT_N=12-12                       815853    1474    ns/op      8.14 MB/s    192 B/op     1 allocs/op\r\nBenchmarkFloatDFT/In_Place_Float_DFT_N=12-12            70460990      17.29 ns/op    694.13 MB/s      0 B/op     0 allocs/op\r\nBenchmarkFloatDFT/Out_of_Place_Float_DFT_N=12-12        70753047      17.00 ns/op    705.75 MB/s      0 B/op     0 allocs/op\r\nBenchmarkCmplxDFT/Naive_Cmplx_DFT_N=12-12                 800121    1470    ns/op      8.16 MB/s    192 B/op     1 allocs/op\r\nBenchmarkCmplxDFT/In_Place_Cmplx_DFT_N=12-12            59896080      19.69 ns/op    609.57 MB/s      0 B/op     0 allocs/op\r\nBenchmarkCmplxDFT/Out_of_Cmplx_Place_DFT_N=12-12        60725056      19.08 ns/op    628.92 MB/s      0 B/op     0 allocs/op\r\nPASS\r\nok      github.com/bemasher/genfft/dft  7.316s\r\n```\r\n\r\nRaspberry Pi 2 Model B Rev 1.1:\r\n\r\n```\r\ngoos: linux\r\ngoarch: arm\r\npkg: github.com/bemasher/genfft/dft\r\nBenchmarkFloatDFT/Naive_DFT_N=12-4         \t                   15980    74300   ns/op     0.16 MB/s    192 B/op    1 allocs/op\r\nBenchmarkFloatDFT/In_Place_Float_DFT_N=12-4                  1972201      606.0 ns/op    19.80 MB/s      0 B/op    0 allocs/op\r\nBenchmarkFloatDFT/Out_of_Place_Float_DFT_N=12-4              1959711      611.5 ns/op    19.62 MB/s      0 B/op    0 allocs/op\r\nBenchmarkCmplxDFT/Naive_Cmplx_DFT_N=12-4                       16048    74256   ns/op     0.16 MB/s    192 B/op    1 allocs/op\r\nBenchmarkCmplxDFT/In_Place_Cmplx_DFT_N=12-4                  1490419      803.4 ns/op    14.94 MB/s      0 B/op    0 allocs/op\r\nBenchmarkCmplxDFT/Out_of_Cmplx_Place_DFT_N=12-4              1476600      806.1 ns/op    14.89 MB/s      0 B/op    0 allocs/op\r\nPASS\r\nok      github.com/bemasher/genfft/dft\t11.639s\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbemasher%2Fgenfft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbemasher%2Fgenfft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbemasher%2Fgenfft/lists"}