Skip to content
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

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

Draft
wants to merge 44 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 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
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
81 changes: 81 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 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.
* ```
*/

'use strict';

// MAIN //

/**
* Performs a pass of the FFT algorithm.
*
* @private
* @param {number} a1 - index of first dimension
* @param {number} a2 - index of second dimension
* @param {number} a3 - index of third dimension
* @param {number} l1 - length parameter related to the FFT stage
* @param {number} ido - dimension order
* @returns {number} - calculated index
*/
function c1Ref( a1, a2, a3, l1, ido ) {
return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1;
}


// EXPORTS //

module.exports = c1Ref;
79 changes: 79 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 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.
* ```
*/

'use strict';

// MAIN //

/**
* Performs a pass of the FFT algorithm.
*
* @private
* @param {number} a1 - index of first dimension
* @param {number} a2 - index of second dimension
* @param {number} idl1 - stride related to the `l1` parameter
* @returns {number} - calculated index
*/
function c2Ref( a1, a2, idl1 ) {
return ( a2 * idl1 ) + a1;
}


// EXPORTS //

module.exports = c2Ref;
81 changes: 81 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 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.
* ```
*/

'use strict';

// MAIN //

/**
* Performs a pass of the FFT algorithm.
*
* @private
* @param {number} a1 - index of first dimension
* @param {number} a2 - index of second dimension
* @param {number} a3 - index of third dimension
* @param {number} ip - number of sub-steps or prime factors in the FFT
* @param {number} ido - dimension order
* @returns {number} - calculated index
*/
function ccRef( a1, a2, a3, ip, ido ) {
return ( ( ( a3 * ip ) + a2 ) * ido ) + a1;
}


// EXPORTS //

module.exports = ccRef;
96 changes: 96 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 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.
* ```
*/

'use strict';

// MODULES //

var cfftb1 = require( './cfftb1.js' );


// MAIN //

/**
* Performs the complex backward Fast Fourier Transform.
*
* @param {number} n - length of the sequence to transform
* @param {Float64Array} c - input array containing sequence to be transformed
* @param {number} cptr - starting index for c
* @param {Float64Array} wsave - working array containing precomputed values
* @param {number} wptr - starting index for wsave

Check warning on line 75 in lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "wsave"
* @returns {void}
*/
function cfftb( n, c, cptr, wsave, wptr ) {
var iw1;
var iw2;

wptr -= 1;
cptr -= 1;

if ( n === 1 ) {
return;
}
iw1 = ( 2 * n ) + 1;
iw2 = iw1 + ( 2 * n );
cfftb1( n, c, cptr, wsave, wptr, wsave, wptr + iw1, wsave, wptr + iw2 );
}


// EXPORTS //

module.exports = cfftb;
Loading
Loading