Skip to content

feat: add fft/base/fftpack/rffti#11467

Open
gunjjoshi wants to merge 2 commits intostdlib-js:developfrom
gunjjoshi:rffti-v2
Open

feat: add fft/base/fftpack/rffti#11467
gunjjoshi wants to merge 2 commits intostdlib-js:developfrom
gunjjoshi:rffti-v2

Conversation

@gunjjoshi
Copy link
Copy Markdown
Member

@gunjjoshi gunjjoshi commented Apr 15, 2026

Resolves None.

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:

None.

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

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 AI to understand how we generate C fixtures using FFTPACK.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 15, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Apr 15, 2026

Coverage Report

Package Statements Branches Functions Lines
fft/base/fftpack/rffti $\color{green}404/404$
$\color{green}+100.00%$
$\color{green}12/12$
$\color{green}+100.00%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{green}404/404$
$\color{green}+100.00%$

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

Comment on lines +76 to +83
if ( y === expected[ off+i ] ) {
t.strictEqual( y, expected[ off+i ], 'returns expected value' );
} else {
delta = abs( y - expected[ off+i ] );
tol = EPS * abs( expected[ off+i ] );
t.ok( delta <= tol, 'within tolerance. N: '+N+'. workspace['+(N+i+1)+']. Value: '+y+'. Expected: '+expected[off+i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
}
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.

I suggest going ahead and migrating to use @stdlib/assert/is-almost-same-value in order to measure differences in units of ULPs, rather than, here, where we compute an epsilon difference.

Comment on lines +117 to +139
var workspace;
var N;
var nf;
var i;
var j;

N = 8;
workspace = new Float64Array( ( 2*N ) + 34 );

rffti( N, workspace, 1, 0 );

console.log( 'Sequence length: %d', N );
console.log( 'Twiddle factors:' );
for ( i = N; i < 2*N; i++ ) {
console.log( ' workspace[%d] = %d', i, workspace[ i ] );
}

console.log( 'Factorization:' );
nf = workspace[ ( 2*N ) + 1 ];
console.log( ' number of factors: %d', nf );
for ( j = 0; j < nf; j++ ) {
console.log( ' factor[%d]: %d', j, workspace[ ( 2*N ) + 2 + j ] );
}
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.

Suggested change
var workspace;
var N;
var nf;
var i;
var j;
N = 8;
workspace = new Float64Array( ( 2*N ) + 34 );
rffti( N, workspace, 1, 0 );
console.log( 'Sequence length: %d', N );
console.log( 'Twiddle factors:' );
for ( i = N; i < 2*N; i++ ) {
console.log( ' workspace[%d] = %d', i, workspace[ i ] );
}
console.log( 'Factorization:' );
nf = workspace[ ( 2*N ) + 1 ];
console.log( ' number of factors: %d', nf );
for ( j = 0; j < nf; j++ ) {
console.log( ' factor[%d]: %d', j, workspace[ ( 2*N ) + 2 + j ] );
}
var N = 8;
var workspace = new Float64Array( ( 2*N ) + 34 );
rffti( N, workspace, 1, 0 );
console.log( 'Sequence length: %d', N );
console.log( 'Twiddle factors:' );
var i;
for ( i = N; i < 2*N; i++ ) {
console.log( ' workspace[%d] = %d', i, workspace[ i ] );
}
console.log( 'Factorization:' );
var nf = workspace[ ( 2*N ) + 1 ];
console.log( ' number of factors: %d', nf );
for ( i = 0; i < nf; i++ ) {
console.log( ' factor[%d]: %d', i, workspace[ ( 2*N ) + 2 + i ] );
}

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.

This may also apply to your example file.

Comment on lines +6 to +8
The workspace array is divided into three sections: scratch/workspace
(indices 0 to N-1), twiddle factors (indices N to 2N-1), and radix factor
table (indices 2N onwards).
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.

Suggested change
The workspace array is divided into three sections: scratch/workspace
(indices 0 to N-1), twiddle factors (indices N to 2N-1), and radix factor
table (indices 2N onwards).
The workspace array is divided into three sections:
1. scratch/workspace: the section range from indices 0 to N-1 and is used while performing transforms. This section is not updated during initialization.
2. twiddle factors (indices N to 2N-1)
3. radix factor table (indices 2N onwards).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants