Skip to content

feat: add fft/base/fftpack/costi - #13200

Merged
kgryte merged 10 commits into
stdlib-js:developfrom
gunjjoshi:costi
Jul 12, 2026
Merged

feat: add fft/base/fftpack/costi#13200
kgryte merged 10 commits into
stdlib-js:developfrom
gunjjoshi:costi

Conversation

@gunjjoshi

@gunjjoshi gunjjoshi commented Jun 29, 2026

Copy link
Copy Markdown
Member

Resolves stdlib-js/metr-issue-tracker#831.

Description

What is the purpose of this pull request?

This pull request:

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding
  • Code Review and debugging

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

Used gpt-5.1-codex-mini to review the package which was initially implemented manually, by copying over a similar package (fft/base/fftpack/cosqi) and modifying it.


@stdlib-js/reviewers

Gunj Joshi added 2 commits June 30, 2026 00:22
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: passed
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: passed
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: passed
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@gunjjoshi
gunjjoshi requested a review from a team June 29, 2026 18:58
@gunjjoshi gunjjoshi added Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. labels Jun 29, 2026
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 29, 2026
@gunjjoshi

Copy link
Copy Markdown
Member Author

The CI tests should pass once #13170 is merged. Marking this PR as a draft PR until then.

@gunjjoshi
gunjjoshi marked this pull request as draft June 29, 2026 19:05
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Jun 29, 2026
gunjjoshi and others added 3 commits July 6, 2026 18:39
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@kgryte
kgryte marked this pull request as ready for review July 7, 2026 01:06
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jul 7, 2026
@stdlib-bot

stdlib-bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
fft/base/fftpack/costi $\\color{green}266/266$
$\\color{green}+0.00\\%$
$\\color{green}7/7$
$\\color{green}+0.00\\%$
$\\color{green}1/1$
$\\color{green}+0.00\\%$
$\\color{green}266/266$
$\\color{green}+0.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jul 7, 2026
Comment thread lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js Outdated
* ↓ ↓ ↓ ↓
* | sine/cosine table | scratch/workspace | twiddle factors | radix factor table |
* ↑ ↑ ↑ ↑
* i = 0 ... N ... 2N-1 ... 3N-2 ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it me, or does this table layout feel off? I feel like the scratch/workspace should start at 2N not 2N-1 and the radix factor table at 3N, not 3N-2. Otherwise, you don't need 3N+34 elements; you only need 3N+32 elements. I get that we are passing N-1 to rffti, so that is where the alignment issues come from, but it is still a bit odd to my eye.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems off, but this is what FFTPACK also uses here: https://github.com/marton78/pffft/blob/master/src/fftpack.h#L375. They are still using 3n + 15, instead of 3n + 13. We could do 3N+32 too, but I kept it to be similar to FFTPACK. Let me know if we should change it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, fine to keep as is.

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left initial comments.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Jul 7, 2026
@gunjjoshi

Copy link
Copy Markdown
Member Author

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jul 12, 2026
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jul 12, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@gunjjoshi gunjjoshi added Needs Review A pull request which needs code review. and removed Needs Changes Pull request which needs changes before being merged. labels Jul 12, 2026
Comment thread lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js Outdated
Comment thread lib/node_modules/@stdlib/fft/base/fftpack/costi/test/fixtures/c/fftpack/runner.c Outdated
kgryte added 2 commits July 12, 2026 11:27
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jul 12, 2026
@kgryte
kgryte merged commit ce67b15 into stdlib-js:develop Jul 12, 2026
14 checks passed
@kgryte
kgryte deleted the costi branch July 12, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add fft/base/fftpack/costi

3 participants