feat: add fft/base/fftpack/ndarray/rffti#13527
Conversation
---
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
---
|
Opening a draft PR to discuss the implementation here, since this seems to be a bit different from existing ndarray wrappers. |
| function rffti( arrays ) { | ||
| var workspace; | ||
| var N; | ||
|
|
||
| N = ndarraylike2scalar( arrays[ 0 ] ); | ||
| workspace = arrays[ 1 ]; | ||
| strided( N, getData( workspace ), getStride( workspace, 0 ), getOffset( workspace ) ); // eslint-disable-line max-len | ||
| return workspace; | ||
| } |
There was a problem hiding this comment.
We can't directly send numelDimension( workspace, 0 ) here, as the length of the sequence to transform (N) is different from the size of the workspace array (2*N + 34).
|
@kgryte Let me know if the above looks good, or if I should make any changes here. I'll work on adding other files meanwhile. |
---
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
---
---
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: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
---
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: na
- 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: na
- task: lint_license_headers
status: passed
---
| * var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); | ||
| * // returns <ndarray>[ 8, 2, 2, 4 ] | ||
| */ | ||
| declare function rffti( arrays: [ ndarray, float64ndarray ] ): float64ndarray; |
There was a problem hiding this comment.
I have used ndarray here (for N) instead of something like int32ndarray, since I didn't saw a similar use anywhere.
| expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); | ||
| expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); |
There was a problem hiding this comment.
Instead of using the full expected workspace array (which would be of length 2N+34), I have just initialized the twiddle and integer factors.
| expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); | ||
| expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); |
There was a problem hiding this comment.
Since I am using these same 2 arrays in most of the tests, would it be better to move these to a separate // VARIABLES // section at the top? Or do we prefer this current way?
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves stdlib-js/metr-issue-tracker#1070.
Description
This pull request:
fft/base/fftpack/ndarray/rffti, which will be the one-dimensional ndarry wrapper forfft/base/fftpack/rffti.Related Issues
This pull request has the following related issues:
fft/base/fftpack/ndarray/rfftimetr-issue-tracker#1070Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
Used
Gemini 3.5 Flashto search and understand working of ndarray wrappers.@stdlib-js/reviewers