Skip to content

feat: add initial implementation of fft/base/fftpack #4121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 79 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
b6c3ed7
feat: implement passfb
gunjjoshi Dec 14, 2024
7479095
feat: add passb2
gunjjoshi Dec 16, 2024
2f134a6
feat: add passb2
gunjjoshi Dec 16, 2024
3b5b05d
feat: add passb3
gunjjoshi Dec 18, 2024
9606e3e
feat: add passb4 function
gunjjoshi Dec 21, 2024
825ca7f
docs: update index.js
gunjjoshi Dec 21, 2024
b3a1fff
Update main.c
gunjjoshi Dec 21, 2024
d793f7f
Update main.c
gunjjoshi Dec 21, 2024
82bc096
Update c2_ref.js
gunjjoshi Dec 21, 2024
d74a322
docs: update parameter descriptions, disable eslint max len at top level
gunjjoshi Dec 23, 2024
a2bb8d4
docs: update parameter descriptions, disable eslint max len at top level
gunjjoshi Dec 23, 2024
e9c30a7
feat: add passfb5.js
gunjjoshi Dec 24, 2024
3eac426
docs: add eslint comment
gunjjoshi Dec 24, 2024
80a4f21
feat: add passf2, passf3
gunjjoshi Dec 24, 2024
d978c43
Update main.c
gunjjoshi Dec 24, 2024
b6ced12
feat: add passf4
gunjjoshi Dec 24, 2024
29f463a
docs: remove spaces before parenthesis, update variable names
gunjjoshi Dec 24, 2024
0aa98e5
docs: remove unused import
gunjjoshi Dec 24, 2024
860bd12
feat: add radb2, radb3, radb4, radb5
gunjjoshi Dec 27, 2024
637309f
refactor: remove unnecessary else
gunjjoshi Dec 27, 2024
4b347f6
feat: add radbg.js
gunjjoshi Dec 29, 2024
c96d70d
feat: add radf2.js
gunjjoshi Jan 1, 2025
c59a7be
feat: radf3, minor clean-up
gunjjoshi Jan 1, 2025
ff38eb2
chore: update copyright years
stdlib-bot Jan 1, 2025
b5f2f50
docs: resolve lint errors
gunjjoshi Jan 1, 2025
3fbfd10
docs: resolve lint errors
gunjjoshi Jan 1, 2025
420ff1c
feat: add radf4, radf5
gunjjoshi Jan 2, 2025
8982c99
feat: add radfg.js
gunjjoshi Jan 8, 2025
d42825b
docs: replace ++x by x++
gunjjoshi Jan 8, 2025
0920570
refactor: use stdlib packages, early return
gunjjoshi Jan 9, 2025
44838d0
feat: add cfftb1, cfftb, update index.js
gunjjoshi Jan 13, 2025
3bfdc59
feat: add cfftf, cfftf1
gunjjoshi Jan 14, 2025
3b2c9de
feat: add cfftfi, cffti, decompose, update cfftf
gunjjoshi Jan 15, 2025
16f8a67
feat: add rfftb, rfftb1, rfftf1
gunjjoshi Jan 16, 2025
f20933d
feat: add rfftb, rfftb1, rfftf1
gunjjoshi Jan 16, 2025
ef1b5b2
feat: add rfftf, rfftfi, rffti1
gunjjoshi Jan 16, 2025
aa4008b
docs: disable eslint max-len
gunjjoshi Jan 16, 2025
59b47ae
feat: add cosqb, cosqb1, cosqf, cosqf1
gunjjoshi Jan 17, 2025
712e412
refactor: use offsets along with arrays in cosqf1 and cosqf
gunjjoshi Jan 21, 2025
535cf96
docs: add eslint comment
gunjjoshi Jan 21, 2025
2c6ee27
refactor: use array offsets in functions
gunjjoshi Jan 28, 2025
83f0f00
refactor: use offset variables for arrays
gunjjoshi Jan 30, 2025
c7badd6
refactor: use offset variables for arrays
gunjjoshi Feb 3, 2025
adeb99a
refactor: add offsets, use sincos
gunjjoshi Feb 6, 2025
b864168
feat: add cosqi, add eslint comments
gunjjoshi Feb 11, 2025
a7ac66f
feat: add cost, costi, sinqb, sinqf, sinqi, sint, sint1, sinti
gunjjoshi Feb 18, 2025
8189014
test: add initial test for rffti
gunjjoshi Mar 2, 2025
95853cb
test: add initial test for rffti
gunjjoshi Mar 5, 2025
02eabb0
test: add test.rfftf.js
gunjjoshi Mar 26, 2025
474def9
test: use correct implementation of tests, improve implementation
gunjjoshi Apr 15, 2025
b6cba55
test: update implementation according to tests
gunjjoshi May 2, 2025
de1040f
test: remove fixtures
gunjjoshi May 3, 2025
33e04a4
test: modify test implementation
gunjjoshi May 24, 2025
606323d
fix: correct positioning of parenthesis
gunjjoshi May 29, 2025
bc4f61b
fix: decrement wa offsets
gunjjoshi May 29, 2025
0e00d49
fix: correct use of i instead of ic
gunjjoshi May 29, 2025
9681c2b
fix: decrement waOffsets by 1, disable eslint rule, mention correct v…
gunjjoshi Jun 1, 2025
df9be71
Merge remote-tracking branch 'upstream/develop' into fftpack
stdlib-bot Jun 9, 2025
de91a9f
docs: update docs and formatting
kgryte Jun 10, 2025
c7aea44
chore: add docs and clean-up
kgryte Jun 10, 2025
22079b1
refactor: update variables and docs
kgryte Jun 10, 2025
5082d3c
refactor: add comments and update utility to support strides
kgryte Jun 10, 2025
72a102e
chore: fix offset bugs in implementation and refactor and fix normali…
kgryte Jun 11, 2025
5d5bb6a
refactor: initial stride support and additional comments
kgryte Jun 11, 2025
7e66211
docs: fix comments
kgryte Jun 11, 2025
410012e
refactor: to use zero-based indexing
kgryte Jun 11, 2025
b773d06
docs: add comment and TODOs
kgryte Jun 11, 2025
f982356
docs: fix typo
kgryte Jun 11, 2025
376ec9d
docs: add examples
kgryte Jun 12, 2025
e1e4446
docs: add comments
kgryte Jun 12, 2025
3cff9af
refactor: add support for strides
kgryte Jun 12, 2025
ca0887d
docs: fix comment
kgryte Jun 12, 2025
6aedb56
chore: refactor and add docs
kgryte Jun 14, 2025
e848427
docs: add comments
kgryte Jun 14, 2025
2dcaa44
docs: fix comment style
kgryte Jun 14, 2025
91cbfa3
refactor: move files into separate packages
kgryte Jun 22, 2025
58764b4
test: add tests for the decompose function
gunjjoshi Jun 29, 2025
073714c
docs: add examples for the decompose function
gunjjoshi Jun 29, 2025
5ed23e7
docs: add docs and benchmark
gunjjoshi Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: radf3, minor clean-up
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
  • Loading branch information
gunjjoshi committed Jan 1, 2025
commit c59a7be6065362e7794d7eff53837375217fcd60
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) {
if ( ido < 2 ) {
return;
}
if ( ido != 2 ) {
if ( ido !== 2 ) {
idp2 = ido + 2;
for ( k = 1; k <= l1; ++k ) {
for ( i = 3; i <= ido; i += 2 ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
* @param {Float64Array} wa - array of twiddle factors
* @returns {void}
*/
function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) {

Check failure on line 93 in lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Variable declarations inside of function are not ordered by length (in decreasing order)

Check warning on line 93 in lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Function 'radbg' has too many statements (150). Maximum allowed is 100
var chOffset;
var ccOffset;
var c1Offset;
Expand Down Expand Up @@ -126,7 +126,7 @@
// Parameter adjustments...
chOffset = 1 + ( ido * ( 1 + l1 ) );
c1Offset = 1 + ( ido * ( 1 + l1 ) );
ccOffset = 1 + ido * ( 1 + ip );
ccOffset = 1 + ( ido * ( 1 + ip ) );
ch2Offset = 1 + idl1;
c2Offset = 1 + idl1;

Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function radf2( ido, l1, cc, ch, wa1 ) {

// Parameter adjustments...
chOffset = 1 + ( ido * 3 );
ccOffset = 1 + ido * ( 1 + l1 );
ccOffset = 1 + ( ido * ( 1 + l1 ) );

// Function body:
for ( k = 1; k <= l1; ++k ) {
Expand Down
149 changes: 149 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* ## Notice
*
* The original C code and copyright notice are from the [PFFFT library]{@link https://github.com/marton78/pffft/blob/master/fftpack.c}. The implementation follows the original, but has been modified for JavaScript.
*
* ```text
* Copyright (c) 2004 the University Corporation for Atmospheric
* Research ("UCAR"). All rights reserved. Developed by NCAR's
* Computational and Information Systems Laboratory, UCAR,
* www.cisl.ucar.edu.
*
* Redistribution and use of the Software in source and binary forms,
* with or without modification, is permitted provided that the
* following conditions are met:
*
* - Neither the names of NCAR's Computational and Information Systems
* Laboratory, the University Corporation for Atmospheric Research,
* nor the names of its sponsors or contributors may be used to
* endorse or promote products derived from this Software without
* specific prior written permission.
*
* - Redistributions of source code must retain the above copyright
* notices, this list of conditions, and the disclaimer below.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions, and the disclaimer below in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
* SOFTWARE.
* ```
*/

/* eslint-disable max-len */

'use strict';

// MODULES //

var chRef = require( './ch_ref.js' );
var ccRef = require( './cc_ref.js' );


// VARIABLES //

var taur = -0.5;
var taui = 0.866025403784439;


// MAIN //

/**
* Performs the forward FFT of length 3 for real-valued sequences.
*
* @private
* @param {number} ido - number of real values for each transform
* @param {number} l1 - length of the input sequences
* @param {Float64Array} cc - input array containing sequences to be transformed
* @param {Float64Array} ch - output array containing transformed sequences
* @param {Float64Array} wa1 - first array of twiddle factors
* @param {Float64Array} wa2 - second array of twiddle factors
* @returns {void}
*/
function radf3( ido, l1, cc, ch, wa1, wa2 ) {
var chOffset;
var ccOffset;
var idp2;
var tr3;
var tr2;
var ti3;
var ti2;
var dr3;
var dr2;
var di3;
var di2;
var cr2;
var ci2;
var ic;
var i;
var k;

// Parameter adjustments...
chOffset = 1 + ( ido << 2 );
ccOffset = 1 + ( ido * ( 1 + l1 ) );

// Function body:
for ( k = 1; k <= l1; ++k ) {
cr2 = cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ];
ch[ chRef( 1, 1, k, 3, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cr2;
ch[ chRef( 1, 3, k, 3, ido ) - chOffset ] = taui * ( cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ] );
ch[ chRef( ido, 2, k, 3, ido ) - chOffset ] = ( cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + taur ) * cr2;
}
if ( ido === 1 ) {
return;
}
idp2 = ido + 2;
for ( k = 1; k <= l1; ++k ) {
for ( i = 3; i <= ido; i += 2 ) {
ic = idp2 - i;
dr2 = ( wa1[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 2, l1, ido ) - ccOffset ]) + ( wa1[ i - 1 - 1 ] * cc[ ccRef( i, k, 2, l1, ido ) - ccOffset ] );
di2 = ( wa1[ i - 2 - 1 ] * cc[ ccRef( i, k, 2, l1, ido ) - ccOffset ]) - ( wa1[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 2, l1, ido ) - ccOffset ] );
dr3 = ( wa2[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 3, l1, ido ) - ccOffset ]) + ( wa2[ i - 1 - 1 ] * cc[ ccRef( i, k, 3, l1, ido ) - ccOffset ] );
di3 = ( wa2[ i - 2 - 1 ] * cc[ ccRef( i, k, 3, l1, ido ) - ccOffset ]) - ( wa2[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 3, l1, ido ) - ccOffset ] );
cr2 = dr2 + dr3;
ci2 = di2 + di3;
ch[ chRef( i - 1, 1, k, 3, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + cr2;
ch[ chRef( i, 1, k, 3, ido ) - chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ci2;
tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( taur * cr2 );
ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( taur * ci2 );
tr3 = taui * ( di2 - di3 );
ti3 = taui * ( dr3 - dr2 );
ch[ chRef( i - 1, 3, k, 3, ido ) - chOffset ] = tr2 + tr3;
ch[ chRef( ic - 1, 2, k, 3, ido ) - chOffset ] = tr2 - tr3;
ch[ chRef( i, 3, k, 3, ido ) - chOffset ] = ti2 + ti3;
ch[ chRef( ic, 2, k, 3, ido ) - chOffset ] = ti3 - ti2;
}
}

}


// EXPORTS //

module.exports = radf3;
Loading