From b6c3ed79ac4fb30ffbd61c9dfefe47fe43018cf2 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 14 Dec 2024 14:42:25 +0530 Subject: [PATCH 001/102] feat: implement passfb --- .../@stdlib/fft/base/fftpack/lib/c1Ref.js | 81 ++ .../@stdlib/fft/base/fftpack/lib/c2Ref.js | 80 ++ .../@stdlib/fft/base/fftpack/lib/ccRef.js | 81 ++ .../@stdlib/fft/base/fftpack/lib/ch2Ref.js | 79 ++ .../@stdlib/fft/base/fftpack/lib/chRef.js | 81 ++ .../@stdlib/fft/base/fftpack/lib/index.js | 791 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/passfb.js | 242 ++++++ 7 files changed, 1435 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js new file mode 100644 index 000000000000..618bb6386ae6 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js @@ -0,0 +1,81 @@ +/** +* @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. +* ``` +*/ + +'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; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js new file mode 100644 index 000000000000..0a07c4e6eb73 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js @@ -0,0 +1,80 @@ +/** +* @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. +* ``` +*/ + +'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 {Float64Array} c2 - Secondary intermediate array for FFT computations. +* @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; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js new file mode 100644 index 000000000000..093d103cb387 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js @@ -0,0 +1,81 @@ +/** +* @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. +* ``` +*/ + +'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; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js new file mode 100644 index 000000000000..8ee2616edf54 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js @@ -0,0 +1,79 @@ +/** +* @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. +* ``` +*/ + +'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 ch2Ref ( a1, a2, idl1 ) { + return ( a2 * idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = ch2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js new file mode 100644 index 000000000000..04d5d01380e8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js @@ -0,0 +1,81 @@ +/** +* @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. +* ``` +*/ + +'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 chRef ( a1, a2, a3, l1, ido ) { + return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = chRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js new file mode 100644 index 000000000000..dcfa9f8c24e1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js @@ -0,0 +1,791 @@ +/** +* @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. +*/ + +'use strict'; + +/* +* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); + + +// MAIN // + +/** +* Top-level namespace. +* +* @namespace fftpack +*/ +var fftpack = {}; + +// REMOVE THIS: Keep only non-static APIs here: + +/** +* @name assert +* @memberof blas +* @readonly +* @type {Namespace} +* @see {@link module:@stdlib/blas/base/assert} +*/ +setReadOnly( blas, 'assert', require( '@stdlib/blas/base/assert' ) ); + +/** +* @name caxpy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/caxpy} +*/ +setReadOnly( blas, 'caxpy', require( '@stdlib/blas/base/caxpy' ) ); + +/** +* @name ccopy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/ccopy} +*/ +setReadOnly( blas, 'ccopy', require( '@stdlib/blas/base/ccopy' ) ); + +/** +* @name cscal +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/cscal} +*/ +setReadOnly( blas, 'cscal', require( '@stdlib/blas/base/cscal' ) ); + +/** +* @name csrot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/csrot} +*/ +setReadOnly( blas, 'csrot', require( '@stdlib/blas/base/csrot' ) ); + +/** +* @name cswap +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/cswap} +*/ +setReadOnly( blas, 'cswap', require( '@stdlib/blas/base/cswap' ) ); + +/** +* @name dasum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dasum} +*/ +setReadOnly( blas, 'dasum', require( '@stdlib/blas/base/dasum' ) ); + +/** +* @name daxpy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/daxpy} +*/ +setReadOnly( blas, 'daxpy', require( '@stdlib/blas/base/daxpy' ) ); + +/** +* @name dcabs1 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dcabs1} +*/ +setReadOnly( blas, 'dcabs1', require( '@stdlib/blas/base/dcabs1' ) ); + +/** +* @name dcopy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dcopy} +*/ +setReadOnly( blas, 'dcopy', require( '@stdlib/blas/base/dcopy' ) ); + +/** +* @name ddot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/ddot} +*/ +setReadOnly( blas, 'ddot', require( '@stdlib/blas/base/ddot' ) ); + +/** +* @name diagonalTypeEnum2Str +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/diagonal-type-enum2str} +*/ +setReadOnly( blas, 'diagonalTypeEnum2Str', require( '@stdlib/blas/base/diagonal-type-enum2str' ) ); + +/** +* @name diagonalTypeResolveEnum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/diagonal-type-resolve-enum} +*/ +setReadOnly( blas, 'diagonalTypeResolveEnum', require( '@stdlib/blas/base/diagonal-type-resolve-enum' ) ); + +/** +* @name diagonalTypeResolveStr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/diagonal-type-resolve-str} +*/ +setReadOnly( blas, 'diagonalTypeResolveStr', require( '@stdlib/blas/base/diagonal-type-resolve-str' ) ); + +/** +* @name diagonalTypeStr2Enum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/diagonal-type-str2enum} +*/ +setReadOnly( blas, 'diagonalTypeStr2Enum', require( '@stdlib/blas/base/diagonal-type-str2enum' ) ); + +/** +* @name diagonalTypes +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/diagonal-types} +*/ +setReadOnly( blas, 'diagonalTypes', require( '@stdlib/blas/base/diagonal-types' ) ); + +/** +* @name dnrm2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dnrm2} +*/ +setReadOnly( blas, 'dnrm2', require( '@stdlib/blas/base/dnrm2' ) ); + +/** +* @name drot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/drot} +*/ +setReadOnly( blas, 'drot', require( '@stdlib/blas/base/drot' ) ); + +/** +* @name drotg +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/drotg} +*/ +setReadOnly( blas, 'drotg', require( '@stdlib/blas/base/drotg' ) ); + +/** +* @name drotm +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/drotm} +*/ +setReadOnly( blas, 'drotm', require( '@stdlib/blas/base/drotm' ) ); + +/** +* @name dscal +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dscal} +*/ +setReadOnly( blas, 'dscal', require( '@stdlib/blas/base/dscal' ) ); + +/** +* @name dsdot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dsdot} +*/ +setReadOnly( blas, 'dsdot', require( '@stdlib/blas/base/dsdot' ) ); + +/** +* @name dspmv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dspmv} +*/ +setReadOnly( blas, 'dspmv', require( '@stdlib/blas/base/dspmv' ) ); + +/** +* @name dswap +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dswap} +*/ +setReadOnly( blas, 'dswap', require( '@stdlib/blas/base/dswap' ) ); + +/** +* @name dsymv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dsymv} +*/ +setReadOnly( blas, 'dsymv', require( '@stdlib/blas/base/dsymv' ) ); + +/** +* @name dsyr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dsyr} +*/ +setReadOnly( blas, 'dsyr', require( '@stdlib/blas/base/dsyr' ) ); + +/** +* @name dsyr2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dsyr2} +*/ +setReadOnly( blas, 'dsyr2', require( '@stdlib/blas/base/dsyr2' ) ); + +/** +* @name dtrmv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dtrmv} +*/ +setReadOnly( blas, 'dtrmv', require( '@stdlib/blas/base/dtrmv' ) ); + +/** +* @name dznrm2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/dznrm2} +*/ +setReadOnly( blas, 'dznrm2', require( '@stdlib/blas/base/dznrm2' ) ); + +/** +* @name gasum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gasum} +*/ +setReadOnly( blas, 'gasum', require( '@stdlib/blas/base/gasum' ) ); + +/** +* @name gaxpy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gaxpy} +*/ +setReadOnly( blas, 'gaxpy', require( '@stdlib/blas/base/gaxpy' ) ); + +/** +* @name gcopy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gcopy} +*/ +setReadOnly( blas, 'gcopy', require( '@stdlib/blas/base/gcopy' ) ); + +/** +* @name gdot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gdot} +*/ +setReadOnly( blas, 'gdot', require( '@stdlib/blas/base/gdot' ) ); + +/** +* @name gnrm2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gnrm2} +*/ +setReadOnly( blas, 'gnrm2', require( '@stdlib/blas/base/gnrm2' ) ); + +/** +* @name gscal +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gscal} +*/ +setReadOnly( blas, 'gscal', require( '@stdlib/blas/base/gscal' ) ); + +/** +* @name gswap +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/gswap} +*/ +setReadOnly( blas, 'gswap', require( '@stdlib/blas/base/gswap' ) ); + +/** +* @name idamax +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/idamax} +*/ +setReadOnly( blas, 'idamax', require( '@stdlib/blas/base/idamax' ) ); + +/** +* @name isamax +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/isamax} +*/ +setReadOnly( blas, 'isamax', require( '@stdlib/blas/base/isamax' ) ); + +/** +* @name layoutEnum2Str +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/layout-enum2str} +*/ +setReadOnly( blas, 'layoutEnum2Str', require( '@stdlib/blas/base/layout-enum2str' ) ); + +/** +* @name layoutResolveEnum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/layout-resolve-enum} +*/ +setReadOnly( blas, 'layoutResolveEnum', require( '@stdlib/blas/base/layout-resolve-enum' ) ); + +/** +* @name layoutResolveStr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/layout-resolve-str} +*/ +setReadOnly( blas, 'layoutResolveStr', require( '@stdlib/blas/base/layout-resolve-str' ) ); + +/** +* @name layoutStr2Enum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/layout-str2enum} +*/ +setReadOnly( blas, 'layoutStr2Enum', require( '@stdlib/blas/base/layout-str2enum' ) ); + +/** +* @name layouts +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/layouts} +*/ +setReadOnly( blas, 'layouts', require( '@stdlib/blas/base/layouts' ) ); + +/** +* @name matrixTriangleEnum2Str +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/matrix-triangle-enum2str} +*/ +setReadOnly( blas, 'matrixTriangleEnum2Str', require( '@stdlib/blas/base/matrix-triangle-enum2str' ) ); + +/** +* @name matrixTriangleResolveEnum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/matrix-triangle-resolve-enum} +*/ +setReadOnly( blas, 'matrixTriangleResolveEnum', require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ) ); + +/** +* @name matrixTriangleResolveStr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/matrix-triangle-resolve-str} +*/ +setReadOnly( blas, 'matrixTriangleResolveStr', require( '@stdlib/blas/base/matrix-triangle-resolve-str' ) ); + +/** +* @name matrixTriangleStr2Enum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/matrix-triangle-str2enum} +*/ +setReadOnly( blas, 'matrixTriangleStr2Enum', require( '@stdlib/blas/base/matrix-triangle-str2enum' ) ); + +/** +* @name matrixTriangles +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/matrix-triangles} +*/ +setReadOnly( blas, 'matrixTriangles', require( '@stdlib/blas/base/matrix-triangles' ) ); + +/** +* @name operationSideEnum2Str +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/operation-side-enum2str} +*/ +setReadOnly( blas, 'operationSideEnum2Str', require( '@stdlib/blas/base/operation-side-enum2str' ) ); + +/** +* @name operationSideResolveEnum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/operation-side-resolve-enum} +*/ +setReadOnly( blas, 'operationSideResolveEnum', require( '@stdlib/blas/base/operation-side-resolve-enum' ) ); + +/** +* @name operationSideResolveStr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/operation-side-resolve-str} +*/ +setReadOnly( blas, 'operationSideResolveStr', require( '@stdlib/blas/base/operation-side-resolve-str' ) ); + +/** +* @name operationSideStr2Enum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/operation-side-str2enum} +*/ +setReadOnly( blas, 'operationSideStr2Enum', require( '@stdlib/blas/base/operation-side-str2enum' ) ); + +/** +* @name operationSides +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/operation-sides} +*/ +setReadOnly( blas, 'operationSides', require( '@stdlib/blas/base/operation-sides' ) ); + +/** +* @name sasum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sasum} +*/ +setReadOnly( blas, 'sasum', require( '@stdlib/blas/base/sasum' ) ); + +/** +* @name saxpy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/saxpy} +*/ +setReadOnly( blas, 'saxpy', require( '@stdlib/blas/base/saxpy' ) ); + +/** +* @name scabs1 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/scabs1} +*/ +setReadOnly( blas, 'scabs1', require( '@stdlib/blas/base/scabs1' ) ); + +/** +* @name scasum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/scasum} +*/ +setReadOnly( blas, 'scasum', require( '@stdlib/blas/base/scasum' ) ); + +/** +* @name scnrm2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/scnrm2} +*/ +setReadOnly( blas, 'scnrm2', require( '@stdlib/blas/base/scnrm2' ) ); + +/** +* @name scopy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/scopy} +*/ +setReadOnly( blas, 'scopy', require( '@stdlib/blas/base/scopy' ) ); + +/** +* @name sdot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sdot} +*/ +setReadOnly( blas, 'sdot', require( '@stdlib/blas/base/sdot' ) ); + +/** +* @name sdsdot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sdsdot} +*/ +setReadOnly( blas, 'sdsdot', require( '@stdlib/blas/base/sdsdot' ) ); + +/** +* @name sgemv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sgemv} +*/ +setReadOnly( blas, 'sgemv', require( '@stdlib/blas/base/sgemv' ) ); + +/** +* @name snrm2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/snrm2} +*/ +setReadOnly( blas, 'snrm2', require( '@stdlib/blas/base/snrm2' ) ); + +/** +* @name srot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/srot} +*/ +setReadOnly( blas, 'srot', require( '@stdlib/blas/base/srot' ) ); + +/** +* @name srotg +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/srotg} +*/ +setReadOnly( blas, 'srotg', require( '@stdlib/blas/base/srotg' ) ); + +/** +* @name srotm +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/srotm} +*/ +setReadOnly( blas, 'srotm', require( '@stdlib/blas/base/srotm' ) ); + +/** +* @name sscal +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sscal} +*/ +setReadOnly( blas, 'sscal', require( '@stdlib/blas/base/sscal' ) ); + +/** +* @name sspmv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sspmv} +*/ +setReadOnly( blas, 'sspmv', require( '@stdlib/blas/base/sspmv' ) ); + +/** +* @name sswap +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/sswap} +*/ +setReadOnly( blas, 'sswap', require( '@stdlib/blas/base/sswap' ) ); + +/** +* @name ssymv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/ssymv} +*/ +setReadOnly( blas, 'ssymv', require( '@stdlib/blas/base/ssymv' ) ); + +/** +* @name ssyr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/ssyr} +*/ +setReadOnly( blas, 'ssyr', require( '@stdlib/blas/base/ssyr' ) ); + +/** +* @name ssyr2 +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/ssyr2} +*/ +setReadOnly( blas, 'ssyr2', require( '@stdlib/blas/base/ssyr2' ) ); + +/** +* @name strmv +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/strmv} +*/ +setReadOnly( blas, 'strmv', require( '@stdlib/blas/base/strmv' ) ); + +/** +* @name transposeOperationEnum2Str +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/transpose-operation-enum2str} +*/ +setReadOnly( blas, 'transposeOperationEnum2Str', require( '@stdlib/blas/base/transpose-operation-enum2str' ) ); + +/** +* @name transposeOperationResolveEnum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/transpose-operation-resolve-enum} +*/ +setReadOnly( blas, 'transposeOperationResolveEnum', require( '@stdlib/blas/base/transpose-operation-resolve-enum' ) ); + +/** +* @name transposeOperationResolveStr +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/transpose-operation-resolve-str} +*/ +setReadOnly( blas, 'transposeOperationResolveStr', require( '@stdlib/blas/base/transpose-operation-resolve-str' ) ); + +/** +* @name transposeOperationStr2Enum +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/transpose-operation-str2enum} +*/ +setReadOnly( blas, 'transposeOperationStr2Enum', require( '@stdlib/blas/base/transpose-operation-str2enum' ) ); + +/** +* @name transposeOperations +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/transpose-operations} +*/ +setReadOnly( blas, 'transposeOperations', require( '@stdlib/blas/base/transpose-operations' ) ); + +/** +* @name zaxpy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/zaxpy} +*/ +setReadOnly( blas, 'zaxpy', require( '@stdlib/blas/base/zaxpy' ) ); + +/** +* @name zcopy +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/zcopy} +*/ +setReadOnly( blas, 'zcopy', require( '@stdlib/blas/base/zcopy' ) ); + +/** +* @name zdrot +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/zdrot} +*/ +setReadOnly( blas, 'zdrot', require( '@stdlib/blas/base/zdrot' ) ); + +/** +* @name zscal +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/zscal} +*/ +setReadOnly( blas, 'zscal', require( '@stdlib/blas/base/zscal' ) ); + +/** +* @name zswap +* @memberof blas +* @readonly +* @type {Function} +* @see {@link module:@stdlib/blas/base/zswap} +*/ +setReadOnly( blas, 'zswap', require( '@stdlib/blas/base/zswap' ) ); + + +// EXPORTS // + +module.exports = blas; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js new file mode 100644 index 000000000000..eb0f42026464 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -0,0 +1,242 @@ +/** +* @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. +* ``` +*/ + +'use strict'; + +// MODULES // + +var c1Ref = require( './c1Ref.js' ); +var c2Ref = require( './c2Ref.js' ); +var chRef = require( './chRef.js' ); +var ch2Ref = require( './ch2Ref.js' ); +var ccRef = require( './ccRef.js' ); + + +// MAIN // + +/** +* Performs a pass of the FFT algorithm. +* +* @private +* @param {Float64Array} nac - Number of FFT passes. +* @param {number} ido - Dimension order for input/output arrays. +* @param {number} ip - Number of sub-steps or prime factors in the FFT. +* @param {number} l1 - Length parameter related to the FFT stage. +* @param {number} idl1 - Stride related to the `l1` parameter. +* @param {Float64Array} cc - Input array containing complex data for FFT computation. +* @param {Float64Array} c1 - Intermediate array for FFT computations. +* @param {Float64Array} c2 - Secondary intermediate array for FFT computations. +* @param {Float64Array} ch - Output array for storing processed FFT data. +* @param {Float64Array} ch2 - Secondary output array for storing processed FFT data. +* @param {Float64Array} wa - Twiddle factor array used in FFT calculations. +* @param {number} fsign - Sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse). +* @returns {void} +*/ +function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { + var ch2_offset; + var ch_offset; + var cc_offset; + var c1_offset; + var c2_offset; + var ipp2; + var idij; + var idlj; + var idot; + var ipph; + var idj; + var idl; + var inc; + var idp; + var wai; + var war; + var jc; + var lc; + var ik; + var i; + var j; + var k; + var l; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + c1_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido * ( 1 + ip ) ); + ch2_offset = 1 + idl1; + c2_offset = 1 + idl1; + + // Function body: + idot = ido / 2; + ipp2 = ip + 2; + ipph = ( ip + 1 ) / 2; + idp = ip * ido; + if ( ido >= l1 ) { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; ++i ) { + ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len + } + } + } + for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; ++i ) { + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, ip, ido ) - cc_offset ]; + } + } + } else { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len + } + } + } + for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, ip, ido ) - cc_offset ]; + } + } + } + idl = 2 - ido; + inc = 0; + for ( l = 2; l <= ipph; ++l ) { + lc = ipp2 - l; + idl += ido; + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, l, idl1 ) - c2_offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2_offset ] ); // eslint-disable-line max-len + c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + } + idlj = idl; + inc += ido; + for ( j = 3; j <= ipph; ++j ) { + jc = ipp2 - j; + idlj += inc; + if ( idlj > idp ) { + idlj -= idp; + } + war = wa[ idlj - 1 - 1 ]; + wai = wa[ idlj - 1 ]; + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, l, idl1 ) - c2_offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + } + } + } + for ( j = 2; j <= ipph; ++j ) { + for ( ik = 1; ik <= idl1; ++ik ) { + ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + } + } + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( ik = 2; ik <= idl1; ik += 2 ) { + ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len + ch2[ ch2Ref( ik - 1, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len + ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len + ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len + } + } + nac[ 0 ] = 1; + if ( ido === 2 ) { + return; + } + nac[ 0 ] = 0; + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, 1, idl1 ) - c2_offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ]; + } + for ( j = 2; j <= ip; ++j ) { + for ( k = 1; k <= l1; ++k ) { + c1[ c1Ref( 1, k, j, l1, ido ) - c1_offset ] = ch[ chRef( 1, k, j, l1, ido ) - ch_offset ]; + c1[ c1Ref( 2, k, j, l1, ido ) - c1_offset ] = ch[ chRef( 2, k, j, l1, ido ) - ch_offset ]; + } + } + if ( idot <= l1 ) { + idij = 0; + for ( j = 2; j <= ip; ++j ) { + idij += 2; + for ( i = 4; i <= ido; i += 2 ) { + idij += 2; + for ( k = 1; k <= l1; ++k ) { + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) ; // eslint-disable-line max-len + c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) ; // eslint-disable-line max-len + } + } + } + return; + } + idj = 2 - ido; + for ( j = 2; j <= ip; ++j ) { + idj += ido; + for ( k = 1; k <= l1; ++k ) { + idij = idj; + for ( i = 4; i <= ido; i += 2 ) { + idij += 2; + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ); // eslint-disable-line max-len + c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ); // eslint-disable-line max-len + } + } + } +} + + +// EXPORTS // + +module.exports = passfb; From 7479095c93fccf6bf4c00363a9d2ec4c4d57fe5c Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 16 Dec 2024 10:24:29 +0530 Subject: [PATCH 002/102] feat: add passb2 --- .../base/fftpack/lib/{c1Ref.js => c1_ref.js} | 0 .../base/fftpack/lib/{c2Ref.js => c2_ref.js} | 0 .../base/fftpack/lib/{ccRef.js => cc_ref.js} | 0 .../fftpack/lib/{ch2Ref.js => ch2_ref.js} | 0 .../base/fftpack/lib/{chRef.js => ch_ref.js} | 0 .../@stdlib/fft/base/fftpack/lib/passb2.js | 117 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/passb3.js | 116 +++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/passfb.js | 10 +- .../math/base/special/log1p/src/main.c | 2 +- 9 files changed, 239 insertions(+), 6 deletions(-) rename lib/node_modules/@stdlib/fft/base/fftpack/lib/{c1Ref.js => c1_ref.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/lib/{c2Ref.js => c2_ref.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/lib/{ccRef.js => cc_ref.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/lib/{ch2Ref.js => ch2_ref.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/lib/{chRef.js => ch_ref.js} (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js rename to lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js rename to lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js new file mode 100644 index 000000000000..f145f7133d71 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js @@ -0,0 +1,117 @@ +/** +* @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. +* ``` +*/ + +'use strict'; + +// MODULES // + +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); + + +// MAIN // + +/** +* Performs a pass of length 2 of the FFT algorithm. +* +* @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 - Array of twiddle factors +* @returns {void} +*/ +function passb2( ido, l1, cc, ch, wa1 ) { + var ch_offset; + var cc_offset; + var ti2; + var tr2; + var i; + var k; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido * 3 ); + + // Function body: + if ( ido <= 2 ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; + } + return; + } + for ( k = 1; k <= l1; ++k ) { + for ( i = 2; i <= ido; i += 2 ) { + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); + } + } +} + + +// EXPORTS // + +module.exports = passb2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js new file mode 100644 index 000000000000..ea00a740d5f8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -0,0 +1,116 @@ +/** +* @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. +* ``` +*/ + +'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 a pass of length 3 of the FFT algorithm. +* +* @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 passb3( ido, l1, cc, ch, wa1, wa2 ) { + var ch_offset; + var cc_offset; + var ci2; + var ci3; + var di2; + var di3; + var cr2; + var cr3; + var dr2; + var dr3; + var ti2; + var tr2; + var i; + var k; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido << 2 ); + + // Function body: + if ( ido == 2 ) { + + } +} + + +// EXPORTS // + +module.exports = passb3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index eb0f42026464..6d7401db3d2a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -60,11 +60,11 @@ // MODULES // -var c1Ref = require( './c1Ref.js' ); -var c2Ref = require( './c2Ref.js' ); -var chRef = require( './chRef.js' ); -var ch2Ref = require( './ch2Ref.js' ); -var ccRef = require( './ccRef.js' ); +var c1Ref = require( './c1_ref.js' ); +var c2Ref = require( './c2_ref.js' ); +var chRef = require( './ch_ref.js' ); +var ch2Ref = require( './ch2_ref.js' ); +var ccRef = require( './cc_ref.js' ); // MAIN // diff --git a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c index 7d19fbb2f229..543b9250ead8 100644 --- a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c @@ -311,7 +311,7 @@ double stdlib_base_log1p( const double x ) { } // Apply a bit mask (0 00000000000 11111111111111111111) to remove the exponent: hu &= 0x000fffff; // max value => 0x000fffff => 1048575 - + // The approximation to sqrt(2) used in thresholds is not critical. However, the ones used above must give less strict bounds than the one here so that the k==0 case is never reached from here, since here we have committed to using the correction term but don't use it if k==0. // Check if u significand is less than sqrt(2) significand => 0x6a09e => 01101010000010011110 From 2f134a63ed28dfd7caa9a10976c4d893699a6365 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 16 Dec 2024 10:24:47 +0530 Subject: [PATCH 003/102] feat: add passb2 --- lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js index 618bb6386ae6..cdfe73c6cc88 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js @@ -71,7 +71,7 @@ * @param {number} ido - Dimension order. * @returns {number} - Calculated index. */ -function c1Ref ( a1, a2, a3, l1, ido ) { +function c1Ref( a1, a2, a3, l1, ido ) { return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js index 0a07c4e6eb73..5564c90dd344 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js @@ -70,7 +70,7 @@ * @param {number} idl1 - Stride related to the `l1` parameter. * @returns {number} - Calculated index. */ -function c2Ref ( a1, a2, idl1 ) { +function c2Ref( a1, a2, idl1 ) { return ( a2 * idl1 ) + a1; } From 3b5b05d15b0efae5d393c41df3bf94f876dbd23a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 18 Dec 2024 15:04:37 +0530 Subject: [PATCH 004/102] feat: add passb3 --- .../@stdlib/fft/base/fftpack/lib/passb3.js | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index ea00a740d5f8..65c926100a5d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -106,7 +106,41 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { // Function body: if ( ido == 2 ) { - + for ( k = 1; k <= l1; ++k ) { + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + tr2; // eslint-disable-line max-len + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ti2; // eslint-disable-line max-len + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr2 + ci3; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + ci3; + ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ci2 - cr3; + } + } else { + for ( k = 1; k <= l1; ++k ) { + for ( i = 2; i <= ido; i += 2 ) { + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + tr2; // eslint-disable-line max-len + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ti2; // eslint-disable-line max-len + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + ci3; + di3 = ci2 - cr3; + ch[ chRef( i, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); + ch[ chRef( i - 1, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); + } + } } } From 9606e3ef1ce42ef4199f231fa46740f4b17aa789 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 21 Dec 2024 11:15:39 +0530 Subject: [PATCH 005/102] feat: add passb4 function --- .../@stdlib/fft/base/fftpack/lib/passb3.js | 2 +- .../@stdlib/fft/base/fftpack/lib/passb4.js | 159 ++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index 65c926100a5d..cde03b93929b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -105,7 +105,7 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { cc_offset = 1 + ( ido << 2 ); // Function body: - if ( ido == 2 ) { + if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js new file mode 100644 index 000000000000..0836ef0171f1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -0,0 +1,159 @@ +/** +* @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. +* ``` +*/ + +'use strict'; + +// MODULES // + +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); + + +// MAIN // + +/** +* Performs a pass of length 4 of the FFT algorithm. +* +* @private +* @param {integer} ido - Number of real values for each transform +* @param {integer} 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 +* @param {Float64Array} wa3 - Third array of twiddle factors +* @returns {void} +*/ +function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { + var ch_offset; + var cc_offset; + var ci2; + var ci3; + var ci4; + var cr2; + var cr3; + var cr4; + var ti1; + var ti2; + var ti3; + var ti4; + var tr1; + var tr2; + var tr3; + var tr4; + var i; + var k; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido * 5 ); + + // Function body: + if ( ido === 2 ) { + for ( k = 1; k <= l1; ++k ) { + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; + ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = tr2 - tr3; + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; + ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ti2 - ti3; + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = tr1 + tr4; + ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = tr1 - tr4; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ti1 + ti4; + ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ti1 - ti4; + } + } else { + for ( k = 1; k <= l1; ++k ) { + for ( i = 2; i <= ido; i += 2 ) { + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr4 = cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; + cr3 = tr2 - tr3; + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 + tr4; + cr4 = tr1 - tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); + } + } + } +} + + +// EXPORTS // + +module.exports = passb4; From 825ca7f50477128e66474ffac09e6832c7182d1f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 21 Dec 2024 11:19:31 +0530 Subject: [PATCH 006/102] docs: update index.js --- .../@stdlib/fft/base/fftpack/lib/index.js | 751 +----------------- 1 file changed, 1 insertion(+), 750 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js index dcfa9f8c24e1..0f3f23a2b960 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js @@ -36,756 +36,7 @@ var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); */ var fftpack = {}; -// REMOVE THIS: Keep only non-static APIs here: - -/** -* @name assert -* @memberof blas -* @readonly -* @type {Namespace} -* @see {@link module:@stdlib/blas/base/assert} -*/ -setReadOnly( blas, 'assert', require( '@stdlib/blas/base/assert' ) ); - -/** -* @name caxpy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/caxpy} -*/ -setReadOnly( blas, 'caxpy', require( '@stdlib/blas/base/caxpy' ) ); - -/** -* @name ccopy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/ccopy} -*/ -setReadOnly( blas, 'ccopy', require( '@stdlib/blas/base/ccopy' ) ); - -/** -* @name cscal -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/cscal} -*/ -setReadOnly( blas, 'cscal', require( '@stdlib/blas/base/cscal' ) ); - -/** -* @name csrot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/csrot} -*/ -setReadOnly( blas, 'csrot', require( '@stdlib/blas/base/csrot' ) ); - -/** -* @name cswap -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/cswap} -*/ -setReadOnly( blas, 'cswap', require( '@stdlib/blas/base/cswap' ) ); - -/** -* @name dasum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dasum} -*/ -setReadOnly( blas, 'dasum', require( '@stdlib/blas/base/dasum' ) ); - -/** -* @name daxpy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/daxpy} -*/ -setReadOnly( blas, 'daxpy', require( '@stdlib/blas/base/daxpy' ) ); - -/** -* @name dcabs1 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dcabs1} -*/ -setReadOnly( blas, 'dcabs1', require( '@stdlib/blas/base/dcabs1' ) ); - -/** -* @name dcopy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dcopy} -*/ -setReadOnly( blas, 'dcopy', require( '@stdlib/blas/base/dcopy' ) ); - -/** -* @name ddot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/ddot} -*/ -setReadOnly( blas, 'ddot', require( '@stdlib/blas/base/ddot' ) ); - -/** -* @name diagonalTypeEnum2Str -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/diagonal-type-enum2str} -*/ -setReadOnly( blas, 'diagonalTypeEnum2Str', require( '@stdlib/blas/base/diagonal-type-enum2str' ) ); - -/** -* @name diagonalTypeResolveEnum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/diagonal-type-resolve-enum} -*/ -setReadOnly( blas, 'diagonalTypeResolveEnum', require( '@stdlib/blas/base/diagonal-type-resolve-enum' ) ); - -/** -* @name diagonalTypeResolveStr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/diagonal-type-resolve-str} -*/ -setReadOnly( blas, 'diagonalTypeResolveStr', require( '@stdlib/blas/base/diagonal-type-resolve-str' ) ); - -/** -* @name diagonalTypeStr2Enum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/diagonal-type-str2enum} -*/ -setReadOnly( blas, 'diagonalTypeStr2Enum', require( '@stdlib/blas/base/diagonal-type-str2enum' ) ); - -/** -* @name diagonalTypes -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/diagonal-types} -*/ -setReadOnly( blas, 'diagonalTypes', require( '@stdlib/blas/base/diagonal-types' ) ); - -/** -* @name dnrm2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dnrm2} -*/ -setReadOnly( blas, 'dnrm2', require( '@stdlib/blas/base/dnrm2' ) ); - -/** -* @name drot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/drot} -*/ -setReadOnly( blas, 'drot', require( '@stdlib/blas/base/drot' ) ); - -/** -* @name drotg -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/drotg} -*/ -setReadOnly( blas, 'drotg', require( '@stdlib/blas/base/drotg' ) ); - -/** -* @name drotm -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/drotm} -*/ -setReadOnly( blas, 'drotm', require( '@stdlib/blas/base/drotm' ) ); - -/** -* @name dscal -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dscal} -*/ -setReadOnly( blas, 'dscal', require( '@stdlib/blas/base/dscal' ) ); - -/** -* @name dsdot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dsdot} -*/ -setReadOnly( blas, 'dsdot', require( '@stdlib/blas/base/dsdot' ) ); - -/** -* @name dspmv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dspmv} -*/ -setReadOnly( blas, 'dspmv', require( '@stdlib/blas/base/dspmv' ) ); - -/** -* @name dswap -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dswap} -*/ -setReadOnly( blas, 'dswap', require( '@stdlib/blas/base/dswap' ) ); - -/** -* @name dsymv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dsymv} -*/ -setReadOnly( blas, 'dsymv', require( '@stdlib/blas/base/dsymv' ) ); - -/** -* @name dsyr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dsyr} -*/ -setReadOnly( blas, 'dsyr', require( '@stdlib/blas/base/dsyr' ) ); - -/** -* @name dsyr2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dsyr2} -*/ -setReadOnly( blas, 'dsyr2', require( '@stdlib/blas/base/dsyr2' ) ); - -/** -* @name dtrmv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dtrmv} -*/ -setReadOnly( blas, 'dtrmv', require( '@stdlib/blas/base/dtrmv' ) ); - -/** -* @name dznrm2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/dznrm2} -*/ -setReadOnly( blas, 'dznrm2', require( '@stdlib/blas/base/dznrm2' ) ); - -/** -* @name gasum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gasum} -*/ -setReadOnly( blas, 'gasum', require( '@stdlib/blas/base/gasum' ) ); - -/** -* @name gaxpy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gaxpy} -*/ -setReadOnly( blas, 'gaxpy', require( '@stdlib/blas/base/gaxpy' ) ); - -/** -* @name gcopy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gcopy} -*/ -setReadOnly( blas, 'gcopy', require( '@stdlib/blas/base/gcopy' ) ); - -/** -* @name gdot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gdot} -*/ -setReadOnly( blas, 'gdot', require( '@stdlib/blas/base/gdot' ) ); - -/** -* @name gnrm2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gnrm2} -*/ -setReadOnly( blas, 'gnrm2', require( '@stdlib/blas/base/gnrm2' ) ); - -/** -* @name gscal -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gscal} -*/ -setReadOnly( blas, 'gscal', require( '@stdlib/blas/base/gscal' ) ); - -/** -* @name gswap -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/gswap} -*/ -setReadOnly( blas, 'gswap', require( '@stdlib/blas/base/gswap' ) ); - -/** -* @name idamax -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/idamax} -*/ -setReadOnly( blas, 'idamax', require( '@stdlib/blas/base/idamax' ) ); - -/** -* @name isamax -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/isamax} -*/ -setReadOnly( blas, 'isamax', require( '@stdlib/blas/base/isamax' ) ); - -/** -* @name layoutEnum2Str -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/layout-enum2str} -*/ -setReadOnly( blas, 'layoutEnum2Str', require( '@stdlib/blas/base/layout-enum2str' ) ); - -/** -* @name layoutResolveEnum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/layout-resolve-enum} -*/ -setReadOnly( blas, 'layoutResolveEnum', require( '@stdlib/blas/base/layout-resolve-enum' ) ); - -/** -* @name layoutResolveStr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/layout-resolve-str} -*/ -setReadOnly( blas, 'layoutResolveStr', require( '@stdlib/blas/base/layout-resolve-str' ) ); - -/** -* @name layoutStr2Enum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/layout-str2enum} -*/ -setReadOnly( blas, 'layoutStr2Enum', require( '@stdlib/blas/base/layout-str2enum' ) ); - -/** -* @name layouts -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/layouts} -*/ -setReadOnly( blas, 'layouts', require( '@stdlib/blas/base/layouts' ) ); - -/** -* @name matrixTriangleEnum2Str -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/matrix-triangle-enum2str} -*/ -setReadOnly( blas, 'matrixTriangleEnum2Str', require( '@stdlib/blas/base/matrix-triangle-enum2str' ) ); - -/** -* @name matrixTriangleResolveEnum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/matrix-triangle-resolve-enum} -*/ -setReadOnly( blas, 'matrixTriangleResolveEnum', require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ) ); - -/** -* @name matrixTriangleResolveStr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/matrix-triangle-resolve-str} -*/ -setReadOnly( blas, 'matrixTriangleResolveStr', require( '@stdlib/blas/base/matrix-triangle-resolve-str' ) ); - -/** -* @name matrixTriangleStr2Enum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/matrix-triangle-str2enum} -*/ -setReadOnly( blas, 'matrixTriangleStr2Enum', require( '@stdlib/blas/base/matrix-triangle-str2enum' ) ); - -/** -* @name matrixTriangles -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/matrix-triangles} -*/ -setReadOnly( blas, 'matrixTriangles', require( '@stdlib/blas/base/matrix-triangles' ) ); - -/** -* @name operationSideEnum2Str -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/operation-side-enum2str} -*/ -setReadOnly( blas, 'operationSideEnum2Str', require( '@stdlib/blas/base/operation-side-enum2str' ) ); - -/** -* @name operationSideResolveEnum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/operation-side-resolve-enum} -*/ -setReadOnly( blas, 'operationSideResolveEnum', require( '@stdlib/blas/base/operation-side-resolve-enum' ) ); - -/** -* @name operationSideResolveStr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/operation-side-resolve-str} -*/ -setReadOnly( blas, 'operationSideResolveStr', require( '@stdlib/blas/base/operation-side-resolve-str' ) ); - -/** -* @name operationSideStr2Enum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/operation-side-str2enum} -*/ -setReadOnly( blas, 'operationSideStr2Enum', require( '@stdlib/blas/base/operation-side-str2enum' ) ); - -/** -* @name operationSides -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/operation-sides} -*/ -setReadOnly( blas, 'operationSides', require( '@stdlib/blas/base/operation-sides' ) ); - -/** -* @name sasum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sasum} -*/ -setReadOnly( blas, 'sasum', require( '@stdlib/blas/base/sasum' ) ); - -/** -* @name saxpy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/saxpy} -*/ -setReadOnly( blas, 'saxpy', require( '@stdlib/blas/base/saxpy' ) ); - -/** -* @name scabs1 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/scabs1} -*/ -setReadOnly( blas, 'scabs1', require( '@stdlib/blas/base/scabs1' ) ); - -/** -* @name scasum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/scasum} -*/ -setReadOnly( blas, 'scasum', require( '@stdlib/blas/base/scasum' ) ); - -/** -* @name scnrm2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/scnrm2} -*/ -setReadOnly( blas, 'scnrm2', require( '@stdlib/blas/base/scnrm2' ) ); - -/** -* @name scopy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/scopy} -*/ -setReadOnly( blas, 'scopy', require( '@stdlib/blas/base/scopy' ) ); - -/** -* @name sdot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sdot} -*/ -setReadOnly( blas, 'sdot', require( '@stdlib/blas/base/sdot' ) ); - -/** -* @name sdsdot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sdsdot} -*/ -setReadOnly( blas, 'sdsdot', require( '@stdlib/blas/base/sdsdot' ) ); - -/** -* @name sgemv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sgemv} -*/ -setReadOnly( blas, 'sgemv', require( '@stdlib/blas/base/sgemv' ) ); - -/** -* @name snrm2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/snrm2} -*/ -setReadOnly( blas, 'snrm2', require( '@stdlib/blas/base/snrm2' ) ); - -/** -* @name srot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/srot} -*/ -setReadOnly( blas, 'srot', require( '@stdlib/blas/base/srot' ) ); - -/** -* @name srotg -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/srotg} -*/ -setReadOnly( blas, 'srotg', require( '@stdlib/blas/base/srotg' ) ); - -/** -* @name srotm -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/srotm} -*/ -setReadOnly( blas, 'srotm', require( '@stdlib/blas/base/srotm' ) ); - -/** -* @name sscal -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sscal} -*/ -setReadOnly( blas, 'sscal', require( '@stdlib/blas/base/sscal' ) ); - -/** -* @name sspmv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sspmv} -*/ -setReadOnly( blas, 'sspmv', require( '@stdlib/blas/base/sspmv' ) ); - -/** -* @name sswap -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/sswap} -*/ -setReadOnly( blas, 'sswap', require( '@stdlib/blas/base/sswap' ) ); - -/** -* @name ssymv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/ssymv} -*/ -setReadOnly( blas, 'ssymv', require( '@stdlib/blas/base/ssymv' ) ); - -/** -* @name ssyr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/ssyr} -*/ -setReadOnly( blas, 'ssyr', require( '@stdlib/blas/base/ssyr' ) ); - -/** -* @name ssyr2 -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/ssyr2} -*/ -setReadOnly( blas, 'ssyr2', require( '@stdlib/blas/base/ssyr2' ) ); - -/** -* @name strmv -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/strmv} -*/ -setReadOnly( blas, 'strmv', require( '@stdlib/blas/base/strmv' ) ); - -/** -* @name transposeOperationEnum2Str -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/transpose-operation-enum2str} -*/ -setReadOnly( blas, 'transposeOperationEnum2Str', require( '@stdlib/blas/base/transpose-operation-enum2str' ) ); - -/** -* @name transposeOperationResolveEnum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/transpose-operation-resolve-enum} -*/ -setReadOnly( blas, 'transposeOperationResolveEnum', require( '@stdlib/blas/base/transpose-operation-resolve-enum' ) ); - -/** -* @name transposeOperationResolveStr -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/transpose-operation-resolve-str} -*/ -setReadOnly( blas, 'transposeOperationResolveStr', require( '@stdlib/blas/base/transpose-operation-resolve-str' ) ); - -/** -* @name transposeOperationStr2Enum -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/transpose-operation-str2enum} -*/ -setReadOnly( blas, 'transposeOperationStr2Enum', require( '@stdlib/blas/base/transpose-operation-str2enum' ) ); - -/** -* @name transposeOperations -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/transpose-operations} -*/ -setReadOnly( blas, 'transposeOperations', require( '@stdlib/blas/base/transpose-operations' ) ); - -/** -* @name zaxpy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/zaxpy} -*/ -setReadOnly( blas, 'zaxpy', require( '@stdlib/blas/base/zaxpy' ) ); - -/** -* @name zcopy -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/zcopy} -*/ -setReadOnly( blas, 'zcopy', require( '@stdlib/blas/base/zcopy' ) ); - -/** -* @name zdrot -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/zdrot} -*/ -setReadOnly( blas, 'zdrot', require( '@stdlib/blas/base/zdrot' ) ); - -/** -* @name zscal -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/zscal} -*/ -setReadOnly( blas, 'zscal', require( '@stdlib/blas/base/zscal' ) ); - -/** -* @name zswap -* @memberof blas -* @readonly -* @type {Function} -* @see {@link module:@stdlib/blas/base/zswap} -*/ -setReadOnly( blas, 'zswap', require( '@stdlib/blas/base/zswap' ) ); - // EXPORTS // -module.exports = blas; +module.exports = fftpack; From b3a1fff79bbbe7d6513080253f1ac2e46af3f36a Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sat, 21 Dec 2024 11:23:30 +0530 Subject: [PATCH 007/102] Update main.c Signed-off-by: Gunj Joshi --- lib/node_modules/@stdlib/math/base/special/log1p/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c index 543b9250ead8..0226de4fff8d 100644 --- a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c @@ -311,7 +311,7 @@ double stdlib_base_log1p( const double x ) { } // Apply a bit mask (0 00000000000 11111111111111111111) to remove the exponent: hu &= 0x000fffff; // max value => 0x000fffff => 1048575 - + // The approximation to sqrt(2) used in thresholds is not critical. However, the ones used above must give less strict bounds than the one here so that the k==0 case is never reached from here, since here we have committed to using the correction term but don't use it if k==0. // Check if u significand is less than sqrt(2) significand => 0x6a09e => 01101010000010011110 From d793f7f63331127223be457f8ceb0f955b593cd7 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sat, 21 Dec 2024 11:23:53 +0530 Subject: [PATCH 008/102] Update main.c Signed-off-by: Gunj Joshi --- lib/node_modules/@stdlib/math/base/special/log1p/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c index 0226de4fff8d..7d19fbb2f229 100644 --- a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c @@ -311,7 +311,7 @@ double stdlib_base_log1p( const double x ) { } // Apply a bit mask (0 00000000000 11111111111111111111) to remove the exponent: hu &= 0x000fffff; // max value => 0x000fffff => 1048575 - + // The approximation to sqrt(2) used in thresholds is not critical. However, the ones used above must give less strict bounds than the one here so that the k==0 case is never reached from here, since here we have committed to using the correction term but don't use it if k==0. // Check if u significand is less than sqrt(2) significand => 0x6a09e => 01101010000010011110 From 82bc096526c60a5bacf1fe8b7ee47eb714dd2416 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sat, 21 Dec 2024 12:13:50 +0530 Subject: [PATCH 009/102] Update c2_ref.js Signed-off-by: Gunj Joshi --- lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js index 5564c90dd344..505b910b4ec7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js @@ -66,7 +66,6 @@ * @private * @param {number} a1 - Index of first dimension. * @param {number} a2 - Index of second dimension. -* @param {Float64Array} c2 - Secondary intermediate array for FFT computations. * @param {number} idl1 - Stride related to the `l1` parameter. * @returns {number} - Calculated index. */ From d74a322d492ee5f46c4fe64719c0e5d682e6c5ff Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 23 Dec 2024 11:14:58 +0530 Subject: [PATCH 010/102] docs: update parameter descriptions, disable eslint max len at top level --- .../@stdlib/fft/base/fftpack/lib/c1_ref.js | 12 ++-- .../@stdlib/fft/base/fftpack/lib/c2_ref.js | 10 +-- .../@stdlib/fft/base/fftpack/lib/cc_ref.js | 12 ++-- .../@stdlib/fft/base/fftpack/lib/ch2_ref.js | 8 +-- .../@stdlib/fft/base/fftpack/lib/ch_ref.js | 12 ++-- .../@stdlib/fft/base/fftpack/lib/passb2.js | 12 ++-- .../@stdlib/fft/base/fftpack/lib/passb3.js | 38 ++++++------ .../@stdlib/fft/base/fftpack/lib/passb4.js | 48 ++++++++------- .../@stdlib/fft/base/fftpack/lib/passfb.js | 61 ++++++++++--------- 9 files changed, 111 insertions(+), 102 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js index cdfe73c6cc88..296bacb5aa15 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js @@ -64,12 +64,12 @@ * 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. +* @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; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js index 5564c90dd344..f5117aaffbe0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js @@ -64,11 +64,11 @@ * Performs a pass of the FFT algorithm. * * @private -* @param {number} a1 - Index of first dimension. -* @param {number} a2 - Index of second dimension. -* @param {Float64Array} c2 - Secondary intermediate array for FFT computations. -* @param {number} idl1 - Stride related to the `l1` parameter. -* @returns {number} - Calculated index. +* @param {number} a1 - index of first dimension +* @param {number} a2 - index of second dimension +* @param {Float64Array} c2 - secondary intermediate array for FFT computations +* @param {number} idl1 - stride related to the `l1` parameter +* @returns {number} - calculated index */ function c2Ref( a1, a2, idl1 ) { return ( a2 * idl1 ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js index 093d103cb387..b9dd88546695 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js @@ -64,12 +64,12 @@ * 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. +* @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; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js index 8ee2616edf54..6e5cd3740ec4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js @@ -64,10 +64,10 @@ * 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. +* @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 ch2Ref ( a1, a2, idl1 ) { return ( a2 * idl1 ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js index 04d5d01380e8..64de6b608e02 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js @@ -64,12 +64,12 @@ * 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. +* @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 chRef ( a1, a2, a3, l1, ido ) { return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js index f145f7133d71..24d7c22dd94d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js @@ -56,6 +56,8 @@ * ``` */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // @@ -70,11 +72,11 @@ var ccRef = require( './cc_ref.js' ); * Performs a pass of length 2 of the FFT algorithm. * * @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 - Array of twiddle factors +* @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 - array of twiddle factors * @returns {void} */ function passb2( ido, l1, cc, ch, wa1 ) { diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index cde03b93929b..b88dd0650586 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -56,6 +56,8 @@ * ``` */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // @@ -76,12 +78,12 @@ var taui = 0.866025403784439; * Performs a pass of length 3 of the FFT algorithm. * * @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 +* @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 passb3( ido, l1, cc, ch, wa1, wa2 ) { @@ -107,14 +109,14 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + tr2; // eslint-disable-line max-len - ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + tr2; + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ]; ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ti2; // eslint-disable-line max-len - cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len - ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ti2; + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ] ); + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ] ); ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci3; ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr2 + ci3; ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + ci3; @@ -123,14 +125,14 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ]; cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + tr2; // eslint-disable-line max-len - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ]; ci2 = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ti2; // eslint-disable-line max-len - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ] ); // eslint-disable-line max-len + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ] ); dr2 = cr2 - ci3; dr3 = cr2 + ci3; di2 = ci2 + ci3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js index 0836ef0171f1..2175e5ec9043 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -56,6 +56,8 @@ * ``` */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // @@ -70,13 +72,13 @@ var ccRef = require( './cc_ref.js' ); * Performs a pass of length 4 of the FFT algorithm. * * @private -* @param {integer} ido - Number of real values for each transform -* @param {integer} 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 -* @param {Float64Array} wa3 - Third array of twiddle factors +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 +* @param {Float64Array} wa3 - third array of twiddle factors * @returns {void} */ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { @@ -106,14 +108,14 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; + tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ]; + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; + ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = tr2 - tr3; ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; @@ -126,14 +128,14 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr4 = cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; + tr4 = cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; + ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; cr3 = tr2 - tr3; ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index 6d7401db3d2a..f48825baff37 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -56,8 +56,11 @@ * ``` */ +/* eslint-disable max-len */ + 'use strict'; + // MODULES // var c1Ref = require( './c1_ref.js' ); @@ -73,18 +76,18 @@ var ccRef = require( './cc_ref.js' ); * Performs a pass of the FFT algorithm. * * @private -* @param {Float64Array} nac - Number of FFT passes. -* @param {number} ido - Dimension order for input/output arrays. -* @param {number} ip - Number of sub-steps or prime factors in the FFT. -* @param {number} l1 - Length parameter related to the FFT stage. -* @param {number} idl1 - Stride related to the `l1` parameter. -* @param {Float64Array} cc - Input array containing complex data for FFT computation. -* @param {Float64Array} c1 - Intermediate array for FFT computations. -* @param {Float64Array} c2 - Secondary intermediate array for FFT computations. -* @param {Float64Array} ch - Output array for storing processed FFT data. -* @param {Float64Array} ch2 - Secondary output array for storing processed FFT data. -* @param {Float64Array} wa - Twiddle factor array used in FFT calculations. -* @param {number} fsign - Sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse). +* @param {Float64Array} nac - number of FFT passes +* @param {number} ido - dimension order for input/output arrays +* @param {number} ip - number of sub-steps or prime factors in the FFT +* @param {number} l1 - length parameter related to the FFT stage +* @param {number} idl1 - stride related to the `l1` parameter +* @param {Float64Array} cc - input array containing complex data for FFT computation +* @param {Float64Array} c1 - intermediate array for FFT computations +* @param {Float64Array} c2 - secondary intermediate array for FFT computations +* @param {Float64Array} ch - output array for storing processed FFT data +* @param {Float64Array} ch2 - secondary output array for storing processed FFT data +* @param {Float64Array} wa - twiddle factor array used in FFT calculations +* @param {number} fsign - sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse) * @returns {void} */ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { @@ -129,8 +132,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { jc = ipp2 - j; for ( k = 1; k <= l1; ++k ) { for ( i = 1; i <= ido; ++i ) { - ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len - ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; + ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; } } } @@ -144,8 +147,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { jc = ipp2 - j; for ( i = 1; i <= ido; ++i ) { for ( k = 1; k <= l1; ++k ) { - ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len - ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; // eslint-disable-line max-len + ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; + ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; } } } @@ -161,8 +164,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { lc = ipp2 - l; idl += ido; for ( ik = 1; ik <= idl1; ++ik ) { - c2[ c2Ref( ik, l, idl1 ) - c2_offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2_offset ] ); // eslint-disable-line max-len - c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + c2[ c2Ref( ik, l, idl1 ) - c2_offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2_offset ] ); + c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2_offset ]; } idlj = idl; inc += ido; @@ -175,23 +178,23 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { war = wa[ idlj - 1 - 1 ]; wai = wa[ idlj - 1 ]; for ( ik = 1; ik <= idl1; ++ik ) { - c2[ c2Ref( ik, l, idl1 ) - c2_offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; // eslint-disable-line max-len - c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + c2[ c2Ref( ik, l, idl1 ) - c2_offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; + c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ]; } } } for ( j = 2; j <= ipph; ++j ) { for ( ik = 1; ik <= idl1; ++ik ) { - ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; // eslint-disable-line max-len + ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; } } for ( j = 2; j <= ipph; ++j ) { jc = ipp2 - j; for ( ik = 2; ik <= idl1; ik += 2 ) { - ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len - ch2[ ch2Ref( ik - 1, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len - ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len - ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; // eslint-disable-line max-len + ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; + ch2[ ch2Ref( ik - 1, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; + ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; + ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; } } nac[ 0 ] = 1; @@ -215,8 +218,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { for ( i = 4; i <= ido; i += 2 ) { idij += 2; for ( k = 1; k <= l1; ++k ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) ; // eslint-disable-line max-len - c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) ; // eslint-disable-line max-len + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) ; + c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) ; } } } @@ -229,8 +232,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { idij = idj; for ( i = 4; i <= ido; i += 2 ) { idij += 2; - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ); // eslint-disable-line max-len - c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ); // eslint-disable-line max-len + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ); + c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ); } } } From e9c30a77c24297b9a7b8b9d0ebba2f56af104aef Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 24 Dec 2024 13:05:59 +0530 Subject: [PATCH 011/102] feat: add passfb5.js --- .../@stdlib/fft/base/fftpack/lib/passfb5.js | 129 +++++++++++------- 1 file changed, 81 insertions(+), 48 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index cef2f514b302..5844bf3b3633 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -64,21 +64,29 @@ var chRef = require( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); +// VARIABLES // + +var TR11 = 0.309016994374947; +var TI11 = 0.951056516295154; +var TR12 = -0.809016994374947; +var TI12 = 0.587785252292473 + + // MAIN // /** * Performs a pass of length 5 of the FFT algorithm with a sign factor. * * @private -* @param {integer} ido - Number of real values for each transform -* @param {integer} 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 -* @param {Float64Array} wa3 - Third array of twiddle factors -* @param {Float64Array} wa4 - Fourth array of twiddle factors -* @param {number} fsign - Sign factor for the FFT computation +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 +* @param {Float64Array} wa3 - third array of twiddle factors +* @param {Float64Array} wa4 - fourth array of twiddle factors +* @param {number} fsign - sign factor for the FFT computation * @returns {void} */ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { @@ -111,55 +119,80 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { var i; var k; + TI11 *= fsign; + TI12 *= fsign; + // Parameter adjustments... ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * 5 ); + cc_offset = 1 + ( ido * 6 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; - ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = tr2 - tr3; - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; - ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ti2 - ti3; - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = tr1 + tr4; - ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = tr1 - tr4; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ti1 + ti4; - ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ti1 - ti4; + ti5 = cc[ ccRef( 2, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( 2, 5, k, 5, ido ) - cc_offset ]; + ti2 = cc[ ccRef( 2, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( 2, 5, k, 5, ido ) - cc_offset ]; + ti4 = cc[ ccRef( 2, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( 2, 4, k, 5, ido ) - cc_offset ]; + ti3 = cc[ ccRef( 2, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 5, ido ) - cc_offset ]; + tr5 = cc[ ccRef( 1, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( 1, 5, k, 5, ido ) - cc_offset ]; + tr2 = cc[ ccRef( 1, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( 1, 5, k, 5, ido ) - cc_offset ]; + tr4 = cc[ ccRef( 1, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 5, ido ) - cc_offset ]; + tr3 = cc[ ccRef( 1, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 5, ido ) - cc_offset ]; + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 5, ido ) - cc_offset ] + tr2 + tr3; + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 5, ido ) - cc_offset ] + ti2 + ti3; + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - cc_offset ] + TR11 * tr2 + TR12 * tr3; + ci2 = cc[ ccRef( 2, 1, k, 5, ido ) - cc_offset ] + TR11 * ti2 + TR12 * ti3; + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - cc_offset ] + TR12 * tr2 + TR11 * tr3; + ci3 = cc[ ccRef( 2, 1, k, 5, ido ) - cc_offset ] + TR12 * ti2 + TR11 * ti3; + cr5 = TI11 * tr5 + TI12 * tr4; + ci5 = TI11 * ti5 + TI12 * ti4; + cr4 = TI12 * tr5 - TI11 * tr4; + ci4 = TI12 * ti5 - TI11 * ti4; + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci5; + ch[ chRef( 1, k, 5, l1, ido ) - ch_offset ] = cr2 + ci5; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + cr5; + ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ci3 + cr4; + ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr3 - ci4; + ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = cr3 + ci4; + ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ci3 - cr4; + ch[ chRef( 2, k, 5, l1, ido ) - ch_offset ] = ci2 - cr5; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr4 = cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; // eslint-disable-line max-len - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; - cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; - ci3 = ti2 - ti3; - cr2 = tr1 + tr4; - cr4 = tr1 - tr4; - ci2 = ti1 + ti4; - ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); + ti5 = cc[ ccRef( i, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( i, 5, k, 5, ido ) - cc_offset ]; + ti2 = cc[ ccRef( i, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( i, 5, k, 5, ido ) - cc_offset ]; + ti4 = cc[ ccRef( i, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( i, 4, k, 5, ido ) - cc_offset ]; + ti3 = cc[ ccRef( i, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 5, ido ) - cc_offset ]; + tr5 = cc[ ccRef( i - 1, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( i - 1, 5, k, 5, ido ) - cc_offset ]; + tr2 = cc[ ccRef( i - 1, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( i - 1, 5, k, 5, ido ) - cc_offset ]; + tr4 = cc[ ccRef( i - 1, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 5, ido ) - cc_offset ]; + tr3 = cc[ ccRef( i - 1, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 5, ido ) - cc_offset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - cc_offset ] + tr2 + tr3; + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 5, ido ) - cc_offset ] + ti2 + ti3; + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - cc_offset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) - cc_offset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - cc_offset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) - cc_offset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); + ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); + cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); + ci4 = ( TI12 * ti5 ) - ( TI11 * ti4 ); + dr3 = cr3 - ci4; + dr4 = cr3 + ci4; + di3 = ci3 + cr4; + di4 = ci3 - cr4; + dr5 = cr2 + ci5; + dr2 = cr2 - ci5; + di5 = ci2 - cr5; + di2 = ci2 + cr5; + ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 2 ] * dr2 ) - ( fsign * wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 2 ] * di2 ) + ( fsign * wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 2 ] * dr3 ) - ( fsign * wa2[ i - 1 ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 2 ] * di3 ) + ( fsign * wa2[ i - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 2 ] * dr4 ) - ( fsign * wa3[ i - 1 ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 2 ] * di4 ) + ( fsign * wa3[ i - 1 ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 2 ] * dr5 ) - ( fsign * wa4[ i - 1 ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 2 ] * di5 ) + ( fsign * wa4[ i - 1 ] * dr5 ); } } } From 3eac4263f5322dbc07ca826a2e0f1508bd07f297 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 24 Dec 2024 13:07:14 +0530 Subject: [PATCH 012/102] docs: add eslint comment --- lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 5844bf3b3633..396a07460bc2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -56,6 +56,8 @@ * ``` */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // From 80a4f21c923afa01a9349ce681b7ae1a8fca5c85 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 24 Dec 2024 23:06:18 +0530 Subject: [PATCH 013/102] feat: add passf2, passf3 --- .../@stdlib/fft/base/fftpack/lib/passf2.js | 119 ++++++++++++++ .../@stdlib/fft/base/fftpack/lib/passf3.js | 152 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/passfb5.js | 16 +- 3 files changed, 279 insertions(+), 8 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js new file mode 100644 index 000000000000..0e059718a97d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -0,0 +1,119 @@ +/** +* @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( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); +var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); + + +// MAIN // + +/** +* Performs a pass of length 2 of the FFT algorithm. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 - array of twiddle factors +* @returns {void} +*/ +function passf2( ido, l1, cc, ch, wa1 ) { + var ch_offset; + var cc_offset; + var ti2; + var tr2; + var i; + var k; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido * 3 ); + + // Function body: + if ( ido == 2 ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; + } + } else { + for ( k = 1; k <= l1; ++k ) { + for ( i = 2; i <= ido; i += 2 ) { + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); + } + } + } +} + + +// EXPORTS // + +module.exports = passf2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js new file mode 100644 index 000000000000..80658034bbcb --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -0,0 +1,152 @@ +/** +* @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( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); +var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); + + +// VARIABLES // + +var taur = -0.5; +var taui = -0.866025403784439; + + +// MAIN // + +/** +* Performs a pass of length 3 of the FFT algorithm. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 passf3( ido, l1, cc, ch, wa1, wa2 ) { + var ch_offset; + var cc_offset; + var ci2; + var ci3; + var di2; + var di3; + var cr2; + var cr3; + var dr2; + var dr3; + var ti2; + var tr2; + var i; + var k; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido << 2 ); + + // Function body: + if ( ido == 2 ) { + for ( k = 1; k <= l1; ++k ) { + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + tr2; + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ]; + ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ti2; + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ] ); + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ] ); + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr2 + ci3; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + cr3; + ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ci2 - cr3; + } + } else { + for ( k = 1; k <= l1; ++k ) { + for ( i = 2; i <= ido; i += 2 ) { + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ] ); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + cr3; + di3 = ci2 - cr3; + ch[ chRef( i, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * di2 ) - ( wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * dr2 ) + ( wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * di3 ) - ( wa2[ i - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( wa2[ i - 1 ] * dr3 ); + } + } + } +} + + +// EXPORTS // + +module.exports = passf3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 396a07460bc2..f5bd3bcec223 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -187,14 +187,14 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { dr2 = cr2 - ci5; di5 = ci2 - cr5; di2 = ci2 + cr5; - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 2 ] * dr2 ) - ( fsign * wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 2 ] * di2 ) + ( fsign * wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 2 ] * dr3 ) - ( fsign * wa2[ i - 1 ] * di3 ); - ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 2 ] * di3 ) + ( fsign * wa2[ i - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 2 ] * dr4 ) - ( fsign * wa3[ i - 1 ] * di4 ); - ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 2 ] * di4 ) + ( fsign * wa3[ i - 1 ] * dr4 ); - ch[ chRef( i - 1, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 2 ] * dr5 ) - ( fsign * wa4[ i - 1 ] * di5 ); - ch[ chRef( i, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 2 ] * di5 ) + ( fsign * wa4[ i - 1 ] * dr5 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( fsign * wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( fsign * wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( fsign * wa2[ i - 1 ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( fsign * wa2[ i - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * dr4 ) - ( fsign * wa3[ i - 1 ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * di4 ) + ( fsign * wa3[ i - 1 ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 1 - 1 ] * dr5 ) - ( fsign * wa4[ i - 1 ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 1 - 1 ] * di5 ) + ( fsign * wa4[ i - 1 ] * dr5 ); } } } From d978c432ff28cd007bbe47f07223e7b440fb251b Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 24 Dec 2024 23:06:59 +0530 Subject: [PATCH 014/102] Update main.c Signed-off-by: Gunj Joshi --- lib/node_modules/@stdlib/math/base/special/log1p/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c index 543b9250ead8..7d19fbb2f229 100644 --- a/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/log1p/src/main.c @@ -311,7 +311,7 @@ double stdlib_base_log1p( const double x ) { } // Apply a bit mask (0 00000000000 11111111111111111111) to remove the exponent: hu &= 0x000fffff; // max value => 0x000fffff => 1048575 - + // The approximation to sqrt(2) used in thresholds is not critical. However, the ones used above must give less strict bounds than the one here so that the k==0 case is never reached from here, since here we have committed to using the correction term but don't use it if k==0. // Check if u significand is less than sqrt(2) significand => 0x6a09e => 01101010000010011110 From b6ced124d5ba66faad60f744782688fb91d4615d Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 24 Dec 2024 23:59:32 +0530 Subject: [PATCH 015/102] feat: add passf4 --- .../@stdlib/fft/base/fftpack/lib/c2_ref.js | 1 - .../@stdlib/fft/base/fftpack/lib/passf2.js | 2 +- .../@stdlib/fft/base/fftpack/lib/passf3.js | 2 +- .../@stdlib/fft/base/fftpack/lib/passf4.js | 161 ++++++++++++++++++ 4 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js index f5117aaffbe0..16b77043128f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js @@ -66,7 +66,6 @@ * @private * @param {number} a1 - index of first dimension * @param {number} a2 - index of second dimension -* @param {Float64Array} c2 - secondary intermediate array for FFT computations * @param {number} idl1 - stride related to the `l1` parameter * @returns {number} - calculated index */ diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js index 0e059718a97d..453b6f284648 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -92,7 +92,7 @@ function passf2( ido, l1, cc, ch, wa1 ) { cc_offset = 1 + ( ido * 3 ); // Function body: - if ( ido == 2 ) { + if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index 80658034bbcb..f57611fcf354 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -107,7 +107,7 @@ function passf3( ido, l1, cc, ch, wa1, wa2 ) { cc_offset = 1 + ( ido << 2 ); // Function body: - if ( ido == 2 ) { + if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js new file mode 100644 index 000000000000..9c3f2329af7b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js @@ -0,0 +1,161 @@ +/** +* @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( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); +var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); + + +// MAIN // + +/** +* Performs a pass of length 4 of the FFT algorithm. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 +* @param {Float64Array} wa3 - third array of twiddle factors +* @returns {void} +*/ +function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { + var ch_offset; + var cc_offset; + var ci2; + var ci3; + var ci4; + var cr2; + var cr3; + var cr4; + var ti1; + var ti2; + var ti3; + var ti4; + var tr1; + var tr2; + var tr3; + var tr4; + var i; + var k; + + // Parameter adjustments... + ch_offset = 1 + ( ido * ( 1 + l1 ) ); + cc_offset = 1 + ( ido * 5 ); + + // Function body: + if ( ido === 2 ) { + for ( k = 1; k <= l1; ++k ) { + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; + tr4 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; + ti4 = cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ]; + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; + ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; + ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = tr2 - tr3; + ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; + ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ti2 - ti3; + ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = tr1 + tr4; + ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = tr1 - tr4; + ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ti1 + ti4; + ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ti1 - ti4; + } + } else { + for ( k = 1; k <= l1; ++k ) { + for ( i = 2; i <= ido; i += 2 ) { + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; + tr4 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; + ti4 = cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; + cr3 = tr2 - tr3; + ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 + tr4; + cr4 = tr1 - tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * cr2 ) + ( wa1[ i - 1 ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ci2 ) - ( wa1[ i - 1 ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * cr3 ) + ( wa2[ i - 1 ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * ci3 ) - ( wa2[ i - 1 ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * cr4 ) + ( wa3[ i - 1 ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * ci4 ) - ( wa3[ i - 1 ] * cr4 ); + } + } + } +} + + +// EXPORTS // + +module.exports = passf4; From 29f463aa2806144b1d8d4a5ff04b16725ea3448b Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 25 Dec 2024 00:14:56 +0530 Subject: [PATCH 016/102] docs: remove spaces before parenthesis, update variable names --- .../@stdlib/fft/base/fftpack/lib/cc_ref.js | 2 +- .../@stdlib/fft/base/fftpack/lib/ch2_ref.js | 2 +- .../@stdlib/fft/base/fftpack/lib/ch_ref.js | 2 +- .../@stdlib/fft/base/fftpack/lib/passb2.js | 28 ++--- .../@stdlib/fft/base/fftpack/lib/passb3.js | 56 ++++----- .../@stdlib/fft/base/fftpack/lib/passb4.js | 72 ++++++------ .../@stdlib/fft/base/fftpack/lib/passf2.js | 32 ++--- .../@stdlib/fft/base/fftpack/lib/passf3.js | 60 +++++----- .../@stdlib/fft/base/fftpack/lib/passf4.js | 76 ++++++------ .../@stdlib/fft/base/fftpack/lib/passfb.js | 67 ++++++----- .../@stdlib/fft/base/fftpack/lib/passfb5.js | 110 +++++++++--------- 11 files changed, 253 insertions(+), 254 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js index b9dd88546695..fb95bf4a5301 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js @@ -71,7 +71,7 @@ * @param {number} ido - dimension order * @returns {number} - calculated index */ -function ccRef ( a1, a2, a3, ip, ido ) { +function ccRef( a1, a2, a3, ip, ido ) { return ( ( ( a3 * ip ) + a2 ) * ido ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js index 6e5cd3740ec4..d577f833bcaf 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js @@ -69,7 +69,7 @@ * @param {number} idl1 - stride related to the `l1` parameter * @returns {number} - calculated index */ -function ch2Ref ( a1, a2, idl1 ) { +function ch2Ref( a1, a2, idl1 ) { return ( a2 * idl1 ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js index 64de6b608e02..614300655439 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js @@ -71,7 +71,7 @@ * @param {number} ido - dimension order * @returns {number} - calculated index */ -function chRef ( a1, a2, a3, l1, ido ) { +function chRef( a1, a2, a3, l1, ido ) { return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js index 24d7c22dd94d..ba322aae0e96 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js @@ -80,35 +80,35 @@ var ccRef = require( './cc_ref.js' ); * @returns {void} */ function passb2( ido, l1, cc, ch, wa1 ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ti2; var tr2; var i; var k; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * 3 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 3 ); // Function body: if ( ido <= 2 ) { for ( k = 1; k <= l1; ++k ) { - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; } return; } for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index b88dd0650586..a85762a1b43c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -87,8 +87,8 @@ var taui = 0.866025403784439; * @returns {void} */ function passb3( ido, l1, cc, ch, wa1, wa2 ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ci2; var ci3; var di2; @@ -103,44 +103,44 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { var k; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido << 2 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido << 2 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; - cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + tr2; - ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ]; - ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ti2; - cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ] ); - ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ] ); - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci3; - ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr2 + ci3; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + ci3; - ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ci2 - cr3; + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ] ); + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr2 + ci3; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + ci3; + ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + tr2; - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ] ); - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ] ); + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); dr2 = cr2 - ci3; dr3 = cr2 + ci3; di2 = ci2 + ci3; di3 = ci2 - cr3; - ch[ chRef( i, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); - ch[ chRef( i - 1, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); + ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); + ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js index 2175e5ec9043..2d8cc32f65ea 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -82,8 +82,8 @@ var ccRef = require( './cc_ref.js' ); * @returns {void} */ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ci2; var ci3; var ci4; @@ -102,54 +102,54 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { var k; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * 5 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 5 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; - ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; - tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ]; - ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; - ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; - tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; - ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = tr2 - tr3; - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; - ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ti2 - ti3; - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = tr1 + tr4; - ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = tr1 - tr4; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ti1 + ti4; - ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ti1 - ti4; + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; + tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ]; + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = tr2 - tr3; + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ti2 - ti3; + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = tr1 + tr4; + ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = tr1 - tr4; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ti1 + ti4; + ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; - tr4 = cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ]; - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; - ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; + tr4 = cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; ci3 = ti2 - ti3; cr2 = tr1 + tr4; cr4 = tr1 - tr4; ci2 = ti1 + ti4; ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js index 453b6f284648..b84f79487634 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -62,8 +62,8 @@ // MODULES // -var chRef = require( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); -var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); // MAIN // @@ -80,34 +80,34 @@ var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); * @returns {void} */ function passf2( ido, l1, cc, ch, wa1 ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ti2; var tr2; var i; var k; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * 3 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 3 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( 2, 2, k, 2, ido ) - cc_offset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] + cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ]; - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index f57611fcf354..14dc8d4c7dc8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -62,8 +62,8 @@ // MODULES // -var chRef = require( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); -var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); // VARIABLES // @@ -87,8 +87,8 @@ var taui = -0.866025403784439; * @returns {void} */ function passf3( ido, l1, cc, ch, wa1, wa2 ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ci2; var ci3; var di2; @@ -103,44 +103,44 @@ function passf3( ido, l1, cc, ch, wa1, wa2 ) { var k; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido << 2 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido << 2 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ]; - cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 3, ido ) - cc_offset ] + tr2; - ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ]; - ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 3, ido ) - cc_offset ] + ti2; - cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 3, ido ) - cc_offset ] ); - ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 3, ido ) - cc_offset ] ); - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci3; - ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr2 + ci3; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + cr3; - ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ci2 - cr3; + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ] ); + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr2 + ci3; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + cr3; + ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - cc_offset ] + tr2; - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 3, ido ) - cc_offset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - cc_offset ] ); - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 3, ido ) - cc_offset ] ); + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); dr2 = cr2 - ci3; dr3 = cr2 + ci3; di2 = ci2 + cr3; di3 = ci2 - cr3; - ch[ chRef( i, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * di2 ) - ( wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 2, l1, ido) - ch_offset ] = ( wa1[ i - 1 - 1 ] * dr2 ) + ( wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * di3 ) - ( wa2[ i - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 3, l1, ido) - ch_offset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( wa2[ i - 1 ] * dr3 ); + ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) - ( wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) + ( wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) - ( wa2[ i - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( wa2[ i - 1 ] * dr3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js index 9c3f2329af7b..ace4deba1f18 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js @@ -62,8 +62,8 @@ // MODULES // -var chRef = require( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); -var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); // MAIN // @@ -82,8 +82,8 @@ var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); * @returns {void} */ function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ci2; var ci3; var ci4; @@ -102,54 +102,54 @@ function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { var k; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * 5 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 5 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; - ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 3, k, 4, ido ) - cc_offset ]; - tr4 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; - ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 4, ido ) - cc_offset ]; - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 3, k, 4, ido ) - cc_offset ]; - ti4 = cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ]; - tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 4, ido ) - cc_offset ]; - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; - ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = tr2 - tr3; - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; - ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ti2 - ti3; - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = tr1 + tr4; - ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = tr1 - tr4; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ti1 + ti4; - ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ti1 - ti4; + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; + tr4 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = tr2 - tr3; + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ti2 - ti3; + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = tr1 + tr4; + ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = tr1 - tr4; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ti1 + ti4; + ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 3, k, 4, ido ) - cc_offset ]; - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; - tr4 = cc[ ccRef( i, 2, k, 4, ido ) - cc_offset ] - cc[ ccRef( i, 4, k, 4, ido ) - cc_offset ]; - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - cc_offset ]; - ti4 = cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ]; - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - cc_offset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = tr2 + tr3; + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; + tr4 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = ti2 + ti3; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; ci3 = ti2 - ti3; cr2 = tr1 + tr4; cr4 = tr1 - tr4; ci2 = ti1 + ti4; ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * cr2 ) + ( wa1[ i - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ci2 ) - ( wa1[ i - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * cr3 ) + ( wa2[ i - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * ci3 ) - ( wa2[ i - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * cr4 ) + ( wa3[ i - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * ci4 ) - ( wa3[ i - 1 ] * cr4 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * cr2 ) + ( wa1[ i - 1 ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ci2 ) - ( wa1[ i - 1 ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * cr3 ) + ( wa2[ i - 1 ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * ci3 ) - ( wa2[ i - 1 ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * cr4 ) + ( wa3[ i - 1 ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * ci4 ) - ( wa3[ i - 1 ] * cr4 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index f48825baff37..244e253ebb8e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -60,7 +60,6 @@ 'use strict'; - // MODULES // var c1Ref = require( './c1_ref.js' ); @@ -90,12 +89,12 @@ var ccRef = require( './cc_ref.js' ); * @param {number} fsign - sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse) * @returns {void} */ -function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { - var ch2_offset; - var ch_offset; - var cc_offset; - var c1_offset; - var c2_offset; +function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // eslint-disable-line max-params + var ch2Offset; + var chOffset; + var ccOffset; + var c1Offset; + var c2Offset; var ipp2; var idij; var idlj; @@ -116,11 +115,11 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { var l; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - c1_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * ( 1 + ip ) ); - ch2_offset = 1 + idl1; - c2_offset = 1 + idl1; + chOffset = 1 + ( ido * ( 1 + l1 ) ); + c1Offset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * ( 1 + ip ) ); + ch2Offset = 1 + idl1; + c2Offset = 1 + idl1; // Function body: idot = ido / 2; @@ -132,14 +131,14 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { jc = ipp2 - j; for ( k = 1; k <= l1; ++k ) { for ( i = 1; i <= ido; ++i ) { - ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; - ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; } } } for ( k = 1; k <= l1; ++k ) { for ( i = 1; i <= ido; ++i ) { - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, ip, ido ) - cc_offset ]; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; } } } else { @@ -147,14 +146,14 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { jc = ipp2 - j; for ( i = 1; i <= ido; ++i ) { for ( k = 1; k <= l1; ++k ) { - ch[ chRef( i, k, j, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] + cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; - ch[ chRef( i, k, jc, l1, ido ) - ch_offset ] = cc[ ccRef( i, j, k, ip, ido ) - cc_offset ] - cc[ ccRef( i, jc, k, ip, ido ) - cc_offset ]; + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; } } } for ( i = 1; i <= ido; ++i ) { for ( k = 1; k <= l1; ++k ) { - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, ip, ido ) - cc_offset ]; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; } } } @@ -164,8 +163,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { lc = ipp2 - l; idl += ido; for ( ik = 1; ik <= idl1; ++ik ) { - c2[ c2Ref( ik, l, idl1 ) - c2_offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2_offset ] ); - c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2_offset ]; + c2[ c2Ref( ik, l, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2Offset ]; } idlj = idl; inc += ido; @@ -178,23 +177,23 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { war = wa[ idlj - 1 - 1 ]; wai = wa[ idlj - 1 ]; for ( ik = 1; ik <= idl1; ++ik ) { - c2[ c2Ref( ik, l, idl1 ) - c2_offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; - c2[ c2Ref( ik, lc, idl1 ) - c2_offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ]; + c2[ c2Ref( ik, l, idl1 ) - c2Offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ]; } } } for ( j = 2; j <= ipph; ++j ) { for ( ik = 1; ik <= idl1; ++ik ) { - ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ]; + ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; } } for ( j = 2; j <= ipph; ++j ) { jc = ipp2 - j; for ( ik = 2; ik <= idl1; ik += 2 ) { - ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; - ch2[ ch2Ref( ik - 1, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik, jc, idl1 ) - c2_offset ]; - ch2[ ch2Ref( ik, j, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; - ch2[ ch2Ref( ik, jc, idl1 ) - ch2_offset ] = c2[ c2Ref( ik, j, idl1 ) - c2_offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) - c2_offset ]; + ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2Offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik - 1, jc, idl1 ) - ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2Offset ] + c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) - c2Offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) - c2Offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) - c2Offset ]; } } nac[ 0 ] = 1; @@ -203,12 +202,12 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { } nac[ 0 ] = 0; for ( ik = 1; ik <= idl1; ++ik ) { - c2[ c2Ref( ik, 1, idl1 ) - c2_offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2_offset ]; + c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; } for ( j = 2; j <= ip; ++j ) { for ( k = 1; k <= l1; ++k ) { - c1[ c1Ref( 1, k, j, l1, ido ) - c1_offset ] = ch[ chRef( 1, k, j, l1, ido ) - ch_offset ]; - c1[ c1Ref( 2, k, j, l1, ido ) - c1_offset ] = ch[ chRef( 2, k, j, l1, ido ) - ch_offset ]; + c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; + c1[ c1Ref( 2, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 2, k, j, l1, ido ) - chOffset ]; } } if ( idot <= l1 ) { @@ -218,8 +217,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { for ( i = 4; i <= ido; i += 2 ) { idij += 2; for ( k = 1; k <= l1; ++k ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) ; - c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) ; + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); } } } @@ -232,8 +231,8 @@ function passfb ( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { idij = idj; for ( i = 4; i <= ido; i += 2 ) { idij += 2; - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ); - c1[ c1Ref( i, k, j, l1, ido ) - c1_offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - ch_offset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - ch_offset ] ); + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index f5bd3bcec223..16412d20cacf 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -62,8 +62,8 @@ // MODULES // -var chRef = require( '@stdlib/fft/base/fftpack/lib/ch_ref.js' ); -var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); // VARIABLES // @@ -71,7 +71,7 @@ var ccRef = require( '@stdlib/fft/base/fftpack/lib/cc_ref.js' ); var TR11 = 0.309016994374947; var TI11 = 0.951056516295154; var TR12 = -0.809016994374947; -var TI12 = 0.587785252292473 +var TI12 = 0.587785252292473; // MAIN // @@ -92,8 +92,8 @@ var TI12 = 0.587785252292473 * @returns {void} */ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { - var ch_offset; - var cc_offset; + var chOffset; + var ccOffset; var ci2; var ci3; var ci4; @@ -125,56 +125,56 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { TI12 *= fsign; // Parameter adjustments... - ch_offset = 1 + ( ido * ( 1 + l1 ) ); - cc_offset = 1 + ( ido * 6 ); + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 6 ); // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; ++k ) { - ti5 = cc[ ccRef( 2, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( 2, 5, k, 5, ido ) - cc_offset ]; - ti2 = cc[ ccRef( 2, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( 2, 5, k, 5, ido ) - cc_offset ]; - ti4 = cc[ ccRef( 2, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( 2, 4, k, 5, ido ) - cc_offset ]; - ti3 = cc[ ccRef( 2, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( 2, 4, k, 5, ido ) - cc_offset ]; - tr5 = cc[ ccRef( 1, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( 1, 5, k, 5, ido ) - cc_offset ]; - tr2 = cc[ ccRef( 1, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( 1, 5, k, 5, ido ) - cc_offset ]; - tr4 = cc[ ccRef( 1, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( 1, 4, k, 5, ido ) - cc_offset ]; - tr3 = cc[ ccRef( 1, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( 1, 4, k, 5, ido ) - cc_offset ]; - ch[ chRef( 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 1, 1, k, 5, ido ) - cc_offset ] + tr2 + tr3; - ch[ chRef( 2, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( 2, 1, k, 5, ido ) - cc_offset ] + ti2 + ti3; - cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - cc_offset ] + TR11 * tr2 + TR12 * tr3; - ci2 = cc[ ccRef( 2, 1, k, 5, ido ) - cc_offset ] + TR11 * ti2 + TR12 * ti3; - cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - cc_offset ] + TR12 * tr2 + TR11 * tr3; - ci3 = cc[ ccRef( 2, 1, k, 5, ido ) - cc_offset ] + TR12 * ti2 + TR11 * ti3; - cr5 = TI11 * tr5 + TI12 * tr4; - ci5 = TI11 * ti5 + TI12 * ti4; - cr4 = TI12 * tr5 - TI11 * tr4; - ci4 = TI12 * ti5 - TI11 * ti4; - ch[ chRef( 1, k, 2, l1, ido ) - ch_offset ] = cr2 - ci5; - ch[ chRef( 1, k, 5, l1, ido ) - ch_offset ] = cr2 + ci5; - ch[ chRef( 2, k, 2, l1, ido ) - ch_offset ] = ci2 + cr5; - ch[ chRef( 2, k, 3, l1, ido ) - ch_offset ] = ci3 + cr4; - ch[ chRef( 1, k, 3, l1, ido ) - ch_offset ] = cr3 - ci4; - ch[ chRef( 1, k, 4, l1, ido ) - ch_offset ] = cr3 + ci4; - ch[ chRef( 2, k, 4, l1, ido ) - ch_offset ] = ci3 - cr4; - ch[ chRef( 2, k, 5, l1, ido ) - ch_offset ] = ci2 - cr5; + ti5 = cc[ ccRef( 2, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( 2, 5, k, 5, ido ) - ccOffset ]; + ti2 = cc[ ccRef( 2, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( 2, 5, k, 5, ido ) - ccOffset ]; + ti4 = cc[ ccRef( 2, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( 2, 4, k, 5, ido ) - ccOffset ]; + ti3 = cc[ ccRef( 2, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 2, 4, k, 5, ido ) - ccOffset ]; + tr5 = cc[ ccRef( 1, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; + tr2 = cc[ ccRef( 1, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; + tr4 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( 1, 4, k, 5, ido ) - ccOffset ]; + tr3 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 5, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; + ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( 2, 1, k, 5, ido ) - ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( 2, 1, k, 5, ido ) - ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); + ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); + cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); + ci4 = ( TI12 * ti5 ) - ( TI11 * ti4 ); + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci5; + ch[ chRef( 1, k, 5, l1, ido ) - chOffset ] = cr2 + ci5; + ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + cr5; + ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci3 + cr4; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr3 - ci4; + ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = cr3 + ci4; + ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ci3 - cr4; + ch[ chRef( 2, k, 5, l1, ido ) - chOffset ] = ci2 - cr5; } } else { for ( k = 1; k <= l1; ++k ) { for ( i = 2; i <= ido; i += 2 ) { - ti5 = cc[ ccRef( i, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( i, 5, k, 5, ido ) - cc_offset ]; - ti2 = cc[ ccRef( i, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( i, 5, k, 5, ido ) - cc_offset ]; - ti4 = cc[ ccRef( i, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( i, 4, k, 5, ido ) - cc_offset ]; - ti3 = cc[ ccRef( i, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( i, 4, k, 5, ido ) - cc_offset ]; - tr5 = cc[ ccRef( i - 1, 2, k, 5, ido ) - cc_offset ] - cc[ ccRef( i - 1, 5, k, 5, ido ) - cc_offset ]; - tr2 = cc[ ccRef( i - 1, 2, k, 5, ido ) - cc_offset ] + cc[ ccRef( i - 1, 5, k, 5, ido ) - cc_offset ]; - tr4 = cc[ ccRef( i - 1, 3, k, 5, ido ) - cc_offset ] - cc[ ccRef( i - 1, 4, k, 5, ido ) - cc_offset ]; - tr3 = cc[ ccRef( i - 1, 3, k, 5, ido ) - cc_offset ] + cc[ ccRef( i - 1, 4, k, 5, ido ) - cc_offset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - cc_offset ] + tr2 + tr3; - ch[ chRef( i, k, 1, l1, ido ) - ch_offset ] = cc[ ccRef( i, 1, k, 5, ido ) - cc_offset ] + ti2 + ti3; - cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - cc_offset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); - ci2 = cc[ ccRef( i, 1, k, 5, ido ) - cc_offset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); - cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - cc_offset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); - ci3 = cc[ ccRef( i, 1, k, 5, ido ) - cc_offset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + ti5 = cc[ ccRef( i, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( i, 4, k, 5, ido ) - ccOffset ]; + ti3 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 5, ido ) - ccOffset ]; + tr5 = cc[ ccRef( i - 1, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ]; + tr4 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( i - 1, 4, k, 5, ido ) - ccOffset ]; + tr3 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 5, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); @@ -187,14 +187,14 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { dr2 = cr2 - ci5; di5 = ci2 - cr5; di2 = ci2 + cr5; - ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( fsign * wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( fsign * wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( fsign * wa2[ i - 1 ] * di3 ); - ch[ chRef( i, k, 3, l1, ido ) - ch_offset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( fsign * wa2[ i - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * dr4 ) - ( fsign * wa3[ i - 1 ] * di4 ); - ch[ chRef( i, k, 4, l1, ido ) - ch_offset ] = ( wa3[ i - 1 - 1 ] * di4 ) + ( fsign * wa3[ i - 1 ] * dr4 ); - ch[ chRef( i - 1, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 1 - 1 ] * dr5 ) - ( fsign * wa4[ i - 1 ] * di5 ); - ch[ chRef( i, k, 5, l1, ido ) - ch_offset ] = ( wa4[ i - 1 - 1 ] * di5 ) + ( fsign * wa4[ i - 1 ] * dr5 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( fsign * wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( fsign * wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( fsign * wa2[ i - 1 ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( fsign * wa2[ i - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * dr4 ) - ( fsign * wa3[ i - 1 ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * di4 ) + ( fsign * wa3[ i - 1 ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 1 - 1 ] * dr5 ) - ( fsign * wa4[ i - 1 ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 1 - 1 ] * di5 ) + ( fsign * wa4[ i - 1 ] * dr5 ); } } } From 0aa98e5ca88651464c0769822a340530f063c8fb Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 25 Dec 2024 00:18:44 +0530 Subject: [PATCH 017/102] docs: remove unused import --- lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js index 0f3f23a2b960..8b18def1f179 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js @@ -22,10 +22,6 @@ * When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. */ -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - // MAIN // From 860bd120171a0f32aea0e1597b920efd0a96725a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Fri, 27 Dec 2024 22:33:36 +0530 Subject: [PATCH 018/102] feat: add radb2, radb3, radb4, radb5 --- 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 --- --- .../@stdlib/fft/base/fftpack/lib/radb2.js | 129 ++++++++++++ .../@stdlib/fft/base/fftpack/lib/radb3.js | 150 ++++++++++++++ .../@stdlib/fft/base/fftpack/lib/radb4.js | 177 ++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/radb5.js | 193 ++++++++++++++++++ 4 files changed, 649 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js new file mode 100644 index 000000000000..a06eb3a8043d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -0,0 +1,129 @@ +/** +* @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' ); + + +// MAIN // + +/** +* Performs the backward FFT of length 2 for real-valued sequences. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 - array of twiddle factors +* @returns {void} +*/ +function radb2( ido, l1, cc, ch, wa1 ) { + var chOffset; + var ccOffset; + var idp2; + var ti2; + var tr2; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 3 ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ido, 2, k, 2, ido ) - ccOffset ]; + } + if ( ido < 2 ) { + return; + } else if ( ido != 2 ) { + idp2 = ido + 2; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 2, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 2, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * tr2 ) - ( wa1[ i - 1 - 1 ] * ti2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * ti2 ) + ( wa1[ i - 1 - 1 ] * tr2 ); + } + } + if ( ido % 2 === 1 ) { + return; + } + } + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( ido, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( ido, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ido, 1, k, 2, ido ) - ccOffset ]; + ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = -( cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ] ); + } +} + + +// EXPORTS // + +module.exports = radb2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js new file mode 100644 index 000000000000..96918e05e086 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js @@ -0,0 +1,150 @@ +/** +* @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 backward FFT of length 3 for real-valued sequences. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 radb3( ido, l1, cc, ch, wa1, wa2 ) { + var chOffset; + var ccOffset; + var idp2; + var ti2; + var tr2; + var ci2; + var ci3; + var di2; + var di3; + var cr2; + var cr3; + var dr2; + var dr3; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido << 2 ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ci3 = taui * ( cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] ); + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr2 + ci3; + } + if ( ido === 1 ) { + return; + } + idp2 = ido + 2; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + tr2 = cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 3, ido ) - ccOffset ] ); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + cr3; + di3 = ci2 - cr3; + ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 2 - 1 ] * dr2 ) - ( wa1[ i - 1 - 1 ] * di2 ); + ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 2 - 1 ] * di2 ) + ( wa1[ i - 1 - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 2 - 1 ] * dr3 ) - ( wa2[ i - 1 - 1 ] * di3 ); + ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 2 - 1 ] * di3 ) + ( wa2[ i - 1 - 1 ] * dr3 ); + } + } +} + + +// EXPORTS // + +module.exports = radb3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js new file mode 100644 index 000000000000..ba8f3378f7fa --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js @@ -0,0 +1,177 @@ +/** +* @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 sqrt2 = 1.414213562373095; + + +// MAIN // + +/** +* Performs the backward FFT of length 4 for real-valued sequences. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 +* @param {Float64Array} wa3 - third array of twiddle factors +* @returns {void} +*/ +function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { + var chOffset; + var ccOffset; + var idp2; + var ti1; + var ti2; + var ti3; + var ti4; + var tr1; + var tr2; + var tr3; + var tr4; + var ci2; + var ci3; + var ci4; + var cr2; + var cr3; + var cr4; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 5 ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 4, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 4, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( ido, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 4, ido ) - ccOffset ]; + tr4 = cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = tr1 - tr4; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = tr2 - tr3; + ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = tr1 + tr4; + } + if ( ido < 2 ) { + return; + } + if ( ido != 2 ) { + idp2 = ido + 2; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic, 4, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic, 4, k, 4, ido ) - ccOffset ]; + ti3 = cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 4, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 4, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 4, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + cr3 = tr2 - tr3; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 - tr4; + cr4 = tr1 + tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * cr2 ) - ( wa1[ i - 1 - 1 ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * ci2 ) + ( wa1[ i - 1 - 1 ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * cr3 ) - ( wa2[ i - 1 - 1 ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * ci3 ) + ( wa2[ i - 1 - 1 ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * cr4 ) - ( wa3[ i - 1 - 1 ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * ci4 ) + ( wa3[ i - 1 - 1 ] * cr4 ); + } + } + if ( ido % 2 === 1 ) { + return; + } + } + for ( k = 1; k <= l1; ++k ) { + ti1 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; + ch[ chRef( ido, k, 1, l1, ido ) - chOffset ] = tr2 + tr2; + ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = sqrt2 * ( tr1 - ti1 ); + ch[ chRef( ido, k, 3, l1, ido ) - chOffset ] = ti2 + ti2; + ch[ chRef( ido, k, 4, l1, ido ) - chOffset ] = -sqrt2 * ( tr1 + ti1 ); + } +} + + +// EXPORTS // + +module.exports = radb4; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js new file mode 100644 index 000000000000..be3e46e55c9e --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js @@ -0,0 +1,193 @@ +/** +* @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 tr11 = 0.309016994374947; +var ti11 = 0.951056516295154; +var tr12 = -0.809016994374947; +var ti12 = 0.587785252292473; + + +// MAIN // + +/** +* Performs the backward FFT of length 5 for real-valued sequences. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} 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 +* @param {Float64Array} wa3 - third array of twiddle factors +* @param {Float64Array} wa4 - fourth array of twiddle factors +* @returns {void} +*/ +function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { + var chOffset; + var ccOffset; + var idp2; + var ti2; + var ti3; + var ti4; + var ti5; + var tr2; + var tr3; + var tr4; + var tr5; + var ci2; + var ci3; + var ci4; + var ci5; + var di2; + var di3; + var di4; + var di5; + var dr2; + var dr3; + var dr4; + var dr5; + var cr2; + var cr3; + var cr4; + var cr5; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * 6 ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + ti5 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ]; + ti4 = cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; + tr2 = cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ]; + tr3 = cc[ ccRef( ido, 4, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 4, k, 5, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr11 ) + ( tr3 * tr12 ); + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr12 ) + ( tr3 * tr11 ); + ci5 = ( ti5 * ti11 ) + ( ti4 * ti12 ); + ci4 = ( ti5 * ti12 ) - ( ti4 * ti11 ); + ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci5; + ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr3 - ci4; + ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = cr3 + ci4; + ch[ chRef( 1, k, 5, l1, ido ) - chOffset ] = cr2 + ci5; + } + if ( ido === 1 ) { + return; + } + idp2 = ido + 2; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + ti5 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 5, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 5, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic, 4, k, 5, ido ) - ccOffset ]; + ti3 = cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic, 4, k, 5, ido ) - ccOffset ]; + tr5 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 5, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 5, ido ) - ccOffset ]; + tr4 = cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 4, k, 5, ido ) - ccOffset ]; + tr3 = cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 4, k, 5, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr11 ) + ( tr3 * tr12 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * tr11 ) + ( ti3 * tr12 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr12 ) + ( tr3 * tr11 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * tr12 ) + ( ti3 * tr11 ); + cr5 = ( tr5 * ti11 ) + ( tr4 * ti12 ); + ci5 = ( ti5 * ti11 ) + ( ti4 * ti12 ); + cr4 = ( tr5 * ti12 ) - ( tr4 * ti11 ); + ci4 = ( ti5 * ti12 ) - ( ti4 * ti11 ); + dr3 = cr3 - ci4; + dr4 = cr3 + ci4; + di3 = ci3 + cr4; + di4 = ci3 - cr4; + dr5 = cr2 + ci5; + dr2 = cr2 - ci5; + di5 = ci2 - cr5; + di2 = ci2 + cr5; + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * dr2 ) - ( wa1[ i - 1 - 1 ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * di2 ) + ( wa1[ i - 1 - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * dr3 ) - ( wa2[ i - 1 - 1 ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * di3 ) + ( wa2[ i - 1 - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * dr4 ) - ( wa3[ i - 1 - 1 ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * di4 ) + ( wa3[ i - 1 - 1 ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 2 - 1 ] * dr5 ) - ( wa4[ i - 1 - 1 ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 2 - 1 ] * di5 ) + ( wa4[ i - 1 - 1 ] * dr5 ); + } + } +} + + +// EXPORTS // + +module.exports = radb5; From 637309f24d4676dbad1c08a798ff4b7d10ec4790 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Fri, 27 Dec 2024 23:03:50 +0530 Subject: [PATCH 019/102] refactor: remove unnecessary else --- 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 --- --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index a06eb3a8043d..b66d6be8282f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -100,7 +100,8 @@ function radb2( ido, l1, cc, ch, wa1 ) { } if ( ido < 2 ) { return; - } else if ( ido != 2 ) { + } + if ( ido !== 2 ) { idp2 = ido + 2; for ( k = 1; k <= l1; ++k ) { for ( i = 3; i <= ido; i += 2 ) { From 4b347f6121407bc7b2da8f0098bd6da66321390e Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 30 Dec 2024 00:42:41 +0530 Subject: [PATCH 020/102] feat: add radbg.js --- 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 --- --- .../@stdlib/fft/base/fftpack/lib/radbg.js | 299 ++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js new file mode 100644 index 000000000000..fa0e005860b9 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -0,0 +1,299 @@ +/** +* @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 sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); +var c1Ref = require( './c1_ref.js' ); +var c2Ref = require( './c2_ref.js' ); +var ch2Ref = require( './ch2_ref.js' ); + + +// MAIN // + +/** +* Performs the backward FFT for real-valued sequences. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} ip - radix of the transform +* @param {integer} l1 - length of the input sequences +* @param {integer} idl1 - stride for the transform +* @param {Float64Array} cc - input array containing sequences to be transformed +* @param {Float64Array} c1 - first work array +* @param {Float64Array} c2 - second work array +* @param {Float64Array} ch - output array containing transformed sequences +* @param {Float64Array} ch2 - work array for transformed sequences +* @param {Float64Array} wa - array of twiddle factors +* @returns {void} +*/ +function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { + var chOffset; + var ccOffset; + var c1Offset; + var c2Offset; + var ch2Offset; + var ar1h; + var ar2h; + var idp2; + var ipp2; + var idij; + var ipph; + var dc2; + var ai1; + var ai2; + var ar1; + var ar2; + var ds2; + var nbd; + var dcp; + var arg; + var dsp; + var j2; + var ic; + var jc; + var lc; + var ik; + var is; + var i; + var j; + var k; + var l; + + // Parameter adjustments... + chOffset = 1 + ( ido * ( 1 + l1 ) ); + c1Offset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ido * ( 1 + ip ); + ch2Offset = 1 + idl1; + c2Offset = 1 + idl1; + + // Function body: + arg = ( 2 * PI ) / ( ip ); + dcp = cos( arg ); + dsp = sin( arg ); + idp2 = ido + 2; + nbd = ( ido - 1 ) / 2; + ipp2 = ip + 2; + ipph = ( ip + 1 ) / 2; + if ( ido >= l1 ) { + for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; ++i ) { + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; + } + } + } else { + for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; + } + } + } + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + j2 = j + j; + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ] + cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ]; + } + } + if ( ido !== 1 ) { + if ( nbd >= l1 ) { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + } + } + } + } else { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + } + } + } + } + } + ar1 = 1.0; + ai1 = 0.0; + for ( l = 2; l <= ipph; ++l ) { + lc = ipp2 - l; + ar1h = ( dcp * ar1 ) - ( dsp * ai1 ); + ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); + ar1 = ar1h; + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, l, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] + ( ar1 * ch2[ ch2Ref( ik, 2, idl1 ) - ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] = ai1 * ch2[ ch2Ref( ik, ip, idl1 ) - ch2Offset ]; + } + dc2 = ar1; + ds2 = ai1; + ar2 = ar1; + ai2 = ai1; + for ( j = 3; j <= ipph; ++j ) { + jc = ipp2 - j; + ar2h = ( dc2 * ar2 ) - ( ds2 * ai2 ); + ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); + ar2 = ar2h; + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, l, idl1 ) - c2Offset ] += ( ar2 * ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] += ( ai2 * ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ] ); + } + } + } + for ( j = 2; j <= ipph; ++j ) { + for ( ik = 1; ik <= idl1; ++ik ) { + ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; + } + } + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ]; + } + } + if ( ido !== 1 ) { + if ( nbd >= l1 ) { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; + } + } + } + } else { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( i = 3; i <= ido; i += 2 ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; + } + } + } + } + } + if ( ido === 1 ) { + return; + } + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; + } + for ( j = 2; j <= ip; ++j ) { + for ( k = 1; k <= l1; ++k ) { + c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; + } + } + if ( nbd <= l1 ) { + is = -ido; + for ( j = 2; j <= ip; ++j ) { + is += ido; + idij = is; + for ( i = 3; i <= ido; i += 2 ) { + idij += 2; + for ( k = 1; k <= l1; ++k ) { + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); + } + } + } + } else { + is = -ido; + for ( j = 2; j <= ip; ++j ) { + is += ido; + for ( k = 1; k <= l1; ++k ) { + idij = is; + for ( i = 3; i <= ido; i += 2 ) { + idij += 2; + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); + } + } + } + } +} + + +// EXPORTS // + +module.exports = radbg; From c96d70d9cc209ab82671144981a8085790b2ae3a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 1 Jan 2025 17:47:35 +0530 Subject: [PATCH 021/102] feat: add radf2.js --- 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 --- --- .../@stdlib/fft/base/fftpack/lib/radf2.js | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js new file mode 100644 index 000000000000..ddd08f9f774a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -0,0 +1,130 @@ +/** +* @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' ); + + +// MAIN // + +/** +* Performs the forward FFT of length 2 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 - array of twiddle factors +* @returns {void} +*/ +function radf2( ido, l1, cc, ch, wa1 ) { + var chOffset; + var ccOffset; + var idp2; + var tr2; + var ti2; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * 3 ); + ccOffset = 1 + ido * ( 1 + l1 ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + ch[ chRef( ido, 2, k, l1, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + } + if ( ido < 2 ) { + return; + } + if ( ido !== 2 ) { + idp2 = ido + 2; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + tr2 = ( 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 ] ); + ti2 = ( 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 ] ); + ch[ chRef( i, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ti2; + ch[ chRef( ic, 2, k, l1, ido ) - chOffset ] = ti2 - cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ]; + ch[ chRef( i - 1, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + tr2; + ch[ chRef( ic - 1, 2, k, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] - tr2; + } + } + if ( ido % 2 === 1 ) { + return; + } + } + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, 2, k, l1, ido ) - chOffset ] = -cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ]; + ch[ chRef( ido, 1, k, l1, ido ) - chOffset ] = -cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ]; + } +} + + +// EXPORTS // + +module.exports = radf2; From c59a7be6065362e7794d7eff53837375217fcd60 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 2 Jan 2025 01:34:50 +0530 Subject: [PATCH 022/102] 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 --- --- .../@stdlib/fft/base/fftpack/lib/radb4.js | 2 +- .../@stdlib/fft/base/fftpack/lib/radbg.js | 2 +- .../@stdlib/fft/base/fftpack/lib/radf2.js | 2 +- .../@stdlib/fft/base/fftpack/lib/radf3.js | 149 ++++++++++++++++++ 4 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js index ba8f3378f7fa..1da12122c0f1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js @@ -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 ) { diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js index fa0e005860b9..80eceeaf6b87 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -126,7 +126,7 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { // 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; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index ddd08f9f774a..2de025bce656 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -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 ) { diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js new file mode 100644 index 000000000000..dc988c5953e2 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -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; From ff38eb22e231ed98a70e7f7fd0ebd1045d41eda9 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Wed, 1 Jan 2025 20:05:52 +0000 Subject: [PATCH 023/102] chore: update copyright years --- lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js index 296bacb5aa15..8845520b0186 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js index 16b77043128f..71b5fa3c8725 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js index fb95bf4a5301..cd81ca004f65 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js index d577f833bcaf..6eab3bd353bc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js index 614300655439..586f122b26ab 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js index 8b18def1f179..8da832adeec0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js index ba322aae0e96..0c41052b064d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index a85762a1b43c..e56c9fb113d6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js index 2d8cc32f65ea..5e40a695b24b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js index b84f79487634..c4a4f97f146e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index 14dc8d4c7dc8..5fcb74421a47 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js index ace4deba1f18..4e552dd0b1b8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index 244e253ebb8e..7c6f44ae6ce0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 16412d20cacf..3d95511fbc79 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index b66d6be8282f..b1207a9e0e3a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js index 96918e05e086..4e8d5ef42827 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js index 1da12122c0f1..9f6b7bcbce52 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js index be3e46e55c9e..bb78da9b13e5 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js index 80eceeaf6b87..51b580df8d5f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 2de025bce656..40f72d98b8e7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index dc988c5953e2..61804a9f9be7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. From b5f2f5078c62003fb65c6b2657f2c831218e06c5 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 2 Jan 2025 01:44:43 +0530 Subject: [PATCH 024/102] docs: resolve lint errors --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js index 51b580df8d5f..f9b6f40e493f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -57,6 +57,7 @@ */ /* eslint-disable max-len */ +/* eslint-disable max-statements */ 'use strict'; @@ -91,11 +92,11 @@ var ch2Ref = require( './ch2_ref.js' ); * @returns {void} */ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { + var ch2Offset; var chOffset; var ccOffset; var c1Offset; var c2Offset; - var ch2Offset; var ar1h; var ar2h; var idp2; From 3fbfd1042b00b17aec8541be54a071e496fb7be9 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 2 Jan 2025 01:55:01 +0530 Subject: [PATCH 025/102] docs: resolve lint errors --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index 61804a9f9be7..32e67510f53a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -122,10 +122,10 @@ function radf3( ido, l1, cc, ch, wa1, wa2 ) { 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 ] ); + 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; @@ -140,7 +140,6 @@ function radf3( ido, l1, cc, ch, wa1, wa2 ) { ch[ chRef( ic, 2, k, 3, ido ) - chOffset ] = ti3 - ti2; } } - } From 420ff1cad5bcf1f012a0b72810fe3d8de934545f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 2 Jan 2025 22:48:11 +0530 Subject: [PATCH 026/102] feat: add radf4, radf5 --- .../@stdlib/fft/base/fftpack/lib/radf4.js | 173 ++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/radf5.js | 189 ++++++++++++++++++ 2 files changed, 362 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js new file mode 100644 index 000000000000..c18c199e49d9 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js @@ -0,0 +1,173 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); + + +// VARIABLES // + +var hsqt2 = 0.7071067811865475; + + +// MAIN // + +/** +* Performs the forward FFT of length 4 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 +* @param {Float64Array} wa3 - third array of twiddle factors +* @returns {void} +*/ +function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { + var chOffset; + var ccOffset; + var idp2; + var tr4; + var tr3; + var tr2; + var tr1; + var ti4; + var ti3; + var ti2; + var ti1; + var cr2; + var cr3; + var cr4; + var ci2; + var ci3; + var ci4; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * 5 ); + ccOffset = 1 + ( ido * ( 1 + l1 ) ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + tr1 = cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ]; + tr2 = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; + ch[ chRef( 1, 1, k, 4, ido ) - chOffset ] = tr1 + tr2; + ch[ chRef( ido, 4, k, 4, ido ) - chOffset ] = tr2 - tr1; + ch[ chRef( ido, 2, k, 4, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; + ch[ chRef( 1, 3, k, 4, ido ) - chOffset ] = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + } + if ( ido < 2 ) { + return; + } + if ( ido !== 2 ) { + idp2 = ido + 2; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + cr2 = ( 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 ] ); + ci2 = ( 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 ] ); + cr3 = ( 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 ] ); + ci3 = ( 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 ] ); + cr4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ) + ( wa3[ i - 1 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ); + ci4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ) - ( wa3[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ); + tr1 = cr2 + cr4; + tr4 = cr4 - cr2; + ti1 = ci2 + ci4; + ti4 = ci2 - ci4; + ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ci3; + ti3 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] - ci3; + tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + cr3; + tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] - cr3; + ch[ chRef( i - 1, 1, k, 4, ido ) - chOffset ] = tr1 + tr2; + ch[ chRef( ic - 1, 4, k, 4, ido ) - chOffset ] = tr2 - tr1; + ch[ chRef( i, 1, k, 4, ido ) - chOffset ] = ti1 + ti2; + ch[ chRef( ic, 4, k, 4, ido ) - chOffset ] = ti1 - ti2; + ch[ chRef( i - 1, 3, k, 4, ido ) - chOffset ] = ti4 + tr3; + ch[ chRef( ic - 1, 2, k, 4, ido ) - chOffset ] = tr3 - ti4; + ch[ chRef( i, 3, k, 4, ido ) - chOffset ] = tr4 + ti3; + ch[ chRef( ic, 2, k, 4, ido ) - chOffset ] = tr4 - ti3; + } + } + if ( ido % 2 === 1 ) { + return; + } + } + for ( k = 1; k <= l1; ++k ) { + ti1 = -hsqt2 * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); + tr1 = hsqt2 * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); + ch[ chRef( ido, 1, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] + tr1; + ch[ chRef( ido, 3, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] - tr1; + ch[ chRef( 1, 2, k, 4, ido ) - chOffset ] = ti1 - cc[ ccRef( ido, k, 3, l1, ido ) - ccOffset ]; + ch[ chRef( 1, 4, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 3, l1, ido ) - ccOffset ] + ti1; + } +} + + +// EXPORTS // + +module.exports = radf4; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js new file mode 100644 index 000000000000..9013499b0374 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js @@ -0,0 +1,189 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); + + +// VARIABLES // + +var tr11 = 0.309016994374947; +var ti11 = 0.951056516295154; +var tr12 = -0.809016994374947; +var ti12 = 0.587785252292473; + + +// MAIN // + +/** +* Performs the forward FFT of length 5 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 +* @param {Float64Array} wa3 - third array of twiddle factors +* @param {Float64Array} wa4 - fourth array of twiddle factors +* @returns {void} +*/ +function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { + var chOffset; + var ccOffset; + var idp2; + var ci2; + var di2; + var ci4; + var ci5; + var di3; + var di4; + var di5; + var ci3; + var cr2; + var cr3; + var dr2; + var dr3; + var dr4; + var dr5; + var cr5; + var cr4; + var ti2; + var ti3; + var ti5; + var ti4; + var tr2; + var tr3; + var tr4; + var tr5; + var ic; + var i; + var k; + + // Parameter adjustments... + chOffset = 1 + ( ido * 6 ); + ccOffset = 1 + ( ido * ( 1 + l1 ) ); + + // Function body: + for ( k = 1; k <= l1; ++k ) { + cr2 = cc[ ccRef( 1, k, 5, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + ci5 = cc[ ccRef( 1, k, 5, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + cr3 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; + ci4 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; + ch[ chRef( 1, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cr2 + cr3; + ch[ chRef( ido, 2, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( tr11 * cr2 ) + ( tr12 * cr3 ); + ch[ chRef( 1, 3, k, 5, ido ) - chOffset ] = ( ti11 * ci5 ) + ( ti12 * ci4 ); + ch[ chRef( ido, 4, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( tr12 * cr2 ) + ( tr11 * cr3 ); + ch[ chRef( 1, 5, k, 5, ido ) - chOffset ] = ( ti12 * ci5 ) - ( ti11 * ci4 ); + } + 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 ] ); + dr4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ) + ( wa3[ i - 1 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ); + di4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ) - ( wa3[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ); + dr5 = ( wa4[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 5, l1, ido ) - ccOffset ] ) + ( wa4[ i - 1 - 1 ] * cc[ ccRef( i, k, 5, l1, ido ) - ccOffset ] ); + di5 = ( wa4[ i - 2 - 1 ] * cc[ ccRef( i, k, 5, l1, ido ) - ccOffset ] ) - ( wa4[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 5, l1, ido ) - ccOffset ] ); + cr2 = dr2 + dr5; + ci5 = dr5 - dr2; + cr5 = di2 - di5; + ci2 = di5 + di2; + cr3 = dr3 + dr4; + ci4 = dr4 - dr3; + cr4 = di3 - di4; + ci3 = di3 + di4; + ch[ chRef( i - 1, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + cr2 + cr3; + ch[ chRef( i, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ci2 + ci3; + tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( tr11 * cr2 ) + ( tr12 * cr3 ); + ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( tr11 * ci2 ) + ( tr12 * ci3 ); + tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( tr12 * cr2 ) + ( tr11 * cr3 ); + ti3 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( tr12 * ci2 ) + ( tr11 * ci3 ); + tr5 = ( ti11 * cr5 ) + ( ti12 * cr4 ); + ti5 = ( ti11 * ci5 ) + ( ti12 * ci4 ); + tr4 = ( ti12 * cr5 ) - ( ti11 * cr4 ); + ti4 = ( ti12 * ci5 ) - ( ti11 * ci4 ); + ch[ chRef( i - 1, 3, k, 5, ido ) - chOffset ] = tr2 + tr5; + ch[ chRef( ic - 1, 2, k, 5, ido ) - chOffset ] = tr2 - tr5; + ch[ chRef( i, 3, k, 5, ido ) - chOffset ] = ti2 + ti5; + ch[ chRef( ic, 2, k, 5, ido ) - chOffset ] = ti5 - ti2; + ch[ chRef( i - 1, 5, k, 5, ido ) - chOffset ] = tr3 + tr4; + ch[ chRef( ic - 1, 4, k, 5, ido ) - chOffset ] = tr3 - tr4; + ch[ chRef( i, 5, k, 5, ido ) - chOffset ] = ti3 + ti4; + ch[ chRef( ic, 4, k, 5, ido ) - chOffset ] = ti4 - ti3; + } + } +} + + +// EXPORTS // + +module.exports = radf5; From 8982c991567062270f6e261af924ab41636fff6e Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 8 Jan 2025 07:36:29 +0530 Subject: [PATCH 027/102] feat: add radfg.js --- .../@stdlib/fft/base/fftpack/lib/radfg.js | 303 ++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js new file mode 100644 index 000000000000..f779aeccdae6 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js @@ -0,0 +1,303 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len, max-lines-per-function, max-statements */ + +'use strict'; + +// MODULES // + +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); +var c1Ref = require( './c1_ref.js' ); +var c2Ref = require( './c2_ref.js' ); +var ch2Ref = require( './ch2_ref.js' ); + + +// MAIN // + +/** +* Performs the forward FFT for real-valued sequences. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} ip - radix of the transform +* @param {integer} l1 - length of the input sequences +* @param {integer} idl1 - stride for the transform +* @param {Float64Array} cc - input array containing sequences to be transformed +* @param {Float64Array} c1 - first work array +* @param {Float64Array} c2 - second work array +* @param {Float64Array} ch - output array containing transformed sequences +* @param {Float64Array} ch2 - work array for transformed sequences +* @param {Float64Array} wa - array of twiddle factors +* @returns {void} +*/ +function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { + var ch2Offset; + var chOffset; + var ccOffset; + var c1Offset; + var c2Offset; + var ar1h; + var ar2h; + var idp2; + var ipp2; + var idij; + var ipph; + var dc2; + var ai1; + var ai2; + var ar1; + var ar2; + var ds2; + var nbd; + var dcp; + var arg; + var dsp; + var ic; + var ik; + var is; + var jc; + var lc; + var j2; + var i; + var j; + var k; + var l; + + // Parameter adjustments... + chOffset = 1 + ( ido * ( 1 + l1 ) ); + ccOffset = 1 + ( ido * ( 1 + ip ) ); + c1Offset = 1 + ( ido * ( 1 + l1 ) ); + ch2Offset = 1 + idl1; + c2Offset = 1 + idl1; + + // Function body: + arg = ( 2 * PI ) / ip; + dcp = cos( arg ); + dsp = sin( arg ); + ipph = ( ip + 1 ) / 2; + ipp2 = ip + 2; + idp2 = ido + 2; + nbd = ( ido - 1 ) / 2; + if ( ido === 1 ) { + for ( ik = 1; ik <= idl1; ++ik ) { + c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; + } + } else { + for ( ik = 1; ik <= idl1; ++ik ) { + ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) - c2Offset ]; + } + for ( j = 2; j <= ip; ++j ) { + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ]; + } + } + if ( nbd <= l1 ) { + is = -ido; + for ( j = 2; j <= ip; ++j ) { + is += ido; + idij = is; + for ( i = 3; i <= ido; i += 2 ) { + idij += 2; + for ( k = 1; k <= l1; ++k ) { + ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ) + ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ); + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ) - ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i - 1, k, j, 4, ido ) - c1Offset ] ); + } + } + } + } else { + is = -ido; + for ( j = 2; j <= ip; ++j ) { + is += ido; + for ( k = 1; k <= l1; ++k ) { + idij = is; + for ( i = 3; i <= ido; i += 2 ) { + idij += 2; + ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 1 - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ) + ( wa[ idij - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ); + ch[ chRef( i, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 1 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ) - ( wa[ idij - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ); + } + } + } + } + if ( nbd >= l1 ) { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] - ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ]; + } + } + } + } else { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( i = 3; i <= ido; i += 2 ) { + for ( k = 1; k <= l1; ++k ) { + c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] - ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ]; + } + } + } + } + } + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; ++k ) { + c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( 1, k, jc, l1, ido ) - chOffset ]; + c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; + } + } + ar1 = 1.0; + ai1 = 0.0; + for ( l = 2; l <= ipph; ++l ) { + lc = ipp2 - l; + ar1h = ( dcp * ar1 ) - ( dsp * ai1 ); + ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); + ar1 = ar1h; + for ( ik = 1; ik <= idl1; ++ik ) { + ch2[ ch2Ref( ik, l, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] + ( ar1 * c2[ c2Ref( ik, 2, idl1 ) - c2Offset ] ); + ch2[ ch2Ref( ik, lc, idl1 ) - ch2Offset ] = ai1 * c2[ c2Ref( ik, ip, idl1 ) - c2Offset ]; + } + dc2 = ar1; + ds2 = ai1; + ar2 = ar1; + ai2 = ai1; + for ( j = 3; j <= ipph; ++j ) { + jc = ipp2 - j; + ar2h = ( dc2 * ar2 ) - ( ds2 * ai2 ); + ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); + ar2 = ar2h; + for ( ik = 1; ik <= idl1; ++ik ) { + ch2[ ch2Ref( ik, l, idl1 ) - ch2Offset ] += ar2 * c2[ c2Ref( ik, j, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, lc, idl1 ) - ch2Offset ] += ai2 * c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; + } + } + } + for ( j = 2; j <= ipph; ++j ) { + for ( ik = 1; ik <= idl1; ++ik ) { + ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += c2[ c2Ref( ik, j, idl1 ) - c2Offset ]; + } + } + if ( ido >= l1 ) { + for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; ++i ) { + cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) - chOffset ]; + } + } + } else { + for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; ++k ) { + cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) - chOffset ]; + } + } + } + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + j2 = j + j; + for ( k = 1; k <= l1; ++k ) { + cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; + cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( 1, k, jc, l1, ido ) - chOffset ]; + } + } + if ( ido === 1 ) { + return; + } + if ( nbd >= l1 ) { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + j2 = j + j; + for ( k = 1; k <= l1; ++k ) { + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; + cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; + cc[ ccRef( i, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( ic, k, jc, l1, ido ) - chOffset ]; + cc[ ccRef( ic, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) - chOffset ] - ch[ chRef( i, k, j, l1, ido ) - chOffset ]; + } + } + } + } else { + for ( j = 2; j <= ipph; ++j ) { + jc = ipp2 - j; + j2 = j + j; + for ( i = 3; i <= ido; i += 2 ) { + ic = idp2 - i; + for ( k = 1; k <= l1; ++k ) { + cc[ccRef( i - 1, j2 - 1, k, ip, ido ) - ccOffset] = ch[chRef(i - 1, k, j, l1, ido) - chOffset] + ch[chRef(i - 1, k, jc, l1, ido) - chOffset]; + cc[ccRef( ic - 1, j2 - 2, k, ip, ido ) - ccOffset] = ch[chRef(i - 1, k, j, l1, ido) - chOffset] - ch[chRef(i - 1, k, jc, l1, ido) - chOffset]; + cc[ccRef( i, j2 - 1, k, ip, ido ) - ccOffset] = ch[chRef(i, k, j, l1, ido) - chOffset] + ch[chRef(i, k, jc, l1, ido) - chOffset]; + cc[ccRef( ic, j2 - 2, k, ip, ido ) - ccOffset] = ch[chRef(i, k, jc, l1, ido) - chOffset] - ch[chRef(i, k, j, l1, ido) - chOffset]; + } + } + } + } +} + + +// EXPORTS // + +module.exports = radfg; From d42825b21e47f738fe0b4c8427ea2c81aafc1c88 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 8 Jan 2025 08:06:23 +0530 Subject: [PATCH 028/102] docs: replace ++x by x++ --- .../@stdlib/fft/base/fftpack/lib/passb2.js | 4 +- .../@stdlib/fft/base/fftpack/lib/passb3.js | 4 +- .../@stdlib/fft/base/fftpack/lib/passb4.js | 4 +- .../@stdlib/fft/base/fftpack/lib/passf2.js | 4 +- .../@stdlib/fft/base/fftpack/lib/passf3.js | 4 +- .../@stdlib/fft/base/fftpack/lib/passf4.js | 4 +- .../@stdlib/fft/base/fftpack/lib/passfb.js | 48 +++++++-------- .../@stdlib/fft/base/fftpack/lib/passfb5.js | 4 +- .../@stdlib/fft/base/fftpack/lib/radb2.js | 6 +- .../@stdlib/fft/base/fftpack/lib/radb3.js | 4 +- .../@stdlib/fft/base/fftpack/lib/radb4.js | 6 +- .../@stdlib/fft/base/fftpack/lib/radb5.js | 4 +- .../@stdlib/fft/base/fftpack/lib/radbg.js | 58 +++++++++--------- .../@stdlib/fft/base/fftpack/lib/radf2.js | 6 +- .../@stdlib/fft/base/fftpack/lib/radf3.js | 4 +- .../@stdlib/fft/base/fftpack/lib/radf4.js | 6 +- .../@stdlib/fft/base/fftpack/lib/radf5.js | 4 +- .../@stdlib/fft/base/fftpack/lib/radfg.js | 60 +++++++++---------- 18 files changed, 117 insertions(+), 117 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js index 0c41052b064d..3565a282c472 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js @@ -93,7 +93,7 @@ function passb2( ido, l1, cc, ch, wa1 ) { // Function body: if ( ido <= 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; @@ -101,7 +101,7 @@ function passb2( ido, l1, cc, ch, wa1 ) { } return; } - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index e56c9fb113d6..22d6899e7ef1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -108,7 +108,7 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { // Function body: if ( ido === 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ]; cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; @@ -123,7 +123,7 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; } } else { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js index 5e40a695b24b..f59d249e8b94 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -107,7 +107,7 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { // Function body: if ( ido === 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ]; @@ -126,7 +126,7 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; } } else { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js index c4a4f97f146e..48edf6b9fd6c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -93,14 +93,14 @@ function passf2( ido, l1, cc, ch, wa1 ) { // Function body: if ( ido === 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; } } else { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index 5fcb74421a47..cf586dfddf76 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -108,7 +108,7 @@ function passf3( ido, l1, cc, ch, wa1, wa2 ) { // Function body: if ( ido === 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ]; cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; @@ -123,7 +123,7 @@ function passf3( ido, l1, cc, ch, wa1, wa2 ) { ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; } } else { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js index 4e552dd0b1b8..033746a72892 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js @@ -107,7 +107,7 @@ function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { // Function body: if ( ido === 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; tr4 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; @@ -126,7 +126,7 @@ function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; } } else { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index 7c6f44ae6ce0..83876b187ee6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -127,48 +127,48 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e ipph = ( ip + 1 ) / 2; idp = ip * ido; if ( ido >= l1 ) { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( k = 1; k <= l1; ++k ) { - for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; k++ ) { + for ( i = 1; i <= ido; i++ ) { ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; } } } - for ( k = 1; k <= l1; ++k ) { - for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; k++ ) { + for ( i = 1; i <= ido; i++ ) { ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; } } } else { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( i = 1; i <= ido; ++i ) { - for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; i++ ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; } } } - for ( i = 1; i <= ido; ++i ) { - for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; i++ ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; } } } idl = 2 - ido; inc = 0; - for ( l = 2; l <= ipph; ++l ) { + for ( l = 2; l <= ipph; l++ ) { lc = ipp2 - l; idl += ido; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, l, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2Offset ] ); c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2Offset ]; } idlj = idl; inc += ido; - for ( j = 3; j <= ipph; ++j ) { + for ( j = 3; j <= ipph; j++ ) { jc = ipp2 - j; idlj += inc; if ( idlj > idp ) { @@ -176,18 +176,18 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e } war = wa[ idlj - 1 - 1 ]; wai = wa[ idlj - 1 ]; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, l, idl1 ) - c2Offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ]; } } } - for ( j = 2; j <= ipph; ++j ) { - for ( ik = 1; ik <= idl1; ++ik ) { + for ( j = 2; j <= ipph; j++ ) { + for ( ik = 1; ik <= idl1; ik++ ) { ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; } } - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( ik = 2; ik <= idl1; ik += 2 ) { ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2Offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; @@ -201,22 +201,22 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e return; } nac[ 0 ] = 0; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; } - for ( j = 2; j <= ip; ++j ) { - for ( k = 1; k <= l1; ++k ) { + for ( j = 2; j <= ip; j++ ) { + for ( k = 1; k <= l1; k++ ) { c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; c1[ c1Ref( 2, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 2, k, j, l1, ido ) - chOffset ]; } } if ( idot <= l1 ) { idij = 0; - for ( j = 2; j <= ip; ++j ) { + for ( j = 2; j <= ip; j++ ) { idij += 2; for ( i = 4; i <= ido; i += 2 ) { idij += 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); } @@ -225,9 +225,9 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e return; } idj = 2 - ido; - for ( j = 2; j <= ip; ++j ) { + for ( j = 2; j <= ip; j++ ) { idj += ido; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { idij = idj; for ( i = 4; i <= ido; i += 2 ) { idij += 2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 3d95511fbc79..33efe662c990 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -130,7 +130,7 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { // Function body: if ( ido === 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ti5 = cc[ ccRef( 2, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( 2, 5, k, 5, ido ) - ccOffset ]; ti2 = cc[ ccRef( 2, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( 2, 5, k, 5, ido ) - ccOffset ]; ti4 = cc[ ccRef( 2, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( 2, 4, k, 5, ido ) - ccOffset ]; @@ -159,7 +159,7 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { ch[ chRef( 2, k, 5, l1, ido ) - chOffset ] = ci2 - cr5; } } else { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { ti5 = cc[ ccRef( i, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ]; ti2 = cc[ ccRef( i, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index b1207a9e0e3a..cc723f811d11 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -94,7 +94,7 @@ function radb2( ido, l1, cc, ch, wa1 ) { ccOffset = 1 + ( ido * 3 ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ido, 2, k, 2, ido ) - ccOffset ]; } @@ -103,7 +103,7 @@ function radb2( ido, l1, cc, ch, wa1 ) { } if ( ido !== 2 ) { idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 2, ido ) - ccOffset ]; @@ -118,7 +118,7 @@ function radb2( ido, l1, cc, ch, wa1 ) { return; } } - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( ido, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( ido, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ido, 1, k, 2, ido ) - ccOffset ]; ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = -( cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ] ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js index 4e8d5ef42827..81beed1df6a6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js @@ -109,7 +109,7 @@ function radb3( ido, l1, cc, ch, wa1, wa2 ) { ccOffset = 1 + ( ido << 2 ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 3, ido ) - ccOffset ]; cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; @@ -121,7 +121,7 @@ function radb3( ido, l1, cc, ch, wa1, wa2 ) { return; } idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; tr2 = cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 3, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js index 9f6b7bcbce52..4a4035875cf5 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js @@ -113,7 +113,7 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { ccOffset = 1 + ( ido * 5 ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 4, k, 4, ido ) - ccOffset ]; tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 4, k, 4, ido ) - ccOffset ]; tr3 = cc[ ccRef( ido, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 4, ido ) - ccOffset ]; @@ -128,7 +128,7 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { } if ( ido !== 2 ) { idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic, 4, k, 4, ido ) - ccOffset ]; @@ -159,7 +159,7 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { return; } } - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ti1 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; ti2 = cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ]; tr1 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js index bb78da9b13e5..037aa682f58e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js @@ -127,7 +127,7 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { ccOffset = 1 + ( ido * 6 ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ti5 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ]; ti4 = cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; tr2 = cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ]; @@ -146,7 +146,7 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { return; } idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; ti5 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 5, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js index f9b6f40e493f..95b18175901f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -140,31 +140,31 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ipp2 = ip + 2; ipph = ( ip + 1 ) / 2; if ( ido >= l1 ) { - for ( k = 1; k <= l1; ++k ) { - for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; k++ ) { + for ( i = 1; i <= ido; i++ ) { ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; } } } else { - for ( i = 1; i <= ido; ++i ) { - for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; i++ ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; } } } - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; j2 = j + j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ] + cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ]; ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ]; } } if ( ido !== 1 ) { if ( nbd >= l1 ) { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; @@ -175,11 +175,11 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } } else { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; @@ -191,12 +191,12 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } ar1 = 1.0; ai1 = 0.0; - for ( l = 2; l <= ipph; ++l ) { + for ( l = 2; l <= ipph; l++ ) { lc = ipp2 - l; ar1h = ( dcp * ar1 ) - ( dsp * ai1 ); ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); ar1 = ar1h; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, l, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] + ( ar1 * ch2[ ch2Ref( ik, 2, idl1 ) - ch2Offset ] ); c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] = ai1 * ch2[ ch2Ref( ik, ip, idl1 ) - ch2Offset ]; } @@ -204,34 +204,34 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ds2 = ai1; ar2 = ar1; ai2 = ai1; - for ( j = 3; j <= ipph; ++j ) { + for ( j = 3; j <= ipph; j++ ) { jc = ipp2 - j; ar2h = ( dc2 * ar2 ) - ( ds2 * ai2 ); ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); ar2 = ar2h; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, l, idl1 ) - c2Offset ] += ( ar2 * ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ] ); c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] += ( ai2 * ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ] ); } } } - for ( j = 2; j <= ipph; ++j ) { - for ( ik = 1; ik <= idl1; ++ik ) { + for ( j = 2; j <= ipph; j++ ) { + for ( ik = 1; ik <= idl1; ik++ ) { ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; } } - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ]; ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ]; } } if ( ido !== 1 ) { if ( nbd >= l1 ) { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; @@ -241,10 +241,10 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } } else { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( i = 3; i <= ido; i += 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; ch[ chRef( i, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; @@ -257,22 +257,22 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { if ( ido === 1 ) { return; } - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; } - for ( j = 2; j <= ip; ++j ) { - for ( k = 1; k <= l1; ++k ) { + for ( j = 2; j <= ip; j++ ) { + for ( k = 1; k <= l1; k++ ) { c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; } } if ( nbd <= l1 ) { is = -ido; - for ( j = 2; j <= ip; ++j ) { + for ( j = 2; j <= ip; j++ ) { is += ido; idij = is; for ( i = 3; i <= ido; i += 2 ) { idij += 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); } @@ -280,9 +280,9 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } else { is = -ido; - for ( j = 2; j <= ip; ++j ) { + for ( j = 2; j <= ip; j++ ) { is += ido; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { idij = is; for ( i = 3; i <= ido; i += 2 ) { idij += 2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 40f72d98b8e7..d88df58b9b9c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -94,7 +94,7 @@ function radf2( ido, l1, cc, ch, wa1 ) { ccOffset = 1 + ( ido * ( 1 + l1 ) ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; ch[ chRef( ido, 2, k, l1, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; } @@ -103,7 +103,7 @@ function radf2( ido, l1, cc, ch, wa1 ) { } if ( ido !== 2 ) { idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; tr2 = ( 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 ] ); @@ -118,7 +118,7 @@ function radf2( ido, l1, cc, ch, wa1 ) { return; } } - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, 2, k, l1, ido ) - chOffset ] = -cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ]; ch[ chRef( ido, 1, k, l1, ido ) - chOffset ] = -cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ]; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index 32e67510f53a..2afb97becf8b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -109,7 +109,7 @@ function radf3( ido, l1, cc, ch, wa1, wa2 ) { ccOffset = 1 + ( ido * ( 1 + l1 ) ); // Function body: - for ( k = 1; k <= l1; ++k ) { + 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 ] ); @@ -119,7 +119,7 @@ function radf3( ido, l1, cc, ch, wa1, wa2 ) { return; } idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + 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 ] ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js index c18c199e49d9..802cb80ad723 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js @@ -113,7 +113,7 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { ccOffset = 1 + ( ido * ( 1 + l1 ) ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { tr1 = cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ]; tr2 = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; ch[ chRef( 1, 1, k, 4, ido ) - chOffset ] = tr1 + tr2; @@ -126,7 +126,7 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { } if ( ido !== 2 ) { idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; cr2 = ( 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 ] ); @@ -157,7 +157,7 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { return; } } - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ti1 = -hsqt2 * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); tr1 = hsqt2 * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); ch[ chRef( ido, 1, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] + tr1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js index 9013499b0374..f8e7d6a077ed 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js @@ -127,7 +127,7 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { ccOffset = 1 + ( ido * ( 1 + l1 ) ); // Function body: - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { cr2 = cc[ ccRef( 1, k, 5, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; ci5 = cc[ ccRef( 1, k, 5, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; cr3 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; @@ -142,7 +142,7 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { return; } idp2 = ido + 2; - for ( k = 1; k <= l1; ++k ) { + 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 ] ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js index f779aeccdae6..c9c431fbb3f8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js @@ -139,26 +139,26 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { idp2 = ido + 2; nbd = ( ido - 1 ) / 2; if ( ido === 1 ) { - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; } } else { - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) - c2Offset ]; } - for ( j = 2; j <= ip; ++j ) { - for ( k = 1; k <= l1; ++k ) { + for ( j = 2; j <= ip; j++ ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ]; } } if ( nbd <= l1 ) { is = -ido; - for ( j = 2; j <= ip; ++j ) { + for ( j = 2; j <= ip; j++ ) { is += ido; idij = is; for ( i = 3; i <= ido; i += 2 ) { idij += 2; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ) + ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ); ch[ chRef( i, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ) - ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i - 1, k, j, 4, ido ) - c1Offset ] ); } @@ -166,9 +166,9 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } else { is = -ido; - for ( j = 2; j <= ip; ++j ) { + for ( j = 2; j <= ip; j++ ) { is += ido; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { idij = is; for ( i = 3; i <= ido; i += 2 ) { idij += 2; @@ -179,9 +179,9 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } if ( nbd >= l1 ) { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] - ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; @@ -191,10 +191,10 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } } else { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( i = 3; i <= ido; i += 2 ) { - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] - ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; @@ -204,21 +204,21 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } } - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( 1, k, jc, l1, ido ) - chOffset ]; c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; } } ar1 = 1.0; ai1 = 0.0; - for ( l = 2; l <= ipph; ++l ) { + for ( l = 2; l <= ipph; l++ ) { lc = ipp2 - l; ar1h = ( dcp * ar1 ) - ( dsp * ai1 ); ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); ar1 = ar1h; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { ch2[ ch2Ref( ik, l, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] + ( ar1 * c2[ c2Ref( ik, 2, idl1 ) - c2Offset ] ); ch2[ ch2Ref( ik, lc, idl1 ) - ch2Offset ] = ai1 * c2[ c2Ref( ik, ip, idl1 ) - c2Offset ]; } @@ -226,39 +226,39 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ds2 = ai1; ar2 = ar1; ai2 = ai1; - for ( j = 3; j <= ipph; ++j ) { + for ( j = 3; j <= ipph; j++ ) { jc = ipp2 - j; ar2h = ( dc2 * ar2 ) - ( ds2 * ai2 ); ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); ar2 = ar2h; - for ( ik = 1; ik <= idl1; ++ik ) { + for ( ik = 1; ik <= idl1; ik++ ) { ch2[ ch2Ref( ik, l, idl1 ) - ch2Offset ] += ar2 * c2[ c2Ref( ik, j, idl1 ) - c2Offset ]; ch2[ ch2Ref( ik, lc, idl1 ) - ch2Offset ] += ai2 * c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; } } } - for ( j = 2; j <= ipph; ++j ) { - for ( ik = 1; ik <= idl1; ++ik ) { + for ( j = 2; j <= ipph; j++ ) { + for ( ik = 1; ik <= idl1; ik++ ) { ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += c2[ c2Ref( ik, j, idl1 ) - c2Offset ]; } } if ( ido >= l1 ) { - for ( k = 1; k <= l1; ++k ) { - for ( i = 1; i <= ido; ++i ) { + for ( k = 1; k <= l1; k++ ) { + for ( i = 1; i <= ido; i++ ) { cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) - chOffset ]; } } } else { - for ( i = 1; i <= ido; ++i ) { - for ( k = 1; k <= l1; ++k ) { + for ( i = 1; i <= ido; i++ ) { + for ( k = 1; k <= l1; k++ ) { cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) - chOffset ]; } } } - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; j2 = j + j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( 1, k, jc, l1, ido ) - chOffset ]; } @@ -267,10 +267,10 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { return; } if ( nbd >= l1 ) { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; j2 = j + j; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; @@ -281,12 +281,12 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { } } } else { - for ( j = 2; j <= ipph; ++j ) { + for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; j2 = j + j; for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - for ( k = 1; k <= l1; ++k ) { + for ( k = 1; k <= l1; k++ ) { cc[ccRef( i - 1, j2 - 1, k, ip, ido ) - ccOffset] = ch[chRef(i - 1, k, j, l1, ido) - chOffset] + ch[chRef(i - 1, k, jc, l1, ido) - chOffset]; cc[ccRef( ic - 1, j2 - 2, k, ip, ido ) - ccOffset] = ch[chRef(i - 1, k, j, l1, ido) - chOffset] - ch[chRef(i - 1, k, jc, l1, ido) - chOffset]; cc[ccRef( i, j2 - 1, k, ip, ido ) - ccOffset] = ch[chRef(i, k, j, l1, ido) - chOffset] + ch[chRef(i, k, jc, l1, ido) - chOffset]; From 09205704e6bb610938a6ca6d401f32b909f1c5e2 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 9 Jan 2025 14:09:31 +0530 Subject: [PATCH 029/102] refactor: use stdlib packages, early return --- .../@stdlib/fft/base/fftpack/lib/passb3.js | 47 +++++++++-------- .../@stdlib/fft/base/fftpack/lib/passb4.js | 52 +++++++++---------- .../@stdlib/fft/base/fftpack/lib/passf2.js | 20 +++---- .../@stdlib/fft/base/fftpack/lib/passf3.js | 47 +++++++++-------- .../@stdlib/fft/base/fftpack/lib/passfb5.js | 11 ++-- .../@stdlib/fft/base/fftpack/lib/radb3.js | 7 ++- .../@stdlib/fft/base/fftpack/lib/radb4.js | 10 ++-- .../@stdlib/fft/base/fftpack/lib/radb5.js | 35 +++++++------ .../@stdlib/fft/base/fftpack/lib/radbg.js | 16 +++--- .../@stdlib/fft/base/fftpack/lib/radf3.js | 7 ++- .../@stdlib/fft/base/fftpack/lib/radf4.js | 10 ++-- .../@stdlib/fft/base/fftpack/lib/radf5.js | 35 +++++++------ 12 files changed, 155 insertions(+), 142 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index 22d6899e7ef1..bfed514da062 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -62,14 +62,17 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = 0.5; -var taui = 0.866025403784439; +var taur = cos( ( 2 * PI ) / 3 ); // -0.5 +var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 // MAIN // @@ -122,26 +125,26 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + ci3; ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; } - } else { - for ( k = 1; k <= l1; k++ ) { - for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); - dr2 = cr2 - ci3; - dr3 = cr2 + ci3; - di2 = ci2 + ci3; - di3 = ci2 - cr3; - ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); - ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); - } + return; + } + for ( k = 1; k <= l1; k++ ) { + for ( i = 2; i <= ido; i += 2 ) { + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + ci3; + di3 = ci2 - cr3; + ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); + ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js index f59d249e8b94..9dfe5e215db6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -125,32 +125,32 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ti1 + ti4; ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; } - } else { - for ( k = 1; k <= l1; k++ ) { - for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; - tr4 = cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; - cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; - ci3 = ti2 - ti3; - cr2 = tr1 + tr4; - cr4 = tr1 - tr4; - ci2 = ti1 + ti4; - ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); - } + return; + } + for ( k = 1; k <= l1; k++ ) { + for ( i = 2; i <= ido; i += 2 ) { + ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; + tr4 = cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; + ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + cr3 = tr2 - tr3; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 + tr4; + cr4 = tr1 - tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js index 48edf6b9fd6c..4210a0bd122a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -99,16 +99,16 @@ function passf2( ido, l1, cc, ch, wa1 ) { ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; } - } else { - for ( k = 1; k <= l1; k++ ) { - for ( i = 2; i <= ido; i += 2 ) { - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); - } + return; + } + for ( k = 1; k <= l1; k++ ) { + for ( i = 2; i <= ido; i += 2 ) { + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index cf586dfddf76..1acf7110b7cb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -62,14 +62,17 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = -0.5; -var taui = -0.866025403784439; +var taur = cos( ( 2 * PI ) / 3 ); // -0.5 +var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 // MAIN // @@ -122,26 +125,26 @@ function passf3( ido, l1, cc, ch, wa1, wa2 ) { ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + cr3; ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; } - } else { - for ( k = 1; k <= l1; k++ ) { - for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); - dr2 = cr2 - ci3; - dr3 = cr2 + ci3; - di2 = ci2 + cr3; - di3 = ci2 - cr3; - ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) - ( wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) + ( wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) - ( wa2[ i - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( wa2[ i - 1 ] * dr3 ); - } + return; + } + for ( k = 1; k <= l1; k++ ) { + for ( i = 2; i <= ido; i += 2 ) { + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + cr3; + di3 = ci2 - cr3; + ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) - ( wa1[ i - 1 ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) + ( wa1[ i - 1 ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) - ( wa2[ i - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( wa2[ i - 1 ] * dr3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 33efe662c990..77639b6cf8f6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -62,16 +62,19 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var TR11 = 0.309016994374947; -var TI11 = 0.951056516295154; -var TR12 = -0.809016994374947; -var TI12 = 0.587785252292473; +var TR11 = cos( ( 2 * PI ) / 5 ); // 0.309016994374947 +var TI11 = sin( ( 2 * PI ) / 5 ); // 0.951056516295154 +var TR12 = cos( ( 4 * PI ) / 5 ); // -0.809016994374947 +var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js index 81beed1df6a6..eb66b14823fc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js @@ -62,14 +62,17 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = 0.5; -var taui = 0.866025403784439; +var taur = cos( ( 2 * PI ) / 3 ); // -0.5 +var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js index 4a4035875cf5..94c296314403 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js @@ -62,15 +62,11 @@ // MODULES // +var SQRT2 = require( '@stdlib/constants/float64/sqrt-two' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); -// VARIABLES // - -var sqrt2 = 1.414213562373095; - - // MAIN // /** @@ -165,9 +161,9 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { tr1 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; tr2 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; ch[ chRef( ido, k, 1, l1, ido ) - chOffset ] = tr2 + tr2; - ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = sqrt2 * ( tr1 - ti1 ); + ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = SQRT2 * ( tr1 - ti1 ); ch[ chRef( ido, k, 3, l1, ido ) - chOffset ] = ti2 + ti2; - ch[ chRef( ido, k, 4, l1, ido ) - chOffset ] = -sqrt2 * ( tr1 + ti1 ); + ch[ chRef( ido, k, 4, l1, ido ) - chOffset ] = -SQRT2 * ( tr1 + ti1 ); } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js index 037aa682f58e..4876a19f77fa 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js @@ -62,16 +62,19 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var tr11 = 0.309016994374947; -var ti11 = 0.951056516295154; -var tr12 = -0.809016994374947; -var ti12 = 0.587785252292473; +var TR11 = cos( ( 2 * PI ) / 5 ); // 0.309016994374947 +var TI11 = sin( ( 2 * PI ) / 5 ); // 0.951056516295154 +var TR12 = cos( ( 4 * PI ) / 5 ); // -0.809016994374947 +var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 // MAIN // @@ -133,10 +136,10 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { tr2 = cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ]; tr3 = cc[ ccRef( ido, 4, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 4, k, 5, ido ) - ccOffset ]; ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; - cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr11 ) + ( tr3 * tr12 ); - cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr12 ) + ( tr3 * tr11 ); - ci5 = ( ti5 * ti11 ) + ( ti4 * ti12 ); - ci4 = ( ti5 * ti12 ) - ( ti4 * ti11 ); + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR11 ) + ( tr3 * TR12 ); + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR12 ) + ( tr3 * TR11 ); + ci5 = ( ti5 * TI11 ) + ( ti4 * TI12 ); + ci4 = ( ti5 * TI12 ) - ( ti4 * TI11 ); ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci5; ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr3 - ci4; ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = cr3 + ci4; @@ -159,14 +162,14 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { tr3 = cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 4, k, 5, ido ) - ccOffset ]; ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; - cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr11 ) + ( tr3 * tr12 ); - ci2 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * tr11 ) + ( ti3 * tr12 ); - cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * tr12 ) + ( tr3 * tr11 ); - ci3 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * tr12 ) + ( ti3 * tr11 ); - cr5 = ( tr5 * ti11 ) + ( tr4 * ti12 ); - ci5 = ( ti5 * ti11 ) + ( ti4 * ti12 ); - cr4 = ( tr5 * ti12 ) - ( tr4 * ti11 ); - ci4 = ( ti5 * ti12 ) - ( ti4 * ti11 ); + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR11 ) + ( tr3 * TR12 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * TR11 ) + ( ti3 * TR12 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR12 ) + ( tr3 * TR11 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * TR12 ) + ( ti3 * TR11 ); + cr5 = ( tr5 * TI11 ) + ( tr4 * TI12 ); + ci5 = ( ti5 * TI11 ) + ( ti4 * TI12 ); + cr4 = ( tr5 * TI12 ) - ( tr4 * TI11 ); + ci4 = ( ti5 * TI12 ) - ( ti4 * TI11 ); dr3 = cr3 - ci4; dr4 = cr3 + ci4; di3 = ci3 + cr4; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js index 95b18175901f..ce333268755f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -56,16 +56,14 @@ * ``` */ -/* eslint-disable max-len */ -/* eslint-disable max-statements */ +/* eslint-disable max-len, max-statements */ 'use strict'; // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); var c1Ref = require( './c1_ref.js' ); @@ -119,6 +117,7 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { var lc; var ik; var is; + var sc; var i; var j; var k; @@ -132,9 +131,10 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { c2Offset = 1 + idl1; // Function body: - arg = ( 2 * PI ) / ( ip ); - dcp = cos( arg ); - dsp = sin( arg ); + arg = TWO_PI / ip; + sc = sincos( arg ); + dcp = sc[ 1 ]; + dsp = sc[ 0 ]; idp2 = ido + 2; nbd = ( ido - 1 ) / 2; ipp2 = ip + 2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index 2afb97becf8b..c4a4220af2d2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -62,14 +62,17 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = -0.5; -var taui = 0.866025403784439; +var taur = cos( ( 2 * PI ) / 3 ); // -0.5 +var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js index 802cb80ad723..77e3020337f9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js @@ -62,15 +62,11 @@ // MODULES // +var SQRT_HALF = require( '@stdlib/constants/float64/sqrt-half' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); -// VARIABLES // - -var hsqt2 = 0.7071067811865475; - - // MAIN // /** @@ -158,8 +154,8 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { } } for ( k = 1; k <= l1; k++ ) { - ti1 = -hsqt2 * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); - tr1 = hsqt2 * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); + ti1 = -SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); + tr1 = SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); ch[ chRef( ido, 1, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] + tr1; ch[ chRef( ido, 3, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] - tr1; ch[ chRef( 1, 2, k, 4, ido ) - chOffset ] = ti1 - cc[ ccRef( ido, k, 3, l1, ido ) - ccOffset ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js index f8e7d6a077ed..8b6aa78877d9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js @@ -62,16 +62,19 @@ // MODULES // +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var tr11 = 0.309016994374947; -var ti11 = 0.951056516295154; -var tr12 = -0.809016994374947; -var ti12 = 0.587785252292473; +var TR11 = cos( ( 2 * PI ) / 5 ); // 0.309016994374947 +var TI11 = sin( ( 2 * PI ) / 5 ); // 0.951056516295154 +var TR12 = cos( ( 4 * PI ) / 5 ); // -0.809016994374947 +var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 // MAIN // @@ -133,10 +136,10 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { cr3 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; ci4 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; ch[ chRef( 1, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cr2 + cr3; - ch[ chRef( ido, 2, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( tr11 * cr2 ) + ( tr12 * cr3 ); - ch[ chRef( 1, 3, k, 5, ido ) - chOffset ] = ( ti11 * ci5 ) + ( ti12 * ci4 ); - ch[ chRef( ido, 4, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( tr12 * cr2 ) + ( tr11 * cr3 ); - ch[ chRef( 1, 5, k, 5, ido ) - chOffset ] = ( ti12 * ci5 ) - ( ti11 * ci4 ); + ch[ chRef( ido, 2, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); + ch[ chRef( 1, 3, k, 5, ido ) - chOffset ] = ( TI11 * ci5 ) + ( TI12 * ci4 ); + ch[ chRef( ido, 4, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); + ch[ chRef( 1, 5, k, 5, ido ) - chOffset ] = ( TI12 * ci5 ) - ( TI11 * ci4 ); } if ( ido === 1 ) { return; @@ -163,14 +166,14 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { ci3 = di3 + di4; ch[ chRef( i - 1, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + cr2 + cr3; ch[ chRef( i, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ci2 + ci3; - tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( tr11 * cr2 ) + ( tr12 * cr3 ); - ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( tr11 * ci2 ) + ( tr12 * ci3 ); - tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( tr12 * cr2 ) + ( tr11 * cr3 ); - ti3 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( tr12 * ci2 ) + ( tr11 * ci3 ); - tr5 = ( ti11 * cr5 ) + ( ti12 * cr4 ); - ti5 = ( ti11 * ci5 ) + ( ti12 * ci4 ); - tr4 = ( ti12 * cr5 ) - ( ti11 * cr4 ); - ti4 = ( ti12 * ci5 ) - ( ti11 * ci4 ); + tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); + ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( TR11 * ci2 ) + ( TR12 * ci3 ); + tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); + ti3 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( TR12 * ci2 ) + ( TR11 * ci3 ); + tr5 = ( TI11 * cr5 ) + ( TI12 * cr4 ); + ti5 = ( TI11 * ci5 ) + ( TI12 * ci4 ); + tr4 = ( TI12 * cr5 ) - ( TI11 * cr4 ); + ti4 = ( TI12 * ci5 ) - ( TI11 * ci4 ); ch[ chRef( i - 1, 3, k, 5, ido ) - chOffset ] = tr2 + tr5; ch[ chRef( ic - 1, 2, k, 5, ido ) - chOffset ] = tr2 - tr5; ch[ chRef( i, 3, k, 5, ido ) - chOffset ] = ti2 + ti5; From 44838d0cdfef6e6c3166d6ed664e36340bab3e06 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 13 Jan 2025 06:53:41 +0530 Subject: [PATCH 030/102] feat: add cfftb1, cfftb, update index.js --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 91 ++++++++++ .../@stdlib/fft/base/fftpack/lib/cfftb1.js | 161 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/index.js | 19 ++- 3 files changed, 268 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js new file mode 100644 index 000000000000..b1d80c9fc34f --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -0,0 +1,91 @@ +/** +* @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. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} c - input array containing sequence to be transformed +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function cfftb( n, c, wsave ) { + var iw1; + var iw2; + if ( n === 1 ) { + return; + } + iw1 = ( 2 * n ) + 1; + iw2 = iw1 + ( 2 * n ); + cfftb1( n, c[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ iw2 - 1 ] ); +} + + +// EXPORTS // + +module.exports = cfftb; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js new file mode 100644 index 000000000000..a28a15c03b6d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js @@ -0,0 +1,161 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var passb4 = require( './passb4.js' ); +var passb2 = require( './passb2.js' ); +var passb3 = require( './passb3.js' ); +var passfb5 = require( './passfb5.js' ); +var passfb = require( './passfb.js' ); + + +// MAIN // + +/** +* Performs the complex backward Fast Fourier Transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} c - input array containing sequence to be transformed +* @param {Float64Array} ch - working array for intermediate results +* @param {Float64Array} wa - array of twiddle factors +* @param {Int32Array} ifac - array containing factorization information +* @returns {void} +*/ +function cfftb1( n, c, ch, wa, ifac ) { + var idl1; + var idot; + var ix2; + var ix3; + var ix4; + var nac; + var ido; + var k1; + var l1; + var l2; + var na; + var nf; + var ip; + var iw; + var i; + + // Function Body: + nf = ifac[ 1 ]; + na = 0; + l1 = 1; + iw = 0; + for ( k1 = 1; k1 <= nf; k1++ ) { + ip = ifac[ k1 + 1 ]; + l2 = ip * l1; + ido = n / l2; + idot = ido + ido; + idl1 = idot * l1; + switch ( ip ) { + case 4: + ix2 = iw + idot; + ix3 = ix2 + idot; + passb4( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + na = 1 - na; + break; + case 2: + passb2( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ] ); + na = 1 - na; + break; + case 3: + ix2 = iw + idot; + passb3( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + na = 1 - na; + break; + case 5: + ix2 = iw + idot; + ix3 = ix2 + idot; + ix4 = ix3 + idot; + passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ], 1 ); + na = 1 - na; + break; + default: + if ( na === 0 ) { + passfb( nac, idot, ip, l1, idl1, c, c, c, ch, ch, wa[ iw ], 1 ); + } else { + passfb( nac, idot, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ], 1 ); + } + if ( nac !== 0 ) { + na = 1 - na; + } + break; + } + l1 = l2; + iw += ( ip - 1 ) * idot; + } + if ( na === 0 ) { + return; + } + for ( i = 0; i < ( 2 * n ); i++ ) { + c[ i ] = ch[ i ]; + } +} + + +// EXPORTS // + +module.exports = cfftb1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js index 8da832adeec0..ff2caab5e16e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js @@ -22,17 +22,30 @@ * When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. */ +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); + // MAIN // /** * Top-level namespace. * -* @namespace fftpack +* @namespace ns +*/ +var ns = {}; + +/** +* @name cfftb +* @memberof ns +* @readonly +* @type {Function} +* @see {@link module:@stdlib/fft/base/fftpack/cfftb} */ -var fftpack = {}; +setReadOnly( ns, 'cfftb', require( './cfftb.js' ) ); // EXPORTS // -module.exports = fftpack; +module.exports = ns; From 3bfdc598389898cbd1a2f51d2051efa265b94676 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 14 Jan 2025 06:50:59 +0530 Subject: [PATCH 031/102] feat: add cfftf, cfftf1 --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 2 +- .../@stdlib/fft/base/fftpack/lib/cfftf.js | 91 ++++++++++ .../@stdlib/fft/base/fftpack/lib/cfftf1.js | 161 ++++++++++++++++++ 3 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index b1d80c9fc34f..d65ba7d1858a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -82,7 +82,7 @@ function cfftb( n, c, wsave ) { } iw1 = ( 2 * n ) + 1; iw2 = iw1 + ( 2 * n ); - cfftb1( n, c[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ iw2 - 1 ] ); + cfftb1( n, c[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ iw1 - 1 ], wsave[ iw2 - 1 ] ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js new file mode 100644 index 000000000000..1bc343c74482 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js @@ -0,0 +1,91 @@ +/** +* @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 cfftf1 = require( './cfftf1.js' ); + + +// MAIN // + +/** +* Performs the complex forward Fast Fourier Transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} c - input array containing sequence to be transformed +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function cfftf( n, c, wsave ) { + var iw1; + var iw2; + if ( n === 1 ) { + return; + } + iw1 = ( 2 * n ) + 1; + iw2 = iw1 + ( 2 * n ); + cfftf1( n, c[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ iw1 - 1 ], wsave[ iw2 - 1 ] ); +} + + +// EXPORTS // + +module.exports = cfftf; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js new file mode 100644 index 000000000000..4f42943dfe92 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js @@ -0,0 +1,161 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var passfb5 = require( './passfb5.js' ); +var passfb = require( './passfb.js' ); +var passf4 = require( './passf4.js' ); +var passf2 = require( './passf2.js' ); +var passf3 = require( './passf3.js' ); + + +// MAIN // + +/** +* Performs the complex forward Fast Fourier Transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} c - input array containing sequence to be transformed +* @param {Float64Array} ch - working array for intermediate results +* @param {Float64Array} wa - array of twiddle factors +* @param {Int32Array} ifac - array containing factorization information +* @returns {void} +*/ +function cfftf1( n, c, ch, wa, ifac ) { + var idl1; + var idot; + var nac; + var ido; + var ix4; + var ix3; + var ix2; + var nf; + var na; + var l2; + var l1; + var iw; + var ip; + var k1; + var i; + + // Function Body: + nf = ifac[ 1 ]; + na = 0; + l1 = 1; + iw = 0; + for ( k1 = 1; k1 <= nf; k1++ ) { + ip = ifac[ k1 + 1 ]; + l2 = ip * l1; + ido = n / l2; + idot = ido + ido; + idl1 = idot * l1; + switch ( ip ) { + case 4: + ix2 = iw + idot; + ix3 = ix2 + idot; + passf4( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + na = 1 - na; + break; + case 2: + passf2( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ] ); + na = 1 - na; + break; + case 3: + ix2 = iw + idot; + passf3( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + na = 1 - na; + break; + case 5: + ix2 = iw + idot; + ix3 = ix2 + idot; + ix4 = ix3 + idot; + passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ], -1 ); + na = 1 - na; + break; + default: + if ( na === 0 ) { + passfb( nac, idot, ip, l1, idl1, c, c, c, ch, ch, wa[ iw ], -1 ); + } else { + passfb( nac, idot, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ], -1 ); + } + if ( nac !== 0 ) { + na = 1 - na; + } + break; + } + l1 = l2; + iw += ( ip - 1 ) * idot; + } + if ( na === 0 ) { + return; + } + for ( i = 0; i < ( 2 * n ); i++ ) { + c[ i ] = ch[ i ]; + } +} + + +// EXPORTS // + +module.exports = cfftf1; From 3b2c9de79f1fd33334b02e4c72b058e8eb67c63a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 15 Jan 2025 07:10:07 +0530 Subject: [PATCH 032/102] feat: add cfftfi, cffti, decompose, update cfftf --- .../@stdlib/fft/base/fftpack/lib/cfftf.js | 2 + .../@stdlib/fft/base/fftpack/lib/cffti.js | 92 ++++++++++++ .../@stdlib/fft/base/fftpack/lib/cffti1.js | 142 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/decompose.js | 122 +++++++++++++++ 4 files changed, 358 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js index 1bc343c74482..2c99af5c74f4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js @@ -77,6 +77,8 @@ var cfftf1 = require( './cfftf1.js' ); function cfftf( n, c, wsave ) { var iw1; var iw2; + + // Function Body: if ( n === 1 ) { return; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js new file mode 100644 index 000000000000..a51716998554 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js @@ -0,0 +1,92 @@ +/** +* @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 cffti1 = require( './cffti1.js' ); + + +// MAIN // + +/** +* Initializes the working array for the complex FFT. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function cffti( n, wsave ) { + var iw1; + var iw2; + + // Function Body: + if ( n === 1 ) { + return; + } + iw1 = ( 2 * n ) + 1; + iw2 = iw1 + ( 2 * n ); + cffti1( n, wsave[ iw1 - 1 ], wsave[ iw2 - 1 ] ); +} + + +// EXPORTS // + +module.exports = cffti; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js new file mode 100644 index 000000000000..459eecb05b0a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js @@ -0,0 +1,142 @@ +/** +* @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 sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var decompose = require( './decompose.js' ); + + +// VARIABLES // + +var NTRYH = [ 3, 4, 2, 5 ]; // Initial trial factors for FFT factorization + + +// MAIN // + +/** +* Initializes the working arrays for the FFT algorithm. +* +* @private +* @param {number} n - length of the sequence +* @param {Float64Array} wa - array of twiddle factors +* @param {Int32Array} ifac - array containing factorization information +* @returns {void} +*/ +function cffti1( n, wa, ifac ) { + var argld; + var argh; + var idot; + var ipm; + var ido; + var arg; + var nf; + var ip; + var ii; + var ld; + var fi; + var l2; + var l1; + var k1; + var i1; + var j; + var i; + + nf = decompose( n, ifac, NTRYH ); + argh = TWO_PI / n; + i = 2; + l1 = 1; + for ( k1 = 1; k1 <= nf; k1++ ) { + ip = ifac[ k1 + 2 - 1 ]; + ld = 0; + l2 = ip * l1; + ido = n / l2; + idot = ido + ido + 2; + ipm = ip - 1; + for ( j = 1; j <= ipm; j++ ) { + i1 = i; + wa[ i - 1 - 1 ] = 1.0; + wa[ i - 1 ] = 0.0; + ld += l1; + fi = 0.0; + argld = ld * argh; + for ( ii = 4; ii <= idot; ii += 2 ) { + i += 2; + fi += 1.0; + arg = fi * argld; + wa[ i - 1 - 1 ] = cos( arg ); + wa[ i - 1 ] = sin( arg ); + } + if ( ip > 5 ) { + wa[ i1 - 1 - 1 ] = wa[ i - 1 - 1 ]; + wa[ i1 - 1 ] = wa[ i - 1 ]; + } + } + + l1 = l2; + } +} + + +// EXPORTS // + +module.exports = cffti1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js new file mode 100644 index 000000000000..9c57f16c1786 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -0,0 +1,122 @@ +/** +* @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 // + +/** +* Decomposes the sequence length into its prime factors. +* +* @private +* @param {number} n - length of the sequence +* @param {Int32Array} ifac - array to store the factors +* @param {Array} ntryh - array of initial trial divisors +* @returns {number} status code +*/ +function decompose( n, ifac, ntryh ) { + var ntry; + var nl; + var nf; + var nq; + var nr; + var ib; + var i; + var j; + + ntry = 0; + nl = n; + nf = 0; + j = 0; + do { + if ( j < 4 ) { + ntry = ntryh[ j ]; + } else { + ntry += 2; + } + j += 1; + while ( true ) { + nq = nl / ntry; + nr = nl - (ntry * nq); + if ( nr !== 0 ) { + break; + } + nf += 1; + ifac[ nf + 2 ] = ntry; + nl = nq; + if ( ntry === 2 && nf !== 1 ) { + for ( i = 2; i <= nf; i++ ) { + ib = nf - i + 2; + ifac[ ib + 2 ] = ifac[ ib + 1 ]; + } + ifac[ 3 ] = 2; + } + if ( nl === 1 ) { + break; + } + } + } while ( nl !== 1 ); + ifac[ 1 ] = n; + ifac[ 2 ] = nf; + return nf; +} + + +// EXPORTS // + +module.exports = decompose; From 16f8a67ad1e44d98be84c01bb95a075565c36b4f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 16 Jan 2025 11:21:49 +0530 Subject: [PATCH 033/102] feat: add rfftb, rfftb1, rfftf1 --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 1 - .../@stdlib/fft/base/fftpack/lib/cfftf.js | 1 - .../@stdlib/fft/base/fftpack/lib/rfftb.js | 86 ++++++++++ .../@stdlib/fft/base/fftpack/lib/rfftb1.js | 158 +++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/rfftf1.js | 159 ++++++++++++++++++ 5 files changed, 403 insertions(+), 2 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index d65ba7d1858a..5a443392ae5c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -68,7 +68,6 @@ var cfftb1 = require( './cfftb1.js' ); /** * Performs the complex backward Fast Fourier Transform. * -* @private * @param {number} n - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed * @param {Float64Array} wsave - working array containing precomputed values diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js index 2c99af5c74f4..0abd8d2ee5fc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js @@ -68,7 +68,6 @@ var cfftf1 = require( './cfftf1.js' ); /** * Performs the complex forward Fast Fourier Transform. * -* @private * @param {number} n - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed * @param {Float64Array} wsave - working array containing precomputed values diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js new file mode 100644 index 000000000000..8f85e8a13333 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js @@ -0,0 +1,86 @@ +/** +* @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 rfftb1 = require( './rfftb1.js' ); + + +// MAIN // + +/** +* Performs the backward FFT for real-valued sequences. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} r - array containing sequence to be transformed +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function rfftb( n, r, wsave ) { + if ( n === 1 ) { + return; + } + rfftb1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 ] ); +} + + +// EXPORTS // + +module.exports = rfftb; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js new file mode 100644 index 000000000000..4bb1760bbc51 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js @@ -0,0 +1,158 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var radb2 = require( './radb2.js' ); +var radb3 = require( './radb3.js' ); +var radb4 = require( './radb4.js' ); +var radb5 = require( './radb5.js' ); +var radbg = require( './radbg.js' ); + + +// MAIN // + +/** +* Performs the backward real-valued Fast Fourier Transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} c - input array containing sequence to be transformed +* @param {Float64Array} ch - working array for intermediate results +* @param {Float64Array} wa - array of twiddle factors +* @param {Int32Array} ifac - array containing factorization information +* @returns {void} +*/ +function rfftb1( n, c, ch, wa, ifac ) { + var idl1; + var ido; + var ix4; + var ix3; + var ix2; + var nf; + var na; + var l2; + var l1; + var iw; + var ip; + var k1; + var i; + + // Function Body: + nf = ifac[ 1 ]; + na = 0; + l1 = 1; + iw = 0; + for ( k1 = 1; k1 <= nf; k1++ ) { + ip = ifac[ k1 + 1 ]; + l2 = ip * l1; + ido = n / l2; + idl1 = ido * l1; + switch ( ip ) { + case 4: + ix2 = iw + ido; + ix3 = ix2 + ido; + radb4( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + na = 1 - na; + break; + case 2: + radb2( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ] ); + na = 1 - na; + break; + case 3: + ix2 = iw + ido; + radb3( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + na = 1 - na; + break; + case 5: + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; + radb5( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ] ); + na = 1 - na; + break; + default: + if ( na === 0 ) { + radbg( ido, ip, l1, idl1, c, c, c, ch, ch, wa[ iw ] ); + } else { + radbg( ido, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ] ); + } + if ( ido === 1 ) { + na = 1 - na; + } + break; + } + l1 = l2; + iw += ( ip - 1 ) * ido; + } + if ( na === 0 ) { + return; + } + for ( i = 0; i < n; i++ ) { + c[ i ] = ch[ i ]; + } +} + + +// EXPORTS // + +module.exports = rfftb1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js new file mode 100644 index 000000000000..1bc43b13f825 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js @@ -0,0 +1,159 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var radf2 = require( './radf2.js' ); +var radf3 = require( './radf3.js' ); +var radf4 = require( './radf4.js' ); +var radf5 = require( './radf5.js' ); +var radfg = require( './radfg.js' ); + + +// MAIN // + +/** +* Performs the forward real-valued Fast Fourier Transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} c - input array containing sequence to be transformed +* @param {Float64Array} ch - working array for intermediate results +* @param {Float64Array} wa - array of twiddle factors +* @param {Int32Array} ifac - array containing factorization information +* @returns {void} +*/ +function rfftf1( n, c, ch, wa, ifac ) { + var idl1; + var ido; + var ix4; + var ix3; + var ix2; + var nf; + var na; + var l2; + var l1; + var kh; + var iw; + var ip; + var k1; + var i; + + // Function Body: + nf = ifac[ 1 ]; + na = 1; + l2 = n; + iw = n - 1; + for ( k1 = 1; k1 <= nf; k1++ ) { + kh = nf - k1; + ip = ifac[ kh + 2 ]; + l1 = l2 / ip; + ido = n / l2; + idl1 = ido * l1; + iw -= ( ip - 1 ) * ido; + na = 1 - na; + switch ( ip ) { + case 4: + ix2 = iw + ido; + ix3 = ix2 + ido; + radf4( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + break; + case 2: + radf2( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + break; + case 3: + ix2 = iw + ido; + radf3( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + break; + case 5: + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; + radf5( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ] ); + break; + default: + if ( ido === 1 ) { + na = 1 - na; + } + if ( na === 0 ) { + radfg( ido, ip, l1, idl1, c, c, c, ch, ch, c, wa[ iw ] ); + na = 1; + } else { + radfg( ido, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ] ); + na = 0; + } + break; + } + l2 = l1; + } + if ( na === 1 ) { + return; + } + for ( i = 0; i < n; i++ ) { + c[ i ] = ch[ i ]; + } +} + + +// EXPORTS // + +module.exports = rfftf1; From f20933d7256dcff26b97eaab370ff3969a155c5e Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 16 Jan 2025 11:22:34 +0530 Subject: [PATCH 034/102] feat: add rfftb, rfftb1, rfftf1 --- lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js index 8f85e8a13333..aa0db2c80c49 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js @@ -77,7 +77,7 @@ function rfftb( n, r, wsave ) { if ( n === 1 ) { return; } - rfftb1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 ] ); + rfftb1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 ] ); // eslint-disable-line max-len } From ef1b5b2d0556299b8f0ea35d31efebd989d6aa0b Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 16 Jan 2025 22:29:43 +0530 Subject: [PATCH 035/102] feat: add rfftf, rfftfi, rffti1 --- .../@stdlib/fft/base/fftpack/lib/rfftf.js | 86 +++++++++++ .../@stdlib/fft/base/fftpack/lib/rfftfi.js | 85 +++++++++++ .../@stdlib/fft/base/fftpack/lib/rffti1.js | 139 ++++++++++++++++++ 3 files changed, 310 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftfi.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js new file mode 100644 index 000000000000..0e3526d81953 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -0,0 +1,86 @@ +/** +* @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 rfftf1 = require( './rfftf1.js' ); + + +// MAIN // + +/** +* Performs the forward FFT for real-valued sequences. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} r - array containing sequence to be transformed +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function rfftf( n, r, wsave ) { + if ( n === 1 ) { + return; + } + rfftf1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 - 1 ] ); +} + + +// EXPORTS // + +module.exports = rfftf; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftfi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftfi.js new file mode 100644 index 000000000000..a56038aad463 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftfi.js @@ -0,0 +1,85 @@ +/** +* @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 rffti1 = require( './rffti1.js' ); + + +// MAIN // + +/** +* Initializes the working array for real-valued FFT. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} wsave - working array to be initialized +* @returns {void} +*/ +function rffti( n, wsave ) { + if ( n === 1 ) { + return; + } + rffti1( n, wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 - 1 ] ); +} + + +// EXPORTS // + +module.exports = rffti; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js new file mode 100644 index 000000000000..69304b5a0c45 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -0,0 +1,139 @@ +/** +* @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 sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var decompose = require( './decompose.js' ); + + +// VARIABLES // + +var NTRYH = [ 4, 2, 3, 5 ]; // Initial trial factors for FFT factorization + + +// MAIN // + +/** +* Initializes the working arrays for the FFT algorithm. +* +* @private +* @param {number} n - length of the sequence +* @param {Float64Array} wa - array of twiddle factors +* @param {Int32Array} ifac - array containing factorization information +* @returns {void} +*/ +function rffti1( n, wa, ifac ) { + var argld; + var argh; + var nfm1; + var ipm; + var ido; + var arg; + var nf; + var ip; + var is; + var ii; + var ld; + var fi; + var l2; + var l1; + var k1; + var j; + var i; + + nf = decompose( n, ifac, NTRYH ); + argh = TWO_PI / n; + is = 0; + nfm1 = nf - 1; + l1 = 1; + if ( nfm1 === 0 ) { + return; + } + for ( k1 = 1; k1 <= nfm1; k1++ ) { + ip = ifac[ k1 + 2 - 1 ]; + ld = 0; + l2 = ip * l1; + ido = n / l2; + ipm = ip - 1; + for ( j = 1; j <= ipm; j++ ) { + ld += l1; + i = is; + argld = ld * argh; + fi = 0.0; + for ( ii = 3; ii <= ido; ii += 2 ) { + i += 2; + fi += 1.0; + arg = fi * argld; + wa[ i - 1 - 1 ] = cos( arg ); + wa[ i - 1 ] = sin( arg ); + } + is += ido; + } + l1 = l2; + } +} + + +// EXPORTS // + +module.exports = rffti1; From aa4008befb64bfb1cc8b3ecfdcdc47a9e7e964f1 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 16 Jan 2025 22:30:35 +0530 Subject: [PATCH 036/102] docs: disable eslint max-len --- lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js index 0e3526d81953..fcfe8ffb5027 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -77,7 +77,7 @@ function rfftf( n, r, wsave ) { if ( n === 1 ) { return; } - rfftf1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 - 1 ] ); + rfftf1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 - 1 ] ); // eslint-disable-line max-len } From 59b47aeec7af5ef02631dfe38307cf1033bad24a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Fri, 17 Jan 2025 18:59:47 +0530 Subject: [PATCH 037/102] feat: add cosqb, cosqb1, cosqf, cosqf1 --- .../@stdlib/fft/base/fftpack/lib/cosqb.js | 100 ++++++++++++++ .../@stdlib/fft/base/fftpack/lib/cosqb1.js | 122 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/cosqf.js | 93 +++++++++++++ .../@stdlib/fft/base/fftpack/lib/cosqf1.js | 118 +++++++++++++++++ 4 files changed, 433 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js new file mode 100644 index 000000000000..14ddc07210ae --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js @@ -0,0 +1,100 @@ +/** +* @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 SQRT_TWO = require( '@stdlib/constants/float64/sqrt-two' ); +var cosqb1 = require( './cosqb1.js' ); + + +// VARIABLES // + +// Two times the square root of 2: +var TSQRT2 = 2.0 * SQRT_TWO; + + +// MAIN // + +/** +* Performs the quarter-wave cosine backward transform. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} x - input array containing sequence to be transformed +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function cosqb( n, x, wsave ) { + var x1; + + if ( n < 2 ) { + x[ 1 - 1 ] *= 4.0; + } else if ( n === 2 ) { + x1 = ( x[ 1 - 1 ] + x[ 2 - 1 ] ) * 4.0; + x[ 2 - 1 ] = TSQRT2 * ( x[ 1 - 1 ] - x[ 2 - 1 ] ); + x[ 1 - 1 ] = x1; + } else { + cosqb1( n, x[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ] ); + } +} + + +// EXPORTS // + +module.exports = cosqb; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js new file mode 100644 index 000000000000..3971caeacbea --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js @@ -0,0 +1,122 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var rfftb = require( './rfftb.js' ); + + +// MAIN // + +/** +* Performs the quarter-wave cosine backward transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} x - input array containing sequence to be transformed +* @param {Float64Array} w - working array containing precomputed cosine values +* @param {Float64Array} xh - auxiliary working array +* @returns {void} +*/ +function cosqb1( n, x, w, xh ) { + var xim1; + var modn; + var np2; + var ns2; + var kc; + var k; + var i; + + // Function Body: + ns2 = ( n + 1 ) / 2; + np2 = n + 2; + for ( i = 3; i <= n; i += 2 ) { + xim1 = x[ i - 1 - 1 ] + x[ i - 1 ]; + x[ i - 1 ] -= x[ i - 1 - 1 ]; + x[ i - 1 - 1 ] = xim1; + } + x[ 1 - 1 ] += x[ 1 - 1 ]; + modn = n % 2; + if ( modn === 0 ) { + x[ n - 1 ] += x[ n - 1 ]; + } + rfftb( n, x[ 1 - 1 ], xh[ 1 - 1 ] ); + for ( k = 2; k <= ns2; k++ ) { + kc = np2 - k; + xh[ k - 1 ] = ( w[ k - 1 - 1 ] * x[ kc - 1 ] ) + ( w[ kc - 1 - 1 ] * x[ k - 1 ] ); + xh[ kc - 1 ] = ( w[ k - 1 - 1 ] * x[ k - 1 ] ) - ( w[ kc - 1 - 1 ] * x[ kc - 1 ] ); + } + if ( modn === 0 ) { + x[ ns2 + 1 - 1 ] = w[ ns2 - 1 ] * ( x[ ns2 + 1 - 1 ] + x[ ns2 + 1 - 1 ] ); + } + for ( k = 2; k <= ns2; k++ ) { + kc = np2 - k; + x[ k - 1 ] = xh[ k - 1 ] + xh[ kc - 1 ]; + x[ kc - 1 ] = xh[ k - 1 ] - xh[ kc - 1 ]; + } + x[ 1 - 1 ] += x[ 1 - 1 ]; +} + + +// EXPORTS // + +module.exports = cosqb1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js new file mode 100644 index 000000000000..fca2da26281f --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js @@ -0,0 +1,93 @@ +/** +* @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 SQRT2 = require( '@stdlib/constants/float64/sqrt-two' ); +var cosqf1 = require( './cosqf1.js' ); + + +// MAIN // + +/** +* Performs the quarter-wave cosine forward transform. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} x - input array containing sequence to be transformed +* @param {Float64Array} wsave - working array containing precomputed values +* @returns {void} +*/ +function cosqf( n, x, wsave ) { + var tsqx; + + // Function Body: + if ( n === 2 ) { + tsqx = SQRT2 * x[ 2 - 1 ]; + x[ 2 - 1 ] = x[ 1 - 1 ] - tsqx; + x[ 1 - 1 ] += tsqx; + } else if ( n > 2 ) { + cosqf1( n, x[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ] ); + } +} + + +// EXPORTS // + +module.exports = cosqf; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js new file mode 100644 index 000000000000..dbfc42bbc284 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js @@ -0,0 +1,118 @@ +/** +* @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 rfftf = require( './rfftf.js' ); + + +// MAIN // + +/** +* Performs the quarter-wave cosine forward transform. +* +* @private +* @param {number} n - length of the sequence to transform +* @param {Float64Array} x - input array containing sequence to be transformed +* @param {Float64Array} w - working array containing precomputed cosine values +* @param {Float64Array} xh - auxiliary working array +* @returns {void} +*/ +function cosqf1( n, x, w, xh ) { + var xim1; + var modn; + var np2; + var ns2; + var kc; + var k; + var i; + + // Function Body: + ns2 = ( n + 1 ) / 2; + np2 = n + 2; + for ( k = 2; k <= ns2; k++ ) { + kc = np2 - k; + xh[ k - 1 ] = x[ k - 1 ] + x[ kc - 1 ]; + xh[ kc - 1 ] = x[ k - 1 ] - x[ kc - 1 ]; + } + modn = n % 2; + if ( modn === 0 ) { + xh[ ns2 + 1 - 1 ] = x[ ns2 + 1 - 1 ] + x[ ns2 + 1 - 1 ]; + } + for ( k = 2; k <= ns2; k++ ) { + kc = np2 - k; + x[ k - 1 ] = ( w[ k - 1 - 1 ] * xh[ kc - 1 ] ) + ( w[ kc - 1 - 1 ] * xh[ k - 1 ] ); + x[ kc - 1 ] = ( w[ k - 1 - 1 ] * xh[ k - 1 ] ) - ( w[ kc - 1 - 1 ] * xh[ kc - 1 ] ); + } + if ( modn === 0 ) { + x[ ns2 + 1 - 1 ] = w[ ns2 - 1 ] * xh[ ns2 + 1 - 1 ]; + } + rfftf( n, x[ 1 - 1 ], xh[ 1 - 1 ] ); + for ( i = 3; i <= n; i += 2 ) { + xim1 = x[ i - 1 - 1 ] - x[ i - 1 ]; + x[ i - 1 ] = x[ i - 1 - 1 ] + x[ i - 1 ]; + x[ i - 1 - 1 ] = xim1; + } +} + + +// EXPORTS // + +module.exports = cosqf1; From 712e412c1117e717c17b53ef7439e94f747184e7 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 21 Jan 2025 06:58:49 +0530 Subject: [PATCH 038/102] refactor: use offsets along with arrays in cosqf1 and cosqf --- .../@stdlib/fft/base/fftpack/lib/cosqf.js | 12 +++++---- .../@stdlib/fft/base/fftpack/lib/cosqf1.js | 25 +++++++++++-------- .../@stdlib/fft/base/fftpack/lib/decompose.js | 2 +- .../base/fftpack/lib/{rfftfi.js => rffti.js} | 0 4 files changed, 22 insertions(+), 17 deletions(-) rename lib/node_modules/@stdlib/fft/base/fftpack/lib/{rfftfi.js => rffti.js} (100%) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js index fca2da26281f..0e9ee47a1b7a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js @@ -71,19 +71,21 @@ var cosqf1 = require( './cosqf1.js' ); * * @param {number} n - length of the sequence to transform * @param {Float64Array} x - input array containing sequence to be transformed +* @param {number} xptr - starting index for `x` * @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqf( n, x, wsave ) { +function cosqf( n, x, xptr, wsave, wptr ) { var tsqx; // Function Body: if ( n === 2 ) { - tsqx = SQRT2 * x[ 2 - 1 ]; - x[ 2 - 1 ] = x[ 1 - 1 ] - tsqx; - x[ 1 - 1 ] += tsqx; + tsqx = SQRT2 * x[ xptr + 1 ]; + x[ xptr + 1 ] = x[ xptr ] - tsqx; + x[ xptr ] += tsqx; } else if ( n > 2 ) { - cosqf1( n, x[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ] ); + cosqf1( n, x, xptr, wsave, wptr, wsave, wptr + n ); } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js index dbfc42bbc284..df4f073d1781 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js @@ -71,11 +71,14 @@ var rfftf = require( './rfftf.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} x - input array containing sequence to be transformed +* @param {number} xptr - starting index for `x` * @param {Float64Array} w - working array containing precomputed cosine values +* @param {number} wptr - starting index for `w` * @param {Float64Array} xh - auxiliary working array +* @param {number} xhptr - starting index for `xh` * @returns {void} */ -function cosqf1( n, x, w, xh ) { +function cosqf1( n, x, xptr, w, wptr, xh, xhptr ) { var xim1; var modn; var np2; @@ -89,26 +92,26 @@ function cosqf1( n, x, w, xh ) { np2 = n + 2; for ( k = 2; k <= ns2; k++ ) { kc = np2 - k; - xh[ k - 1 ] = x[ k - 1 ] + x[ kc - 1 ]; - xh[ kc - 1 ] = x[ k - 1 ] - x[ kc - 1 ]; + xh[ xhptr + k - 1 ] = x[ xptr + k - 1 ] + x[ xptr + kc - 1 ]; + xh[ xhptr + kc - 1 ] = x[ xptr + k - 1 ] - x[ xptr + kc - 1 ]; } modn = n % 2; if ( modn === 0 ) { - xh[ ns2 + 1 - 1 ] = x[ ns2 + 1 - 1 ] + x[ ns2 + 1 - 1 ]; + xh[ xhptr + ns2 ] = x[ xptr + ns2 ] + x[ xptr + ns2 ]; } for ( k = 2; k <= ns2; k++ ) { kc = np2 - k; - x[ k - 1 ] = ( w[ k - 1 - 1 ] * xh[ kc - 1 ] ) + ( w[ kc - 1 - 1 ] * xh[ k - 1 ] ); - x[ kc - 1 ] = ( w[ k - 1 - 1 ] * xh[ k - 1 ] ) - ( w[ kc - 1 - 1 ] * xh[ kc - 1 ] ); + x[ xptr + k - 1 ] = ( w[ wptr + k - 2 ] * xh[ xhptr + kc - 1 ] ) + ( w[ wptr + kc - 2 ] * xh[ xhptr + k - 1 ] ); + x[ xptr + kc - 1 ] = ( w[ wptr + k - 2 ] * xh[ xhptr + k - 1 ] ) - ( w[ wptr + kc - 2 ] * xh[ xhptr + kc - 1 ] ); } if ( modn === 0 ) { - x[ ns2 + 1 - 1 ] = w[ ns2 - 1 ] * xh[ ns2 + 1 - 1 ]; + x[ xptr + ns2 ] = w[ wptr + ns2 - 1 ] * xh[ xhptr + ns2 ]; } - rfftf( n, x[ 1 - 1 ], xh[ 1 - 1 ] ); + rfftf( n, x, xptr, xh, xhptr ); for ( i = 3; i <= n; i += 2 ) { - xim1 = x[ i - 1 - 1 ] - x[ i - 1 ]; - x[ i - 1 ] = x[ i - 1 - 1 ] + x[ i - 1 ]; - x[ i - 1 - 1 ] = xim1; + xim1 = x[ xptr + i - 2 ] - x[ xptr + i - 1 ]; + x[ xptr + i - 1 ] = x[ xptr + i - 2 ] + x[ xptr + i - 1 ]; + x[ xptr + i - 2 ] = xim1; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index 9c57f16c1786..e5a47e53f091 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -92,7 +92,7 @@ function decompose( n, ifac, ntryh ) { j += 1; while ( true ) { nq = nl / ntry; - nr = nl - (ntry * nq); + nr = nl - ( ntry * nq ); if ( nr !== 0 ) { break; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftfi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftfi.js rename to lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js From 535cf963447d286733a21f628810a369510b092a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 21 Jan 2025 06:59:40 +0530 Subject: [PATCH 039/102] docs: add eslint comment --- lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js index df4f073d1781..ef90e6e09c00 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js @@ -56,6 +56,8 @@ * ``` */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // From 2c6ee270361143a5bac569e19374fd6de7bb6c87 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 28 Jan 2025 07:50:54 +0530 Subject: [PATCH 040/102] refactor: use array offsets in functions --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 10 ++++-- .../@stdlib/fft/base/fftpack/lib/cfftb1.js | 24 ++++++++------ .../@stdlib/fft/base/fftpack/lib/cfftf.js | 9 +++-- .../@stdlib/fft/base/fftpack/lib/cfftf1.js | 24 ++++++++------ .../@stdlib/fft/base/fftpack/lib/cffti.js | 7 ++-- .../@stdlib/fft/base/fftpack/lib/cffti1.js | 23 ++++++++----- .../@stdlib/fft/base/fftpack/lib/cosqb.js | 17 ++++++---- .../@stdlib/fft/base/fftpack/lib/cosqb1.js | 33 +++++++++++-------- .../@stdlib/fft/base/fftpack/lib/cosqf.js | 11 ++++--- .../@stdlib/fft/base/fftpack/lib/cosqf1.js | 24 ++++++++------ .../@stdlib/fft/base/fftpack/lib/decompose.js | 13 ++++---- .../@stdlib/fft/base/fftpack/lib/rffti.js | 6 ++-- .../@stdlib/fft/base/fftpack/lib/rffti1.js | 15 ++++++--- 13 files changed, 135 insertions(+), 81 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index 5a443392ae5c..bc4519c44c4e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -70,18 +70,24 @@ var cfftb1 = require( './cfftb1.js' ); * * @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 * @returns {void} */ -function cfftb( n, c, wsave ) { +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[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ iw1 - 1 ], wsave[ iw2 - 1 ] ); + cfftb1( n, c, cptr, wsave, wptr, wsave, wptr + iw1, wsave, wptr + iw2 ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js index a28a15c03b6d..2b9103325061 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js @@ -77,12 +77,16 @@ var passfb = require( './passfb.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed +* @param {NonNegativeInteger} cOffset - starting index for input array * @param {Float64Array} ch - working array for intermediate results +* @param {NonNegativeInteger} chOffset - starting index for working array * @param {Float64Array} wa - array of twiddle factors +* @param {NonNegativeInteger} waOffset - starting index for twiddle factors array * @param {Int32Array} ifac - array containing factorization information +* @param {NonNegativeInteger} ifacOffset - starting index for factorization array * @returns {void} */ -function cfftb1( n, c, ch, wa, ifac ) { +function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var idl1; var idot; var ix2; @@ -100,12 +104,12 @@ function cfftb1( n, c, ch, wa, ifac ) { var i; // Function Body: - nf = ifac[ 1 ]; + nf = ifac[ ifacOffset + 1 ]; na = 0; l1 = 1; iw = 0; for ( k1 = 1; k1 <= nf; k1++ ) { - ip = ifac[ k1 + 1 ]; + ip = ifac[ ifacOffset + k1 + 1 ]; l2 = ip * l1; ido = n / l2; idot = ido + ido; @@ -114,30 +118,30 @@ function cfftb1( n, c, ch, wa, ifac ) { case 4: ix2 = iw + idot; ix3 = ix2 + idot; - passb4( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + passb4( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); na = 1 - na; break; case 2: - passb2( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ] ); + passb2( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); na = 1 - na; break; case 3: ix2 = iw + idot; - passb3( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + passb3( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); na = 1 - na; break; case 5: ix2 = iw + idot; ix3 = ix2 + idot; ix4 = ix3 + idot; - passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ], 1 ); + passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset, 1 ); na = 1 - na; break; default: if ( na === 0 ) { - passfb( nac, idot, ip, l1, idl1, c, c, c, ch, ch, wa[ iw ], 1 ); + passfb( nac, idot, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset, 1 ); } else { - passfb( nac, idot, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ], 1 ); + passfb( nac, idot, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset, 1 ); } if ( nac !== 0 ) { na = 1 - na; @@ -151,7 +155,7 @@ function cfftb1( n, c, ch, wa, ifac ) { return; } for ( i = 0; i < ( 2 * n ); i++ ) { - c[ i ] = ch[ i ]; + c[ i + cOffset ] = ch[ i + chOffset ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js index 0abd8d2ee5fc..3151a94f19ba 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js @@ -70,20 +70,25 @@ var cfftf1 = require( './cfftf1.js' ); * * @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 * @returns {void} */ -function cfftf( n, c, wsave ) { +function cfftf( n, c, cptr, wsave, wptr ) { var iw1; var iw2; + wptr -= 1; + cptr -= 1; + // Function Body: if ( n === 1 ) { return; } iw1 = ( 2 * n ) + 1; iw2 = iw1 + ( 2 * n ); - cfftf1( n, c[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ iw1 - 1 ], wsave[ iw2 - 1 ] ); + cfftf1( n, c, 1 + cptr, wsave, 1 + wptr, wsave, iw1 + wptr, wsave, iw2 + wptr ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js index 4f42943dfe92..e62ed008d290 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js @@ -77,12 +77,16 @@ var passf3 = require( './passf3.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed +* @param {number} cOffset - index of first element in `c` * @param {Float64Array} ch - working array for intermediate results +* @param {number} chOffset - index of first element in `ch` * @param {Float64Array} wa - array of twiddle factors +* @param {number} waOffset - index of first element in `wa` * @param {Int32Array} ifac - array containing factorization information +* @param {number} ifacOffset - index of first element in `ifac` * @returns {void} */ -function cfftf1( n, c, ch, wa, ifac ) { +function cfftf1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var idl1; var idot; var nac; @@ -100,12 +104,12 @@ function cfftf1( n, c, ch, wa, ifac ) { var i; // Function Body: - nf = ifac[ 1 ]; + nf = ifac[ ifacOffset + 1 ]; na = 0; l1 = 1; iw = 0; for ( k1 = 1; k1 <= nf; k1++ ) { - ip = ifac[ k1 + 1 ]; + ip = ifac[ ifacOffset + k1 + 1 ]; l2 = ip * l1; ido = n / l2; idot = ido + ido; @@ -114,30 +118,30 @@ function cfftf1( n, c, ch, wa, ifac ) { case 4: ix2 = iw + idot; ix3 = ix2 + idot; - passf4( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + passf4( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); na = 1 - na; break; case 2: - passf2( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ] ); + passf2( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); na = 1 - na; break; case 3: ix2 = iw + idot; - passf3( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + passf3( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); na = 1 - na; break; case 5: ix2 = iw + idot; ix3 = ix2 + idot; ix4 = ix3 + idot; - passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ], -1 ); + passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset, -1 ); na = 1 - na; break; default: if ( na === 0 ) { - passfb( nac, idot, ip, l1, idl1, c, c, c, ch, ch, wa[ iw ], -1 ); + passfb( nac, idot, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset, -1 ); } else { - passfb( nac, idot, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ], -1 ); + passfb( nac, idot, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset, -1 ); } if ( nac !== 0 ) { na = 1 - na; @@ -151,7 +155,7 @@ function cfftf1( n, c, ch, wa, ifac ) { return; } for ( i = 0; i < ( 2 * n ); i++ ) { - c[ i ] = ch[ i ]; + c[ i + cOffset ] = ch[ i + chOffset ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js index a51716998554..1830e1d549ac 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js @@ -71,19 +71,22 @@ var cffti1 = require( './cffti1.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wptr - starting index for wsave * @returns {void} */ -function cffti( n, wsave ) { +function cffti( n, wsave, wptr ) { var iw1; var iw2; + wptr -= 1; + // Function Body: if ( n === 1 ) { return; } iw1 = ( 2 * n ) + 1; iw2 = iw1 + ( 2 * n ); - cffti1( n, wsave[ iw1 - 1 ], wsave[ iw2 - 1 ] ); + cffti1( n, wsave, wptr + iw1, wsave, wptr + iw2 ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js index 459eecb05b0a..61a010bbf971 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js @@ -79,10 +79,12 @@ var NTRYH = [ 3, 4, 2, 5 ]; // Initial trial factors for FFT factorization * @private * @param {number} n - length of the sequence * @param {Float64Array} wa - array of twiddle factors +* @param {number} wptr - starting index for wa * @param {Int32Array} ifac - array containing factorization information +* @param {number} ifptr - starting index for ifac * @returns {void} */ -function cffti1( n, wa, ifac ) { +function cffti1( n, wa, wptr, ifac, ifptr ) { var argld; var argh; var idot; @@ -101,12 +103,15 @@ function cffti1( n, wa, ifac ) { var j; var i; - nf = decompose( n, ifac, NTRYH ); + ifptr -= 1; + wptr -= 1; + + nf = decompose( n, ifac, ifptr, NTRYH ); argh = TWO_PI / n; i = 2; l1 = 1; for ( k1 = 1; k1 <= nf; k1++ ) { - ip = ifac[ k1 + 2 - 1 ]; + ip = ifac[ ifptr + k1 + 2 ]; ld = 0; l2 = ip * l1; ido = n / l2; @@ -114,8 +119,8 @@ function cffti1( n, wa, ifac ) { ipm = ip - 1; for ( j = 1; j <= ipm; j++ ) { i1 = i; - wa[ i - 1 - 1 ] = 1.0; - wa[ i - 1 ] = 0.0; + wa[ wptr + i - 1 ] = 1.0; + wa[ wptr + i ] = 0.0; ld += l1; fi = 0.0; argld = ld * argh; @@ -123,12 +128,12 @@ function cffti1( n, wa, ifac ) { i += 2; fi += 1.0; arg = fi * argld; - wa[ i - 1 - 1 ] = cos( arg ); - wa[ i - 1 ] = sin( arg ); + wa[ wptr + i - 1 ] = cos( arg ); + wa[ wptr + i ] = sin( arg ); } if ( ip > 5 ) { - wa[ i1 - 1 - 1 ] = wa[ i - 1 - 1 ]; - wa[ i1 - 1 ] = wa[ i - 1 ]; + wa[ wptr + i1 - 1 ] = wa[ wptr + i - 1 ]; + wa[ wptr + i1 ] = wa[ wptr + i ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js index 14ddc07210ae..d6992df13679 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js @@ -77,20 +77,25 @@ var TSQRT2 = 2.0 * SQRT_TWO; * * @param {number} n - length of the sequence to transform * @param {Float64Array} x - input array containing sequence to be transformed +* @param {number} xptr - starting index for `x` * @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqb( n, x, wsave ) { +function cosqb( n, x, xptr, wsave, wptr ) { var x1; + wptr -= 1; + xptr -= 1; + if ( n < 2 ) { - x[ 1 - 1 ] *= 4.0; + x[ xptr + 1 ] *= 4.0; } else if ( n === 2 ) { - x1 = ( x[ 1 - 1 ] + x[ 2 - 1 ] ) * 4.0; - x[ 2 - 1 ] = TSQRT2 * ( x[ 1 - 1 ] - x[ 2 - 1 ] ); - x[ 1 - 1 ] = x1; + x1 = ( x[ xptr + 1 ] + x[ xptr + 2 ] ) * 4.0; + x[ xptr + 2 ] = TSQRT2 * ( x[ xptr + 1 ] - x[ xptr + 2 ] ); + x[ xptr + 1 ] = x1; } else { - cosqb1( n, x[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ] ); + cosqb1( n, x, xptr + 1, wsave, wptr + 1, wsave, wptr + n + 1 ); } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js index 3971caeacbea..4c65b6b8c625 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js @@ -73,11 +73,14 @@ var rfftb = require( './rfftb.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} x - input array containing sequence to be transformed +* @param {number} xptr - starting index for `x` * @param {Float64Array} w - working array containing precomputed cosine values +* @param {number} wptr - starting index for `w` * @param {Float64Array} xh - auxiliary working array +* @param {number} xhptr - starting index for `xh` * @returns {void} */ -function cosqb1( n, x, w, xh ) { +function cosqb1( n, x, xptr, w, wptr, xh, xhptr ) { var xim1; var modn; var np2; @@ -86,34 +89,38 @@ function cosqb1( n, x, w, xh ) { var k; var i; + xhptr -= 1; + xptr -= 1; + wptr -= 1; + // Function Body: ns2 = ( n + 1 ) / 2; np2 = n + 2; for ( i = 3; i <= n; i += 2 ) { - xim1 = x[ i - 1 - 1 ] + x[ i - 1 ]; - x[ i - 1 ] -= x[ i - 1 - 1 ]; - x[ i - 1 - 1 ] = xim1; + xim1 = x[ xptr + i - 1 ] + x[ xptr + i ]; + x[ xptr + i ] -= x[ xptr + i - 1 ]; + x[ xptr + i - 1 ] = xim1; } - x[ 1 - 1 ] += x[ 1 - 1 ]; + x[ xptr + 1 ] += x[ xptr + 1 ]; modn = n % 2; if ( modn === 0 ) { - x[ n - 1 ] += x[ n - 1 ]; + x[ xptr + n ] += x[ xptr + n ]; } - rfftb( n, x[ 1 - 1 ], xh[ 1 - 1 ] ); + rfftb( n, x, xptr + 1, xh, xhptr + 1 ); for ( k = 2; k <= ns2; k++ ) { kc = np2 - k; - xh[ k - 1 ] = ( w[ k - 1 - 1 ] * x[ kc - 1 ] ) + ( w[ kc - 1 - 1 ] * x[ k - 1 ] ); - xh[ kc - 1 ] = ( w[ k - 1 - 1 ] * x[ k - 1 ] ) - ( w[ kc - 1 - 1 ] * x[ kc - 1 ] ); + xh[ xhptr + k ] = ( w[ wptr + k - 1 ] * x[ xptr + kc ] ) + ( w[ wptr + kc - 1 ] * x[ xptr + k ] ); + xh[ xhptr + kc ] = ( w[ wptr + k - 1 ] * x[ xptr + k ] ) - ( w[ wptr + kc - 1 ] * x[ xptr + kc ] ); } if ( modn === 0 ) { - x[ ns2 + 1 - 1 ] = w[ ns2 - 1 ] * ( x[ ns2 + 1 - 1 ] + x[ ns2 + 1 - 1 ] ); + x[ xptr + ns2 + 1 ] = w[ wptr + ns2 ] * ( x[ xptr + ns2 + 1 ] + x[ xptr + ns2 + 1 ] ); } for ( k = 2; k <= ns2; k++ ) { kc = np2 - k; - x[ k - 1 ] = xh[ k - 1 ] + xh[ kc - 1 ]; - x[ kc - 1 ] = xh[ k - 1 ] - xh[ kc - 1 ]; + x[ xptr + k ] = xh[ xhptr + k ] + xh[ xhptr + kc ]; + x[ xptr + kc ] = xh[ xhptr + k ] - xh[ xhptr + kc ]; } - x[ 1 - 1 ] += x[ 1 - 1 ]; + x[ xptr + 1 ] += x[ xptr + 1 ]; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js index 0e9ee47a1b7a..23c4edb4cc50 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js @@ -79,13 +79,16 @@ var cosqf1 = require( './cosqf1.js' ); function cosqf( n, x, xptr, wsave, wptr ) { var tsqx; + wptr -= 1; + xptr -= 1; + // Function Body: if ( n === 2 ) { - tsqx = SQRT2 * x[ xptr + 1 ]; - x[ xptr + 1 ] = x[ xptr ] - tsqx; - x[ xptr ] += tsqx; + tsqx = SQRT2 * x[ xptr + 2 ]; + x[ xptr + 2 ] = x[ xptr + 1 ] - tsqx; + x[ xptr + 1 ] += tsqx; } else if ( n > 2 ) { - cosqf1( n, x, xptr, wsave, wptr, wsave, wptr + n ); + cosqf1( n, x, xptr + 1, wsave, wptr + 1, wsave, wptr + n + 1 ); } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js index ef90e6e09c00..f4d28647c1bf 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js @@ -89,31 +89,35 @@ function cosqf1( n, x, xptr, w, wptr, xh, xhptr ) { var k; var i; + xhptr -= 1; + xptr -= 1; + wptr -= 1; + // Function Body: ns2 = ( n + 1 ) / 2; np2 = n + 2; for ( k = 2; k <= ns2; k++ ) { kc = np2 - k; - xh[ xhptr + k - 1 ] = x[ xptr + k - 1 ] + x[ xptr + kc - 1 ]; - xh[ xhptr + kc - 1 ] = x[ xptr + k - 1 ] - x[ xptr + kc - 1 ]; + xh[ xhptr + k ] = x[ xptr + k ] + x[ xptr + kc ]; + xh[ xhptr + kc ] = x[ xptr + k ] - x[ xptr + kc ]; } modn = n % 2; if ( modn === 0 ) { - xh[ xhptr + ns2 ] = x[ xptr + ns2 ] + x[ xptr + ns2 ]; + xh[ xhptr + ns2 + 1 ] = x[ xptr + ns2 + 1 ] + x[ xptr + ns2 + 1 ]; } for ( k = 2; k <= ns2; k++ ) { kc = np2 - k; - x[ xptr + k - 1 ] = ( w[ wptr + k - 2 ] * xh[ xhptr + kc - 1 ] ) + ( w[ wptr + kc - 2 ] * xh[ xhptr + k - 1 ] ); - x[ xptr + kc - 1 ] = ( w[ wptr + k - 2 ] * xh[ xhptr + k - 1 ] ) - ( w[ wptr + kc - 2 ] * xh[ xhptr + kc - 1 ] ); + x[ xptr + k ] = ( w[ wptr + k - 1 ] * xh[ xhptr + kc ] ) + ( w[ wptr + kc - 1 ] * xh[ xhptr + k ] ); + x[ xptr + kc ] = ( w[ wptr + k - 1 ] * xh[ xhptr + k ] ) - ( w[ wptr + kc - 1 ] * xh[ xhptr + kc ] ); } if ( modn === 0 ) { - x[ xptr + ns2 ] = w[ wptr + ns2 - 1 ] * xh[ xhptr + ns2 ]; + x[ xptr + ns2 ] = w[ wptr + ns2 ] * xh[ xhptr + ns2 + 1 ]; } - rfftf( n, x, xptr, xh, xhptr ); + rfftf( n, x, xptr + 1, xh, xhptr + 1 ); for ( i = 3; i <= n; i += 2 ) { - xim1 = x[ xptr + i - 2 ] - x[ xptr + i - 1 ]; - x[ xptr + i - 1 ] = x[ xptr + i - 2 ] + x[ xptr + i - 1 ]; - x[ xptr + i - 2 ] = xim1; + xim1 = x[ xptr + i - 1 ] - x[ xptr + i ]; + x[ xptr + i ] = x[ xptr + i - 1 ] + x[ xptr + i ]; + x[ xptr + i - 1 ] = xim1; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index e5a47e53f091..d5233a29f6a4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -66,10 +66,11 @@ * @private * @param {number} n - length of the sequence * @param {Int32Array} ifac - array to store the factors +* @param {number} ifptr - starting index for ifac * @param {Array} ntryh - array of initial trial divisors * @returns {number} status code */ -function decompose( n, ifac, ntryh ) { +function decompose( n, ifac, ifptr, ntryh ) { var ntry; var nl; var nf; @@ -97,22 +98,22 @@ function decompose( n, ifac, ntryh ) { break; } nf += 1; - ifac[ nf + 2 ] = ntry; + ifac[ ifptr + nf + 2 ] = ntry; nl = nq; if ( ntry === 2 && nf !== 1 ) { for ( i = 2; i <= nf; i++ ) { ib = nf - i + 2; - ifac[ ib + 2 ] = ifac[ ib + 1 ]; + ifac[ ifptr + ib + 2 ] = ifac[ ifptr + ib + 1 ]; } - ifac[ 3 ] = 2; + ifac[ ifptr + 3 ] = 2; } if ( nl === 1 ) { break; } } } while ( nl !== 1 ); - ifac[ 1 ] = n; - ifac[ 2 ] = nf; + ifac[ ifptr + 1 ] = n; + ifac[ ifptr + 2 ] = nf; return nf; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js index a56038aad463..5a2e94475c16 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js @@ -70,13 +70,15 @@ var rffti1 = require( './rffti1.js' ); * * @param {number} n - length of the sequence to transform * @param {Float64Array} wsave - working array to be initialized +* @param {number} wptr - starting index for wsave * @returns {void} */ -function rffti( n, wsave ) { +function rffti( n, wsave, wptr ) { if ( n === 1 ) { return; } - rffti1( n, wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 - 1 ] ); + wptr -= 1; + rffti1( n, wsave, n + wptr, wsave, ( n << 1 ) + wptr ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js index 69304b5a0c45..fa943b47c3a4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -79,10 +79,12 @@ var NTRYH = [ 4, 2, 3, 5 ]; // Initial trial factors for FFT factorization * @private * @param {number} n - length of the sequence * @param {Float64Array} wa - array of twiddle factors +* @param {number} wptr - starting index for wa * @param {Int32Array} ifac - array containing factorization information +* @param {number} ifptr - starting index for ifac * @returns {void} */ -function rffti1( n, wa, ifac ) { +function rffti1( n, wa, wptr, ifac, ifptr ) { var argld; var argh; var nfm1; @@ -101,7 +103,10 @@ function rffti1( n, wa, ifac ) { var j; var i; - nf = decompose( n, ifac, NTRYH ); + ifptr -= 1; + wptr -= 1; + + nf = decompose( n, ifac, ifptr, NTRYH ); argh = TWO_PI / n; is = 0; nfm1 = nf - 1; @@ -110,7 +115,7 @@ function rffti1( n, wa, ifac ) { return; } for ( k1 = 1; k1 <= nfm1; k1++ ) { - ip = ifac[ k1 + 2 - 1 ]; + ip = ifac[ ifptr + k1 + 2 ]; ld = 0; l2 = ip * l1; ido = n / l2; @@ -124,8 +129,8 @@ function rffti1( n, wa, ifac ) { i += 2; fi += 1.0; arg = fi * argld; - wa[ i - 1 - 1 ] = cos( arg ); - wa[ i - 1 ] = sin( arg ); + wa[ wptr + i - 1 ] = cos( arg ); + wa[ wptr + i ] = sin( arg ); } is += ido; } From 83f0f0081bc2b240ae61ef6d5fa95984cc2676e4 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 30 Jan 2025 22:33:24 +0530 Subject: [PATCH 041/102] refactor: use offset variables for arrays --- .../@stdlib/fft/base/fftpack/lib/passb2.js | 32 +++--- .../@stdlib/fft/base/fftpack/lib/passb3.js | 62 +++++----- .../@stdlib/fft/base/fftpack/lib/passb4.js | 80 +++++++------ .../@stdlib/fft/base/fftpack/lib/passf2.js | 32 +++--- .../@stdlib/fft/base/fftpack/lib/passf3.js | 62 +++++----- .../@stdlib/fft/base/fftpack/lib/passf4.js | 80 +++++++------ .../@stdlib/fft/base/fftpack/lib/passfb.js | 72 ++++++------ .../@stdlib/fft/base/fftpack/lib/passfb5.js | 106 ++++++++++-------- .../@stdlib/fft/base/fftpack/lib/radb2.js | 32 +++--- 9 files changed, 297 insertions(+), 261 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js index 3565a282c472..753412c594f7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js @@ -75,40 +75,42 @@ var ccRef = require( './cc_ref.js' ); * @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 {number} ccOffset - index of first element in `cc` * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - index of first element in `ch` * @param {Float64Array} wa1 - array of twiddle factors +* @param {number} wa1Offset - index of first element in `wa1` * @returns {void} */ -function passb2( ido, l1, cc, ch, wa1 ) { - var chOffset; - var ccOffset; +function passb2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { var ti2; var tr2; var i; var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 3 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 3 ); + wa1Offset -= 1; // Function body: if ( ido <= 2 ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) + ccOffset ]; } return; } for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ wa1Offset + i - 1 ] * ti2 ) - ( wa1[ wa1Offset + i ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ wa1Offset + i - 1 ] * tr2 ) + ( wa1[ wa1Offset + i ] * ti2 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index bfed514da062..c241cb7cd32f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -84,14 +84,16 @@ var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 * @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 {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @returns {void} */ -function passb3( ido, l1, cc, ch, wa1, wa2 ) { - var chOffset; - var ccOffset; +function passb3( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset ) { var ci2; var ci3; var di2; @@ -106,45 +108,47 @@ function passb3( ido, l1, cc, ch, wa1, wa2 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido << 2 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido << 2 ); + wa1Offset -= 1; + wa2Offset -= 1; // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; k++ ) { - tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ] ); - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci3; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr2 + ci3; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + ci3; - ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) + ccOffset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) + ccOffset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) + ccOffset ] + tr2; + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( 2, 3, k, 3, ido ) + ccOffset ]; + ci2 = cc[ ccRef( 2, 1, k, 3, ido ) + ccOffset ] + ( taur * ti2 ); + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 3, ido ) + ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( 1, 3, k, 3, ido ) + ccOffset ] ); + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( 2, 3, k, 3, ido ) + ccOffset ] ); + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = cr2 + ci3; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = ci2 + ci3; + ch[ chRef( 2, k, 3, l1, ido ) + chOffset ] = ci2 - cr3; } return; } for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) + ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) + ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) + ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) + ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) + ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) + ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) + ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) + ccOffset ] ); dr2 = cr2 - ci3; dr3 = cr2 + ci3; di2 = ci2 + ci3; di3 = ci2 - cr3; - ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); - ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( wa2[ i - 1 ] * di3 ); + ch[ chRef( i, k, 2, l1, ido) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * di2 ) + ( wa1[ i + wa1Offset ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * dr2 ) - ( wa1[ i + wa1Offset ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * dr3 ) - ( wa2[ i + wa2Offset ] * di3 ); + ch[ chRef( i - 1, k, 3, l1, ido) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * dr3 ) - ( wa2[ i + wa2Offset ] * di3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js index 9dfe5e215db6..9f6c1ef5fa41 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js @@ -75,15 +75,18 @@ var ccRef = require( './cc_ref.js' ); * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {integer} ccOffset - `cc` stride length * @param {Float64Array} ch - output array containing transformed sequences +* @param {integer} chOffset - `ch` stride length * @param {Float64Array} wa1 - first array of twiddle factors +* @param {integer} wa1Offset - `wa1` stride length * @param {Float64Array} wa2 - second array of twiddle factors +* @param {integer} wa2Offset - `wa2` stride length * @param {Float64Array} wa3 - third array of twiddle factors +* @param {integer} wa3Offset - `wa3` stride length * @returns {void} */ -function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { - var chOffset; - var ccOffset; +function passb4( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset ) { // eslint-disable-line max-params var ci2; var ci3; var ci4; @@ -102,55 +105,58 @@ function passb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 5 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 5 ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; k++ ) { - ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; - tr4 = cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ]; - ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = tr2 - tr3; - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; - ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ti2 - ti3; - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = tr1 + tr4; - ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = tr1 - tr4; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ti1 + ti4; - ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) + ccOffset ]; + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) + ccOffset ]; + tr4 = cc[ ccRef( 2, 4, k, 4, ido ) + ccOffset ] - cc[ ccRef( 2, 2, k, 4, ido ) + ccOffset ]; + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( 2, 4, k, 4, ido ) + ccOffset ]; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( 1, 3, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) + ccOffset ]; + ti4 = cc[ ccRef( 1, 2, k, 4, ido ) + ccOffset ] - cc[ ccRef( 1, 4, k, 4, ido ) + ccOffset ]; + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) + ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = tr2 + tr3; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = tr2 - tr3; + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = ti2 + ti3; + ch[ chRef( 2, k, 3, l1, ido ) + chOffset ] = ti2 - ti3; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = tr1 + tr4; + ch[ chRef( 1, k, 4, l1, ido ) + chOffset ] = tr1 - tr4; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = ti1 + ti4; + ch[ chRef( 2, k, 4, l1, ido ) + chOffset ] = ti1 - ti4; } return; } for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; - tr4 = cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + ti1 = cc[ ccRef( i, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) + ccOffset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) + ccOffset ]; + tr4 = cc[ ccRef( i, 4, k, 4, ido ) + ccOffset ] - cc[ ccRef( i, 2, k, 4, ido ) + ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i - 1, 2, k, 4, ido ) + ccOffset ] - cc[ ccRef( i - 1, 4, k, 4, ido ) + ccOffset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = tr2 + tr3; cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = ti2 + ti3; ci3 = ti2 - ti3; cr2 = tr1 + tr4; cr4 = tr1 - tr4; ci2 = ti1 + ti4; ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * cr2 ) - ( wa1[ i - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ci2 ) + ( wa1[ i - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * cr3 ) - ( wa2[ i - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * ci3 ) + ( wa2[ i - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * cr4 ) - ( wa3[ i - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * ci4 ) + ( wa3[ i - 1 ] * cr4 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * cr2 ) - ( wa1[ i + wa1Offset ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * ci2 ) + ( wa1[ i + wa1Offset ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * cr3 ) - ( wa2[ i + wa2Offset ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * ci3 ) + ( wa2[ i + wa2Offset ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * cr4 ) - ( wa3[ i + wa3Offset ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * ci4 ) + ( wa3[ i + wa3Offset ] * cr4 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js index 4210a0bd122a..d0002c188606 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js @@ -75,40 +75,42 @@ var ccRef = require( './cc_ref.js' ); * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {integer} ccOffset - `cc` stride length * @param {Float64Array} ch - output array containing transformed sequences +* @param {integer} chOffset - `ch` stride length * @param {Float64Array} wa1 - array of twiddle factors +* @param {integer} wa1Offset - `wa1` stride length * @returns {void} */ -function passf2( ido, l1, cc, ch, wa1 ) { - var chOffset; - var ccOffset; +function passf2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { var ti2; var tr2; var i; var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 3 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 3 ); + wa1Offset -= 1; // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( 2, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( 2, 2, k, 2, ido ) + ccOffset ]; } return; } for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 ); - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( i - 1, 2, k, 2, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( i, 2, k, 2, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( i, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * ti2 ) - ( wa1[ i + wa1Offset ] * tr2 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * tr2 ) - ( wa1[ i + wa1Offset ] * ti2 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index 1acf7110b7cb..6edeef9c4f58 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -84,14 +84,16 @@ var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {integer} ccOffset - `cc` stride length * @param {Float64Array} ch - output array containing transformed sequences +* @param {integer} chOffset - `ch` stride length * @param {Float64Array} wa1 - first array of twiddle factors +* @param {integer} wa1Offset - `wa1` stride length * @param {Float64Array} wa2 - second array of twiddle factors +* @param {integer} wa2Offset - `wa2` stride length * @returns {void} */ -function passf3( ido, l1, cc, ch, wa1, wa2 ) { - var chOffset; - var ccOffset; +function passf3( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset ) { var ci2; var ci3; var di2; @@ -106,45 +108,47 @@ function passf3( ido, l1, cc, ch, wa1, wa2 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido << 2 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido << 2 ); + wa1Offset -= 1; + wa2Offset -= 1; // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; k++ ) { - tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 3, ido ) - ccOffset ] ); - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci3; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr2 + ci3; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + cr3; - ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci2 - cr3; + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) + ccOffset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) + ccOffset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) + ccOffset ] + tr2; + ti2 = cc[ ccRef( 2, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( 2, 3, k, 3, ido ) + ccOffset ]; + ci2 = cc[ ccRef( 2, 1, k, 3, ido ) + ccOffset ] + ( taur * ti2 ); + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 3, ido ) + ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( 1, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( 1, 3, k, 3, ido ) + ccOffset ] ); + ci3 = taui * ( cc[ ccRef( 2, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( 2, 3, k, 3, ido ) + ccOffset ] ); + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = cr2 + ci3; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = ci2 + cr3; + ch[ chRef( 2, k, 3, l1, ido ) + chOffset ] = ci2 - cr3; } return; } for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] ); + tr2 = cc[ ccRef( i - 1, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( i - 1, 3, k, 3, ido ) + ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) + ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) + ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( i, 3, k, 3, ido ) + ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) + ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) + ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( i - 1, 3, k, 3, ido ) + ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 2, k, 3, ido ) + ccOffset ] - cc[ ccRef( i, 3, k, 3, ido ) + ccOffset ] ); dr2 = cr2 - ci3; dr3 = cr2 + ci3; di2 = ci2 + cr3; di3 = ci2 - cr3; - ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) - ( wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) + ( wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) - ( wa2[ i - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( wa2[ i - 1 ] * dr3 ); + ch[ chRef( i, k, 2, l1, ido) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * di2 ) - ( wa1[ i + wa1Offset ] * dr2 ); + ch[ chRef( i - 1, k, 2, l1, ido) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * dr2 ) + ( wa1[ i + wa1Offset ] * di2 ); + ch[ chRef( i, k, 3, l1, ido) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * di3 ) - ( wa2[ i + wa2Offset ] * dr3 ); + ch[ chRef( i - 1, k, 3, l1, ido) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * di3 ) + ( wa2[ i + wa2Offset ] * dr3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js index 033746a72892..44b86c725673 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js @@ -75,15 +75,18 @@ var ccRef = require( './cc_ref.js' ); * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {integer} ccOffset - `cc` stride length * @param {Float64Array} ch - output array containing transformed sequences +* @param {integer} chOffset - `ch` stride length * @param {Float64Array} wa1 - first array of twiddle factors +* @param {integer} wa1Offset - `wa1` stride length * @param {Float64Array} wa2 - second array of twiddle factors +* @param {integer} wa2Offset - `wa2` stride length * @param {Float64Array} wa3 - third array of twiddle factors +* @param {integer} wa3Offset - `wa3` stride length * @returns {void} */ -function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { - var chOffset; - var ccOffset; +function passf4( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset ) { // eslint-disable-line max-params var ci2; var ci3; var ci4; @@ -102,54 +105,57 @@ function passf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 5 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 5 ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; k++ ) { - ti1 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( 2, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) - ccOffset ]; - tr4 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; - ti3 = cc[ ccRef( 2, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 2, 4, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = tr2 - tr3; - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; - ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ti2 - ti3; - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = tr1 + tr4; - ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = tr1 - tr4; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ti1 + ti4; - ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ti1 - ti4; + ti1 = cc[ ccRef( 2, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( 2, 3, k, 4, ido ) + ccOffset ]; + ti2 = cc[ ccRef( 2, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( 2, 3, k, 4, ido ) + ccOffset ]; + tr4 = cc[ ccRef( 2, 2, k, 4, ido ) + ccOffset ] - cc[ ccRef( 2, 4, k, 4, ido ) + ccOffset ]; + ti3 = cc[ ccRef( 2, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( 2, 4, k, 4, ido ) + ccOffset ]; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( 1, 3, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) + ccOffset ]; + ti4 = cc[ ccRef( 1, 4, k, 4, ido ) + ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) + ccOffset ]; + tr3 = cc[ ccRef( 1, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) + ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = tr2 + tr3; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = tr2 - tr3; + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = ti2 + ti3; + ch[ chRef( 2, k, 3, l1, ido ) + chOffset ] = ti2 - ti3; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = tr1 + tr4; + ch[ chRef( 1, k, 4, l1, ido ) + chOffset ] = tr1 - tr4; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = ti1 + ti4; + ch[ chRef( 2, k, 4, l1, ido ) + chOffset ] = ti1 - ti4; } } else { for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ]; - ti3 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; - tr4 = cc[ ccRef( i, 2, k, 4, ido ) - ccOffset ] - cc[ ccRef( i, 4, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + ti1 = cc[ ccRef( i, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( i, 3, k, 4, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( i, 3, k, 4, ido ) + ccOffset ]; + ti3 = cc[ ccRef( i, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( i, 4, k, 4, ido ) + ccOffset ]; + tr4 = cc[ ccRef( i, 2, k, 4, ido ) + ccOffset ] - cc[ ccRef( i, 4, k, 4, ido ) + ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( i - 1, 3, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( i - 1, 3, k, 4, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i - 1, 4, k, 4, ido ) + ccOffset ] - cc[ ccRef( i - 1, 2, k, 4, ido ) + ccOffset ]; + tr3 = cc[ ccRef( i - 1, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( i - 1, 4, k, 4, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = tr2 + tr3; cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = ti2 + ti3; ci3 = ti2 - ti3; cr2 = tr1 + tr4; cr4 = tr1 - tr4; ci2 = ti1 + ti4; ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * cr2 ) + ( wa1[ i - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * ci2 ) - ( wa1[ i - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * cr3 ) + ( wa2[ i - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * ci3 ) - ( wa2[ i - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * cr4 ) + ( wa3[ i - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * ci4 ) - ( wa3[ i - 1 ] * cr4 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * cr2 ) + ( wa1[ i + wa1Offset ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * ci2 ) - ( wa1[ i + wa1Offset ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * cr3 ) + ( wa2[ i + wa2Offset ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * ci3 ) - ( wa2[ i + wa2Offset ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * cr4 ) + ( wa3[ i + wa3Offset ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * ci4 ) - ( wa3[ i + wa3Offset ] * cr4 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index 83876b187ee6..3b8cc1051612 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -81,20 +81,21 @@ var ccRef = require( './cc_ref.js' ); * @param {number} l1 - length parameter related to the FFT stage * @param {number} idl1 - stride related to the `l1` parameter * @param {Float64Array} cc - input array containing complex data for FFT computation +* @param {number} ccOffset - index of first element in `cc` * @param {Float64Array} c1 - intermediate array for FFT computations +* @param {number} c1Offset - index of first element in `c1` * @param {Float64Array} c2 - secondary intermediate array for FFT computations +* @param {number} c2Offset - index of first element in `c2` * @param {Float64Array} ch - output array for storing processed FFT data +* @param {number} chOffset - index of first element in `ch` * @param {Float64Array} ch2 - secondary output array for storing processed FFT data +* @param {number} ch2Offset - index of first element in `ch2` * @param {Float64Array} wa - twiddle factor array used in FFT calculations +* @param {number} waOffset - index of first element in `wa` * @param {number} fsign - sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse) * @returns {void} */ -function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // eslint-disable-line max-params - var ch2Offset; - var chOffset; - var ccOffset; - var c1Offset; - var c2Offset; +function passfb( nac, ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset, fsign ) { // eslint-disable-line max-params var ipp2; var idij; var idlj; @@ -115,11 +116,12 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e var l; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - c1Offset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * ( 1 + ip ) ); - ch2Offset = 1 + idl1; - c2Offset = 1 + idl1; + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + c1Offset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * ( 1 + ip ) ); + ch2Offset -= 1 + idl1; + c2Offset -= 1 + idl1; + waOffset -= 1; // Function body: idot = ido / 2; @@ -131,14 +133,14 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e jc = ipp2 - j; for ( k = 1; k <= l1; k++ ) { for ( i = 1; i <= ido; i++ ) { - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; - ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; } } } for ( k = 1; k <= l1; k++ ) { for ( i = 1; i <= ido; i++ ) { - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ]; } } } else { @@ -146,14 +148,14 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e jc = ipp2 - j; for ( i = 1; i <= ido; i++ ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; - ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, j, k, ip, ido ) - ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; } } } for ( i = 1; i <= ido; i++ ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ]; } } } @@ -163,8 +165,8 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e lc = ipp2 - l; idl += ido; for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, l, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] + ( wa[ idl - 1 - 1 ] * ch2[ ch2Ref( ik, 2, idl1 ) - ch2Offset ] ); - c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] = fsign * wa[ idl - 1 ] * ch2[ ch2Ref( ik, ip, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, l, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] + ( wa[ idl - 1 + waOffset ] * ch2[ ch2Ref( ik, 2, idl1 ) + ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) + c2Offset ] = fsign * wa[ idl + waOffset ] * ch2[ ch2Ref( ik, ip, idl1 ) + ch2Offset ]; } idlj = idl; inc += ido; @@ -174,26 +176,26 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e if ( idlj > idp ) { idlj -= idp; } - war = wa[ idlj - 1 - 1 ]; - wai = wa[ idlj - 1 ]; + war = wa[ idlj - 1 + waOffset ]; + wai = wa[ idlj + waOffset ]; for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, l, idl1 ) - c2Offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; - c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, l, idl1 ) + c2Offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ]; + c2[ c2Ref( ik, lc, idl1 ) + c2Offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) + ch2Offset ]; } } } for ( j = 2; j <= ipph; j++ ) { for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; + ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ]; } } for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( ik = 2; ik <= idl1; ik += 2 ) { - ch2[ ch2Ref( ik - 1, j, idl1 ) - ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2Offset ] - c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; - ch2[ ch2Ref( ik - 1, jc, idl1 ) - ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) - c2Offset ] + c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; - ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) - c2Offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) - c2Offset ]; - ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) - c2Offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik - 1, j, idl1 ) + ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) + c2Offset ] - c2[ c2Ref( ik, jc, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik - 1, jc, idl1 ) + ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) + c2Offset ] + c2[ c2Ref( ik, jc, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) + c2Offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik, jc, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) + c2Offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) + c2Offset ]; } } nac[ 0 ] = 1; @@ -202,12 +204,12 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e } nac[ 0 ] = 0; for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ]; } for ( j = 2; j <= ip; j++ ) { for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; - c1[ c1Ref( 2, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 2, k, j, l1, ido ) - chOffset ]; + c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; + c1[ c1Ref( 2, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 2, k, j, l1, ido ) + chOffset ]; } } if ( idot <= l1 ) { @@ -217,8 +219,8 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e for ( i = 4; i <= ido; i += 2 ) { idij += 2; for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); - c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ) - ( fsign * wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ( wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ) + ( fsign * wa[ idij + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ); } } } @@ -231,8 +233,8 @@ function passfb( nac, ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa, fsign ) { // e idij = idj; for ( i = 4; i <= ido; i += 2 ) { idij += 2; - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( fsign * wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); - c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( fsign * wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ) - ( fsign * wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ) + ( fsign * wa[ idij + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 77639b6cf8f6..87b57bcbabc3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -86,17 +86,21 @@ var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @param {Float64Array} wa3 - third array of twiddle factors +* @param {number} wa3Offset - offset for the third twiddle factors array * @param {Float64Array} wa4 - fourth array of twiddle factors +* @param {number} wa4Offset - offset for the fourth twiddle factors array * @param {number} fsign - sign factor for the FFT computation * @returns {void} */ -function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { - var chOffset; - var ccOffset; +function passfb5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset, wa4, wa4Offset, fsign ) { // eslint-disable-line max-params var ci2; var ci3; var ci4; @@ -128,56 +132,60 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { TI12 *= fsign; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 6 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 6 ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; + wa4Offset -= 1; // Function body: if ( ido === 2 ) { for ( k = 1; k <= l1; k++ ) { - ti5 = cc[ ccRef( 2, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( 2, 5, k, 5, ido ) - ccOffset ]; - ti2 = cc[ ccRef( 2, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( 2, 5, k, 5, ido ) - ccOffset ]; - ti4 = cc[ ccRef( 2, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( 2, 4, k, 5, ido ) - ccOffset ]; - ti3 = cc[ ccRef( 2, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 2, 4, k, 5, ido ) - ccOffset ]; - tr5 = cc[ ccRef( 1, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; - tr2 = cc[ ccRef( 1, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; - tr4 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( 1, 4, k, 5, ido ) - ccOffset ]; - tr3 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 5, ido ) - ccOffset ]; - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; - ch[ chRef( 2, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 2, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; - cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); - ci2 = cc[ ccRef( 2, 1, k, 5, ido ) - ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); - cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); - ci3 = cc[ ccRef( 2, 1, k, 5, ido ) - ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + ti5 = cc[ ccRef( 2, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( 2, 5, k, 5, ido ) + ccOffset ]; + ti2 = cc[ ccRef( 2, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( 2, 5, k, 5, ido ) + ccOffset ]; + ti4 = cc[ ccRef( 2, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( 2, 4, k, 5, ido ) + ccOffset ]; + ti3 = cc[ ccRef( 2, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( 2, 4, k, 5, ido ) + ccOffset ]; + tr5 = cc[ ccRef( 1, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( 1, 5, k, 5, ido ) + ccOffset ]; + tr2 = cc[ ccRef( 1, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) + ccOffset ]; + tr4 = cc[ ccRef( 1, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( 1, 4, k, 5, ido ) + ccOffset ]; + tr3 = cc[ ccRef( 1, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( 1, 4, k, 5, ido ) + ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + tr2 + tr3; + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 5, ido ) + ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( 2, 1, k, 5, ido ) + ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( 2, 1, k, 5, ido ) + ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); ci4 = ( TI12 * ti5 ) - ( TI11 * ti4 ); - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci5; - ch[ chRef( 1, k, 5, l1, ido ) - chOffset ] = cr2 + ci5; - ch[ chRef( 2, k, 2, l1, ido ) - chOffset ] = ci2 + cr5; - ch[ chRef( 2, k, 3, l1, ido ) - chOffset ] = ci3 + cr4; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr3 - ci4; - ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = cr3 + ci4; - ch[ chRef( 2, k, 4, l1, ido ) - chOffset ] = ci3 - cr4; - ch[ chRef( 2, k, 5, l1, ido ) - chOffset ] = ci2 - cr5; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cr2 - ci5; + ch[ chRef( 1, k, 5, l1, ido ) + chOffset ] = cr2 + ci5; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = ci2 + cr5; + ch[ chRef( 2, k, 3, l1, ido ) + chOffset ] = ci3 + cr4; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = cr3 - ci4; + ch[ chRef( 1, k, 4, l1, ido ) + chOffset ] = cr3 + ci4; + ch[ chRef( 2, k, 4, l1, ido ) + chOffset ] = ci3 - cr4; + ch[ chRef( 2, k, 5, l1, ido ) + chOffset ] = ci2 - cr5; } } else { for ( k = 1; k <= l1; k++ ) { for ( i = 2; i <= ido; i += 2 ) { - ti5 = cc[ ccRef( i, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( i, 4, k, 5, ido ) - ccOffset ]; - ti3 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( i, 4, k, 5, ido ) - ccOffset ]; - tr5 = cc[ ccRef( i - 1, 2, k, 5, ido ) - ccOffset ] - cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ]; - tr4 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( i - 1, 4, k, 5, ido ) - ccOffset ]; - tr3 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( i - 1, 4, k, 5, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; - cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); - ci2 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); - cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); - ci3 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + ti5 = cc[ ccRef( i, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( i, 5, k, 5, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( i, 5, k, 5, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( i, 4, k, 5, ido ) + ccOffset ]; + ti3 = cc[ ccRef( i, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( i, 4, k, 5, ido ) + ccOffset ]; + tr5 = cc[ ccRef( i - 1, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( i - 1, 5, k, 5, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( i - 1, 5, k, 5, ido ) + ccOffset ]; + tr4 = cc[ ccRef( i - 1, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( i - 1, 4, k, 5, ido ) + ccOffset ]; + tr3 = cc[ ccRef( i - 1, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( i - 1, 4, k, 5, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + tr2 + tr3; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); @@ -190,14 +198,14 @@ function passfb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4, fsign ) { dr2 = cr2 - ci5; di5 = ci2 - cr5; di2 = ci2 + cr5; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * dr2 ) - ( fsign * wa1[ i - 1 ] * di2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 1 - 1 ] * di2 ) + ( fsign * wa1[ i - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * dr3 ) - ( fsign * wa2[ i - 1 ] * di3 ); - ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 1 - 1 ] * di3 ) + ( fsign * wa2[ i - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * dr4 ) - ( fsign * wa3[ i - 1 ] * di4 ); - ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 1 - 1 ] * di4 ) + ( fsign * wa3[ i - 1 ] * dr4 ); - ch[ chRef( i - 1, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 1 - 1 ] * dr5 ) - ( fsign * wa4[ i - 1 ] * di5 ); - ch[ chRef( i, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 1 - 1 ] * di5 ) + ( fsign * wa4[ i - 1 ] * dr5 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * dr2 ) - ( fsign * wa1[ i + wa1Offset ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * di2 ) + ( fsign * wa1[ i + wa1Offset ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * dr3 ) - ( fsign * wa2[ i + wa2Offset ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * di3 ) + ( fsign * wa2[ i + wa2Offset ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * dr4 ) - ( fsign * wa3[ i + wa3Offset ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * di4 ) + ( fsign * wa3[ i + wa3Offset ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) + chOffset ] = ( wa4[ i - 1 + wa4Offset ] * dr5 ) - ( fsign * wa4[ i + wa4Offset ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) + chOffset ] = ( wa4[ i - 1 + wa4Offset ] * di5 ) + ( fsign * wa4[ i + wa4Offset ] * dr5 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index cc723f811d11..090f96c800e2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -75,13 +75,14 @@ var ccRef = require( './cc_ref.js' ); * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - array of twiddle factors +* @param {number} wa1Offset - offset for the twiddle factors array * @returns {void} */ -function radb2( ido, l1, cc, ch, wa1 ) { - var chOffset; - var ccOffset; +function radb2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { var idp2; var ti2; var tr2; @@ -90,13 +91,14 @@ function radb2( ido, l1, cc, ch, wa1 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 3 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 3 ); + wa1Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ido, 2, k, 2, ido ) - ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ido, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( ido, 2, k, 2, ido ) + ccOffset ]; } if ( ido < 2 ) { return; @@ -106,12 +108,12 @@ function radb2( ido, l1, cc, ch, wa1 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 2, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 2, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 2, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * tr2 ) - ( wa1[ i - 1 - 1 ] * ti2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * ti2 ) + ( wa1[ i - 1 - 1 ] * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 2, k, 2, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( ic, 2, k, 2, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ic, 2, k, 2, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * tr2 ) - ( wa1[ i - 1 + wa1Offset ] * ti2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * ti2 ) + ( wa1[ i - 1 + wa1Offset ] * tr2 ); } } if ( ido % 2 === 1 ) { @@ -119,8 +121,8 @@ function radb2( ido, l1, cc, ch, wa1 ) { } } for ( k = 1; k <= l1; k++ ) { - ch[ chRef( ido, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( ido, 1, k, 2, ido ) - ccOffset ] + cc[ ccRef( ido, 1, k, 2, ido ) - ccOffset ]; - ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = -( cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) - ccOffset ] ); + ch[ chRef( ido, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( ido, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ido, 1, k, 2, ido ) + ccOffset ]; + ch[ chRef( ido, k, 2, l1, ido ) + chOffset ] = -( cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ] ); } } From c7badd6fb0c9aafed86b9960ae597f573f78cddb Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 3 Feb 2025 11:02:02 +0530 Subject: [PATCH 042/102] refactor: use offset variables for arrays --- .../@stdlib/fft/base/fftpack/lib/radb3.js | 50 ++++++----- .../@stdlib/fft/base/fftpack/lib/radb4.js | 80 +++++++++-------- .../@stdlib/fft/base/fftpack/lib/radb5.js | 84 +++++++++-------- .../@stdlib/fft/base/fftpack/lib/radbg.js | 90 ++++++++++--------- .../@stdlib/fft/base/fftpack/lib/radf2.js | 32 +++---- .../@stdlib/fft/base/fftpack/lib/radf3.js | 46 +++++----- .../@stdlib/fft/base/fftpack/lib/radf4.js | 76 ++++++++-------- 7 files changed, 245 insertions(+), 213 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js index eb66b14823fc..04e4a8d526c2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js @@ -84,14 +84,16 @@ var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @returns {void} */ -function radb3( ido, l1, cc, ch, wa1, wa2 ) { - var chOffset; - var ccOffset; +function radb3( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset ) { var idp2; var ti2; var tr2; @@ -108,17 +110,19 @@ function radb3( ido, l1, cc, ch, wa1, wa2 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido << 2 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido << 2 ); + wa1Offset -= 1; + wa2Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { - tr2 = cc[ ccRef( 1, 2, k, 3, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ci3 = taui * ( cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) - ccOffset ] ); - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci3; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr2 + ci3; + tr2 = cc[ ccRef( 1, 2, k, 3, ido ) + ccOffset ] + cc[ ccRef( ido, 2, k, 3, ido ) + ccOffset ]; + cr2 = cc[ ccRef( 1, 1, k, 3, ido ) + ccOffset ] + ( taur * tr2 ); + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 3, ido ) + ccOffset ] + tr2; + ci3 = taui * ( cc[ ccRef( 1, 3, k, 3, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 3, ido ) + ccOffset ] ); + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cr2 - ci3; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = cr2 + ci3; } if ( ido === 1 ) { return; @@ -127,22 +131,22 @@ function radb3( ido, l1, cc, ch, wa1, wa2 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - tr2 = cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 3, ido ) - ccOffset ]; - cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + ( taur * tr2 ); - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) - ccOffset ] + tr2; - ti2 = cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 3, ido ) - ccOffset ]; - ci2 = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ( taur * ti2 ); - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) - ccOffset ] + ti2; - cr3 = taui * ( cc[ ccRef( i - 1, 3, k, 3, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 3, ido ) - ccOffset ] ); - ci3 = taui * ( cc[ ccRef( i, 3, k, 3, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 3, ido ) - ccOffset ] ); + tr2 = cc[ ccRef( i - 1, 3, k, 3, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 2, k, 3, ido ) + ccOffset ]; + cr2 = cc[ ccRef( i - 1, 1, k, 3, ido ) + ccOffset ] + ( taur * tr2 ); + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 3, ido ) + ccOffset ] + tr2; + ti2 = cc[ ccRef( i, 3, k, 3, ido ) + ccOffset ] - cc[ ccRef( ic, 2, k, 3, ido ) + ccOffset ]; + ci2 = cc[ ccRef( i, 1, k, 3, ido ) + ccOffset ] + ( taur * ti2 ); + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 3, ido ) + ccOffset ] + ti2; + cr3 = taui * ( cc[ ccRef( i - 1, 3, k, 3, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 2, k, 3, ido ) + ccOffset ] ); + ci3 = taui * ( cc[ ccRef( i, 3, k, 3, ido ) + ccOffset ] + cc[ ccRef( ic, 2, k, 3, ido ) + ccOffset ] ); dr2 = cr2 - ci3; dr3 = cr2 + ci3; di2 = ci2 + cr3; di3 = ci2 - cr3; - ch[ chRef( i - 1, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 2 - 1 ] * dr2 ) - ( wa1[ i - 1 - 1 ] * di2 ); - ch[ chRef( i, k, 2, l1, ido) - chOffset ] = ( wa1[ i - 2 - 1 ] * di2 ) + ( wa1[ i - 1 - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 2 - 1 ] * dr3 ) - ( wa2[ i - 1 - 1 ] * di3 ); - ch[ chRef( i, k, 3, l1, ido) - chOffset ] = ( wa2[ i - 2 - 1 ] * di3 ) + ( wa2[ i - 1 - 1 ] * dr3 ); + ch[ chRef( i - 1, k, 2, l1, ido) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * dr2 ) - ( wa1[ i - 1 + wa1Offset ] * di2 ); + ch[ chRef( i, k, 2, l1, ido) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * di2 ) + ( wa1[ i - 1 + wa1Offset ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido) + chOffset ] = ( wa2[ i - 2 + wa2Offset ] * dr3 ) - ( wa2[ i - 1 + wa2Offset ] * di3 ); + ch[ chRef( i, k, 3, l1, ido) + chOffset ] = ( wa2[ i - 2 + wa2Offset ] * di3 ) + ( wa2[ i - 1 + wa2Offset ] * dr3 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js index 94c296314403..7adc501a803a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js @@ -76,15 +76,18 @@ var ccRef = require( './cc_ref.js' ); * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @param {Float64Array} wa3 - third array of twiddle factors +* @param {number} wa3Offset - offset for the third twiddle factors array * @returns {void} */ -function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { - var chOffset; - var ccOffset; +function radb4( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset ) { // eslint-disable-line max-params var idp2; var ti1; var ti2; @@ -105,19 +108,22 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 5 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 5 ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { - tr1 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 4, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 4, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( ido, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 4, ido ) - ccOffset ]; - tr4 = cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) - ccOffset ]; - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = tr1 - tr4; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = tr2 - tr3; - ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = tr1 + tr4; + tr1 = cc[ ccRef( 1, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( ido, 4, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( 1, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( ido, 4, k, 4, ido ) + ccOffset ]; + tr3 = cc[ ccRef( ido, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( ido, 2, k, 4, ido ) + ccOffset ]; + tr4 = cc[ ccRef( 1, 3, k, 4, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 4, ido ) + ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = tr2 + tr3; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = tr1 - tr4; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = tr2 - tr3; + ch[ chRef( 1, k, 4, l1, ido ) + chOffset ] = tr1 + tr4; } if ( ido < 2 ) { return; @@ -127,28 +133,28 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - ti1 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic, 4, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic, 4, k, 4, ido ) - ccOffset ]; - ti3 = cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i, 3, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 4, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 4, k, 4, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 4, ido ) - ccOffset ]; - tr3 = cc[ ccRef( i - 1, 3, k, 4, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 4, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = tr2 + tr3; + ti1 = cc[ ccRef( i, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( ic, 4, k, 4, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( ic, 4, k, 4, ido ) + ccOffset ]; + ti3 = cc[ ccRef( i, 3, k, 4, ido ) + ccOffset ] - cc[ ccRef( ic, 2, k, 4, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i, 3, k, 4, ido ) + ccOffset ] + cc[ ccRef( ic, 2, k, 4, ido ) + ccOffset ]; + tr1 = cc[ ccRef( i - 1, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 4, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 4, k, 4, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i - 1, 3, k, 4, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 2, k, 4, ido ) + ccOffset ]; + tr3 = cc[ ccRef( i - 1, 3, k, 4, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 2, k, 4, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = tr2 + tr3; cr3 = tr2 - tr3; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = ti2 + ti3; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = ti2 + ti3; ci3 = ti2 - ti3; cr2 = tr1 - tr4; cr4 = tr1 + tr4; ci2 = ti1 + ti4; ci4 = ti1 - ti4; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * cr2 ) - ( wa1[ i - 1 - 1 ] * ci2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * ci2 ) + ( wa1[ i - 1 - 1 ] * cr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * cr3 ) - ( wa2[ i - 1 - 1 ] * ci3 ); - ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * ci3 ) + ( wa2[ i - 1 - 1 ] * cr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * cr4 ) - ( wa3[ i - 1 - 1 ] * ci4 ); - ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * ci4 ) + ( wa3[ i - 1 - 1 ] * cr4 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * cr2 ) - ( wa1[ i - 1 + wa1Offset ] * ci2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * ci2 ) + ( wa1[ i - 1 + wa1Offset ] * cr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 2 + wa2Offset ] * cr3 ) - ( wa2[ i - 1 + wa2Offset ] * ci3 ); + ch[ chRef( i, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 2 + wa2Offset ] * ci3 ) + ( wa2[ i - 1 + wa2Offset ] * cr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 2 + wa3Offset ] * cr4 ) - ( wa3[ i - 1 + wa3Offset ] * ci4 ); + ch[ chRef( i, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 2 + wa3Offset ] * ci4 ) + ( wa3[ i - 1 + wa3Offset ] * cr4 ); } } if ( ido % 2 === 1 ) { @@ -156,14 +162,14 @@ function radb4( ido, l1, cc, ch, wa1, wa2, wa3 ) { } } for ( k = 1; k <= l1; k++ ) { - ti1 = cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ]; - ti2 = cc[ ccRef( 1, 4, k, 4, ido ) - ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) - ccOffset ]; - tr1 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] - cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; - tr2 = cc[ ccRef( ido, 1, k, 4, ido ) - ccOffset ] + cc[ ccRef( ido, 3, k, 4, ido ) - ccOffset ]; - ch[ chRef( ido, k, 1, l1, ido ) - chOffset ] = tr2 + tr2; - ch[ chRef( ido, k, 2, l1, ido ) - chOffset ] = SQRT2 * ( tr1 - ti1 ); - ch[ chRef( ido, k, 3, l1, ido ) - chOffset ] = ti2 + ti2; - ch[ chRef( ido, k, 4, l1, ido ) - chOffset ] = -SQRT2 * ( tr1 + ti1 ); + ti1 = cc[ ccRef( 1, 2, k, 4, ido ) + ccOffset ] + cc[ ccRef( 1, 4, k, 4, ido ) + ccOffset ]; + ti2 = cc[ ccRef( 1, 4, k, 4, ido ) + ccOffset ] - cc[ ccRef( 1, 2, k, 4, ido ) + ccOffset ]; + tr1 = cc[ ccRef( ido, 1, k, 4, ido ) + ccOffset ] - cc[ ccRef( ido, 3, k, 4, ido ) + ccOffset ]; + tr2 = cc[ ccRef( ido, 1, k, 4, ido ) + ccOffset ] + cc[ ccRef( ido, 3, k, 4, ido ) + ccOffset ]; + ch[ chRef( ido, k, 1, l1, ido ) + chOffset ] = tr2 + tr2; + ch[ chRef( ido, k, 2, l1, ido ) + chOffset ] = SQRT2 * ( tr1 - ti1 ); + ch[ chRef( ido, k, 3, l1, ido ) + chOffset ] = ti2 + ti2; + ch[ chRef( ido, k, 4, l1, ido ) + chOffset ] = -SQRT2 * ( tr1 + ti1 ); } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js index 4876a19f77fa..0f133b82b594 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js @@ -86,16 +86,20 @@ var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 * @param {integer} ido - number of real values for each transform * @param {integer} l1 - length of the input sequences * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @param {Float64Array} wa3 - third array of twiddle factors +* @param {number} wa3Offset - offset for the third twiddle factors array * @param {Float64Array} wa4 - fourth array of twiddle factors +* @param {number} wa4Offset - offset for the fourth twiddle factors array * @returns {void} */ -function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { - var chOffset; - var ccOffset; +function radb5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset, wa4, wa4Offset ) { // eslint-disable-line max-params var idp2; var ti2; var ti3; @@ -126,24 +130,28 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * 6 ); + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 6 ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; + wa4Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { - ti5 = cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 3, k, 5, ido ) - ccOffset ]; - ti4 = cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) - ccOffset ]; - tr2 = cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 2, k, 5, ido ) - ccOffset ]; - tr3 = cc[ ccRef( ido, 4, k, 5, ido ) - ccOffset ] + cc[ ccRef( ido, 4, k, 5, ido ) - ccOffset ]; - ch[ chRef( 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; - cr2 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR11 ) + ( tr3 * TR12 ); - cr3 = cc[ ccRef( 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR12 ) + ( tr3 * TR11 ); + ti5 = cc[ ccRef( 1, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( 1, 3, k, 5, ido ) + ccOffset ]; + ti4 = cc[ ccRef( 1, 5, k, 5, ido ) + ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) + ccOffset ]; + tr2 = cc[ ccRef( ido, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( ido, 2, k, 5, ido ) + ccOffset ]; + tr3 = cc[ ccRef( ido, 4, k, 5, ido ) + ccOffset ] + cc[ ccRef( ido, 4, k, 5, ido ) + ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + tr2 + tr3; + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + ( tr2 * TR11 ) + ( tr3 * TR12 ); + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + ( tr2 * TR12 ) + ( tr3 * TR11 ); ci5 = ( ti5 * TI11 ) + ( ti4 * TI12 ); ci4 = ( ti5 * TI12 ) - ( ti4 * TI11 ); - ch[ chRef( 1, k, 2, l1, ido ) - chOffset ] = cr2 - ci5; - ch[ chRef( 1, k, 3, l1, ido ) - chOffset ] = cr3 - ci4; - ch[ chRef( 1, k, 4, l1, ido ) - chOffset ] = cr3 + ci4; - ch[ chRef( 1, k, 5, l1, ido ) - chOffset ] = cr2 + ci5; + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cr2 - ci5; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = cr3 - ci4; + ch[ chRef( 1, k, 4, l1, ido ) + chOffset ] = cr3 + ci4; + ch[ chRef( 1, k, 5, l1, ido ) + chOffset ] = cr2 + ci5; } if ( ido === 1 ) { return; @@ -152,20 +160,20 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - ti5 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic, 2, k, 5, ido ) - ccOffset ]; - ti2 = cc[ ccRef( i, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic, 2, k, 5, ido ) - ccOffset ]; - ti4 = cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic, 4, k, 5, ido ) - ccOffset ]; - ti3 = cc[ ccRef( i, 5, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic, 4, k, 5, ido ) - ccOffset ]; - tr5 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 2, k, 5, ido ) - ccOffset ]; - tr2 = cc[ ccRef( i - 1, 3, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 2, k, 5, ido ) - ccOffset ]; - tr4 = cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ] - cc[ ccRef( ic - 1, 4, k, 5, ido ) - ccOffset ]; - tr3 = cc[ ccRef( i - 1, 5, k, 5, ido ) - ccOffset ] + cc[ ccRef( ic - 1, 4, k, 5, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + tr2 + tr3; - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ti2 + ti3; - cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR11 ) + ( tr3 * TR12 ); - ci2 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * TR11 ) + ( ti3 * TR12 ); - cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) - ccOffset ] + ( tr2 * TR12 ) + ( tr3 * TR11 ); - ci3 = cc[ ccRef( i, 1, k, 5, ido ) - ccOffset ] + ( ti2 * TR12 ) + ( ti3 * TR11 ); + ti5 = cc[ ccRef( i, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( ic, 2, k, 5, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( ic, 2, k, 5, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i, 5, k, 5, ido ) + ccOffset ] + cc[ ccRef( ic, 4, k, 5, ido ) + ccOffset ]; + ti3 = cc[ ccRef( i, 5, k, 5, ido ) + ccOffset ] - cc[ ccRef( ic, 4, k, 5, ido ) + ccOffset ]; + tr5 = cc[ ccRef( i - 1, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 2, k, 5, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 2, k, 5, ido ) + ccOffset ]; + tr4 = cc[ ccRef( i - 1, 5, k, 5, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 4, k, 5, ido ) + ccOffset ]; + tr3 = cc[ ccRef( i - 1, 5, k, 5, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 4, k, 5, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + tr2 + tr3; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + ( tr2 * TR11 ) + ( tr3 * TR12 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ( ti2 * TR11 ) + ( ti3 * TR12 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + ( tr2 * TR12 ) + ( tr3 * TR11 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ( ti2 * TR12 ) + ( ti3 * TR11 ); cr5 = ( tr5 * TI11 ) + ( tr4 * TI12 ); ci5 = ( ti5 * TI11 ) + ( ti4 * TI12 ); cr4 = ( tr5 * TI12 ) - ( tr4 * TI11 ); @@ -178,14 +186,14 @@ function radb5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { dr2 = cr2 - ci5; di5 = ci2 - cr5; di2 = ci2 + cr5; - ch[ chRef( i - 1, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * dr2 ) - ( wa1[ i - 1 - 1 ] * di2 ); - ch[ chRef( i, k, 2, l1, ido ) - chOffset ] = ( wa1[ i - 2 - 1 ] * di2 ) + ( wa1[ i - 1 - 1 ] * dr2 ); - ch[ chRef( i - 1, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * dr3 ) - ( wa2[ i - 1 - 1 ] * di3 ); - ch[ chRef( i, k, 3, l1, ido ) - chOffset ] = ( wa2[ i - 2 - 1 ] * di3 ) + ( wa2[ i - 1 - 1 ] * dr3 ); - ch[ chRef( i - 1, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * dr4 ) - ( wa3[ i - 1 - 1 ] * di4 ); - ch[ chRef( i, k, 4, l1, ido ) - chOffset ] = ( wa3[ i - 2 - 1 ] * di4 ) + ( wa3[ i - 1 - 1 ] * dr4 ); - ch[ chRef( i - 1, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 2 - 1 ] * dr5 ) - ( wa4[ i - 1 - 1 ] * di5 ); - ch[ chRef( i, k, 5, l1, ido ) - chOffset ] = ( wa4[ i - 2 - 1 ] * di5 ) + ( wa4[ i - 1 - 1 ] * dr5 ); + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * dr2 ) - ( wa1[ i - 1 + wa1Offset ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * di2 ) + ( wa1[ i - 1 + wa1Offset ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 2 + wa2Offset ] * dr3 ) - ( wa2[ i - 1 + wa2Offset ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 2 + wa2Offset ] * di3 ) + ( wa2[ i - 1 + wa2Offset ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 2 + wa3Offset ] * dr4 ) - ( wa3[ i - 1 + wa3Offset ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 2 + wa3Offset ] * di4 ) + ( wa3[ i - 1 + wa3Offset ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) + chOffset ] = ( wa4[ i - 2 + wa4Offset ] * dr5 ) - ( wa4[ i - 1 + wa4Offset ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) + chOffset ] = ( wa4[ i - 2 + wa4Offset ] * di5 ) + ( wa4[ i - 1 + wa4Offset ] * dr5 ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js index ce333268755f..b025eefe8d81 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js @@ -82,19 +82,20 @@ var ch2Ref = require( './ch2_ref.js' ); * @param {integer} l1 - length of the input sequences * @param {integer} idl1 - stride for the transform * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array * @param {Float64Array} c1 - first work array +* @param {number} c1Offset - offset for the first work array * @param {Float64Array} c2 - second work array +* @param {number} c2Offset - offset for the second work array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} ch2 - work array for transformed sequences +* @param {number} ch2Offset - offset for the work array * @param {Float64Array} wa - array of twiddle factors +* @param {number} waOffset - offset for the twiddle factors array * @returns {void} */ -function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { - var ch2Offset; - var chOffset; - var ccOffset; - var c1Offset; - var c2Offset; +function radbg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset ) { // eslint-disable-line max-params var ar1h; var ar2h; var idp2; @@ -124,11 +125,12 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { var l; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - c1Offset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * ( 1 + ip ) ); - ch2Offset = 1 + idl1; - c2Offset = 1 + idl1; + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + c1Offset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * ( 1 + ip ) ); + ch2Offset -= 1 + idl1; + c2Offset -= 1 + idl1; + waOffset -= 1; // Function body: arg = TWO_PI / ip; @@ -142,13 +144,13 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { if ( ido >= l1 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 1; i <= ido; i++ ) { - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ]; } } } else { for ( i = 1; i <= ido; i++ ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i, k, 1, l1, ido ) - chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ]; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ]; } } } @@ -156,8 +158,8 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { jc = ipp2 - j; j2 = j + j; for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ] + cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ]; + ch[ chRef( 1, k, j, l1, ido ) + chOffset ] = cc[ ccRef( ido, j2 - 2, k, ip, ido ) + ccOffset ] + cc[ ccRef( ido, j2 - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( 1, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( 1, j2 - 1, k, ip, ido ) + ccOffset ] + cc[ ccRef( 1, j2 - 1, k, ip, ido ) + ccOffset ]; } } if ( ido !== 1 ) { @@ -167,10 +169,10 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] + cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; } } } @@ -180,10 +182,10 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; - ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) - ccOffset ] + cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) - ccOffset ]; + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] + cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] - cc[ ccRef( ic - 1, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] - cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i, ( j << 1 ) - 1, k, ip, ido ) + ccOffset ] + cc[ ccRef( ic, ( j << 1 ) - 2, k, ip, ido ) + ccOffset ]; } } } @@ -197,8 +199,8 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); ar1 = ar1h; for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, l, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] + ( ar1 * ch2[ ch2Ref( ik, 2, idl1 ) - ch2Offset ] ); - c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] = ai1 * ch2[ ch2Ref( ik, ip, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, l, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] + ( ar1 * ch2[ ch2Ref( ik, 2, idl1 ) + ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) + c2Offset ] = ai1 * ch2[ ch2Ref( ik, ip, idl1 ) + ch2Offset ]; } dc2 = ar1; ds2 = ai1; @@ -210,21 +212,21 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); ar2 = ar2h; for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, l, idl1 ) - c2Offset ] += ( ar2 * ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ] ); - c2[ c2Ref( ik, lc, idl1 ) - c2Offset ] += ( ai2 * ch2[ ch2Ref( ik, jc, idl1 ) - ch2Offset ] ); + c2[ c2Ref( ik, l, idl1 ) + c2Offset ] += ( ar2 * ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) + c2Offset ] += ( ai2 * ch2[ ch2Ref( ik, jc, idl1 ) + ch2Offset ] ); } } } for ( j = 2; j <= ipph; j++ ) { for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) - ch2Offset ]; + ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ]; } } for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( 1, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] - c1[ c1Ref( 1, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( 1, k, jc, l1, ido ) + chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] + c1[ c1Ref( 1, k, jc, l1, ido ) + c1Offset ]; } } if ( ido !== 1 ) { @@ -233,10 +235,10 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { jc = ipp2 - j; for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] - c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ]; } } } @@ -245,10 +247,10 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { jc = ipp2 - j; for ( i = 3; i <= ido; i += 2 ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; - ch[ chRef( i, k, jc, l1, ido ) - chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] - c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ]; + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] - c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] = c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] + c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] + c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] - c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ]; } } } @@ -258,11 +260,11 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { return; } for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ]; } for ( j = 2; j <= ip; j++ ) { for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; + c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; } } if ( nbd <= l1 ) { @@ -273,8 +275,8 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( i = 3; i <= ido; i += 2 ) { idij += 2; for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); - c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ) - ( wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ) + ( wa[ idij + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ); } } } @@ -286,8 +288,8 @@ function radbg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { idij = is; for ( i = 3; i <= ido; i += 2 ) { idij += 2; - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ) - ( wa[ idij - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ); - c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ( wa[ idij - 1 - 1 ] * ch[ chRef( i, k, j, l1, ido ) - chOffset ] ) + ( wa[ idij - 1 ] * ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] ); + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ) - ( wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ) + ( wa[ idij + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ); } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index d88df58b9b9c..5339db7bedc3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -75,13 +75,14 @@ var ccRef = require( './cc_ref.js' ); * @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 {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - array of twiddle factors +* @param {number} wa1Offset - offset for the twiddle factors array * @returns {void} */ -function radf2( ido, l1, cc, ch, wa1 ) { - var chOffset; - var ccOffset; +function radf2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { var idp2; var tr2; var ti2; @@ -90,13 +91,14 @@ function radf2( ido, l1, cc, ch, wa1 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * 3 ); - ccOffset = 1 + ( ido * ( 1 + l1 ) ); + chOffset -= 1 + ( ido * 3 ); + ccOffset -= 1 + ( ido * ( 1 + l1 ) ); + wa1Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; - ch[ chRef( ido, 2, k, l1, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + ch[ chRef( 1, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; + ch[ chRef( ido, 2, k, l1, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; } if ( ido < 2 ) { return; @@ -106,12 +108,12 @@ function radf2( ido, l1, cc, ch, wa1 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - tr2 = ( 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 ] ); - ti2 = ( 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 ] ); - ch[ chRef( i, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ti2; - ch[ chRef( ic, 2, k, l1, ido ) - chOffset ] = ti2 - cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ]; - ch[ chRef( i - 1, 1, k, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + tr2; - ch[ chRef( ic - 1, 2, k, l1, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] - tr2; + tr2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); + ti2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); + ch[ chRef( i, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ti2; + ch[ chRef( ic, 2, k, l1, ido ) + chOffset ] = ti2 - cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ]; + ch[ chRef( i - 1, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + tr2; + ch[ chRef( ic - 1, 2, k, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] - tr2; } } if ( ido % 2 === 1 ) { @@ -119,8 +121,8 @@ function radf2( ido, l1, cc, ch, wa1 ) { } } for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, 2, k, l1, ido ) - chOffset ] = -cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ]; - ch[ chRef( ido, 1, k, l1, ido ) - chOffset ] = -cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ]; + ch[ chRef( 1, 2, k, l1, ido ) + chOffset ] = -cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ]; + ch[ chRef( ido, 1, k, l1, ido ) + chOffset ] = -cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index c4a4220af2d2..1d41302223bd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -84,14 +84,16 @@ var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 * @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 {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @returns {void} */ -function radf3( ido, l1, cc, ch, wa1, wa2 ) { - var chOffset; - var ccOffset; +function radf3( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset ) { var idp2; var tr3; var tr2; @@ -108,15 +110,17 @@ function radf3( ido, l1, cc, ch, wa1, wa2 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido << 2 ); - ccOffset = 1 + ( ido * ( 1 + l1 ) ); + chOffset -= 1 + ( ido << 2 ); + ccOffset -= 1 + ( ido * ( 1 + l1 ) ); + wa1Offset -= 1; + wa2Offset -= 1; // 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; + 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; @@ -125,22 +129,22 @@ function radf3( ido, l1, cc, ch, wa1, wa2 ) { 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 ] ); + dr2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ]) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); + di2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ]) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); + dr3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ]) + ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ); + di3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ]) - ( wa2[ i - 1 + wa2Offset ] * 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 ); + 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; + 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; } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js index 77e3020337f9..bed422791feb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js @@ -76,15 +76,18 @@ var ccRef = require( './cc_ref.js' ); * @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 {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @param {Float64Array} wa3 - third array of twiddle factors +* @param {number} wa3Offset - offset for the third twiddle factors array * @returns {void} */ -function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { - var chOffset; - var ccOffset; +function radf4( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset ) { // eslint-disable-line max-params var idp2; var tr4; var tr3; @@ -105,17 +108,20 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { var k; // Parameter adjustments... - chOffset = 1 + ( ido * 5 ); - ccOffset = 1 + ( ido * ( 1 + l1 ) ); + chOffset -= 1 + ( ido * 5 ); + ccOffset -= 1 + ( ido * ( 1 + l1 ) ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { - tr1 = cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ]; - tr2 = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; - ch[ chRef( 1, 1, k, 4, ido ) - chOffset ] = tr1 + tr2; - ch[ chRef( ido, 4, k, 4, ido ) - chOffset ] = tr2 - tr1; - ch[ chRef( ido, 2, k, 4, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; - ch[ chRef( 1, 3, k, 4, ido ) - chOffset ] = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; + tr1 = cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ]; + tr2 = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; + ch[ chRef( 1, 1, k, 4, ido ) + chOffset ] = tr1 + tr2; + ch[ chRef( ido, 4, k, 4, ido ) + chOffset ] = tr2 - tr1; + ch[ chRef( ido, 2, k, 4, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; + ch[ chRef( 1, 3, k, 4, ido ) + chOffset ] = cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; } if ( ido < 2 ) { return; @@ -125,28 +131,28 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - cr2 = ( 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 ] ); - ci2 = ( 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 ] ); - cr3 = ( 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 ] ); - ci3 = ( 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 ] ); - cr4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ) + ( wa3[ i - 1 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ); - ci4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ) - ( wa3[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ); + cr2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); + ci2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); + cr3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ) + ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ); + ci3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ) - ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ); + cr4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ) + ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ); + ci4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ) - ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ); tr1 = cr2 + cr4; tr4 = cr4 - cr2; ti1 = ci2 + ci4; ti4 = ci2 - ci4; - ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ci3; - ti3 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] - ci3; - tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + cr3; - tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] - cr3; - ch[ chRef( i - 1, 1, k, 4, ido ) - chOffset ] = tr1 + tr2; - ch[ chRef( ic - 1, 4, k, 4, ido ) - chOffset ] = tr2 - tr1; - ch[ chRef( i, 1, k, 4, ido ) - chOffset ] = ti1 + ti2; - ch[ chRef( ic, 4, k, 4, ido ) - chOffset ] = ti1 - ti2; - ch[ chRef( i - 1, 3, k, 4, ido ) - chOffset ] = ti4 + tr3; - ch[ chRef( ic - 1, 2, k, 4, ido ) - chOffset ] = tr3 - ti4; - ch[ chRef( i, 3, k, 4, ido ) - chOffset ] = tr4 + ti3; - ch[ chRef( ic, 2, k, 4, ido ) - chOffset ] = tr4 - ti3; + ti2 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ci3; + ti3 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] - ci3; + tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + cr3; + tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] - cr3; + ch[ chRef( i - 1, 1, k, 4, ido ) + chOffset ] = tr1 + tr2; + ch[ chRef( ic - 1, 4, k, 4, ido ) + chOffset ] = tr2 - tr1; + ch[ chRef( i, 1, k, 4, ido ) + chOffset ] = ti1 + ti2; + ch[ chRef( ic, 4, k, 4, ido ) + chOffset ] = ti1 - ti2; + ch[ chRef( i - 1, 3, k, 4, ido ) + chOffset ] = ti4 + tr3; + ch[ chRef( ic - 1, 2, k, 4, ido ) + chOffset ] = tr3 - ti4; + ch[ chRef( i, 3, k, 4, ido ) + chOffset ] = tr4 + ti3; + ch[ chRef( ic, 2, k, 4, ido ) + chOffset ] = tr4 - ti3; } } if ( ido % 2 === 1 ) { @@ -154,12 +160,12 @@ function radf4( ido, l1, cc, ch, wa1, wa2, wa3 ) { } } for ( k = 1; k <= l1; k++ ) { - ti1 = -SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); - tr1 = SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) - ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) - ccOffset ] ); - ch[ chRef( ido, 1, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] + tr1; - ch[ chRef( ido, 3, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) - ccOffset ] - tr1; - ch[ chRef( 1, 2, k, 4, ido ) - chOffset ] = ti1 - cc[ ccRef( ido, k, 3, l1, ido ) - ccOffset ]; - ch[ chRef( 1, 4, k, 4, ido ) - chOffset ] = cc[ ccRef( ido, k, 3, l1, ido ) - ccOffset ] + ti1; + ti1 = -SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) + ccOffset ] ); + tr1 = SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) + ccOffset ] ); + ch[ chRef( ido, 1, k, 4, ido ) + chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ] + tr1; + ch[ chRef( ido, 3, k, 4, ido ) + chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ] - tr1; + ch[ chRef( 1, 2, k, 4, ido ) + chOffset ] = ti1 - cc[ ccRef( ido, k, 3, l1, ido ) + ccOffset ]; + ch[ chRef( 1, 4, k, 4, ido ) + chOffset ] = cc[ ccRef( ido, k, 3, l1, ido ) + ccOffset ] + ti1; } } From adeb99ae14e77c80b6e34bea89d3183e4637f391 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Fri, 7 Feb 2025 00:20:03 +0530 Subject: [PATCH 043/102] refactor: add offsets, use sincos --- .../@stdlib/fft/base/fftpack/lib/cffti1.js | 9 +- .../@stdlib/fft/base/fftpack/lib/passb3.js | 10 +- .../@stdlib/fft/base/fftpack/lib/passf3.js | 10 +- .../@stdlib/fft/base/fftpack/lib/passfb5.js | 15 +-- .../@stdlib/fft/base/fftpack/lib/radb3.js | 10 +- .../@stdlib/fft/base/fftpack/lib/radb5.js | 15 +-- .../@stdlib/fft/base/fftpack/lib/radf3.js | 10 +- .../@stdlib/fft/base/fftpack/lib/radf5.js | 87 +++++++------- .../@stdlib/fft/base/fftpack/lib/radfg.js | 107 +++++++++--------- .../@stdlib/fft/base/fftpack/lib/rfftb.js | 9 +- .../@stdlib/fft/base/fftpack/lib/rfftb1.js | 24 ++-- .../@stdlib/fft/base/fftpack/lib/rfftf.js | 9 +- .../@stdlib/fft/base/fftpack/lib/rfftf1.js | 24 ++-- .../@stdlib/fft/base/fftpack/lib/rffti1.js | 9 +- 14 files changed, 189 insertions(+), 159 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js index 61a010bbf971..f99b004d20be 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js @@ -60,8 +60,7 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var decompose = require( './decompose.js' ); @@ -100,6 +99,7 @@ function cffti1( n, wa, wptr, ifac, ifptr ) { var l1; var k1; var i1; + var sc; var j; var i; @@ -128,8 +128,9 @@ function cffti1( n, wa, wptr, ifac, ifptr ) { i += 2; fi += 1.0; arg = fi * argld; - wa[ wptr + i - 1 ] = cos( arg ); - wa[ wptr + i ] = sin( arg ); + sc = sincos( arg ); + wa[ wptr + i - 1 ] = sc[ 1 ]; + wa[ wptr + i ] = sc[ 0 ]; } if ( ip > 5 ) { wa[ wptr + i1 - 1 ] = wa[ wptr + i - 1 ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js index c241cb7cd32f..2f5ac687b363 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js @@ -62,17 +62,17 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = cos( ( 2 * PI ) / 3 ); // -0.5 -var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 +var sc = sincos( ( 2 * TWO_PI ) / 3 ); +var taur = sc[ 1 ]; // -0.5 +var taui = -sc[ 0 ]; // -0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js index 6edeef9c4f58..503431a6359b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js @@ -62,17 +62,17 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = cos( ( 2 * PI ) / 3 ); // -0.5 -var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 +var sc = sincos( ( 2 * TWO_PI ) / 3 ); +var taur = sc[ 1 ]; // -0.5 +var taui = -sc[ 0 ]; // -0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js index 87b57bcbabc3..af2f8689ce72 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js @@ -62,19 +62,20 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var TR11 = cos( ( 2 * PI ) / 5 ); // 0.309016994374947 -var TI11 = sin( ( 2 * PI ) / 5 ); // 0.951056516295154 -var TR12 = cos( ( 4 * PI ) / 5 ); // -0.809016994374947 -var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 +var sc1 = sincos( TWO_PI / 5 ); +var sc2 = sincos( ( 2 * TWO_PI ) / 5 ); +var TR11 = sc1[ 1 ]; // 0.309016994374947 +var TI11 = sc1[ 0 ]; // 0.951056516295154 +var TR12 = sc2[ 1 ]; // -0.809016994374947 +var TI12 = sc2[ 0 ]; // 0.587785252292473 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js index 04e4a8d526c2..1c30914e1d52 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js @@ -62,17 +62,17 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = cos( ( 2 * PI ) / 3 ); // -0.5 -var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 +var sc = sincos( ( 2 * TWO_PI ) / 3 ); +var taur = sc[ 1 ]; // -0.5 +var taui = -sc[ 0 ]; // -0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js index 0f133b82b594..6f90f17fe014 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js @@ -62,19 +62,20 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var TR11 = cos( ( 2 * PI ) / 5 ); // 0.309016994374947 -var TI11 = sin( ( 2 * PI ) / 5 ); // 0.951056516295154 -var TR12 = cos( ( 4 * PI ) / 5 ); // -0.809016994374947 -var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 +var sc1 = sincos( TWO_PI / 5 ); +var sc2 = sincos( ( 2 * TWO_PI ) / 5 ); +var TR11 = sc1[ 1 ]; // 0.309016994374947 +var TI11 = sc1[ 0 ]; // 0.951056516295154 +var TR12 = sc2[ 1 ]; // -0.809016994374947 +var TI12 = sc2[ 0 ]; // 0.587785252292473 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index 1d41302223bd..9d451af01d9a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -62,17 +62,17 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var taur = cos( ( 2 * PI ) / 3 ); // -0.5 -var taui = -sin( ( 2 * PI ) / 3 ); // -0.866025403784439 +var sc = sincos( ( 2 * TWO_PI ) / 3 ); +var taur = sc[ 1 ]; // -0.5 +var taui = -sc[ 0 ]; // -0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js index 8b6aa78877d9..0a33e7a375de 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js @@ -62,19 +62,20 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); // VARIABLES // -var TR11 = cos( ( 2 * PI ) / 5 ); // 0.309016994374947 -var TI11 = sin( ( 2 * PI ) / 5 ); // 0.951056516295154 -var TR12 = cos( ( 4 * PI ) / 5 ); // -0.809016994374947 -var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 +var sc1 = sincos( TWO_PI / 5 ); +var sc2 = sincos( ( 2 * TWO_PI ) / 5 ); +var TR11 = sc1[ 1 ]; // 0.309016994374947 +var TI11 = sc1[ 0 ]; // 0.951056516295154 +var TR12 = sc2[ 1 ]; // -0.809016994374947 +var TI12 = sc2[ 0 ]; // 0.587785252292473 // MAIN // @@ -86,16 +87,20 @@ var TI12 = sin( ( 4 * PI ) / 5 ); // 0.587785252292473 * @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 {number} ccOffset - offset for the input array * @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array * @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array * @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array * @param {Float64Array} wa3 - third array of twiddle factors +* @param {number} wa3Offset - offset for the third twiddle factors array * @param {Float64Array} wa4 - fourth array of twiddle factors +* @param {number} wa4Offset - offset for the fourth twiddle factors array * @returns {void} */ -function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { - var chOffset; - var ccOffset; +function radf5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset, wa4, wa4Offset ) { // eslint-disable-line max-params var idp2; var ci2; var di2; @@ -131,15 +136,15 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { // Function body: for ( k = 1; k <= l1; k++ ) { - cr2 = cc[ ccRef( 1, k, 5, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; - ci5 = cc[ ccRef( 1, k, 5, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) - ccOffset ]; - cr3 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; - ci4 = cc[ ccRef( 1, k, 4, l1, ido ) - ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) - ccOffset ]; - ch[ chRef( 1, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + cr2 + cr3; - ch[ chRef( ido, 2, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); - ch[ chRef( 1, 3, k, 5, ido ) - chOffset ] = ( TI11 * ci5 ) + ( TI12 * ci4 ); - ch[ chRef( ido, 4, k, 5, ido ) - chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) - ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); - ch[ chRef( 1, 5, k, 5, ido ) - chOffset ] = ( TI12 * ci5 ) - ( TI11 * ci4 ); + cr2 = cc[ ccRef( 1, k, 5, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; + ci5 = cc[ ccRef( 1, k, 5, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; + cr3 = cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; + ci4 = cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; + ch[ chRef( 1, 1, k, 5, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + cr2 + cr3; + ch[ chRef( ido, 2, k, 5, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); + ch[ chRef( 1, 3, k, 5, ido ) + chOffset ] = ( TI11 * ci5 ) + ( TI12 * ci4 ); + ch[ chRef( ido, 4, k, 5, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); + ch[ chRef( 1, 5, k, 5, ido ) + chOffset ] = ( TI12 * ci5 ) - ( TI11 * ci4 ); } if ( ido === 1 ) { return; @@ -148,14 +153,14 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { 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 ] ); - dr4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ) + ( wa3[ i - 1 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ); - di4 = ( wa3[ i - 2 - 1 ] * cc[ ccRef( i, k, 4, l1, ido ) - ccOffset ] ) - ( wa3[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 4, l1, ido ) - ccOffset ] ); - dr5 = ( wa4[ i - 2 - 1 ] * cc[ ccRef( i - 1, k, 5, l1, ido ) - ccOffset ] ) + ( wa4[ i - 1 - 1 ] * cc[ ccRef( i, k, 5, l1, ido ) - ccOffset ] ); - di5 = ( wa4[ i - 2 - 1 ] * cc[ ccRef( i, k, 5, l1, ido ) - ccOffset ] ) - ( wa4[ i - 1 - 1 ] * cc[ ccRef( i - 1, k, 5, l1, ido ) - ccOffset ] ); + dr2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); + di2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); + dr3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ) + ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ); + di3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ) - ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ); + dr4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ) + ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ); + di4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ) - ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ); + dr5 = ( wa4[ i - 2 + wa4Offset ] * cc[ ccRef( i - 1, k, 5, l1, ido ) + ccOffset ] ) + ( wa4[ i - 1 + wa4Offset ] * cc[ ccRef( i, k, 5, l1, ido ) + ccOffset ] ); + di5 = ( wa4[ i - 2 + wa4Offset ] * cc[ ccRef( i, k, 5, l1, ido ) + ccOffset ] ) - ( wa4[ i - 1 + wa4Offset ] * cc[ ccRef( i - 1, k, 5, l1, ido ) + ccOffset ] ); cr2 = dr2 + dr5; ci5 = dr5 - dr2; cr5 = di2 - di5; @@ -164,24 +169,24 @@ function radf5( ido, l1, cc, ch, wa1, wa2, wa3, wa4 ) { ci4 = dr4 - dr3; cr4 = di3 - di4; ci3 = di3 + di4; - ch[ chRef( i - 1, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + cr2 + cr3; - ch[ chRef( i, 1, k, 5, ido ) - chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ci2 + ci3; - tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); - ti2 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( TR11 * ci2 ) + ( TR12 * ci3 ); - tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) - ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); - ti3 = cc[ ccRef( i, k, 1, l1, ido ) - ccOffset ] + ( TR12 * ci2 ) + ( TR11 * ci3 ); + ch[ chRef( i - 1, 1, k, 5, ido ) + chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + cr2 + cr3; + ch[ chRef( i, 1, k, 5, ido ) + chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ci2 + ci3; + tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); + ti2 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ( TR11 * ci2 ) + ( TR12 * ci3 ); + tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); + ti3 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ( TR12 * ci2 ) + ( TR11 * ci3 ); tr5 = ( TI11 * cr5 ) + ( TI12 * cr4 ); ti5 = ( TI11 * ci5 ) + ( TI12 * ci4 ); tr4 = ( TI12 * cr5 ) - ( TI11 * cr4 ); ti4 = ( TI12 * ci5 ) - ( TI11 * ci4 ); - ch[ chRef( i - 1, 3, k, 5, ido ) - chOffset ] = tr2 + tr5; - ch[ chRef( ic - 1, 2, k, 5, ido ) - chOffset ] = tr2 - tr5; - ch[ chRef( i, 3, k, 5, ido ) - chOffset ] = ti2 + ti5; - ch[ chRef( ic, 2, k, 5, ido ) - chOffset ] = ti5 - ti2; - ch[ chRef( i - 1, 5, k, 5, ido ) - chOffset ] = tr3 + tr4; - ch[ chRef( ic - 1, 4, k, 5, ido ) - chOffset ] = tr3 - tr4; - ch[ chRef( i, 5, k, 5, ido ) - chOffset ] = ti3 + ti4; - ch[ chRef( ic, 4, k, 5, ido ) - chOffset ] = ti4 - ti3; + ch[ chRef( i - 1, 3, k, 5, ido ) + chOffset ] = tr2 + tr5; + ch[ chRef( ic - 1, 2, k, 5, ido ) + chOffset ] = tr2 - tr5; + ch[ chRef( i, 3, k, 5, ido ) + chOffset ] = ti2 + ti5; + ch[ chRef( ic, 2, k, 5, ido ) + chOffset ] = ti5 - ti2; + ch[ chRef( i - 1, 5, k, 5, ido ) + chOffset ] = tr3 + tr4; + ch[ chRef( ic - 1, 4, k, 5, ido ) + chOffset ] = tr3 - tr4; + ch[ chRef( i, 5, k, 5, ido ) + chOffset ] = ti3 + ti4; + ch[ chRef( ic, 4, k, 5, ido ) + chOffset ] = ti4 - ti3; } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js index c9c431fbb3f8..a9a1affc2140 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js @@ -56,15 +56,14 @@ * ``` */ -/* eslint-disable max-len, max-lines-per-function, max-statements */ +/* eslint-disable max-len, max-statements */ 'use strict'; // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var PI = require( '@stdlib/constants/float64/pi' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); var c1Ref = require( './c1_ref.js' ); @@ -83,19 +82,20 @@ var ch2Ref = require( './ch2_ref.js' ); * @param {integer} l1 - length of the input sequences * @param {integer} idl1 - stride for the transform * @param {Float64Array} cc - input array containing sequences to be transformed +* @param {integer} ccOffset - offset for the `cc` array * @param {Float64Array} c1 - first work array +* @param {integer} c1Offset - offset for the `c1` array * @param {Float64Array} c2 - second work array +* @param {integer} c2Offset - offset for the `c2` array * @param {Float64Array} ch - output array containing transformed sequences +* @param {integer} chOffset - offset for the `ch` array * @param {Float64Array} ch2 - work array for transformed sequences +* @param {integer} ch2Offset - offset for the `ch2` array * @param {Float64Array} wa - array of twiddle factors +* @param {integer} waOffset - offset for the `wa` array * @returns {void} */ -function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { - var ch2Offset; - var chOffset; - var ccOffset; - var c1Offset; - var c2Offset; +function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset ) { // eslint-disable-line max-params var ar1h; var ar2h; var idp2; @@ -118,37 +118,40 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { var jc; var lc; var j2; + var sc; var i; var j; var k; var l; // Parameter adjustments... - chOffset = 1 + ( ido * ( 1 + l1 ) ); - ccOffset = 1 + ( ido * ( 1 + ip ) ); - c1Offset = 1 + ( ido * ( 1 + l1 ) ); - ch2Offset = 1 + idl1; - c2Offset = 1 + idl1; + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * ( 1 + ip ) ); + c1Offset -= 1 + ( ido * ( 1 + l1 ) ); + ch2Offset -= 1 + idl1; + c2Offset -= 1 + idl1; + waOffset -= 1; // Function body: - arg = ( 2 * PI ) / ip; - dcp = cos( arg ); - dsp = sin( arg ); + arg = TWO_PI / ip; + sc = sincos( arg ); + dcp = sc[ 1 ]; + dsp = sc[ 0 ]; ipph = ( ip + 1 ) / 2; ipp2 = ip + 2; idp2 = ido + 2; nbd = ( ido - 1 ) / 2; if ( ido === 1 ) { for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ]; + c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ]; } } else { for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) + c2Offset ]; } for ( j = 2; j <= ip; j++ ) { for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, j, l1, ido ) - chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ]; + ch[ chRef( 1, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ]; } } if ( nbd <= l1 ) { @@ -159,8 +162,8 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( i = 3; i <= ido; i += 2 ) { idij += 2; for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ) + ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ); - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ) - ( wa[ idij - 2 - 1 ] * c1[ c1Ref( i - 1, k, j, 4, ido ) - c1Offset ] ); + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ) + ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ); + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ) - ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ); } } } @@ -172,8 +175,8 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { idij = is; for ( i = 3; i <= ido; i += 2 ) { idij += 2; - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 1 - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ) + ( wa[ idij - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ); - ch[ chRef( i, k, j, l1, ido ) - chOffset ] = ( wa[ idij - 1 - 1 ] * c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] ) - ( wa[ idij - 1 ] * c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] ); + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ) + ( wa[ idij + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ); + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ) - ( wa[ idij + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ); } } } @@ -183,10 +186,10 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { jc = ipp2 - j; for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] - ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ]; + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] - ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ]; } } } @@ -195,10 +198,10 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { jc = ipp2 - j; for ( i = 3; i <= ido; i += 2 ) { for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( i - 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] - ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( i, k, j, l1, ido ) - c1Offset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( i, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( i, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ]; + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] - ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ]; } } } @@ -207,8 +210,8 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( 1, k, j, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( 1, k, jc, l1, ido ) - chOffset ]; - c1[ c1Ref( 1, k, jc, l1, ido ) - c1Offset ] = ch[ chRef( 1, k, jc, l1, ido ) - chOffset ] - ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; + c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( 1, k, jc, l1, ido ) + chOffset ]; + c1[ c1Ref( 1, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, jc, l1, ido ) + chOffset ] - ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; } } ar1 = 1.0; @@ -219,8 +222,8 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); ar1 = ar1h; for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, l, idl1 ) - ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) - c2Offset ] + ( ar1 * c2[ c2Ref( ik, 2, idl1 ) - c2Offset ] ); - ch2[ ch2Ref( ik, lc, idl1 ) - ch2Offset ] = ai1 * c2[ c2Ref( ik, ip, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, l, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] + ( ar1 * c2[ c2Ref( ik, 2, idl1 ) + c2Offset ] ); + ch2[ ch2Ref( ik, lc, idl1 ) + ch2Offset ] = ai1 * c2[ c2Ref( ik, ip, idl1 ) + c2Offset ]; } dc2 = ar1; ds2 = ai1; @@ -232,26 +235,26 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); ar2 = ar2h; for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, l, idl1 ) - ch2Offset ] += ar2 * c2[ c2Ref( ik, j, idl1 ) - c2Offset ]; - ch2[ ch2Ref( ik, lc, idl1 ) - ch2Offset ] += ai2 * c2[ c2Ref( ik, jc, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, l, idl1 ) + ch2Offset ] += ar2 * c2[ c2Ref( ik, j, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik, lc, idl1 ) + ch2Offset ] += ai2 * c2[ c2Ref( ik, jc, idl1 ) + c2Offset ]; } } } for ( j = 2; j <= ipph; j++ ) { for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, 1, idl1 ) - ch2Offset ] += c2[ c2Ref( ik, j, idl1 ) - c2Offset ]; + ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] += c2[ c2Ref( ik, j, idl1 ) + c2Offset ]; } } if ( ido >= l1 ) { for ( k = 1; k <= l1; k++ ) { for ( i = 1; i <= ido; i++ ) { - cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) - chOffset ]; + cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) + chOffset ]; } } } else { for ( i = 1; i <= ido; i++ ) { for ( k = 1; k <= l1; k++ ) { - cc[ ccRef( i, 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) - chOffset ]; + cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) + chOffset ]; } } } @@ -259,8 +262,8 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { jc = ipp2 - j; j2 = j + j; for ( k = 1; k <= l1; k++ ) { - cc[ ccRef( ido, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( 1, k, j, l1, ido ) - chOffset ]; - cc[ ccRef( 1, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( 1, k, jc, l1, ido ) - chOffset ]; + cc[ ccRef( ido, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; + cc[ ccRef( 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( 1, k, jc, l1, ido ) + chOffset ]; } } if ( ido === 1 ) { @@ -273,10 +276,10 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; - cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) - chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) - chOffset ]; - cc[ ccRef( i, j2 - 1, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, j, l1, ido ) - chOffset ] + ch[ chRef( ic, k, jc, l1, ido ) - chOffset ]; - cc[ ccRef( ic, j2 - 2, k, ip, ido ) - ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) - chOffset ] - ch[ chRef( i, k, j, l1, ido ) - chOffset ]; + cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( i, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( ic, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( ic, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i, k, j, l1, ido ) + chOffset ]; } } } @@ -287,10 +290,10 @@ function radfg( ido, ip, l1, idl1, cc, c1, c2, ch, ch2, wa ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; for ( k = 1; k <= l1; k++ ) { - cc[ccRef( i - 1, j2 - 1, k, ip, ido ) - ccOffset] = ch[chRef(i - 1, k, j, l1, ido) - chOffset] + ch[chRef(i - 1, k, jc, l1, ido) - chOffset]; - cc[ccRef( ic - 1, j2 - 2, k, ip, ido ) - ccOffset] = ch[chRef(i - 1, k, j, l1, ido) - chOffset] - ch[chRef(i - 1, k, jc, l1, ido) - chOffset]; - cc[ccRef( i, j2 - 1, k, ip, ido ) - ccOffset] = ch[chRef(i, k, j, l1, ido) - chOffset] + ch[chRef(i, k, jc, l1, ido) - chOffset]; - cc[ccRef( ic, j2 - 2, k, ip, ido ) - ccOffset] = ch[chRef(i, k, jc, l1, ido) - chOffset] - ch[chRef(i, k, j, l1, ido) - chOffset]; + cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( i, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( ic, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i, k, j, l1, ido ) + chOffset ]; } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js index aa0db2c80c49..77f7000c120c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js @@ -70,14 +70,19 @@ var rfftb1 = require( './rfftb1.js' ); * * @param {number} n - length of the sequence to transform * @param {Float64Array} r - array containing sequence to be transformed +* @param {number} rptr - starting index for r * @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wptr - starting index for wsave * @returns {void} */ -function rfftb( n, r, wsave ) { +function rfftb( n, r, rptr, wsave, wptr ) { + rptr -= 1; + wptr -= 1; + if ( n === 1 ) { return; } - rfftb1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 ] ); // eslint-disable-line max-len + rfftb1( n, r, 1 + rptr, wsave, 1 + wptr, wsave, n + 1 + wptr, wsave, ( n << 1 ) + 1 + wptr ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js index 4bb1760bbc51..67973a0d8dc8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js @@ -77,12 +77,16 @@ var radbg = require( './radbg.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed +* @param {number} cOffset - starting index for input array * @param {Float64Array} ch - working array for intermediate results +* @param {number} chOffset - starting index for working array * @param {Float64Array} wa - array of twiddle factors +* @param {number} waOffset - starting index for twiddle factors array * @param {Int32Array} ifac - array containing factorization information +* @param {number} ifacOffset - starting index for factorization array * @returns {void} */ -function rfftb1( n, c, ch, wa, ifac ) { +function rfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var idl1; var ido; var ix4; @@ -98,12 +102,12 @@ function rfftb1( n, c, ch, wa, ifac ) { var i; // Function Body: - nf = ifac[ 1 ]; + nf = ifac[ ifacOffset + 1 ]; na = 0; l1 = 1; iw = 0; for ( k1 = 1; k1 <= nf; k1++ ) { - ip = ifac[ k1 + 1 ]; + ip = ifac[ ifacOffset + k1 + 1 ]; l2 = ip * l1; ido = n / l2; idl1 = ido * l1; @@ -111,30 +115,30 @@ function rfftb1( n, c, ch, wa, ifac ) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; - radb4( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + radb4( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); na = 1 - na; break; case 2: - radb2( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ] ); + radb2( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); na = 1 - na; break; case 3: ix2 = iw + ido; - radb3( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + radb3( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); na = 1 - na; break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; - radb5( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ] ); + radb5( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset ); na = 1 - na; break; default: if ( na === 0 ) { - radbg( ido, ip, l1, idl1, c, c, c, ch, ch, wa[ iw ] ); + radbg( ido, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset ); } else { - radbg( ido, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ] ); + radbg( ido, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset ); } if ( ido === 1 ) { na = 1 - na; @@ -148,7 +152,7 @@ function rfftb1( n, c, ch, wa, ifac ) { return; } for ( i = 0; i < n; i++ ) { - c[ i ] = ch[ i ]; + c[ i + cOffset ] = ch[ i + chOffset ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js index fcfe8ffb5027..c6f06552a521 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -70,14 +70,19 @@ var rfftf1 = require( './rfftf1.js' ); * * @param {number} n - length of the sequence to transform * @param {Float64Array} r - array containing sequence to be transformed +* @param {number} rOffset - starting index for input array * @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wsaveOffset - starting index for working array * @returns {void} */ -function rfftf( n, r, wsave ) { +function rfftf( n, r, rOffset, wsave, wsaveOffset ) { + wsaveOffset -= 1; + rOffset -= 1; + if ( n === 1 ) { return; } - rfftf1( n, r[ 1 - 1 ], wsave[ 1 - 1 ], wsave[ n + 1 - 1 ], wsave[ ( n << 1 ) + 1 - 1 ] ); // eslint-disable-line max-len + rfftf1( n, r, 1 + rOffset, wsave, 1 + wsaveOffset, wsave, n + 1 + wsaveOffset, wsave, ( n << 1 ) + 1 + wsaveOffset ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js index 1bc43b13f825..52151be2eeae 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js @@ -77,12 +77,16 @@ var radfg = require( './radfg.js' ); * @private * @param {number} n - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed +* @param {number} cOffset - starting index for input array * @param {Float64Array} ch - working array for intermediate results +* @param {number} chOffset - starting index for working array * @param {Float64Array} wa - array of twiddle factors +* @param {number} waOffset - starting index for twiddle factors array * @param {Int32Array} ifac - array containing factorization information +* @param {number} ifacOffset - starting index for factorization array * @returns {void} */ -function rfftf1( n, c, ch, wa, ifac ) { +function rfftf1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var idl1; var ido; var ix4; @@ -99,13 +103,13 @@ function rfftf1( n, c, ch, wa, ifac ) { var i; // Function Body: - nf = ifac[ 1 ]; + nf = ifac[ ifacOffset + 1 ]; na = 1; l2 = n; iw = n - 1; for ( k1 = 1; k1 <= nf; k1++ ) { kh = nf - k1; - ip = ifac[ kh + 2 ]; + ip = ifac[ ifacOffset + kh + 2 ]; l1 = l2 / ip; ido = n / l2; idl1 = ido * l1; @@ -115,30 +119,30 @@ function rfftf1( n, c, ch, wa, ifac ) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; - radf4( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ] ); + radf4( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); break; case 2: - radf2( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + radf2( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); break; case 3: ix2 = iw + ido; - radf3( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ] ); + radf3( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; - radf5( ido, l1, ( na ) ? ch : c, ( na ) ? c : ch, wa[ iw ], wa[ ix2 ], wa[ ix3 ], wa[ ix4 ] ); + radf5( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset ); break; default: if ( ido === 1 ) { na = 1 - na; } if ( na === 0 ) { - radfg( ido, ip, l1, idl1, c, c, c, ch, ch, c, wa[ iw ] ); + radfg( ido, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset ); na = 1; } else { - radfg( ido, ip, l1, idl1, ch, ch, ch, c, c, wa[ iw ] ); + radfg( ido, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset ); na = 0; } break; @@ -149,7 +153,7 @@ function rfftf1( n, c, ch, wa, ifac ) { return; } for ( i = 0; i < n; i++ ) { - c[ i ] = ch[ i ]; + c[ cOffset + i ] = ch[ chOffset + i ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js index fa943b47c3a4..6c0a357c8ae4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -60,8 +60,7 @@ // MODULES // -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); +var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var decompose = require( './decompose.js' ); @@ -100,6 +99,7 @@ function rffti1( n, wa, wptr, ifac, ifptr ) { var l2; var l1; var k1; + var sc; var j; var i; @@ -129,8 +129,9 @@ function rffti1( n, wa, wptr, ifac, ifptr ) { i += 2; fi += 1.0; arg = fi * argld; - wa[ wptr + i - 1 ] = cos( arg ); - wa[ wptr + i ] = sin( arg ); + sc = sincos( arg ); + wa[ wptr + i - 1 ] = sc[ 1 ]; + wa[ wptr + i ] = sc[ 0 ]; } is += ido; } From b8641686d7ecad5ad6007fcf0c57b7eee70020ba Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 11 Feb 2025 23:42:52 +0530 Subject: [PATCH 044/102] feat: add cosqi, add eslint comments --- .../@stdlib/fft/base/fftpack/lib/cosqi.js | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js new file mode 100644 index 000000000000..46e70a4c57f3 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js @@ -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 HALF_PI = require( '@stdlib/constants/float64/half-pi' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var rffti = require( './rffti.js' ); + + +// MAIN // + +/** +* Initializes the working array for quarter-wave cosine transforms. +* +* @param {number} n - sequence length +* @param {Float64Array} wsave - working array +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function cosqi( n, wsave, wptr ) { + var fk; + var dt; + var k; + + wptr -= 1; + dt = HALF_PI / n; + fk = 0.0; + for ( k = 1; k <= n; k++ ) { + fk += 1.0; + wsave[ wptr + k ] = cos( fk * dt ); + } + rffti( n, wsave, wptr + n + 1 ); +} + + +// EXPORTS // + +module.exports = cosqi; From a7ac66f1d0e45386c2b81476f0b7cc71b8e7c24c Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 18 Feb 2025 23:52:44 +0530 Subject: [PATCH 045/102] feat: add cost, costi, sinqb, sinqf, sinqi, sint, sint1, sinti --- 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 --- --- .../@stdlib/fft/base/fftpack/lib/cost.js | 146 +++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/costi.js | 112 +++++++++++++ .../@stdlib/fft/base/fftpack/lib/sinqb.js | 107 +++++++++++++ .../@stdlib/fft/base/fftpack/lib/sinqf.js | 106 +++++++++++++ .../@stdlib/fft/base/fftpack/lib/sinqi.js | 85 ++++++++++ .../@stdlib/fft/base/fftpack/lib/sint.js | 101 ++++++++++++ .../@stdlib/fft/base/fftpack/lib/sint1.js | 150 ++++++++++++++++++ .../@stdlib/fft/base/fftpack/lib/sinti.js | 105 ++++++++++++ 8 files changed, 912 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js new file mode 100644 index 000000000000..951e6350c204 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js @@ -0,0 +1,146 @@ +/** +* @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 rfftf = require( './rfftf.js' ); + + +// MAIN // + +/** +* Computes the discrete Fourier cosine transform of a sequence. +* +* @param {number} n - sequence length +* @param {Float64Array} x - input array +* @param {number} xptr - starting index for x +* @param {Float64Array} wsave - working array +* @param {number} wptr - starting index for wsave +* @returns {void} +*/ +function cost( n, x, xptr, wsave, wptr ) { + var x1p3; + var xim2; + var modn; + var nm1; + var np1; + var x1h; + var ns2; + var tx2; + var c1; + var t1; + var t2; + var kc; + var xi; + var i; + var k; + + xptr -= 1; + wptr -= 1; + + // Function Body + nm1 = n - 1; + np1 = n + 1; + ns2 = n / 2; + if ( n === 2 ) { + x1h = x[ xptr + 1 ] + x[ xptr + 2 ]; + x[ xptr + 2 ] = x[ xptr + 1 ] - x[ xptr + 2 ]; + x[ xptr + 1 ] = x1h; + } else if ( n === 3 ) { + x1p3 = x[ xptr + 1 ] + x[ xptr + 3 ]; + tx2 = x[ xptr + 2 ] + x[ xptr + 2 ]; + x[ xptr + 2 ] = x[ xptr + 1 ] - x[ xptr + 3 ]; + x[ xptr + 1 ] = x1p3 + tx2; + x[ xptr + 3 ] = x1p3 - tx2; + } else if ( n > 3 ) { + c1 = x[ xptr + 1 ] - x[ xptr + n ]; + x[ xptr + 1 ] += x[ xptr + n ]; + for ( k = 2; k <= ns2; k++ ) { + kc = np1 - k; + t1 = x[ xptr + k ] + x[ xptr + kc ]; + t2 = x[ xptr + k ] - x[ xptr + kc ]; + c1 += wsave[ wptr + kc ] * t2; + t2 *= wsave[ wptr + k ]; + x[ xptr + k ] = t1 - t2; + x[ xptr + kc ] = t1 + t2; + } + modn = n % 2; + if ( modn !== 0 ) { + x[ xptr + ns2 + 1 ] += x[ xptr + ns2 + 1 ]; + } + rfftf( nm1, x, xptr + 1, wsave, wptr + n + 1 ); + xim2 = x[ xptr + 2 ]; + x[ xptr + 2 ] = c1; + for ( i = 4; i <= n; i += 2 ) { + xi = x[ xptr + i ]; + x[ xptr + i ] = x[ xptr + i - 2 ] - x[ xptr + i - 1 ]; + x[ xptr + i - 1 ] = xim2; + xim2 = xi; + } + if ( modn !== 0 ) { + x[ xptr + n ] = xim2; + } + } +} + + +// EXPORTS // + +module.exports = cost; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js new file mode 100644 index 000000000000..0393bd663161 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js @@ -0,0 +1,112 @@ +/** +* @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 sincos = require( '@stdlib/math/base/special/sincos' ); +var PI = require( '@stdlib/constants/float64/pi' ); +var rffti = require( './rffti.js' ); + + +// MAIN // + +/** +* Initializes the working array for the discrete Fourier cosine transform. +* +* @param {number} n - sequence length +* @param {Float64Array} wsave - working array +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function costi( n, wsave, wptr ) { + var nm1; + var np1; + var ns2; + var dt; + var sc; + var fk; + var kc; + var k; + + wptr -= 1; + + if ( n <= 3 ) { + return; + } + nm1 = n - 1; + np1 = n + 1; + ns2 = n / 2; + dt = PI / nm1; + fk = 0.0; + + for ( k = 2; k <= ns2; k++ ) { + kc = np1 - k; + fk += 1.0; + sc = sincos( fk * dt ); + wsave[ wptr + k ] = sc[ 0 ] * 2.0; + wsave[ wptr + kc ] = sc[ 1 ] * 2.0; + } + rffti( nm1, wsave, wptr + n + 1 ); +} + + +// EXPORTS // + +module.exports = costi; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js new file mode 100644 index 000000000000..40d003aa63b1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js @@ -0,0 +1,107 @@ +/** +* @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 cosqb = require( './cosqb.js' ); + + +// MAIN // + +/** +* Performs the quarter-wave sine backward transform. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} x - input array containing sequence to be transformed +* @param {number} xptr - starting index for `x` +* @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function sinqb( n, x, xptr, wsave, wptr ) { + var xhold; + var ns2; + var kc; + var k; + + wptr -= 1; + xptr -= 1; + + if ( n <= 1 ) { + x[ xptr + 1 ] *= 4.0; + return; + } + ns2 = n / 2; + for ( k = 2; k <= n; k += 2 ) { + x[ xptr + k ] = -x[ xptr + k ]; + } + cosqb( n, x, xptr + 1, wsave, wptr + 1 ); + for ( k = 1; k <= ns2; ++k ) { + kc = n - k; + xhold = x[ xptr + k ]; + x[ xptr + k ] = x[ xptr + kc + 1 ]; + x[ xptr + kc + 1 ] = xhold; + } +} + + +// EXPORTS // + +module.exports = sinqb; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js new file mode 100644 index 000000000000..5555c56daf3b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js @@ -0,0 +1,106 @@ +/** +* @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 cosqb = require( './cosqb.js' ); + + +// MAIN // + +/** +* Performs the quarter-wave sine forward transform. +* +* @param {number} n - length of the sequence to transform +* @param {Float64Array} x - input array containing sequence to be transformed +* @param {number} xptr - starting index for `x` +* @param {Float64Array} wsave - working array containing precomputed values +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function sinqf( n, x, xptr, wsave, wptr ) { + var xhold; + var ns2; + var kc; + var k; + + wptr -= 1; + xptr -= 1; + + if ( n === 1 ) { + return; + } + ns2 = n / 2; + for ( k = 1; k <= ns2; ++k ) { + kc = n - k; + xhold = x[ xptr + k ]; + x[ xptr + k ] = x[ xptr + kc + 1 ]; + x[ xptr + kc + 1 ] = xhold; + } + cosqb( n, x, xptr + 1, wsave, wptr + 1 ); + for ( k = 2; k <= n; k += 2 ) { + x[ xptr + k ] = -x[ xptr + k ]; + } +} + + +// EXPORTS // + +module.exports = sinqf; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js new file mode 100644 index 000000000000..79ac3914670b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js @@ -0,0 +1,85 @@ +/** +* @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 cosqi = require( './cosqi.js' ); + + +// MAIN // + +/** +* Initializes the working array for quarter-wave sine transforms. +* +* @param {number} n - sequence length +* @param {Float64Array} wsave - working array +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function sinqi( n, wsave, wptr ) { + wptr -= 1; + + cosqi( n, wsave, wptr + 1 ); +} + + +// EXPORTS // + +module.exports = sinqi; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js new file mode 100644 index 000000000000..d2cc827dd90d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js @@ -0,0 +1,101 @@ +/** +* @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 sint1 = require( './sint1.js' ); + + +// MAIN // + +/** +* Computes the sine transform of a sequence. +* +* @private +* @param {number} n - sequence length +* @param {Float64Array} x - input/output array +* @param {number} xptr - starting index for `x` +* @param {Float64Array} wsave - working array +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function sint( n, x, xptr, wsave, wptr ) { + var iw1; + var iw2; + var iw3; + var np1; + + // Parameter adjustments + wptr -= 1; + xptr -= 1; + + // Function Body + np1 = n + 1; + iw1 = ( n / 2 ) + 1; + iw2 = iw1 + np1; + iw3 = iw2 + np1; + + sint1( n, x, xptr+1, wsave, wptr+1, wsave, wptr+iw1, wsave, wptr+iw2, wsave, wptr+iw3 ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = sint; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js new file mode 100644 index 000000000000..a6eb16c6328d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js @@ -0,0 +1,150 @@ +/** +* @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 SQRT3 = require( '@stdlib/constants/float64/sqrt-three' ); +var rfftf1 = require( './rfftf1.js' ); + + +// MAIN // + +/** +* Computes the sine transform of a sequence. +* +* @private +* @param {number} n - sequence length +* @param {Float64Array} war - working array for real values +* @param {number} warptr - starting index for `war` +* @param {Float64Array} was - working array for sine values +* @param {number} wasptr - starting index for `was` +* @param {Float64Array} xh - auxiliary array +* @param {number} xhptr - starting index for `xh` +* @param {Float64Array} x - input/output array +* @param {number} xptr - starting index for `x` +* @param {Int32Array} ifac - array containing factorization +* @param {number} ifptr - starting index for `ifac` +* @returns {void} +*/ +function sint1( n, war, warptr, was, wasptr, xh, xhptr, x, xptr, ifac, ifptr ) { // eslint-disable-line max-params + var xhold; + var modn; + var np1; + var ns2; + var kc; + var t1; + var t2; + var k; + var i; + + // Parameter adjustments + ifptr -= 1; + xptr -= 1; + xhptr -= 1; + wasptr -= 1; + warptr -= 1; + + // Function Body + for ( i = 1; i <= n; i++ ) { + xh[ xhptr + i ] = war[ warptr + i ]; + war[ warptr + i ] = x[ xptr + i ]; + } + if ( n < 2 ) { + xh[ xhptr + 1 ] += xh[ xhptr + 1 ]; + } else if ( n === 2 ) { + xhold = SQRT3 * ( xh[ xhptr + 1 ] + xh[ xhptr + 2 ] ); + xh[ xhptr + 2 ] = SQRT3 * ( xh[ xhptr + 1 ] - xh[ xhptr + 2 ] ); + xh[ xhptr + 1 ] = xhold; + } else { + np1 = n + 1; + ns2 = n / 2; + x[ xptr + 1 ] = 0.0; + for ( k = 1; k <= ns2; ++k ) { + kc = np1 - k; + t1 = xh[ xhptr + k ] - xh[ xhptr + kc ]; + t2 = was[ wasptr + k ] * ( xh[ xhptr + k ] + xh[ xhptr + kc ] ); + x[ xptr + k + 1 ] = t1 + t2; + x[ xptr + kc + 1 ] = t2 - t1; + } + modn = n % 2; + if ( modn !== 0 ) { + x[ xptr + ns2 + 2 ] = xh[ xhptr + ns2 + 1 ] * 4.0; + } + rfftf1( np1, x, xptr + 1, xh, xhptr + 1, war, warptr + 1, ifac, ifptr + 1 ); // eslint-disable-line max-len + xh[ xhptr + 1 ] = x[ xptr + 1 ] * 0.5; + for ( i = 3; i <= n; i += 2 ) { + xh[ xhptr + i - 1 ] = -x[ xptr + i ]; + xh[ xhptr + i ] = xh[ xhptr + i - 2 ] + x[ xptr + i - 1 ]; + } + if ( modn === 0 ) { + xh[ xhptr + n ] = -x[ xptr + n + 1 ]; + } + } + + for ( i = 1; i <= n; i++ ) { + x[ xptr + i ] = war[ warptr + i ]; + war[ warptr + i ] = xh[ xhptr + i ]; + } +} + + +// EXPORTS // + +module.exports = sint1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js new file mode 100644 index 000000000000..9dc9c9edb034 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js @@ -0,0 +1,105 @@ +/** +* @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 sin = require( '@stdlib/math/base/special/sin' ); +var PI = require( '@stdlib/constants/float64/pi' ); +var rffti = require( './rffti.js' ); + + +// MAIN // + +/** +* Initializes the sine transform. +* +* @private +* @param {number} n - sequence length +* @param {Float64Array} wsave - working array +* @param {number} wptr - starting index for `wsave` +* @returns {void} +*/ +function sinti( n, wsave, wptr ) { + var np1; + var ns2; + var dt; + var k; + + // Parameter adjustments + wptr -= 1; + + // Function Body + if ( n <= 1 ) { + return; + } + ns2 = n / 2; + np1 = n + 1; + dt = PI / np1; + + for ( k = 1; k <= ns2; k++ ) { + wsave[ wptr + k ] = sin( k * dt ) * 2.0; + } + rffti( np1, wsave, wptr + ns2 + 1 ); +} + + +// EXPORTS // + +module.exports = sinti; From 8189014504f2045f2698a7b5823de6d077b22214 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 2 Mar 2025 13:42:49 +0530 Subject: [PATCH 046/102] test: add initial test for rffti --- .../@stdlib/fft/base/fftpack/lib/decompose.js | 7 ++- .../fft/base/fftpack/test/test.rffti.js | 59 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index d5233a29f6a4..edb94467250a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -58,6 +58,11 @@ 'use strict'; +// MODULES // + +var floor = require( '@stdlib/math/base/special/floor' ); + + // MAIN // /** @@ -92,7 +97,7 @@ function decompose( n, ifac, ifptr, ntryh ) { } j += 1; while ( true ) { - nq = nl / ntry; + nq = floor( nl / ntry ); nr = nl - ( ntry * nq ); if ( nr !== 0 ) { break; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js new file mode 100644 index 000000000000..81940233ba80 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js @@ -0,0 +1,59 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var rffti = require( './../lib/rffti.js' ); + + +// FIXTURES // + +var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof rffti, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function initializes FFT working arrays', function test( t ) { + var ptr; + var w; + var i; + var n; + + ptr = 1; + for ( i = 0; i < nd.length; i++ ) { + n = nd[ i ]; + w = new Float64Array( ( 2 * n ) + 15 ); + rffti( n, w, ptr ); + t.strictEqual( isFloat64Array( w ), true, 'returns expected value for n=' + n ); + t.notEqual( w[ ptr ], 0.0, 'modifies input array for n=' + n ); + t.notEqual( w[ n + ptr ], 0.0, 'modifies input array for n=' + n ); + ptr += ( 2 * n ) + 15; + } + t.end(); +}); From 95853cba23eb1f60271f65a95ce192ba1b27ca0f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 5 Mar 2025 11:50:07 +0530 Subject: [PATCH 047/102] test: add initial test for rffti --- 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: passed --- --- lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js index 81940233ba80..ac48c0b4d275 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js @@ -51,7 +51,6 @@ tape( 'the function initializes FFT working arrays', function test( t ) { w = new Float64Array( ( 2 * n ) + 15 ); rffti( n, w, ptr ); t.strictEqual( isFloat64Array( w ), true, 'returns expected value for n=' + n ); - t.notEqual( w[ ptr ], 0.0, 'modifies input array for n=' + n ); t.notEqual( w[ n + ptr ], 0.0, 'modifies input array for n=' + n ); ptr += ( 2 * n ) + 15; } From 02eabb09bc8179146cf50ebe82a1b0c48cec130f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 26 Mar 2025 11:41:22 +0530 Subject: [PATCH 048/102] test: add test.rfftf.js --- .../fft/base/fftpack/test/test.rfftf.js | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js new file mode 100644 index 000000000000..89d98f683f62 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js @@ -0,0 +1,166 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var max = require( '@stdlib/math/base/special/max' ); +var PI = require( '@stdlib/constants/float64/pi' ); +var rffti = require( './../lib/rffti.js' ); +var rfftf = require( './../lib/rfftf.js' ); +var rfftb = require( './../lib/rfftb.js' ); + + +// FIXTURES // + +var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof rfftf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'rfftf computes the forward transform with accuracy', function test( t ) { + var tolerance = 1.0e-7; + var maxError = 0.0; + var sumReal = 0.0; + var sumImag = 0.0; + var sqrt2 = sqrt( 2.0 ); + var scale = 0.0; + var angle = 0.0; + var sum1 = 0.0; + var sum2 = 0.0; + var arg = 0.0; + var err = 0.0; + var ref = null; + var ns2 = 0; + var dt = 0.0; + var xh = null; + var ni = 0; + var w = null; + var x = null; + var y = null; + var n = 0; + var j = 0; + var i = 0; + var k = 0; + + for ( ni = 0; ni < nd.length; ni++ ) { + n = nd[ ni ]; + w = new Float64Array( (2*n) + 15 ); + x = new Float64Array( n ); + xh = new Float64Array( n ); + y = new Float64Array( n ); + + for ( j = 0; j < n; j++ ) { + x[ j ] = sin( (j+1) * sqrt2 ); + xh[ j ] = x[ j ]; + y[ j ] = x[ j ]; + } + + rffti( n, w ); + + dt = (2.0 * PI) / n; + ns2 = floor( (n + 1) / 2 ); + ref = new Float64Array( n ); + + sum1 = 0.0; + sum2 = 0.0; + for ( i = 0; i < n-1; i += 2 ) { + sum1 += x[ i ]; + sum2 += x[ i+1 ]; + } + if ( n % 2 === 1 ) { + sum1 += x[ n-1 ]; + } + ref[ 0 ] = sum1 + sum2; + if ( n % 2 === 0 ) { + ref[ n-1 ] = sum1 - sum2; + } + + if ( ns2 >= 2 ) { + for ( k = 2; k <= ns2; k++ ) { + sumReal = 0.0; + sumImag = 0.0; + arg = (k-1) * dt; + + for ( i = 0; i < n; i++ ) { + angle = arg * i; + sumReal += x[ i ] * cos( angle ); + sumImag += x[ i ] * sin( angle ); + } + ref[ (2*k)-3 ] = sumReal; + ref[ (2*k)-2 ] = -sumImag; + } + } + + rfftf( n, x, 1, w, 1 ); + + maxError = 0.0; + for ( i = 0; i < n; i++ ) { + err = abs( x[i] - ref[i] ); + maxError = max( maxError, err ); + } + t.ok( maxError < tolerance, 'n=' + n + ' max error: ' + maxError ); + + rfftb( n, x, 1, w, 1 ); + scale = 1.0 / n; + maxError = 0.0; + for ( i = 0; i < n; i++ ) { + err = abs( (x[i] * scale) - xh[i] ); + maxError = max( maxError, err ); + } + t.ok( maxError < tolerance, 'n=' + n + ' inverse consistency error: ' + maxError ); + } + t.end(); +}); + +tape( 'rfftf handles edge cases', function test( t ) { + var w = null; + var x = null; + var n = 0; + + n = 1; + w = new Float64Array( 2*n + 15 ); + x = new Float64Array( [ 5.0 ] ); + rffti( n, w ); + rfftf( n, x, 1, w, 1 ); + t.equal( x[0], 5.0, 'n=1 transform equals input' ); + + n = 2; + w = new Float64Array( 2*n + 15 ); + x = new Float64Array( [ 1.0, 2.0 ] ); + rffti( n, w ); + rfftf( n, x, 1, w, 1 ); + t.ok( abs( x[0] - 3.0 ) < 1e-10, 'n=2 DC component' ); + t.ok( abs( x[1] - (-1.0) ) < 1e-10, 'n=2 Nyquist component' ); + + t.end(); +}); From 474def90781b6126cc6f017c7e6c45ab58377b29 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 15 Apr 2025 17:20:10 +0530 Subject: [PATCH 049/102] test: use correct implementation of tests, improve implementation --- .../@stdlib/fft/base/fftpack/lib/decompose.js | 5 +- .../@stdlib/fft/base/fftpack/lib/radf2.js | 2 +- .../@stdlib/fft/base/fftpack/lib/radfg.js | 15 +- .../@stdlib/fft/base/fftpack/lib/rfftf.js | 5 +- .../@stdlib/fft/base/fftpack/lib/rfftf1.js | 7 +- .../@stdlib/fft/base/fftpack/lib/rffti.js | 4 +- .../@stdlib/fft/base/fftpack/lib/rffti1.js | 3 +- .../fft/base/fftpack/test/test.rfft.js | 185 ++++++++++++++++++ .../fft/base/fftpack/test/test.rfftf.js | 166 ---------------- .../fft/base/fftpack/test/test.rffti.js | 58 ------ 10 files changed, 207 insertions(+), 243 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index edb94467250a..100afaebe371 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -112,9 +112,10 @@ function decompose( n, ifac, ifptr, ntryh ) { } ifac[ ifptr + 3 ] = 2; } - if ( nl === 1 ) { - break; + if ( nl !== 1 ) { + continue; } + break; } } while ( nl !== 1 ); ifac[ ifptr + 1 ] = n; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 5339db7bedc3..434145829ae8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -122,7 +122,7 @@ function radf2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { } for ( k = 1; k <= l1; k++ ) { ch[ chRef( 1, 2, k, l1, ido ) + chOffset ] = -cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ]; - ch[ chRef( ido, 1, k, l1, ido ) + chOffset ] = -cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ]; + ch[ chRef( ido, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js index a9a1affc2140..abfe507c9761 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js @@ -64,6 +64,7 @@ var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var floor = require( '@stdlib/math/base/special/floor' ); var chRef = require( './ch_ref.js' ); var ccRef = require( './cc_ref.js' ); var c1Ref = require( './c1_ref.js' ); @@ -137,10 +138,10 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, sc = sincos( arg ); dcp = sc[ 1 ]; dsp = sc[ 0 ]; - ipph = ( ip + 1 ) / 2; + ipph = floor( ( ip + 1 ) / 2 ); ipp2 = ip + 2; idp2 = ido + 2; - nbd = ( ido - 1 ) / 2; + nbd = floor( ( ido - 1 ) / 2 ); if ( ido === 1 ) { for ( ik = 1; ik <= idl1; ik++ ) { c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ]; @@ -162,8 +163,8 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, for ( i = 3; i <= ido; i += 2 ) { idij += 2; for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ) + ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ); - ch[ chRef( i, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ) - ( wa[ idij - 2 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ); + ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ) + ( wa[ idij + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ); + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ) - ( wa[ idij + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ); } } } @@ -260,7 +261,7 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, } for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - j2 = j + j; + j2 = j * 2; for ( k = 1; k <= l1; k++ ) { cc[ ccRef( ido, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; cc[ ccRef( 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( 1, k, jc, l1, ido ) + chOffset ]; @@ -272,7 +273,7 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, if ( nbd >= l1 ) { for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - j2 = j + j; + j2 = j * 2; for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; @@ -286,7 +287,7 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, } else { for ( j = 2; j <= ipph; j++ ) { jc = ipp2 - j; - j2 = j + j; + j2 = j * 2; for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; for ( k = 1; k <= l1; k++ ) { diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js index c6f06552a521..0f1466fc36d0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -76,13 +76,12 @@ var rfftf1 = require( './rfftf1.js' ); * @returns {void} */ function rfftf( n, r, rOffset, wsave, wsaveOffset ) { - wsaveOffset -= 1; rOffset -= 1; - + wsaveOffset -= 1; if ( n === 1 ) { return; } - rfftf1( n, r, 1 + rOffset, wsave, 1 + wsaveOffset, wsave, n + 1 + wsaveOffset, wsave, ( n << 1 ) + 1 + wsaveOffset ); // eslint-disable-line max-len + rfftf1( n, r, rOffset + 1, wsave, wsaveOffset + 1, wsave, n + wsaveOffset + 1, wsave, ( n << 1 ) + 1 + wsaveOffset ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js index 52151be2eeae..3a9741ad8ab3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js @@ -62,6 +62,7 @@ // MODULES // +var floor = require( '@stdlib/math/base/special/floor' ); var radf2 = require( './radf2.js' ); var radf3 = require( './radf3.js' ); var radf4 = require( './radf4.js' ); @@ -110,10 +111,10 @@ function rfftf1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { for ( k1 = 1; k1 <= nf; k1++ ) { kh = nf - k1; ip = ifac[ ifacOffset + kh + 2 ]; - l1 = l2 / ip; - ido = n / l2; + l1 = floor( l2 / ip ); + ido = floor( n / l2 ); idl1 = ido * l1; - iw -= ( ip - 1 ) * ido; + iw -= ( ( ip - 1 ) * ido ); na = 1 - na; switch ( ip ) { case 4: diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js index 5a2e94475c16..be2b0bece4a2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js @@ -74,11 +74,11 @@ var rffti1 = require( './rffti1.js' ); * @returns {void} */ function rffti( n, wsave, wptr ) { + wptr -= 1; if ( n === 1 ) { return; } - wptr -= 1; - rffti1( n, wsave, n + wptr, wsave, ( n << 1 ) + wptr ); + rffti1( n, wsave, n + 1 + wptr, wsave, 1 + ( n << 1 ) + wptr ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js index 6c0a357c8ae4..00d5afbfbb49 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -62,6 +62,7 @@ var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var floor = require( '@stdlib/math/base/special/floor' ); var decompose = require( './decompose.js' ); @@ -118,7 +119,7 @@ function rffti1( n, wa, wptr, ifac, ifptr ) { ip = ifac[ ifptr + k1 + 2 ]; ld = 0; l2 = ip * l1; - ido = n / l2; + ido = floor( n / l2 ); ipm = ip - 1; for ( j = 1; j <= ipm; j++ ) { ld += l1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js new file mode 100644 index 000000000000..9eaa87144f4d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -0,0 +1,185 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var SQRT2 = require( '@stdlib/constants/float64/sqrt-two' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var max = require( '@stdlib/math/base/special/max' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var rffti = require( './../lib/rffti.js' ); +var rfftf = require( './../lib/rfftf.js' ); +var rfftb = require( './../lib/rfftb.js' ); + + +// FIXTURES // + +var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof rffti, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function initializes FFT working arrays', function test( t ) { // eslint-disable-line max-statements + var rftfb; + var modn; + var rftf; + var rftb; + var sum1; + var sum2; + var arg1; + var sum; + var arg; + var np1; + var nm1; + var ns2; + var tol; + var r2; + var r3; + var r1; + var nz; + var xh; + var dt; + var cf; + var n; + var j; + var x; + var y; + var w; + var k; + var i; + + x = new Float64Array( 200 ); + y = new Float64Array( 200 ); + xh = new Float64Array( 200 ); + w = new Float64Array( 2000 ); + for ( nz = 1; nz <= nd.length; nz++ ) { + n = nd[ nz - 1 ]; + modn = n % 2; + np1 = n + 1; + nm1 = n - 1; + + for ( j = 1; j <= np1; j++ ) { + x[ j - 1 ] = sin( j * SQRT2 ); + y[ j - 1 ] = x[ j - 1 ]; + xh[ j - 1 ] = x[ j - 1 ]; + } + + // TEST SUBROUTINES RFFTI,RFFTF AND RFFTB: + rffti( n, w, 0 ); + dt = TWO_PI / n; + ns2 = floor( ( n + 1 ) / 2 ); + if ( ns2 >= 1 ) { + for ( k = 2; k <= ns2; k++ ) { + sum1 = 0.0; + sum2 = 0.0; + arg = ( k - 1 ) * dt; + for ( i = 1; i <= n; i++ ) { + arg1 = ( i - 1 ) * arg; + sum1 += x[ i - 1 ] * cos( arg1 ); + sum2 += x[ i - 1 ] * sin( arg1 ); + } + y[ ( k << 1 ) - 3 ] = sum1; + y[ ( k << 1 ) - 2 ] = -sum2; + } + } + sum1 = 0.0; + sum2 = 0.0; + for ( i = 1; i <= nm1; i += 2 ) { + sum1 += x[ i - 1 ]; + sum2 += x[ i ]; + } + if ( modn === 1 ) { + sum1 += x[ n - 1 ]; + } + y[ 0 ] = sum1 + sum2; + if ( modn === 0 ) { + y[ n - 1 ] = sum1 - sum2; + } + rfftf( n, x, 0, w, 0 ); + rftf = 0.0; + for ( i = 1; i <= n; i++ ) { + // Computing MAX: + r2 = rftf; + r1 = x[ i - 1 ] - y[ i - 1 ]; + r3 = abs( r1 ); + rftf = max( r2, r3 ); + x[ i - 1 ] = xh[ i - 1 ]; + } + rftf /= n; + + for ( i = 0; i < n; i++ ) { + sum = x[ 0 ] * 0.5; + arg = i * dt; + if ( ns2 >= 1 ) { + for ( k = 1; k < ns2; k++ ) { + arg1 = k * arg; + sum += ( x[ ( ( k + 1 ) << 1 ) - 3 ] * cos( arg1 ) ) - ( x[ ( ( k + 1 ) << 1 ) - 2 ] * sin( arg1 ) ); // eslint-disable-line max-len + } + } + if ( modn === 0 ) { + sum += pow( -1, i - 1 ) * 0.5 * x[ n ]; + } + y[ i ] = 2 * sum; + } + + rfftb( n, x, 0, w, 0 ); + rftb = 0.0; + for ( i = 0; i < n; i++ ) { + // Computing MAX: + r2 = rftb; + r1 = x[ i ] - y[ i ]; + r3 = abs( r1 ); + rftb = max( r2, r3 ); + x[ i ] = xh[ i ]; + y[ i ] = xh[ i ]; + } + + rfftb( n, y, 0, w, 0 ); + rfftf( n, y, 0, w, 0 ); + cf = 1.0 / n; + rftfb = 0.0; + for ( i = 0; i < n; i++ ) { + // Computing MAX: + r2 = rftfb; + r1 = cf * ( y[ i ] - x[ i ] ); + r3 = abs( r1 ); + rftfb = max( r2, r3 ); + } + + tol = 1e-3; + t.ok( rftf <= tol, 'forward transform error: ' + rftf + ' (expected <= ' + tol + ')' ); + t.ok( rftb <= tol, 'backward transform error: ' + rftb + ' (expected <= ' + tol + ')' ); + t.ok( rftfb <= tol, 'forward-backward transform error: ' + rftfb + ' (expected <= ' + tol + ')' ); + } + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js deleted file mode 100644 index 89d98f683f62..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfftf.js +++ /dev/null @@ -1,166 +0,0 @@ -/** -* @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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array/float64' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); -var sqrt = require( '@stdlib/math/base/special/sqrt' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var max = require( '@stdlib/math/base/special/max' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var rffti = require( './../lib/rffti.js' ); -var rfftf = require( './../lib/rfftf.js' ); -var rfftb = require( './../lib/rfftb.js' ); - - -// FIXTURES // - -var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rfftf, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'rfftf computes the forward transform with accuracy', function test( t ) { - var tolerance = 1.0e-7; - var maxError = 0.0; - var sumReal = 0.0; - var sumImag = 0.0; - var sqrt2 = sqrt( 2.0 ); - var scale = 0.0; - var angle = 0.0; - var sum1 = 0.0; - var sum2 = 0.0; - var arg = 0.0; - var err = 0.0; - var ref = null; - var ns2 = 0; - var dt = 0.0; - var xh = null; - var ni = 0; - var w = null; - var x = null; - var y = null; - var n = 0; - var j = 0; - var i = 0; - var k = 0; - - for ( ni = 0; ni < nd.length; ni++ ) { - n = nd[ ni ]; - w = new Float64Array( (2*n) + 15 ); - x = new Float64Array( n ); - xh = new Float64Array( n ); - y = new Float64Array( n ); - - for ( j = 0; j < n; j++ ) { - x[ j ] = sin( (j+1) * sqrt2 ); - xh[ j ] = x[ j ]; - y[ j ] = x[ j ]; - } - - rffti( n, w ); - - dt = (2.0 * PI) / n; - ns2 = floor( (n + 1) / 2 ); - ref = new Float64Array( n ); - - sum1 = 0.0; - sum2 = 0.0; - for ( i = 0; i < n-1; i += 2 ) { - sum1 += x[ i ]; - sum2 += x[ i+1 ]; - } - if ( n % 2 === 1 ) { - sum1 += x[ n-1 ]; - } - ref[ 0 ] = sum1 + sum2; - if ( n % 2 === 0 ) { - ref[ n-1 ] = sum1 - sum2; - } - - if ( ns2 >= 2 ) { - for ( k = 2; k <= ns2; k++ ) { - sumReal = 0.0; - sumImag = 0.0; - arg = (k-1) * dt; - - for ( i = 0; i < n; i++ ) { - angle = arg * i; - sumReal += x[ i ] * cos( angle ); - sumImag += x[ i ] * sin( angle ); - } - ref[ (2*k)-3 ] = sumReal; - ref[ (2*k)-2 ] = -sumImag; - } - } - - rfftf( n, x, 1, w, 1 ); - - maxError = 0.0; - for ( i = 0; i < n; i++ ) { - err = abs( x[i] - ref[i] ); - maxError = max( maxError, err ); - } - t.ok( maxError < tolerance, 'n=' + n + ' max error: ' + maxError ); - - rfftb( n, x, 1, w, 1 ); - scale = 1.0 / n; - maxError = 0.0; - for ( i = 0; i < n; i++ ) { - err = abs( (x[i] * scale) - xh[i] ); - maxError = max( maxError, err ); - } - t.ok( maxError < tolerance, 'n=' + n + ' inverse consistency error: ' + maxError ); - } - t.end(); -}); - -tape( 'rfftf handles edge cases', function test( t ) { - var w = null; - var x = null; - var n = 0; - - n = 1; - w = new Float64Array( 2*n + 15 ); - x = new Float64Array( [ 5.0 ] ); - rffti( n, w ); - rfftf( n, x, 1, w, 1 ); - t.equal( x[0], 5.0, 'n=1 transform equals input' ); - - n = 2; - w = new Float64Array( 2*n + 15 ); - x = new Float64Array( [ 1.0, 2.0 ] ); - rffti( n, w ); - rfftf( n, x, 1, w, 1 ); - t.ok( abs( x[0] - 3.0 ) < 1e-10, 'n=2 DC component' ); - t.ok( abs( x[1] - (-1.0) ) < 1e-10, 'n=2 Nyquist component' ); - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js deleted file mode 100644 index ac48c0b4d275..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rffti.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array/float64' ); -var isFloat64Array = require( '@stdlib/assert/is-float64array' ); -var rffti = require( './../lib/rffti.js' ); - - -// FIXTURES // - -var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rffti, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function initializes FFT working arrays', function test( t ) { - var ptr; - var w; - var i; - var n; - - ptr = 1; - for ( i = 0; i < nd.length; i++ ) { - n = nd[ i ]; - w = new Float64Array( ( 2 * n ) + 15 ); - rffti( n, w, ptr ); - t.strictEqual( isFloat64Array( w ), true, 'returns expected value for n=' + n ); - t.notEqual( w[ n + ptr ], 0.0, 'modifies input array for n=' + n ); - ptr += ( 2 * n ) + 15; - } - t.end(); -}); From b6cba55359743a365fba7e8b346691de1f1a41b5 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Fri, 2 May 2025 10:38:26 +0530 Subject: [PATCH 050/102] test: update implementation according to tests --- lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js | 3 ++- lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js | 3 +++ lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js | 3 +++ .../fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json | 7 +++++++ .../fftpack/test/fixtures/fft_arrays_after_rffti_n120.json | 7 +++++++ .../fftpack/test/fixtures/fft_arrays_initial_n120.json | 7 +++++++ .../@stdlib/fft/base/fftpack/test/test.rfft.js | 5 ++++- 7 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js index 67973a0d8dc8..0254e0ce200a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js @@ -62,6 +62,7 @@ // MODULES // +var floor = require( '@stdlib/math/base/special/floor' ); var radb2 = require( './radb2.js' ); var radb3 = require( './radb3.js' ); var radb4 = require( './radb4.js' ); @@ -109,7 +110,7 @@ function rfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { for ( k1 = 1; k1 <= nf; k1++ ) { ip = ifac[ ifacOffset + k1 + 1 ]; l2 = ip * l1; - ido = n / l2; + ido = floor( n / l2 ); idl1 = ido * l1; switch ( ip ) { case 4: diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js index 0f1466fc36d0..fd43545bf195 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -76,8 +76,11 @@ var rfftf1 = require( './rfftf1.js' ); * @returns {void} */ function rfftf( n, r, rOffset, wsave, wsaveOffset ) { + // Parameter adjustments: rOffset -= 1; wsaveOffset -= 1; + + // Function Body: if ( n === 1 ) { return; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js index be2b0bece4a2..330d8c90323f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js @@ -74,7 +74,10 @@ var rffti1 = require( './rffti1.js' ); * @returns {void} */ function rffti( n, wsave, wptr ) { + // Parameter adjustments: wptr -= 1; + + // Function Body: if ( n === 1 ) { return; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json new file mode 100644 index 000000000000..d818c69044db --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json @@ -0,0 +1,7 @@ +{ +"n": 120, +"x": [0.03083902969956398,0.030900374054908752,-0.00020247766224201769,0.031040014699101448,-0.00047737153363414109,0.03135429322719574,-0.00069796526804566383,0.031725130975246429,-0.00096623948775231838,0.032305143773555756,-0.0012189216213300824,0.032975524663925171,-0.0014748886460438371,0.033795684576034546,-0.0017344177467748523,0.034791789948940277,-0.0020218964200466871,0.035969942808151245,-0.0023188898339867592,0.037362650036811829,-0.0026424960233271122,0.039003536105155945,-0.003011561231687665,0.040955860167741776,-0.003406106261536479,0.043271362781524658,-0.0038257110863924026,0.045990999788045883,-0.0042763263918459415,0.049222987145185471,-0.0047971354797482491,0.053122729063034058,-0.0054354295134544373,0.057901963591575623,-0.0061875460669398308,0.063855946063995361,-0.0070716571062803268,0.071370065212249756,-0.008146963082253933,0.08110392838716507,-0.0094751361757516861,0.094240143895149231,-0.011275533586740494,0.1126929298043251,-0.013713463209569454,0.14050231873989105,-0.017380006611347198,0.18702024221420288,-0.023406274616718292,0.28012543916702271,-0.035382881760597229,0.55822575092315674,-0.070929050445556641,59.508262634277344,-7.5845475196838379,-0.57180434465408325,0.072892248630523682,-0.28565272688865662,0.036319263279438019,-0.19105374813079834,0.024175975471735001,-0.1439974308013916,0.01806979812681675,-0.11590223014354706,0.014376971870660782,-0.097253799438476562,0.011901378631591797,-0.084020942449569702,0.010126423090696335,-0.074179209768772125,0.0087793758139014244,-0.066573970019817352,0.0077061271294951439,-0.06053180992603302,0.0068333921954035759,-0.055645354092121124,0.0061358669772744179,-0.051642805337905884,0.005544295534491539,-0.048319138586521149,0.0050014499574899673,-0.045488756150007248,0.0045139910653233528,-0.043039977550506592,0.0040927696973085403,-0.040955647826194763,0.0037340838462114334,-0.039184771478176117,0.0034191349986940622,-0.037640523165464401,0.0030661181081086397,-0.036249179393053055,0.0028076146263629198,-0.035059034824371338,0.0025288993492722511,-0.03405042365193367,0.0022866141516715288,-0.033147640526294708,0.0020571693312376738,-0.032315805554389954,0.0018158011371269822,-0.031667672097682953,0.0016478649340569973,-0.0310530886054039,0.0014280847972258925,-0.030578164383769035,0.0012640516506507993,-0.030152836814522743,0.0010560512309893966,-0.029794521629810333,0.00085893168579787016,-0.0295118298381567,0.00070250802673399448,-0.02930961549282074,0.00053680455312132835,-0.029176684096455574,0.00034588968264870346,-0.029077693819999695,0.00016692864301148802,-0.029034022241830826], +"y": [0.030839033424854279,0.030900157988071442,-0.00020209288049954921,0.031038636341691017,-0.00047537029604427516,0.031356561928987503,-0.00069980142870917916,0.031720448285341263,-0.00096687825862318277,0.032306842505931854,-0.001218556659296155,0.03297949954867363,-0.0014728016685694456,0.033799774944782257,-0.0017323096981272101,0.034793972969055176,-0.0020210205111652613,0.035971205681562424,-0.0023171533830463886,0.037361223250627518,-0.0026441747322678566,0.039013862609863281,-0.0030138564761728048,0.040949482470750809,-0.0034058163873851299,0.043278880417346954,-0.0038293588440865278,0.045984350144863129,-0.004275705199688673,0.049226399511098862,-0.0047954828478395939,0.053125549107789993,-0.0054269256070256233,0.057886891067028046,-0.006187832448631525,0.063864156603813171,-0.0070704971440136433,0.071364983916282654,-0.0081554381176829338,0.081106856465339661,-0.0094713149592280388,0.094250679016113281,-0.011276840232312679,0.11269472539424896,-0.013700877316296101,0.14046232402324677,-0.017392802983522415,0.18699529767036438,-0.023378325626254082,0.28015166521072388,-0.035412818193435669,0.55818092823028564,-0.0709189772605896,59.508224487304688,-7.5848789215087891,-0.57174909114837646,0.072905957698822021,-0.28566664457321167,0.036314193159341812,-0.19104973971843719,0.024181321263313293,-0.14396752417087555,0.018063604831695557,-0.11588776111602783,0.014379133470356464,-0.097253128886222839,0.011902566999197006,-0.084011249244213104,0.010136635974049568,-0.074164167046546936,0.0087833832949399948,-0.066573724150657654,0.007725812029093504,-0.060557235032320023,0.0068348334170877934,-0.055626880377531052,0.0061401855200529099,-0.051631040871143341,0.0055518895387649536,-0.0482960045337677,0.005002977792173624,-0.045484796166419983,0.0045031392946839333,-0.043036479502916336,0.0040796715766191483,-0.040936168283224106,0.0037210385780781507,-0.039188381284475327,0.0034156972542405128,-0.037638276815414429,0.0030720417853444815,-0.036231242120265961,0.0028135501779615879,-0.035028070211410522,0.0025393918622285128,-0.034082677215337753,0.0023091656621545553,-0.033151034265756607,0.0020959652028977871,-0.032320640981197357,0.0018393107457086444,-0.031669147312641144,0.0016544634709134698,-0.031027892604470253,0.0014082385459914804,-0.030571868643164635,0.0013093580491840839,-0.030155891552567482,0.00099236180540174246,-0.029800813645124435,0.00083190418081358075,-0.029508264735341072,0.00068956613540649414,-0.029280709102749825,0.00053987069986760616,-0.029210545122623444,0.00041600182885304093,-0.029106197878718376,0.00017845185357145965,-0.02903420478105545], +"xh": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"w": [0.00090250372886657715,0.00091134011745452881,-0.00018470315262675285,0.00093166530132293701,-0.00041163060814142227,0.0010223388671875,-0.00061738491058349609,0.00110664963722229,-0.00083437375724315643,0.0012553110718727112,-0.0010389266535639763,0.0014113429933786392,-0.0012654699385166168,0.0016087610274553299,-0.0014992346987128258,0.0018693516030907631,-0.0017249905504286289,0.0021511353552341461,-0.0019833773840218782,0.0025234222412109375,-0.0022291485220193863,0.0029279487207531929,-0.0025343652814626694,0.0034527182579040527,-0.0028463602066040039,0.0041061630472540855,-0.0031773052178323269,0.0048709092661738396,-0.0035419706255197525,0.0057912319898605347,-0.0039316266775131226,0.006968979723751545,-0.0044272821396589279,0.0084731588140130043,-0.0049608149565756321,0.010407984256744385,-0.0055822134017944336,0.012940655462443829,-0.0063304770737886429,0.01639239490032196,-0.0072382930666208267,0.021298669278621674,-0.0084099145606160164,0.02852378785610199,-0.009924665093421936,0.039985254406929016,-0.0121066989377141,0.060223139822483063,-0.015556201338768005,0.10297311097383499,-0.022081129252910614,0.23710241913795471,-0.040527738630771637,29.705503463745117,-3.7982244491577148,-0.34385329484939575,0.029257636517286301,-0.21482507884502411,0.00912473164498806,-0.19105374813079834,0.029936525970697403,0.029948865994811058,0.0015517547726631165,0.029950283467769623,0.0030817985534667969,0.029971122741699219,0.004665374755859375,0.029976807534694672,0.0062369555234909058,0.030038421973586082,0.0078624263405799866,0.030084032565355301,0.0095546990633010864,0.030133366584777832,0.011315200477838516,0.030196908861398697,0.013119526207447052,0.030285097658634186,0.015054473653435707,0.030378330498933792,0.017061645165085793,0.030515432357788086,0.019247964024543762,0.030669689178466797,0.021590948104858398,0.030845131725072861,0.024143554270267487,0.031049560755491257,0.026968978345394135,0.031322896480560303,0.03009888157248497,0.031632084399461746,0.03362433984875679,0.032059904187917709,0.037641391158103943,0.032620906829833984,0.042364835739135742,0.033346369862556458,0.048013702034950256,0.034292925149202347,0.054923407733440399,0.035668022930622101,0.063690364360809326,0.037695910781621933,0.075351297855377197,0.040945142507553101,0.091950982809066772,0.046648319810628891,0.11816540360450745,0.058698907494544983,0.167673259973526,0.096502266824245453,0.3077852725982666,8.4018831253051758,28.843524932861328,-0.067222937941551208,-0.22214126586914062,-0.030864095315337181,-0.069307334721088409,-0.024175975471735001,0.99862951040267944,0.052335958927869797,0.99452191591262817,0.10452846437692642,0.98768836259841919,0.15643447637557983,0.97814762592315674,0.20791170001029968,0.96592581272125244,0.25881904363632202,0.95105654001235962,0.30901700258255005,0.93358039855957031,0.35836794972419739,0.91354542970657349,0.40673664212226868,0.89100652933120728,0.45399051904678345,0.86602538824081421,0.5,0.83867055177688599,0.54463905096054077,0.80901700258255005,0.58778524398803711,0.77714592218399048,0.62932038307189941,0.74314481019973755,0.66913062334060669,0.70710676908493042,0.70710676908493042,0.66913056373596191,0.74314486980438232,0.62932038307189941,0.77714598178863525,0.58778524398803711,0.80901700258255005,0.544638991355896,0.83867061138153076,0.49999997019767761,0.86602544784545898,0.45399051904678345,0.89100652933120728,0.40673661231994629,0.91354548931121826,0.35836786031723022,0.93358045816421509,0.30901697278022766,0.95105654001235962,0.25881907343864441,0.96592581272125244,0.2079116553068161,0.97814762592315674,0.15643437206745148,0.98768836259841919,0.10452841967344284,0.99452191591262817,0.052335973829030991,0.99862951040267944,0,0,0.99452191591262817,0.10452846437692642,0.97814762592315674,0.20791170001029968,0.95105654001235962,0.30901700258255005,0.91354542970657349,0.40673664212226868,0.86602538824081421,0.5,0.80901700258255005,0.58778524398803711,0.74314481019973755,0.66913062334060669,0,0.97814762592315674,0.20791170001029968,0.91354542970657349,0.40673664212226868,0.80901700258255005,0.58778524398803711,0.66913056373596191,0.74314486980438232,0.49999997019767761,0.86602544784545898,0.30901697278022766,0.95105654001235962,0.10452841967344284,0.99452191591262817,0,0.95105654001235962,0.30901700258255005,0.80901700258255005,0.58778524398803711,0.58778524398803711,0.80901700258255005,0.30901697278022766,0.95105654001235962,-4.3711388286737929e-08,1,-0.30901703238487244,0.95105648040771484,-0.58778518438339233,0.80901700258255005,0,0.91354542970657349,0.40673664212226868,0.66913056373596191,0.74314486980438232,0,0.66913056373596191,0.74314486980438232,-0.10452850908041,0.99452191591262817,0,0,0,0,0,0,1.6815581571897805e-43,5.6051938572992683e-45,2.8025969286496341e-45,5.6051938572992683e-45,4.2038953929744512e-45,7.0064923216240854e-45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json new file mode 100644 index 000000000000..14ee1ec4b1ee --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json @@ -0,0 +1,7 @@ +{ +"n": 120, +"x": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"y": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"xh": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"w": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.99862951040267944,0.052335958927869797,0.99452191591262817,0.10452846437692642,0.98768836259841919,0.15643447637557983,0.97814762592315674,0.20791170001029968,0.96592581272125244,0.25881904363632202,0.95105654001235962,0.30901700258255005,0.93358039855957031,0.35836794972419739,0.91354542970657349,0.40673664212226868,0.89100652933120728,0.45399051904678345,0.86602538824081421,0.5,0.83867055177688599,0.54463905096054077,0.80901700258255005,0.58778524398803711,0.77714592218399048,0.62932038307189941,0.74314481019973755,0.66913062334060669,0.70710676908493042,0.70710676908493042,0.66913056373596191,0.74314486980438232,0.62932038307189941,0.77714598178863525,0.58778524398803711,0.80901700258255005,0.544638991355896,0.83867061138153076,0.49999997019767761,0.86602544784545898,0.45399051904678345,0.89100652933120728,0.40673661231994629,0.91354548931121826,0.35836786031723022,0.93358045816421509,0.30901697278022766,0.95105654001235962,0.25881907343864441,0.96592581272125244,0.2079116553068161,0.97814762592315674,0.15643437206745148,0.98768836259841919,0.10452841967344284,0.99452191591262817,0.052335973829030991,0.99862951040267944,0,0,0.99452191591262817,0.10452846437692642,0.97814762592315674,0.20791170001029968,0.95105654001235962,0.30901700258255005,0.91354542970657349,0.40673664212226868,0.86602538824081421,0.5,0.80901700258255005,0.58778524398803711,0.74314481019973755,0.66913062334060669,0,0.97814762592315674,0.20791170001029968,0.91354542970657349,0.40673664212226868,0.80901700258255005,0.58778524398803711,0.66913056373596191,0.74314486980438232,0.49999997019767761,0.86602544784545898,0.30901697278022766,0.95105654001235962,0.10452841967344284,0.99452191591262817,0,0.95105654001235962,0.30901700258255005,0.80901700258255005,0.58778524398803711,0.58778524398803711,0.80901700258255005,0.30901697278022766,0.95105654001235962,-4.3711388286737929e-08,1,-0.30901703238487244,0.95105648040771484,-0.58778518438339233,0.80901700258255005,0,0.91354542970657349,0.40673664212226868,0.66913056373596191,0.74314486980438232,0,0.66913056373596191,0.74314486980438232,-0.10452850908041,0.99452191591262817,0,0,0,0,0,0,1.6815581571897805e-43,5.6051938572992683e-45,2.8025969286496341e-45,5.6051938572992683e-45,4.2038953929744512e-45,7.0064923216240854e-45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json new file mode 100644 index 000000000000..a976e6c300e3 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json @@ -0,0 +1,7 @@ +{ +"n": 120, +"x": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"y": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"xh": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], +"w": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 9eaa87144f4d..5156494d4406 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -38,6 +38,9 @@ var rfftb = require( './../lib/rfftb.js' ); // FIXTURES // var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; +var initialArraysN120 = require( './fixtures/fft_arrays_initial_n120.json' ); +var afterRfftiN120 = require( './fixtures/fft_arrays_after_rffti_n120.json' ); +var afterRfftfN120 = require( './fixtures/fft_arrays_after_rfftf_n120.json' ); // TESTS // @@ -81,7 +84,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl y = new Float64Array( 200 ); xh = new Float64Array( 200 ); w = new Float64Array( 2000 ); - for ( nz = 1; nz <= nd.length; nz++ ) { + for ( nz = 1; nz <= 1; nz++ ) { n = nd[ nz - 1 ]; modn = n % 2; np1 = n + 1; From de1040fd2a8827ed62562afeaa9c73fdbd09b277 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 3 May 2025 10:24:18 +0530 Subject: [PATCH 051/102] test: remove fixtures --- .../fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json | 7 ------- .../fftpack/test/fixtures/fft_arrays_after_rffti_n120.json | 7 ------- .../fftpack/test/fixtures/fft_arrays_initial_n120.json | 7 ------- .../@stdlib/fft/base/fftpack/test/test.rfft.js | 5 +---- 4 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json deleted file mode 100644 index d818c69044db..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rfftf_n120.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -"n": 120, -"x": [0.03083902969956398,0.030900374054908752,-0.00020247766224201769,0.031040014699101448,-0.00047737153363414109,0.03135429322719574,-0.00069796526804566383,0.031725130975246429,-0.00096623948775231838,0.032305143773555756,-0.0012189216213300824,0.032975524663925171,-0.0014748886460438371,0.033795684576034546,-0.0017344177467748523,0.034791789948940277,-0.0020218964200466871,0.035969942808151245,-0.0023188898339867592,0.037362650036811829,-0.0026424960233271122,0.039003536105155945,-0.003011561231687665,0.040955860167741776,-0.003406106261536479,0.043271362781524658,-0.0038257110863924026,0.045990999788045883,-0.0042763263918459415,0.049222987145185471,-0.0047971354797482491,0.053122729063034058,-0.0054354295134544373,0.057901963591575623,-0.0061875460669398308,0.063855946063995361,-0.0070716571062803268,0.071370065212249756,-0.008146963082253933,0.08110392838716507,-0.0094751361757516861,0.094240143895149231,-0.011275533586740494,0.1126929298043251,-0.013713463209569454,0.14050231873989105,-0.017380006611347198,0.18702024221420288,-0.023406274616718292,0.28012543916702271,-0.035382881760597229,0.55822575092315674,-0.070929050445556641,59.508262634277344,-7.5845475196838379,-0.57180434465408325,0.072892248630523682,-0.28565272688865662,0.036319263279438019,-0.19105374813079834,0.024175975471735001,-0.1439974308013916,0.01806979812681675,-0.11590223014354706,0.014376971870660782,-0.097253799438476562,0.011901378631591797,-0.084020942449569702,0.010126423090696335,-0.074179209768772125,0.0087793758139014244,-0.066573970019817352,0.0077061271294951439,-0.06053180992603302,0.0068333921954035759,-0.055645354092121124,0.0061358669772744179,-0.051642805337905884,0.005544295534491539,-0.048319138586521149,0.0050014499574899673,-0.045488756150007248,0.0045139910653233528,-0.043039977550506592,0.0040927696973085403,-0.040955647826194763,0.0037340838462114334,-0.039184771478176117,0.0034191349986940622,-0.037640523165464401,0.0030661181081086397,-0.036249179393053055,0.0028076146263629198,-0.035059034824371338,0.0025288993492722511,-0.03405042365193367,0.0022866141516715288,-0.033147640526294708,0.0020571693312376738,-0.032315805554389954,0.0018158011371269822,-0.031667672097682953,0.0016478649340569973,-0.0310530886054039,0.0014280847972258925,-0.030578164383769035,0.0012640516506507993,-0.030152836814522743,0.0010560512309893966,-0.029794521629810333,0.00085893168579787016,-0.0295118298381567,0.00070250802673399448,-0.02930961549282074,0.00053680455312132835,-0.029176684096455574,0.00034588968264870346,-0.029077693819999695,0.00016692864301148802,-0.029034022241830826], -"y": [0.030839033424854279,0.030900157988071442,-0.00020209288049954921,0.031038636341691017,-0.00047537029604427516,0.031356561928987503,-0.00069980142870917916,0.031720448285341263,-0.00096687825862318277,0.032306842505931854,-0.001218556659296155,0.03297949954867363,-0.0014728016685694456,0.033799774944782257,-0.0017323096981272101,0.034793972969055176,-0.0020210205111652613,0.035971205681562424,-0.0023171533830463886,0.037361223250627518,-0.0026441747322678566,0.039013862609863281,-0.0030138564761728048,0.040949482470750809,-0.0034058163873851299,0.043278880417346954,-0.0038293588440865278,0.045984350144863129,-0.004275705199688673,0.049226399511098862,-0.0047954828478395939,0.053125549107789993,-0.0054269256070256233,0.057886891067028046,-0.006187832448631525,0.063864156603813171,-0.0070704971440136433,0.071364983916282654,-0.0081554381176829338,0.081106856465339661,-0.0094713149592280388,0.094250679016113281,-0.011276840232312679,0.11269472539424896,-0.013700877316296101,0.14046232402324677,-0.017392802983522415,0.18699529767036438,-0.023378325626254082,0.28015166521072388,-0.035412818193435669,0.55818092823028564,-0.0709189772605896,59.508224487304688,-7.5848789215087891,-0.57174909114837646,0.072905957698822021,-0.28566664457321167,0.036314193159341812,-0.19104973971843719,0.024181321263313293,-0.14396752417087555,0.018063604831695557,-0.11588776111602783,0.014379133470356464,-0.097253128886222839,0.011902566999197006,-0.084011249244213104,0.010136635974049568,-0.074164167046546936,0.0087833832949399948,-0.066573724150657654,0.007725812029093504,-0.060557235032320023,0.0068348334170877934,-0.055626880377531052,0.0061401855200529099,-0.051631040871143341,0.0055518895387649536,-0.0482960045337677,0.005002977792173624,-0.045484796166419983,0.0045031392946839333,-0.043036479502916336,0.0040796715766191483,-0.040936168283224106,0.0037210385780781507,-0.039188381284475327,0.0034156972542405128,-0.037638276815414429,0.0030720417853444815,-0.036231242120265961,0.0028135501779615879,-0.035028070211410522,0.0025393918622285128,-0.034082677215337753,0.0023091656621545553,-0.033151034265756607,0.0020959652028977871,-0.032320640981197357,0.0018393107457086444,-0.031669147312641144,0.0016544634709134698,-0.031027892604470253,0.0014082385459914804,-0.030571868643164635,0.0013093580491840839,-0.030155891552567482,0.00099236180540174246,-0.029800813645124435,0.00083190418081358075,-0.029508264735341072,0.00068956613540649414,-0.029280709102749825,0.00053987069986760616,-0.029210545122623444,0.00041600182885304093,-0.029106197878718376,0.00017845185357145965,-0.02903420478105545], -"xh": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"w": [0.00090250372886657715,0.00091134011745452881,-0.00018470315262675285,0.00093166530132293701,-0.00041163060814142227,0.0010223388671875,-0.00061738491058349609,0.00110664963722229,-0.00083437375724315643,0.0012553110718727112,-0.0010389266535639763,0.0014113429933786392,-0.0012654699385166168,0.0016087610274553299,-0.0014992346987128258,0.0018693516030907631,-0.0017249905504286289,0.0021511353552341461,-0.0019833773840218782,0.0025234222412109375,-0.0022291485220193863,0.0029279487207531929,-0.0025343652814626694,0.0034527182579040527,-0.0028463602066040039,0.0041061630472540855,-0.0031773052178323269,0.0048709092661738396,-0.0035419706255197525,0.0057912319898605347,-0.0039316266775131226,0.006968979723751545,-0.0044272821396589279,0.0084731588140130043,-0.0049608149565756321,0.010407984256744385,-0.0055822134017944336,0.012940655462443829,-0.0063304770737886429,0.01639239490032196,-0.0072382930666208267,0.021298669278621674,-0.0084099145606160164,0.02852378785610199,-0.009924665093421936,0.039985254406929016,-0.0121066989377141,0.060223139822483063,-0.015556201338768005,0.10297311097383499,-0.022081129252910614,0.23710241913795471,-0.040527738630771637,29.705503463745117,-3.7982244491577148,-0.34385329484939575,0.029257636517286301,-0.21482507884502411,0.00912473164498806,-0.19105374813079834,0.029936525970697403,0.029948865994811058,0.0015517547726631165,0.029950283467769623,0.0030817985534667969,0.029971122741699219,0.004665374755859375,0.029976807534694672,0.0062369555234909058,0.030038421973586082,0.0078624263405799866,0.030084032565355301,0.0095546990633010864,0.030133366584777832,0.011315200477838516,0.030196908861398697,0.013119526207447052,0.030285097658634186,0.015054473653435707,0.030378330498933792,0.017061645165085793,0.030515432357788086,0.019247964024543762,0.030669689178466797,0.021590948104858398,0.030845131725072861,0.024143554270267487,0.031049560755491257,0.026968978345394135,0.031322896480560303,0.03009888157248497,0.031632084399461746,0.03362433984875679,0.032059904187917709,0.037641391158103943,0.032620906829833984,0.042364835739135742,0.033346369862556458,0.048013702034950256,0.034292925149202347,0.054923407733440399,0.035668022930622101,0.063690364360809326,0.037695910781621933,0.075351297855377197,0.040945142507553101,0.091950982809066772,0.046648319810628891,0.11816540360450745,0.058698907494544983,0.167673259973526,0.096502266824245453,0.3077852725982666,8.4018831253051758,28.843524932861328,-0.067222937941551208,-0.22214126586914062,-0.030864095315337181,-0.069307334721088409,-0.024175975471735001,0.99862951040267944,0.052335958927869797,0.99452191591262817,0.10452846437692642,0.98768836259841919,0.15643447637557983,0.97814762592315674,0.20791170001029968,0.96592581272125244,0.25881904363632202,0.95105654001235962,0.30901700258255005,0.93358039855957031,0.35836794972419739,0.91354542970657349,0.40673664212226868,0.89100652933120728,0.45399051904678345,0.86602538824081421,0.5,0.83867055177688599,0.54463905096054077,0.80901700258255005,0.58778524398803711,0.77714592218399048,0.62932038307189941,0.74314481019973755,0.66913062334060669,0.70710676908493042,0.70710676908493042,0.66913056373596191,0.74314486980438232,0.62932038307189941,0.77714598178863525,0.58778524398803711,0.80901700258255005,0.544638991355896,0.83867061138153076,0.49999997019767761,0.86602544784545898,0.45399051904678345,0.89100652933120728,0.40673661231994629,0.91354548931121826,0.35836786031723022,0.93358045816421509,0.30901697278022766,0.95105654001235962,0.25881907343864441,0.96592581272125244,0.2079116553068161,0.97814762592315674,0.15643437206745148,0.98768836259841919,0.10452841967344284,0.99452191591262817,0.052335973829030991,0.99862951040267944,0,0,0.99452191591262817,0.10452846437692642,0.97814762592315674,0.20791170001029968,0.95105654001235962,0.30901700258255005,0.91354542970657349,0.40673664212226868,0.86602538824081421,0.5,0.80901700258255005,0.58778524398803711,0.74314481019973755,0.66913062334060669,0,0.97814762592315674,0.20791170001029968,0.91354542970657349,0.40673664212226868,0.80901700258255005,0.58778524398803711,0.66913056373596191,0.74314486980438232,0.49999997019767761,0.86602544784545898,0.30901697278022766,0.95105654001235962,0.10452841967344284,0.99452191591262817,0,0.95105654001235962,0.30901700258255005,0.80901700258255005,0.58778524398803711,0.58778524398803711,0.80901700258255005,0.30901697278022766,0.95105654001235962,-4.3711388286737929e-08,1,-0.30901703238487244,0.95105648040771484,-0.58778518438339233,0.80901700258255005,0,0.91354542970657349,0.40673664212226868,0.66913056373596191,0.74314486980438232,0,0.66913056373596191,0.74314486980438232,-0.10452850908041,0.99452191591262817,0,0,0,0,0,0,1.6815581571897805e-43,5.6051938572992683e-45,2.8025969286496341e-45,5.6051938572992683e-45,4.2038953929744512e-45,7.0064923216240854e-45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] -} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json deleted file mode 100644 index 14ee1ec4b1ee..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_after_rffti_n120.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -"n": 120, -"x": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"y": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"xh": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"w": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.99862951040267944,0.052335958927869797,0.99452191591262817,0.10452846437692642,0.98768836259841919,0.15643447637557983,0.97814762592315674,0.20791170001029968,0.96592581272125244,0.25881904363632202,0.95105654001235962,0.30901700258255005,0.93358039855957031,0.35836794972419739,0.91354542970657349,0.40673664212226868,0.89100652933120728,0.45399051904678345,0.86602538824081421,0.5,0.83867055177688599,0.54463905096054077,0.80901700258255005,0.58778524398803711,0.77714592218399048,0.62932038307189941,0.74314481019973755,0.66913062334060669,0.70710676908493042,0.70710676908493042,0.66913056373596191,0.74314486980438232,0.62932038307189941,0.77714598178863525,0.58778524398803711,0.80901700258255005,0.544638991355896,0.83867061138153076,0.49999997019767761,0.86602544784545898,0.45399051904678345,0.89100652933120728,0.40673661231994629,0.91354548931121826,0.35836786031723022,0.93358045816421509,0.30901697278022766,0.95105654001235962,0.25881907343864441,0.96592581272125244,0.2079116553068161,0.97814762592315674,0.15643437206745148,0.98768836259841919,0.10452841967344284,0.99452191591262817,0.052335973829030991,0.99862951040267944,0,0,0.99452191591262817,0.10452846437692642,0.97814762592315674,0.20791170001029968,0.95105654001235962,0.30901700258255005,0.91354542970657349,0.40673664212226868,0.86602538824081421,0.5,0.80901700258255005,0.58778524398803711,0.74314481019973755,0.66913062334060669,0,0.97814762592315674,0.20791170001029968,0.91354542970657349,0.40673664212226868,0.80901700258255005,0.58778524398803711,0.66913056373596191,0.74314486980438232,0.49999997019767761,0.86602544784545898,0.30901697278022766,0.95105654001235962,0.10452841967344284,0.99452191591262817,0,0.95105654001235962,0.30901700258255005,0.80901700258255005,0.58778524398803711,0.58778524398803711,0.80901700258255005,0.30901697278022766,0.95105654001235962,-4.3711388286737929e-08,1,-0.30901703238487244,0.95105648040771484,-0.58778518438339233,0.80901700258255005,0,0.91354542970657349,0.40673664212226868,0.66913056373596191,0.74314486980438232,0,0.66913056373596191,0.74314486980438232,-0.10452850908041,0.99452191591262817,0,0,0,0,0,0,1.6815581571897805e-43,5.6051938572992683e-45,2.8025969286496341e-45,5.6051938572992683e-45,4.2038953929744512e-45,7.0064923216240854e-45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] -} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json b/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json deleted file mode 100644 index a976e6c300e3..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/fixtures/fft_arrays_initial_n120.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -"n": 120, -"x": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"y": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"xh": [0.98776596784591675,0.3080717921257019,-0.89168214797973633,-0.58617627620697021,0.70886129140853882,0.80726128816604614,-0.45708689093589783,-0.94982075691223145,0.16084907948970795,0.99998766183853149,0.15103428065776825,-0.95288187265396118,-0.44822683930397034,0.81308633089065552,0.7018170952796936,-0.59419786930084229,-0.88714039325714111,0.31750932335853577,0.98616749048233032,-0.0099371941760182381,-0.98926675319671631,-0.29860338568687439,0.89613676071166992,0.57809752225875854,-0.71583545207977295,-0.80135774612426758,0.46590185165405273,0.94666522741317749,-0.170647993683815,-0.99988889694213867,-0.14120550453662872,0.95584917068481445,0.43931993842124939,-0.81882995367050171,-0.69470363855361938,0.60215967893600464,0.88251060247421265,-0.32691845297813416,-0.98447197675704956,0.019873406738042831,0.99066966772079468,0.28910478949546814,-0.90050244331359863,-0.56996059417724609,0.72273898124694824,0.79537153244018555,-0.47466829419136047,-0.94341778755187988,0.18043100833892822,0.9996914267539978,0.13135713338851929,-0.95872104167938232,-0.43037480115890503,0.82449382543563843,0.68752151727676392,-0.61006659269332886,-0.87779545783996582,0.33628988265991211,0.98267900943756104,-0.029807658866047859,-0.99197554588317871,-0.27958133816719055,0.90477752685546875,0.5617673397064209,-0.72957110404968262,-0.78930914402008057,0.48339122533798218,0.94007599353790283,-0.1901962012052536,-0.99939519166946411,-0.12149955332279205,0.96149927377700806,0.42138373851776123,-0.83007627725601196,-0.68027156591415405,0.61791020631790161,0.87299180030822754,-0.34563171863555908,-0.9807889461517334,0.039738964289426804,0.99318289756774902,0.27002662420272827,-0.90896493196487427,-0.55351859331130981,0.73633116483688354,0.78316879272460938,-0.49206641316413879,-0.93664133548736572,0.19994261860847473,0.99900031089782715,0.11162997782230377,-0.96418464183807373,-0.41234409809112549,0.83557260036468506,0.67296004295349121,-0.6256868839263916,-0.86810201406478882,0.35493943095207214,0.97880208492279053,-0.049666348844766617,-0.99429219961166382,-0.26043787598609924,0.91306573152542114,0.54522156715393066,-0.74301338195800781,-0.77695584297180176,0.50069302320480347,0.93311417102813721,-0.20966927707195282,-0.99850678443908691,-0.10174938291311264,0.96677273511886597,0.40327069163322449,-0.84099066257476807,-0.6655765175819397,0.63340771198272705,0.86312645673751831,-0.36421206593513489,-0.97671854496002197,0.059588827192783356], -"w": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] -} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 5156494d4406..b40208656c3e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -35,12 +35,9 @@ var rfftf = require( './../lib/rfftf.js' ); var rfftb = require( './../lib/rfftb.js' ); -// FIXTURES // +// VARIABLES // var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; -var initialArraysN120 = require( './fixtures/fft_arrays_initial_n120.json' ); -var afterRfftiN120 = require( './fixtures/fft_arrays_after_rffti_n120.json' ); -var afterRfftfN120 = require( './fixtures/fft_arrays_after_rfftf_n120.json' ); // TESTS // From 33e04a4ed1c5f4a22f81d9735a28cbe3498eeab2 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 24 May 2025 17:35:19 +0530 Subject: [PATCH 052/102] test: modify test implementation --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 2 +- .../@stdlib/fft/base/fftpack/lib/cfftf.js | 2 +- .../@stdlib/fft/base/fftpack/lib/cffti1.js | 1 - .../@stdlib/fft/base/fftpack/lib/cosqb1.js | 3 +- .../fft/base/fftpack/test/test.rfft.js | 32 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index bc4519c44c4e..bad44fa753a3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -87,7 +87,7 @@ function cfftb( n, c, cptr, wsave, wptr ) { } iw1 = ( 2 * n ) + 1; iw2 = iw1 + ( 2 * n ); - cfftb1( n, c, cptr, wsave, wptr, wsave, wptr + iw1, wsave, wptr + iw2 ); + cfftb1( n, c, cptr + 1, wsave, wptr + 1, wsave, wptr + iw1, wsave, wptr + iw2 ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js index 3151a94f19ba..728f1823acc3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js @@ -88,7 +88,7 @@ function cfftf( n, c, cptr, wsave, wptr ) { } iw1 = ( 2 * n ) + 1; iw2 = iw1 + ( 2 * n ); - cfftf1( n, c, 1 + cptr, wsave, 1 + wptr, wsave, iw1 + wptr, wsave, iw2 + wptr ); + cfftf1( n, c, 1 + cptr, wsave, 1 + wptr, wsave, iw1 + wptr, wsave, iw2 + wptr ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js index f99b004d20be..e48d93050505 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js @@ -137,7 +137,6 @@ function cffti1( n, wa, wptr, ifac, ifptr ) { wa[ wptr + i1 ] = wa[ wptr + i ]; } } - l1 = l2; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js index 4c65b6b8c625..6bdc7c3cd888 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js @@ -62,6 +62,7 @@ // MODULES // +var floor = require( '@stdlib/math/base/special/floor' ); var rfftb = require( './rfftb.js' ); @@ -94,7 +95,7 @@ function cosqb1( n, x, xptr, w, wptr, xh, xhptr ) { wptr -= 1; // Function Body: - ns2 = ( n + 1 ) / 2; + ns2 = floor( ( n + 1 ) / 2 ); np2 = n + 2; for ( i = 3; i <= n; i += 2 ) { xim1 = x[ xptr + i - 1 ] + x[ xptr + i ]; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index b40208656c3e..74ed8f5a89e7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -81,7 +81,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl y = new Float64Array( 200 ); xh = new Float64Array( 200 ); w = new Float64Array( 2000 ); - for ( nz = 1; nz <= 1; nz++ ) { + for ( nz = 1; nz <= nd.length; nz++ ) { n = nd[ nz - 1 ]; modn = n % 2; np1 = n + 1; @@ -97,7 +97,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl rffti( n, w, 0 ); dt = TWO_PI / n; ns2 = floor( ( n + 1 ) / 2 ); - if ( ns2 >= 1 ) { + if ( ns2 > 1 ) { for ( k = 2; k <= ns2; k++ ) { sum1 = 0.0; sum2 = 0.0; @@ -136,41 +136,41 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl } rftf /= n; - for ( i = 0; i < n; i++ ) { + for ( i = 1; i <= n; i++ ) { sum = x[ 0 ] * 0.5; - arg = i * dt; - if ( ns2 >= 1 ) { - for ( k = 1; k < ns2; k++ ) { - arg1 = k * arg; - sum += ( x[ ( ( k + 1 ) << 1 ) - 3 ] * cos( arg1 ) ) - ( x[ ( ( k + 1 ) << 1 ) - 2 ] * sin( arg1 ) ); // eslint-disable-line max-len + arg = ( i - 1 ) * dt; + if ( ns2 > 1 ) { + for ( k = 2; k <= ns2; k++ ) { + arg1 = ( k - 1 ) * arg; + sum += ( x[ ( k << 1 ) - 3 ] * cos( arg1 ) ) - ( x[ ( k << 1 ) - 2 ] * sin( arg1 ) ); // eslint-disable-line max-len } } if ( modn === 0 ) { - sum += pow( -1, i - 1 ) * 0.5 * x[ n ]; + sum += pow( -1, i - 1 ) * 0.5 * x[ n - 1 ]; } - y[ i ] = 2 * sum; + y[ i - 1 ] = 2 * sum; } rfftb( n, x, 0, w, 0 ); rftb = 0.0; - for ( i = 0; i < n; i++ ) { + for ( i = 1; i <= n; i++ ) { // Computing MAX: r2 = rftb; - r1 = x[ i ] - y[ i ]; + r1 = x[ i - 1 ] - y[ i - 1 ]; r3 = abs( r1 ); rftb = max( r2, r3 ); - x[ i ] = xh[ i ]; - y[ i ] = xh[ i ]; + x[ i - 1 ] = xh[ i - 1 ]; + y[ i - 1 ] = xh[ i - 1 ]; } rfftb( n, y, 0, w, 0 ); rfftf( n, y, 0, w, 0 ); cf = 1.0 / n; rftfb = 0.0; - for ( i = 0; i < n; i++ ) { + for ( i = 1; i <= n; i++ ) { // Computing MAX: r2 = rftfb; - r1 = cf * ( y[ i ] - x[ i ] ); + r1 = cf * ( y[ i - 1 ] - x[ i - 1 ] ); r3 = abs( r1 ); rftfb = max( r2, r3 ); } From 606323d6aaae3ac5ddaced7ab4f39d688da979e6 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 29 May 2025 12:16:12 +0530 Subject: [PATCH 053/102] fix: correct positioning of parenthesis --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index 9d451af01d9a..3e313d322fa8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -120,7 +120,7 @@ function radf3( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Off 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; + ch[ chRef( ido, 2, k, 3, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + ( taur * cr2 ); } if ( ido === 1 ) { return; From bc4f61b60c2f4d3367e5f6e9399e1dc6d50dcd19 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 29 May 2025 14:38:14 +0530 Subject: [PATCH 054/102] fix: decrement wa offsets --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js index 0a33e7a375de..12f1f04951d7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js @@ -133,6 +133,10 @@ function radf5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Off // Parameter adjustments... chOffset = 1 + ( ido * 6 ); ccOffset = 1 + ( ido * ( 1 + l1 ) ); + wa1Offset -= 1; + wa2Offset -= 2; + wa3Offset -= 3; + wa4Offset -= 4; // Function body: for ( k = 1; k <= l1; k++ ) { From 0e00d49eca8856e9f0f1ef3a2cec5aebbb03305c Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 29 May 2025 15:28:52 +0530 Subject: [PATCH 055/102] fix: correct use of i instead of ic --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js index abfe507c9761..52918a172596 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js @@ -279,7 +279,7 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, ic = idp2 - i; cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( i, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( ic, k, jc, l1, ido ) + chOffset ]; + cc[ ccRef( i, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; cc[ ccRef( ic, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i, k, j, l1, ido ) + chOffset ]; } } From 9681c2b006cd22eaa0cbd1925bdd103b726acdbd Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 1 Jun 2025 23:37:22 +0530 Subject: [PATCH 056/102] fix: decrement waOffsets by 1, disable eslint rule, mention correct value --- lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js index 3b8cc1051612..8ccb832f674a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js @@ -95,7 +95,7 @@ var ccRef = require( './cc_ref.js' ); * @param {number} fsign - sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse) * @returns {void} */ -function passfb( nac, ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset, fsign ) { // eslint-disable-line max-params +function passfb( nac, ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset, fsign ) { // eslint-disable-line max-params, max-statements var ipp2; var idij; var idlj; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js index 3e313d322fa8..d7e4771eebf5 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js @@ -72,7 +72,7 @@ var ccRef = require( './cc_ref.js' ); var sc = sincos( ( 2 * TWO_PI ) / 3 ); var taur = sc[ 1 ]; // -0.5 -var taui = -sc[ 0 ]; // -0.866025403784439 +var taui = -sc[ 0 ]; // 0.866025403784439 // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js index 12f1f04951d7..159bd7158742 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js @@ -134,9 +134,9 @@ function radf5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Off chOffset = 1 + ( ido * 6 ); ccOffset = 1 + ( ido * ( 1 + l1 ) ); wa1Offset -= 1; - wa2Offset -= 2; - wa3Offset -= 3; - wa4Offset -= 4; + wa2Offset -= 1; + wa3Offset -= 1; + wa4Offset -= 1; // Function body: for ( k = 1; k <= l1; k++ ) { From de91a9fa6c00a6768f7ae12fc073d0371ef05626 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Jun 2025 18:20:05 -0700 Subject: [PATCH 057/102] docs: update docs and formatting --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/c1_ref.js | 16 ++++++++-------- .../@stdlib/fft/base/fftpack/lib/c2_ref.js | 12 ++++++------ .../@stdlib/fft/base/fftpack/lib/cc_ref.js | 16 ++++++++-------- .../@stdlib/fft/base/fftpack/lib/ch2_ref.js | 12 ++++++------ .../@stdlib/fft/base/fftpack/lib/ch_ref.js | 16 ++++++++-------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js index 8845520b0186..942378815633 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js @@ -61,18 +61,18 @@ // MAIN // /** -* Performs a pass of the FFT algorithm. +* Computes an index into the intermediate array `c1`. * * @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 +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index */ function c1Ref( a1, a2, a3, l1, ido ) { - return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1; + return ( ( (a3*l1)+a2 ) * ido ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js index 71b5fa3c8725..3b4910a3f245 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js @@ -61,16 +61,16 @@ // MAIN // /** -* Performs a pass of the FFT algorithm. +* Computes an index into the intermediate array `c2`. * * @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 +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index */ function c2Ref( a1, a2, idl1 ) { - return ( a2 * idl1 ) + a1; + return ( a2*idl1 ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js index cd81ca004f65..9f1965c5a2d9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js @@ -61,18 +61,18 @@ // MAIN // /** -* Performs a pass of the FFT algorithm. +* Computes an index into an input array `cc` containing complex-valued data. * * @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 +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} ip - number of sub-steps or prime factors in the FFT +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index */ function ccRef( a1, a2, a3, ip, ido ) { - return ( ( ( a3 * ip ) + a2 ) * ido ) + a1; + return ( ( (a3*ip)+a2 ) * ido ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js index 6eab3bd353bc..b53f3d8579d4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js @@ -61,16 +61,16 @@ // MAIN // /** -* Performs a pass of the FFT algorithm. +* Computes an index into an output array `ch2` for storing processed FFT data. * * @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 +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index */ function ch2Ref( a1, a2, idl1 ) { - return ( a2 * idl1 ) + a1; + return ( a2*idl1 ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js index 586f122b26ab..6179938bcf34 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js @@ -61,18 +61,18 @@ // MAIN // /** -* Performs a pass of the FFT algorithm. +* Computes an index into an output array `ch` for storing processed FFT data. * * @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 +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} - calculated index */ function chRef( a1, a2, a3, l1, ido ) { - return ( ( ( a3 * l1 ) + a2 ) * ido ) + a1; + return ( ( (a3*l1)+a2 ) * ido ) + a1; } From c7aea441b0ed7f79a1b401f2eaa7808a28eeca1f Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Jun 2025 19:13:40 -0700 Subject: [PATCH 058/102] chore: add docs and clean-up --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/cc_ref.js | 4 ++ .../@stdlib/fft/base/fftpack/lib/cfftb.js | 68 ++++++++++++++----- .../@stdlib/fft/base/fftpack/lib/cfftb1.js | 23 +++---- 3 files changed, 67 insertions(+), 28 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js index 9f1965c5a2d9..c9491438a35c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js @@ -70,6 +70,10 @@ * @param {NonNegativeInteger} ip - number of sub-steps or prime factors in the FFT * @param {NonNegativeInteger} ido - dimension order * @returns {NonNegativeInteger} computed index +* +* @example +* var out = ccRef( 3, 2, 1, 2, 2 ); +* // returns 11 */ function ccRef( a1, a2, a3, ip, ido ) { return ( ( (a3*ip)+a2 ) * ido ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index bad44fa753a3..c66fde894b36 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -66,28 +66,64 @@ var cfftb1 = require( './cfftb1.js' ); // MAIN // /** -* Performs the complex backward Fast Fourier Transform. +* Performs the backward complex Fourier transform (i.e., the Fourier synthesis). * -* @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 +* ## Notes +* +* - This function computes a complex periodic sequence from its Fourier coefficients. +* +* - Invoking `cfftf` prior to invoking this function will multiply an input sequence by `N`. +* +* - Prior to invoking this function, `wsave` must be initialized by calling `cffti(N, wsave)`. +* +* - This function is more efficient when `N` is the product of small prime numbers. +* +* - A provided workspace array must have at least `4N+15` elements. +* +* - Different workspace arrays must be used for each different value of `N`. +* +* - The workspace array does **not** require re-initialization between subsequent transforms as long as `N` remains the same. Hence, subsequent transforms can be performed faster than the first by avoiding repeated initialization. +* +* - The same workspace array can be used by both `cfftf` and `cfftb`. +* +* - The initialization calculations stored in a workspace must **not** be destroyed between calls of `cfftf` and `cfftb`. +* +* - This function mutates the input array `c`. For `j = 0, ..., N-1`, +* +* ```tex +* c_j = \sum_{k=0}^{N-1} c_k \cdot e^{\frac{2\pi}{N} \cdot ijk} +* ``` +* +* where `i = sqrt(-1)`. +* +* @param {NonNegativeInteger} N - length of the sequence to transform +* @param {Float64Array} c - input array containing the sequence to be transformed +* @param {NonNegativeInteger} offsetC - starting index for `c` +* @param {Float64Array} wsave - workspace array containing pre-computed values +* @param {NonNegativeInteger} offsetW - starting index for `wsave` * @returns {void} +* +* @example +* // TODO */ -function cfftb( n, c, cptr, wsave, wptr ) { - var iw1; - var iw2; +function cfftb( N, c, offsetC, wsave, offsetW ) { + var offsetT; + var offsetF; - wptr -= 1; - cptr -= 1; - - if ( n === 1 ) { + if ( N <= 1 ) { return; } - iw1 = ( 2 * n ) + 1; - iw2 = iw1 + ( 2 * n ); - cfftb1( n, c, cptr + 1, wsave, wptr + 1, wsave, wptr + iw1, wsave, wptr + iw2 ); // eslint-disable-line max-len + /* + * The workspace array is divided into three sections: + * + * [ intermediate_results | twiddle_factors | factorization_info ] + * + * The first two sections each contain `2*N` elements. + */ + offsetT = N * 2; // index offset for twiddle factors + offsetF = offsetT * 2; // index offset for factorization info + + cfftb1( N, c, offsetC, wsave, offsetW, wsave, offsetW+offsetT, wsave, offsetW+offsetF ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js index 2b9103325061..c2e1a777e053 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js @@ -72,7 +72,7 @@ var passfb = require( './passfb.js' ); // MAIN // /** -* Performs the complex backward Fast Fourier Transform. +* Performs the backward complex Fourier transform (i.e., the Fourier synthesis). * * @private * @param {number} n - length of the sequence to transform @@ -103,13 +103,12 @@ function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var iw; var i; - // Function Body: - nf = ifac[ ifacOffset + 1 ]; + nf = ifac[ ifacOffset+1 ]; na = 0; l1 = 1; iw = 0; for ( k1 = 1; k1 <= nf; k1++ ) { - ip = ifac[ ifacOffset + k1 + 1 ]; + ip = ifac[ ifacOffset+k1+1 ]; l2 = ip * l1; ido = n / l2; idot = ido + ido; @@ -118,30 +117,30 @@ function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { case 4: ix2 = iw + idot; ix3 = ix2 + idot; - passb4( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); + passb4( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset ); na = 1 - na; break; case 2: - passb2( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); + passb2( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw+waOffset ); na = 1 - na; break; case 3: ix2 = iw + idot; - passb3( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); + passb3( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset ); na = 1 - na; break; case 5: ix2 = iw + idot; ix3 = ix2 + idot; ix4 = ix3 + idot; - passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset, 1 ); + passfb5( idot, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset, wa, ix4+waOffset, 1 ); na = 1 - na; break; default: if ( na === 0 ) { - passfb( nac, idot, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset, 1 ); + passfb( nac, idot, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw+waOffset, 1 ); } else { - passfb( nac, idot, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset, 1 ); + passfb( nac, idot, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw+waOffset, 1 ); } if ( nac !== 0 ) { na = 1 - na; @@ -154,8 +153,8 @@ function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { if ( na === 0 ) { return; } - for ( i = 0; i < ( 2 * n ); i++ ) { - c[ i + cOffset ] = ch[ i + chOffset ]; + for ( i = 0; i < n*2; i++ ) { + c[ i+cOffset ] = ch[ i+chOffset ]; } } From 22079b1ee080fc9e3a271668d29b2ad3185b28ac Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 9 Jun 2025 19:33:12 -0700 Subject: [PATCH 059/102] refactor: update variables and docs --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 4 +-- .../@stdlib/fft/base/fftpack/lib/cfftb1.js | 28 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index c66fde894b36..65e49e210801 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -97,9 +97,9 @@ var cfftb1 = require( './cfftb1.js' ); * where `i = sqrt(-1)`. * * @param {NonNegativeInteger} N - length of the sequence to transform -* @param {Float64Array} c - input array containing the sequence to be transformed +* @param {Float64Array} c - real-valued input array containing interleaved real and imaginary components corresponding to the sequence to be transformed * @param {NonNegativeInteger} offsetC - starting index for `c` -* @param {Float64Array} wsave - workspace array containing pre-computed values +* @param {Float64Array} wsave - real-valued workspace array containing pre-computed values * @param {NonNegativeInteger} offsetW - starting index for `wsave` * @returns {void} * diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js index c2e1a777e053..3d62ef438efc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js @@ -62,6 +62,7 @@ // MODULES // +var floor = require( '@stdlib/math/base/special/floor' ); var passb4 = require( './passb4.js' ); var passb2 = require( './passb2.js' ); var passb3 = require( './passb3.js' ); @@ -75,18 +76,18 @@ var passfb = require( './passfb.js' ); * Performs the backward complex Fourier transform (i.e., the Fourier synthesis). * * @private -* @param {number} n - length of the sequence to transform -* @param {Float64Array} c - input array containing sequence to be transformed -* @param {NonNegativeInteger} cOffset - starting index for input array -* @param {Float64Array} ch - working array for intermediate results -* @param {NonNegativeInteger} chOffset - starting index for working array -* @param {Float64Array} wa - array of twiddle factors -* @param {NonNegativeInteger} waOffset - starting index for twiddle factors array -* @param {Int32Array} ifac - array containing factorization information -* @param {NonNegativeInteger} ifacOffset - starting index for factorization array +* @param {number} N - length of the sequence to transform +* @param {Float64Array} c - real-valued input array containing interleaved real and imaginary components corresponding to the sequence to be transformed +* @param {NonNegativeInteger} cOffset - starting index for `c` +* @param {Float64Array} ch - workspace array for storing intermediate results +* @param {NonNegativeInteger} chOffset - starting index for `ch` +* @param {Float64Array} wa - workspace array for storing twiddle factors +* @param {NonNegativeInteger} waOffset - starting index for `wa` +* @param {Int32Array} ifac - workspace array for storing factorization information +* @param {NonNegativeInteger} ifacOffset - starting index for `ifac` * @returns {void} */ -function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { +function cfftb1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var idl1; var idot; var ix2; @@ -110,7 +111,7 @@ function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { for ( k1 = 1; k1 <= nf; k1++ ) { ip = ifac[ ifacOffset+k1+1 ]; l2 = ip * l1; - ido = n / l2; + ido = floor( N / l2 ); idot = ido + ido; idl1 = idot * l1; switch ( ip ) { @@ -148,12 +149,13 @@ function cfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { break; } l1 = l2; - iw += ( ip - 1 ) * idot; + iw += ( ip-1 ) * idot; } if ( na === 0 ) { return; } - for ( i = 0; i < n*2; i++ ) { + // Now that we've finished computing the transforms, copy over the final results to the input array... + for ( i = 0; i < N*2; i++ ) { c[ i+cOffset ] = ch[ i+chOffset ]; } } From 5082d3c7a3fda6cebad913b895ba33a00c1280dd Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 10 Jun 2025 02:49:22 -0700 Subject: [PATCH 060/102] refactor: add comments and update utility to support strides --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 30 ++++- .../@stdlib/fft/base/fftpack/lib/cffti.js | 4 +- .../@stdlib/fft/base/fftpack/lib/cffti1.js | 2 +- .../@stdlib/fft/base/fftpack/lib/decompose.js | 104 ++++++++++++++---- .../@stdlib/fft/base/fftpack/lib/rffti1.js | 2 +- 5 files changed, 112 insertions(+), 30 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index 65e49e210801..13c24fe74645 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -111,17 +111,43 @@ function cfftb( N, c, offsetC, wsave, offsetW ) { var offsetF; if ( N <= 1 ) { + // FFT of one data point is the identity... return; } + + // TODO: roll the above comment into the extended description above; or perhaps, better yet, create a README file in the `/lib` folder providing a high level overview to the implementation, as the content below also applies to the `rfft*` variants, as well, albeit with slightly different storage requirements. + /* * The workspace array is divided into three sections: * - * [ intermediate_results | twiddle_factors | factorization_info ] + * [ intermediate_results | twiddle_factors | factors ] * * The first two sections each contain `2*N` elements. + * + * Twiddle factors are small, reusable complex-exponential constants that appear inside each "butterfly" stage of a Cooley–Tukey–style FFT. Formally, + * + * ```tex + * W_N^k = e^{-2\pi ik/N} + * ``` + * + * is an N-th root of unity, and every arithmetic step in a radix-2 FFT multiplies one intermediate value by some + * + * ```tex + * W_N^k + * ``` + * + * Because these constants only depend on the transform length `N` (and **not** on the input data), we can pre-compute and store them once, then "twiddle" them (i.e., reuse them with different indices) as we proceed through the factorization. + * + * As a quick aside regarding the name "twiddle", early FFT papers (notably Gentleman & Sande, 1966) described how you "twiddle" one branch of each butterfly by a complex rotation before adding/subtracting. The coefficients themselves inherited the nickname "twiddle factors," and the term stuck. + * + * In the context, of this implementation, apart from the intermediate FFT results, the workspace stores the sine/cosine pairs that make up all required \\( W_N^K \\) (i.e., the "twiddle factors") and a small table of radix factors (i.e., the factorization of `N`). + * + * By reusing the workspace array when computing multiple transforms of the same length `N`, every subsequent `*f` (forward) or `*b` (backward) call simply looks up the pre-stored twiddle factors instead of recomputing sine and cosine on-the-fly. + * + * In short, twiddle factors are cached roots of unity that allow each stage of the algorithm to rotate data quickly and predictably. */ offsetT = N * 2; // index offset for twiddle factors - offsetF = offsetT * 2; // index offset for factorization info + offsetF = offsetT * 2; // index offset for factors describing the sub-transforms cfftb1( N, c, offsetC, wsave, offsetW, wsave, offsetW+offsetT, wsave, offsetW+offsetF ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js index 1830e1d549ac..1d13edc62b87 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js @@ -80,8 +80,8 @@ function cffti( n, wsave, wptr ) { wptr -= 1; - // Function Body: - if ( n === 1 ) { + if ( n <= 1 ) { + // FFT of one data point is the identity... return; } iw1 = ( 2 * n ) + 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js index e48d93050505..c51b132a74ea 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js @@ -106,7 +106,7 @@ function cffti1( n, wa, wptr, ifac, ifptr ) { ifptr -= 1; wptr -= 1; - nf = decompose( n, ifac, ifptr, NTRYH ); + nf = decompose( n, NTRYH, ifac, 1, ifptr ); argh = TWO_PI / n; i = 2; l1 = 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index 100afaebe371..1bf68e978539 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -66,17 +66,46 @@ var floor = require( '@stdlib/math/base/special/floor' ); // MAIN // /** -* Decomposes the sequence length into its prime factors. +* Factorizes a sequence length into its prime factors. +* +* ## Notes +* +* - Factorization results are stored in the input array as follows: +* +* ```text +* [ sequence_length | number_of_factors | prime_factors | unused_storage ] +* ``` +* +* - The function mutates the input array. * * @private -* @param {number} n - length of the sequence -* @param {Int32Array} ifac - array to store the factors -* @param {number} ifptr - starting index for ifac -* @param {Array} ntryh - array of initial trial divisors -* @returns {number} status code +* @param {NonNegativeInteger} N - length of the sequence +* @param {NonNegativeIntegerArray} initial - array of initial trial divisors +* @param {Collection} out - output array for storing factorization results +* @param {integer} stride - stride length for `out` +* @param {NonNegativeInteger} offset - starting index for `out` +* @returns {NonNegativeInteger} number of factors into which `N` was decomposed +* +* @example +* // Specify an initial list of potential divisors: +* var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK +* +* // Define a sequence length: +* var N = 630; +* +* // Initialize an array for storing factorization results: +* var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; +* +* // Factorize the sequence length into its prime factors: +* var numFactors = decompose( 630, initial, factors, 1, 0 ); +* // returns 5 +* +* var f = factors.slice(); +* // returns [ 630, 5, 2, 3, 3, 5, 7 ] */ -function decompose( n, ifac, ifptr, ntryh ) { - var ntry; +function decompose( N, initial, out, stride, offset ) { + var divisor; + var ntrials; var nl; var nf; var nq; @@ -85,41 +114,68 @@ function decompose( n, ifac, ifptr, ntryh ) { var i; var j; - ntry = 0; - nl = n; + // Resolve the number of trial divisors: + ntrials = initial.length; + + // Initialize a variable for storing a trial divisor: + divisor = 0; + + // Initialize a variable for storing a sub-sequence length: + nl = N; + + // Initialize a variable for keeping track of the number of factors into which `N` decomposes: nf = 0; + j = 0; do { - if ( j < 4 ) { - ntry = ntryh[ j ]; + if ( j < ntrials ) { + divisor = initial[ j ]; } else { - ntry += 2; + divisor += 2; } j += 1; while ( true ) { - nq = floor( nl / ntry ); - nr = nl - ( ntry * nq ); + // Compute the integer quotient: + nq = floor( nl / divisor ); + + // Compute the remainder: + nr = nl - ( divisor * nq ); + + // If the divisor did not evenly divide the current sub-sequence length, try a new divisor... if ( nr !== 0 ) { break; } + // We found a new factor: nf += 1; - ifac[ ifptr + nf + 2 ] = ntry; + + // Update the sub-sequence length: nl = nq; - if ( ntry === 2 && nf !== 1 ) { + + // Store the factor in the output array: + out[ offset+((nf+1)*stride) ] = divisor; + + // When the divisor is `2` and we've already found other factors, shift the other factors right to make room for the most recent `2` factor... + if ( divisor === 2 && nf !== 1 ) { for ( i = 2; i <= nf; i++ ) { ib = nf - i + 2; - ifac[ ifptr + ib + 2 ] = ifac[ ifptr + ib + 1 ]; + out[ offset+((ib+1)*stride) ] = out[ offset+(ib*stride) ]; } - ifac[ ifptr + 3 ] = 2; + out[ offset+(2*stride) ] = 2; } - if ( nl !== 1 ) { - continue; + // If we cannot further divide the sequence length into smaller sub-sequences, we're done... + if ( nl === 1 ) { + break; } - break; } } while ( nl !== 1 ); - ifac[ ifptr + 1 ] = n; - ifac[ ifptr + 2 ] = nf; + + // Store the sequence length: + out[ offset ] = N; + + // Store the number of factors: + out[ offset+stride ] = nf; + + // Return the number of factors: return nf; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js index 00d5afbfbb49..1f0f79af191b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -107,7 +107,7 @@ function rffti1( n, wa, wptr, ifac, ifptr ) { ifptr -= 1; wptr -= 1; - nf = decompose( n, ifac, ifptr, NTRYH ); + nf = decompose( n, NTRYH, ifac, 1, ifptr ); argh = TWO_PI / n; is = 0; nfm1 = nf - 1; From 72a102e5aa49cb0911019e6766d6a1459c449986 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 10 Jun 2025 17:08:31 -0700 Subject: [PATCH 061/102] chore: fix offset bugs in implementation and refactor and fix normalization in tests --- 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 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: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 14 +- .../@stdlib/fft/base/fftpack/lib/cfftb1.js | 4 +- .../@stdlib/fft/base/fftpack/lib/ch_ref.js | 6 +- .../@stdlib/fft/base/fftpack/lib/decompose.js | 19 ++- .../base/fftpack/lib/print_real_workspace.js | 64 +++++++++ .../@stdlib/fft/base/fftpack/lib/radb2.js | 125 +++++++++++++----- .../@stdlib/fft/base/fftpack/lib/radf2.js | 122 +++++++++++++---- .../@stdlib/fft/base/fftpack/lib/rfftb.js | 26 ++-- .../@stdlib/fft/base/fftpack/lib/rfftb1.js | 56 ++++---- .../@stdlib/fft/base/fftpack/lib/rfftf.js | 28 ++-- .../@stdlib/fft/base/fftpack/lib/rfftf1.js | 92 ++++++++----- .../@stdlib/fft/base/fftpack/lib/rffti.js | 23 ++-- .../@stdlib/fft/base/fftpack/lib/rffti1.js | 54 ++++---- .../fft/base/fftpack/test/test.rfft.js | 17 ++- 14 files changed, 450 insertions(+), 200 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index 13c24fe74645..3ae57d1bc986 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -74,7 +74,7 @@ var cfftb1 = require( './cfftb1.js' ); * * - Invoking `cfftf` prior to invoking this function will multiply an input sequence by `N`. * -* - Prior to invoking this function, `wsave` must be initialized by calling `cffti(N, wsave)`. +* - Prior to invoking this function, `workspace` must be initialized by calling `cffti(N, workspace)`. * * - This function is more efficient when `N` is the product of small prime numbers. * @@ -99,14 +99,14 @@ var cfftb1 = require( './cfftb1.js' ); * @param {NonNegativeInteger} N - length of the sequence to transform * @param {Float64Array} c - real-valued input array containing interleaved real and imaginary components corresponding to the sequence to be transformed * @param {NonNegativeInteger} offsetC - starting index for `c` -* @param {Float64Array} wsave - real-valued workspace array containing pre-computed values -* @param {NonNegativeInteger} offsetW - starting index for `wsave` +* @param {Float64Array} workspace - real-valued workspace array containing pre-computed values +* @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} * * @example * // TODO */ -function cfftb( N, c, offsetC, wsave, offsetW ) { +function cfftb( N, c, offsetC, workspace, offsetW ) { var offsetT; var offsetF; @@ -146,10 +146,10 @@ function cfftb( N, c, offsetC, wsave, offsetW ) { * * In short, twiddle factors are cached roots of unity that allow each stage of the algorithm to rotate data quickly and predictably. */ - offsetT = N * 2; // index offset for twiddle factors - offsetF = offsetT * 2; // index offset for factors describing the sub-transforms + offsetT = offsetW + ( 2*N ); // index offset for twiddle factors + offsetF = offsetT + ( 2*N ); // index offset for factors describing the sub-transforms - cfftb1( N, c, offsetC, wsave, offsetW, wsave, offsetW+offsetT, wsave, offsetW+offsetF ); // eslint-disable-line max-len + cfftb1( N, c, offsetC, workspace, offsetW, workspace, offsetT, workspace, offsetF ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js index 3d62ef438efc..a7ce90d39890 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js @@ -83,7 +83,7 @@ var passfb = require( './passfb.js' ); * @param {NonNegativeInteger} chOffset - starting index for `ch` * @param {Float64Array} wa - workspace array for storing twiddle factors * @param {NonNegativeInteger} waOffset - starting index for `wa` -* @param {Int32Array} ifac - workspace array for storing factorization information +* @param {Int32Array} ifac - workspace array for storing factorization results * @param {NonNegativeInteger} ifacOffset - starting index for `ifac` * @returns {void} */ @@ -156,7 +156,7 @@ function cfftb1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { } // Now that we've finished computing the transforms, copy over the final results to the input array... for ( i = 0; i < N*2; i++ ) { - c[ i+cOffset ] = ch[ i+chOffset ]; + c[ i+cOffset ] = ch[ i+chOffset ]; // FIXME: use `blas/base/dcopy` } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js index 6179938bcf34..1e4de83a80f1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js @@ -67,12 +67,12 @@ * @param {NonNegativeInteger} a1 - index of first dimension * @param {NonNegativeInteger} a2 - index of second dimension * @param {NonNegativeInteger} a3 - index of third dimension -* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage +* @param {NonNegativeInteger} radix - length parameter related to the FFT stage * @param {NonNegativeInteger} ido - dimension order * @returns {NonNegativeInteger} - calculated index */ -function chRef( a1, a2, a3, l1, ido ) { - return ( ( (a3*l1)+a2 ) * ido ) + a1; +function chRef( a1, a2, a3, radix, ido ) { + return ( ( (a3*radix)+a2 ) * ido ) + a1; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index 1bf68e978539..5fe84ac83a44 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -97,11 +97,28 @@ var floor = require( '@stdlib/math/base/special/floor' ); * var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; * * // Factorize the sequence length into its prime factors: -* var numFactors = decompose( 630, initial, factors, 1, 0 ); +* var numFactors = decompose( N, initial, factors, 1, 0 ); * // returns 5 * * var f = factors.slice(); * // returns [ 630, 5, 2, 3, 3, 5, 7 ] +* +* @example +* // Specify an initial list of potential divisors: +* var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK +* +* // Define a sequence length: +* var N = 8; +* +* // Initialize an array for storing factorization results: +* var factors = [ 0, 0, 0, 0 ]; +* +* // Factorize the sequence length into its prime factors: +* var numFactors = decompose( N, initial, factors, 1, 0 ); +* // returns 2 +* +* var f = factors.slice(); +* // returns [ 8, 2, 2, 4 ] */ function decompose( N, initial, out, stride, offset ) { var divisor; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js new file mode 100644 index 000000000000..e43c9c26b76e --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js @@ -0,0 +1,64 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var strided2array = require( '@stdlib/array/base/from-strided' ); + + +// MAIN // + +/** +* Prints the contents of a workspace array for a real-valued Fourier transform. +* +* @private +* @param {NonNegativeInteger} N - sequence length +* @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` +* @param {NonNegativeInteger} offsetW - starting index for `workspace` +* @returns {void} +*/ +function printWorkspace( N, workspace, strideW, offsetW ) { + var offsetT; + var offsetF; + var tmp; + + tmp = strided2array( N, workspace, strideW, offsetW ); + console.log( 'INTERMEDIATE RESULTS:' ); + console.log( tmp ); + console.log( ' ' ); + + offsetT = offsetW + ( N*strideW ); + tmp = strided2array( N, workspace, strideW, offsetT ); + console.log( 'TWIDDLE FACTORS:' ); + console.log( tmp ); + console.log( ' ' ); + + offsetF = offsetT + ( N*strideW ); + tmp = strided2array( N, workspace, strideW, offsetF ); + console.log( 'FACTORIZATION:' ); + console.log( tmp ); + console.log( ' ' ); +} + + +// EXPORTS // + +module.exports = printWorkspace; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 090f96c800e2..73184fc58185 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -60,69 +60,134 @@ 'use strict'; -// MODULES // +// FUNCTIONS // -var chRef = require( './ch_ref.js' ); -var ccRef = require( './cc_ref.js' ); +/** +* Resolves an index into the input array. +* +* @private +* @param {NonNegativeInteger} a1 - first parameter +* @param {NonNegativeInteger} a2 - second parameter +* @param {NonNegativeInteger} a3 - third parameter +* @param {NonNegativeInteger} ido - fourth parameter +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} index +*/ +function iptr( a1, a2, a3, ido, offset ) { // FIXME: update with more descriptive parameter descriptions + return ( ( (a3*2) + a2) * ido ) + a1 + offset; // FIXME: support strides +} + +/** +* Resolves an index into the output array. +* +* @private +* @param {NonNegativeInteger} a1 - first parameter +* @param {NonNegativeInteger} a2 - second parameter +* @param {NonNegativeInteger} a3 - third parameter +* @param {NonNegativeInteger} l1 - fourth parameter +* @param {NonNegativeInteger} ido - fifth parameter +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} index +*/ +function optr( a1, a2, a3, l1, ido, offset ) { // FIXME: update with more descriptive parameter descriptions + return ( ( (a3*l1) + a2) * ido ) + a1 + offset; // FIXME: support strides +} // MAIN // /** -* Performs the backward FFT of length 2 for real-valued sequences. +* Performs the backward Fourier transform of length 2 for real-valued sequences. * * @private -* @param {integer} ido - number of real values for each transform -* @param {integer} l1 - length of the input sequences -* @param {Float64Array} cc - input array containing sequences to be transformed -* @param {number} ccOffset - offset for the input array -* @param {Float64Array} ch - output array containing transformed sequences -* @param {number} chOffset - offset for the output array -* @param {Float64Array} wa1 - array of twiddle factors -* @param {number} wa1Offset - offset for the twiddle factors array +* @param {NonNegativeInteger} ido - number of real values for each transform +* @param {NonNegativeInteger} l1 - length of the input sequences +* @param {Float64Array} cc - input array containing the sequences to be transformed +* @param {NonNegativeInteger} offsetCC - offset for `cc` +* @param {Float64Array} out - output array containing transformed sequences +* @param {NonNegativeInteger} offsetOut - offset for `out` +* @param {Float64Array} twiddles - array of twiddle factors +* @param {NonNegativeInteger} offsetT - offset for `twiddles` * @returns {void} */ -function radb2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { +function radb2( ido, l1, cc, offsetCC, out, offsetOut, twiddles, offsetT ) { // FIXME: support strides var idp2; - var ti2; var tr2; + var ti2; + var ip1; + var ip2; + var it1; + var it2; + var io; var ic; var i; var k; - // Parameter adjustments... - chOffset -= 1 + ( ido * ( 1 + l1 ) ); - ccOffset -= 1 + ( ido * 3 ); - wa1Offset -= 1; + // Adjust offsets: // FIXME: why are these adjustments necessary? Describe here what is happening. + offsetOut -= 1 + ( ido*(1+l1) ); + offsetCC -= 1 + ( ido*3 ); - // Function body: + // FIXME: describe what is happening below for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ido, 2, k, 2, ido ) + ccOffset ]; - ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( ido, 2, k, 2, ido ) + ccOffset ]; + ip1 = iptr( 1, 1, k, ido, offsetCC ); + ip2 = iptr( ido, 2, k, ido, offsetCC ); + + io = optr( 1, k, 1, l1, ido, offsetOut ); + out[ io ] = cc[ ip1 ] + cc[ ip2 ]; + + io = optr( 1, k, 2, l1, ido, offsetOut ); + out[ io ] = cc[ ip1 ] - cc[ ip2 ]; } + // FIXME: describe why this check is necessary if ( ido < 2 ) { return; } if ( ido !== 2 ) { idp2 = ido + 2; + + // FIXME: describe what is happening in the loops below for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ic - 1, 2, k, 2, ido ) + ccOffset ]; - tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( ic - 1, 2, k, 2, ido ) + ccOffset ]; - ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] - cc[ ccRef( ic, 2, k, 2, ido ) + ccOffset ]; - ti2 = cc[ ccRef( i, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ic, 2, k, 2, ido ) + ccOffset ]; - ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * tr2 ) - ( wa1[ i - 1 + wa1Offset ] * ti2 ); - ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 2 + wa1Offset ] * ti2 ) + ( wa1[ i - 1 + wa1Offset ] * tr2 ); + + it1 = i - 2 + offsetT; + it2 = i - 1 + offsetT; + + ip1 = iptr( i-1, 1, k, ido, offsetCC ); + ip2 = iptr( ic-1, 2, k, ido, offsetCC ); + tr2 = cc[ ip1 ] - cc[ ip2 ]; + + io = optr( i-1, k, 1, l1, ido, offsetOut ); + out[ io ] = cc[ ip1 ] + cc[ ip2 ]; + + ip1 = iptr( i, 1, k, ido, offsetCC ); + ip2 = iptr( ic, 2, k, ido, offsetCC ); + ti2 = cc[ ip1 ] + cc[ ip2 ]; + + io = optr( i, k, 1, l1, ido, offsetOut ); + out[ io ] = cc[ ip1 ] - cc[ ip2 ]; + + io = optr( i-1, k, 2, l1, ido, offsetOut ); + out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); + + io = optr( i, k, 2, l1, ido, offsetOut ); + out[ io ] = ( twiddles[ it1 ] * ti2 ) + ( twiddles[ it2 ] * tr2 ); } } - if ( ido % 2 === 1 ) { + // FIXME: explain why we are checking whether `ido` is odd + if ( ido%2 === 1 ) { return; } } + // FIXME: describe what is happening here for ( k = 1; k <= l1; k++ ) { - ch[ chRef( ido, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( ido, 1, k, 2, ido ) + ccOffset ] + cc[ ccRef( ido, 1, k, 2, ido ) + ccOffset ]; - ch[ chRef( ido, k, 2, l1, ido ) + chOffset ] = -( cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ] + cc[ ccRef( 1, 2, k, 2, ido ) + ccOffset ] ); + ip1 = iptr( ido, 1, k, ido, offsetCC ); + io = optr( ido, k, 1, l1, ido, offsetOut ); + out[ io ] = cc[ ip1 ] + cc[ ip1 ]; + + ip1 = iptr( 1, 2, k, ido, offsetCC ); + io = optr( ido, k, 2, l1, ido, offsetOut ); + out[ io ] = -( cc[ ip1 ] + cc[ ip1 ] ); } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 434145829ae8..0364c31a98d4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -60,69 +60,133 @@ 'use strict'; -// MODULES // +// FUNCTIONS // -var chRef = require( './ch_ref.js' ); -var ccRef = require( './cc_ref.js' ); +/** +* Resolves an index into the input array. +* +* @private +* @param {NonNegativeInteger} a1 - first parameter +* @param {NonNegativeInteger} a2 - second parameter +* @param {NonNegativeInteger} a3 - third parameter +* @param {NonNegativeInteger} l1 - fourth parameter +* @param {NonNegativeInteger} ido - fifth parameter +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} index +*/ +function iptr( a1, a2, a3, l1, ido, offset ) { // FIXME: update with more descriptive parameter descriptions + return ( ( (a3*l1) + a2) * ido ) + a1 + offset; // FIXME: support strides +} + +/** +* Resolves an index into the output array. +* +* @private +* @param {NonNegativeInteger} a1 - first parameter +* @param {NonNegativeInteger} a2 - second parameter +* @param {NonNegativeInteger} a3 - third parameter +* @param {NonNegativeInteger} ido - fourth parameter +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} index +*/ +function optr( a1, a2, a3, ido, offset ) { // FIXME: update with more descriptive parameter descriptions + return ( ( (a3*2) + a2) * ido ) + a1 + offset; // FIXME: support strides +} // MAIN // /** -* Performs the forward FFT of length 2 for real-valued sequences. +* Performs the forward Fourier transform of length 2 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 {number} ccOffset - offset for the input array -* @param {Float64Array} ch - output array containing transformed sequences -* @param {number} chOffset - offset for the output array -* @param {Float64Array} wa1 - array of twiddle factors -* @param {number} wa1Offset - offset for the twiddle factors array +* @param {NonNegativeInteger} ido - number of real values for each transform +* @param {NonNegativeInteger} l1 - length of the input sequences +* @param {Float64Array} cc - input array containing the sequences to be transformed +* @param {NonNegativeInteger} offsetCC - offset for `cc` +* @param {Float64Array} out - output array for storing transformed sequences +* @param {NonNegativeInteger} offsetOut - offset for `out` +* @param {Float64Array} twiddles - array containing twiddle factors +* @param {NonNegativeInteger} offsetT - index offset for `twiddles` * @returns {void} */ -function radf2( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset ) { +function radf2( ido, l1, cc, offsetCC, out, offsetOut, twiddles, offsetT ) { // FIXME: support strides var idp2; var tr2; var ti2; + var ip1; + var ip2; + var it1; + var it2; + var io; var ic; var i; var k; - // Parameter adjustments... - chOffset -= 1 + ( ido * 3 ); - ccOffset -= 1 + ( ido * ( 1 + l1 ) ); - wa1Offset -= 1; + // Adjust offsets: // FIXME: why are these adjustments necessary? Describe here what is happening. + offsetOut -= 1 + ( ido*3 ); + offsetCC -= 1 + ( ido*(1+l1) ); - // Function body: + // FIXME: describe what is happening below for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; - ch[ chRef( ido, 2, k, l1, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; + ip1 = iptr( 1, k, 1, l1, ido, offsetCC ); + ip2 = iptr( 1, k, 2, l1, ido, offsetCC ); + + io = optr( 1, 1, k, ido, offsetOut ); + out[ io ] = cc[ ip1 ] + cc[ ip2 ]; + + io = optr( ido, 2, k, ido, offsetOut ); + out[ io ] = cc[ ip1 ] - cc[ ip2 ]; } + // FIXME: describe why this check is necessary if ( ido < 2 ) { return; } if ( ido !== 2 ) { idp2 = ido + 2; + + // FIXME: describe what is happening in the loops below for ( k = 1; k <= l1; k++ ) { for ( i = 3; i <= ido; i += 2 ) { ic = idp2 - i; - tr2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); - ti2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); - ch[ chRef( i, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ti2; - ch[ chRef( ic, 2, k, l1, ido ) + chOffset ] = ti2 - cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ]; - ch[ chRef( i - 1, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + tr2; - ch[ chRef( ic - 1, 2, k, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] - tr2; + + it1 = i - 2 + offsetT; + it2 = i - 1 + offsetT; + + ip1 = iptr( i-1, k, 2, l1, ido, offsetCC ); + ip2 = iptr( i, k, 2, l1, ido, offsetCC ); + tr2 = ( twiddles[ it1 ] * cc[ ip1 ] ) + ( twiddles[ it2 ] * cc[ ip2 ] ); + ti2 = ( twiddles[ it1 ] * cc[ ip2 ] ) - ( twiddles[ it2 ] * cc[ ip1 ] ); + + ip1 = iptr( i, k, 1, l1, ido, offsetCC ); + io = optr( i, 1, k, ido, offsetOut ); + out[ optr ] = cc[ ip1 ] + ti2; + + io = optr( ic, 2, k, ido, offsetOut ); + out[ io ] = ti2 - cc[ ip1 ]; + + ip1 = iptr( i-1, k, 1, l1, ido, offsetCC ); + io = optr( i-1, 1, k, ido, offsetOut ); + out[ io ] = cc[ ip1 ] + tr2; + + io = optr( ic-1, 2, k, ido, offsetOut ); + out[ io ] = cc[ ip1 ] - tr2; } } - if ( ido % 2 === 1 ) { + // FIXME: explain why we are checking whether `ido` is odd + if ( ido%2 === 1 ) { return; } } + // FIXME: describe what is happening here for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, 2, k, l1, ido ) + chOffset ] = -cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ]; - ch[ chRef( ido, 1, k, l1, ido ) + chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ]; + ip1 = iptr( ido, k, 2, l1, ido, offsetCC ); + io = optr( 1, 2, k, ido, offsetOut ); + out[ io ] = -cc[ ip1 ]; + + ip1 = iptr( ido, k, 1, l1, ido, offsetCC ); + io = optr( ido, 1, k, ido, offsetOut ); + out[ io ] = cc[ ip1 ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js index 77f7000c120c..00f6cd88f2a6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js @@ -66,23 +66,27 @@ var rfftb1 = require( './rfftb1.js' ); // MAIN // /** -* Performs the backward FFT for real-valued sequences. +* Performs the backward real-valued Fourier transform (i.e., Fourier synthesis). * -* @param {number} n - length of the sequence to transform -* @param {Float64Array} r - array containing sequence to be transformed -* @param {number} rptr - starting index for r -* @param {Float64Array} wsave - working array containing precomputed values -* @param {number} wptr - starting index for wsave +* @param {NonNegativeInteger} N - length of the sequence to transform +* @param {Float64Array} r - real-valued array containing the sequence to be transformed +* @param {NonNegativeInteger} offsetR - starting index for r +* @param {Float64Array} workspace - working array containing precomputed values +* @param {NonNegativeInteger} offsetW - starting index for workspace * @returns {void} */ -function rfftb( n, r, rptr, wsave, wptr ) { - rptr -= 1; - wptr -= 1; +function rfftb( N, r, offsetR, workspace, offsetW ) { + var offsetT; + var offsetF; - if ( n === 1 ) { + if ( N === 1 ) { + // FFT of one data point is the identity... return; } - rfftb1( n, r, 1 + rptr, wsave, 1 + wptr, wsave, n + 1 + wptr, wsave, ( n << 1 ) + 1 + wptr ); // eslint-disable-line max-len + offsetT = offsetW + N; // index offset for twiddle factors + offsetF = offsetT + N; // index offset for factors describing the sub-transforms + + rfftb1( N, r, offsetR, workspace, offsetW, workspace, offsetT, workspace, offsetF ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js index 0254e0ce200a..440aebd21edd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js @@ -69,6 +69,8 @@ var radb4 = require( './radb4.js' ); var radb5 = require( './radb5.js' ); var radbg = require( './radbg.js' ); +var printWorkspace = require( './print_real_workspace.js' ); // FIXME + // MAIN // @@ -76,7 +78,7 @@ var radbg = require( './radbg.js' ); * Performs the backward real-valued Fast Fourier Transform. * * @private -* @param {number} n - length of the sequence to transform +* @param {number} N - length of the sequence to transform * @param {Float64Array} c - input array containing sequence to be transformed * @param {number} cOffset - starting index for input array * @param {Float64Array} ch - working array for intermediate results @@ -87,14 +89,14 @@ var radbg = require( './radbg.js' ); * @param {number} ifacOffset - starting index for factorization array * @returns {void} */ -function rfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { +function rfftb1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var idl1; var ido; var ix4; var ix3; var ix2; + var FLG; var nf; - var na; var l2; var l1; var iw; @@ -102,58 +104,66 @@ function rfftb1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var k1; var i; - // Function Body: - nf = ifac[ ifacOffset + 1 ]; - na = 0; + // Resolve the number of factors: + nf = ifac[ ifacOffset+1 ]; + + FLG = 0; // FIXME: describe the point of this flag l1 = 1; + + // FIXME + printWorkspace( N, ch, 1, chOffset ); + iw = 0; for ( k1 = 1; k1 <= nf; k1++ ) { - ip = ifac[ ifacOffset + k1 + 1 ]; + // Resolve the next factor: + ip = ifac[ ifacOffset+k1+1 ]; + l2 = ip * l1; - ido = floor( n / l2 ); + ido = floor( N / l2 ); idl1 = ido * l1; switch ( ip ) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; - radb4( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); - na = 1 - na; + radb4( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset ); + FLG = 1 - FLG; break; case 2: - radb2( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); - na = 1 - na; + radb2( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset ); + FLG = 1 - FLG; break; case 3: ix2 = iw + ido; - radb3( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); - na = 1 - na; + radb3( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset ); + FLG = 1 - FLG; break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; - radb5( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset ); - na = 1 - na; + radb5( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset, wa, ix4+waOffset ); + FLG = 1 - FLG; break; default: - if ( na === 0 ) { - radbg( ido, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset ); + if ( FLG === 0 ) { + radbg( ido, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw+waOffset ); } else { - radbg( ido, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset ); + radbg( ido, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw+waOffset ); } if ( ido === 1 ) { - na = 1 - na; + FLG = 1 - FLG; } break; } l1 = l2; iw += ( ip - 1 ) * ido; } - if ( na === 0 ) { + if ( FLG === 0 ) { return; } - for ( i = 0; i < n; i++ ) { - c[ i + cOffset ] = ch[ i + chOffset ]; + // Now that we've finished computing the transforms, copy over the final results to the input array... + for ( i = 0; i < N; i++ ) { + c[ i+cOffset ] = ch[ i+chOffset ]; // FIXME: use `blas/base/dcopy` } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js index fd43545bf195..ccde23b93f1b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -66,25 +66,27 @@ var rfftf1 = require( './rfftf1.js' ); // MAIN // /** -* Performs the forward FFT for real-valued sequences. +* Performs the forward Fourier transform for a real-valued sequence. * -* @param {number} n - length of the sequence to transform -* @param {Float64Array} r - array containing sequence to be transformed -* @param {number} rOffset - starting index for input array -* @param {Float64Array} wsave - working array containing precomputed values -* @param {number} wsaveOffset - starting index for working array +* @param {NonNegativeInteger} N - length of the sequence to transform +* @param {Float64Array} r - real-valued input array containing the sequence to be transformed +* @param {NonNegativeInteger} offsetR - starting index for `r` +* @param {Float64Array} workspace - workspace array containing pre-computed values +* @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} */ -function rfftf( n, r, rOffset, wsave, wsaveOffset ) { - // Parameter adjustments: - rOffset -= 1; - wsaveOffset -= 1; +function rfftf( N, r, offsetR, workspace, offsetW ) { + var offsetT; + var offsetF; - // Function Body: - if ( n === 1 ) { + if ( N === 1 ) { + // FFT of one data point is the identity... return; } - rfftf1( n, r, rOffset + 1, wsave, wsaveOffset + 1, wsave, n + wsaveOffset + 1, wsave, ( n << 1 ) + 1 + wsaveOffset ); // eslint-disable-line max-len + offsetT = offsetW + N; // index offset for twiddle factors + offsetF = offsetT + N; // index offset for factors describing the sub-transforms + + rfftf1( N, r, offsetR, workspace, offsetW, workspace, offsetT, workspace, offsetF ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js index 3a9741ad8ab3..03effe6c9080 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js @@ -69,92 +69,112 @@ var radf4 = require( './radf4.js' ); var radf5 = require( './radf5.js' ); var radfg = require( './radfg.js' ); +var printWorkspace = require( './print_real_workspace.js' ); // FIXME + // MAIN // /** -* Performs the forward real-valued Fast Fourier Transform. +* Performs the forward real-valued Fourier transform. * * @private -* @param {number} n - length of the sequence to transform -* @param {Float64Array} c - input array containing sequence to be transformed -* @param {number} cOffset - starting index for input array +* @param {NonNegativeInteger} N - length of the sequence to transform +* @param {Float64Array} c - input array containing the sequence to be transformed +* @param {NonNegativeInteger} cOffset - starting index for `c` * @param {Float64Array} ch - working array for intermediate results -* @param {number} chOffset - starting index for working array -* @param {Float64Array} wa - array of twiddle factors -* @param {number} waOffset - starting index for twiddle factors array -* @param {Int32Array} ifac - array containing factorization information -* @param {number} ifacOffset - starting index for factorization array +* @param {NonNegativeInteger} chOffset - starting index for `ch` +* @param {Float64Array} wa - workspace array for storing twiddle factors +* @param {NonNegativeInteger} waOffset - starting index for `wa` +* @param {Int32Array} ifac - workspace array for storing factorization results +* @param {NonNegativeInteger} ifacOffset - starting index for `ifac` * @returns {void} */ -function rfftf1( n, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { +function rfftf1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { + var factor; var idl1; + var FLG; var ido; var ix4; var ix3; var ix2; var nf; - var na; var l2; var l1; var kh; var iw; - var ip; var k1; var i; - // Function Body: - nf = ifac[ ifacOffset + 1 ]; - na = 1; - l2 = n; - iw = n - 1; + // Resolve the number of factors: + nf = ifac[ ifacOffset+1 ]; + + FLG = 1; // FIXME: describe the point of this flag + l2 = N; + + // FIXME + printWorkspace( N, ch, 1, chOffset ); + + // Initialize an index offset to the last element in each workspace: + iw = N - 1; + for ( k1 = 1; k1 <= nf; k1++ ) { kh = nf - k1; - ip = ifac[ ifacOffset + kh + 2 ]; - l1 = floor( l2 / ip ); - ido = floor( n / l2 ); + + // Resolve the next factor: + factor = ifac[ ifacOffset+kh+2 ]; + + // Compute a sub-transform length: + l1 = floor( l2 / factor ); + + ido = floor( N / l2 ); idl1 = ido * l1; - iw -= ( ( ip - 1 ) * ido ); - na = 1 - na; - switch ( ip ) { + + // Adjust the index offset + iw -= ( (factor-1) * ido ); + + // Toggle the flag: // FIXME: better description? + FLG = 1 - FLG; + + switch ( factor ) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; - radf4( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset ); + radf4( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset ); break; case 2: - radf2( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset ); + radf2( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset ); break; case 3: ix2 = iw + ido; - radf3( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset ); + radf3( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset ); break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; - radf5( ido, l1, ( na ) ? ch : c, ( na ) ? chOffset : cOffset, ( na ) ? c : ch, ( na ) ? cOffset : chOffset, wa, iw + waOffset, wa, ix2 + waOffset, wa, ix3 + waOffset, wa, ix4 + waOffset ); + radf5( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset, wa, ix4+waOffset ); break; default: if ( ido === 1 ) { - na = 1 - na; + FLG = 1 - FLG; } - if ( na === 0 ) { - radfg( ido, ip, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw + waOffset ); - na = 1; + if ( FLG === 0 ) { + radfg( ido, factor, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw+waOffset ); + FLG = 1; } else { - radfg( ido, ip, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw + waOffset ); - na = 0; + radfg( ido, factor, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw+waOffset ); + FLG = 0; } break; } l2 = l1; } - if ( na === 1 ) { + if ( FLG === 1 ) { return; } - for ( i = 0; i < n; i++ ) { - c[ cOffset + i ] = ch[ chOffset + i ]; + // Now that we've finished computing the transforms, copy over the final results to the input array... + for ( i = 0; i < N; i++ ) { + c[ cOffset+i ] = ch[ chOffset+i ]; // FIXME: use `blas/base/dcopy` } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js index 330d8c90323f..69633ecaf3c1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js @@ -66,22 +66,25 @@ var rffti1 = require( './rffti1.js' ); // MAIN // /** -* Initializes the working array for real-valued FFT. +* Initializes the workspace array for performing a real-valued Fourier transform. * -* @param {number} n - length of the sequence to transform -* @param {Float64Array} wsave - working array to be initialized -* @param {number} wptr - starting index for wsave +* @param {NonNegativeInteger} N - length of the sequence to transform +* @param {Float64Array} workspace - workspace array +* @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} */ -function rffti( n, wsave, wptr ) { - // Parameter adjustments: - wptr -= 1; +function rffti( N, workspace, offsetW ) { // FIXME: add support for stride + var offsetT; + var offsetF; - // Function Body: - if ( n === 1 ) { + if ( N === 1 ) { + // FFT of one data point is the identity, so no initialization necessary... return; } - rffti1( n, wsave, n + 1 + wptr, wsave, 1 + ( n << 1 ) + wptr ); + offsetT = offsetW + N; // index offset for twiddle factors + offsetF = offsetT + N; // index offset for factors describing the sub-transforms + + rffti1( N, workspace, offsetT, workspace, offsetF ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js index 1f0f79af191b..3a379a8dd40d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -60,7 +60,7 @@ // MODULES // -var sincos = require( '@stdlib/math/base/special/sincos' ); +var sincos = require( '@stdlib/math/base/special/sincos' ).assign; var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var floor = require( '@stdlib/math/base/special/floor' ); var decompose = require( './decompose.js' ); @@ -68,27 +68,26 @@ var decompose = require( './decompose.js' ); // VARIABLES // -var NTRYH = [ 4, 2, 3, 5 ]; // Initial trial factors for FFT factorization +// Define a list of initial trial factors for FFT factorization: +var TRIAL_FACTORS = [ 4, 2, 3, 5 ]; // MAIN // /** -* Initializes the working arrays for the FFT algorithm. +* Initializes the working arrays for applying a Fourier transform to a real-valued sequence. * * @private -* @param {number} n - length of the sequence -* @param {Float64Array} wa - array of twiddle factors -* @param {number} wptr - starting index for wa -* @param {Int32Array} ifac - array containing factorization information -* @param {number} ifptr - starting index for ifac +* @param {NonNegativeInteger} N - length of the sequence +* @param {Collection} twiddles - array of twiddle factors +* @param {NonNegativeInteger} offsetT - starting index for twiddles +* @param {Collection} factors - array containing factorization information +* @param {NonNegativeInteger} offsetF - starting index for factors * @returns {void} */ -function rffti1( n, wa, wptr, ifac, ifptr ) { +function rffti1( N, twiddles, offsetT, factors, offsetF ) { // FIXME: accommodate strides for twiddles and factors var argld; var argh; - var nfm1; - var ipm; var ido; var arg; var nf; @@ -99,29 +98,26 @@ function rffti1( n, wa, wptr, ifac, ifptr ) { var fi; var l2; var l1; - var k1; - var sc; + var k; var j; var i; - ifptr -= 1; - wptr -= 1; + // Decompose the sequence length into its prime factors: + nf = decompose( N, TRIAL_FACTORS, factors, 1, offsetF ); // FIXME: allow non-unit stride + if ( nf-1 === 0 ) { + return; + } - nf = decompose( n, NTRYH, ifac, 1, ifptr ); - argh = TWO_PI / n; + // FIXME: document this loop sequence + argh = TWO_PI / N; is = 0; - nfm1 = nf - 1; l1 = 1; - if ( nfm1 === 0 ) { - return; - } - for ( k1 = 1; k1 <= nfm1; k1++ ) { - ip = ifac[ ifptr + k1 + 2 ]; + for ( k = 1; k < nf; k++ ) { + ip = factors[ offsetF+k+1 ]; // FIXME: adjust for a stride in factors ld = 0; l2 = ip * l1; - ido = floor( n / l2 ); - ipm = ip - 1; - for ( j = 1; j <= ipm; j++ ) { + ido = floor( N / l2 ); + for ( j = 1; j < ip; j++ ) { ld += l1; i = is; argld = ld * argh; @@ -130,9 +126,9 @@ function rffti1( n, wa, wptr, ifac, ifptr ) { i += 2; fi += 1.0; arg = fi * argld; - sc = sincos( arg ); - wa[ wptr + i - 1 ] = sc[ 1 ]; - wa[ wptr + i ] = sc[ 0 ]; + + // FIXME: adjust for a stride in twiddles + sincos( arg, twiddles, -1, offsetT+i+1 ); // note: cosine before sine } is += ido; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 74ed8f5a89e7..750c8db8aaf5 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -37,7 +37,8 @@ var rfftb = require( './../lib/rfftb.js' ); // VARIABLES // -var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; +// var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; +var nd = [ 2 ]; // TESTS // @@ -77,12 +78,14 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl var k; var i; - x = new Float64Array( 200 ); - y = new Float64Array( 200 ); - xh = new Float64Array( 200 ); - w = new Float64Array( 2000 ); for ( nz = 1; nz <= nd.length; nz++ ) { n = nd[ nz - 1 ]; + + x = new Float64Array( n ); + y = new Float64Array( n ); + xh = new Float64Array( n ); + w = new Float64Array( (n*2)+15 ); + modn = n % 2; np1 = n + 1; nm1 = n - 1; @@ -170,10 +173,12 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl for ( i = 1; i <= n; i++ ) { // Computing MAX: r2 = rftfb; - r1 = cf * ( y[ i - 1 ] - x[ i - 1 ] ); + r1 = ( cf * y[ i - 1 ] ) - x[ i - 1 ]; r3 = abs( r1 ); rftfb = max( r2, r3 ); } + console.log( x ); + console.log( y ); tol = 1e-3; t.ok( rftf <= tol, 'forward transform error: ' + rftf + ' (expected <= ' + tol + ')' ); From 5d5bb6ae95b20382ee03133d8e28fa4c83046601 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 02:53:41 -0700 Subject: [PATCH 062/102] refactor: initial stride support and additional comments --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/radb2.js | 188 ++++++++++++------ 1 file changed, 122 insertions(+), 66 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 73184fc58185..2cf1868489e4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -63,54 +63,97 @@ // FUNCTIONS // /** -* Resolves an index into the input array. +* Resolves an index in the input array. +* +* ## Notes +* +* When transforming an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the real and imaginary parts of a folded complex vector and where each "column" has `M` elements. +* +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: +* +* ```text +* j = 0 ("even" column) j = 1 ("odd" column) +* k = 0 ─┬────────────────────────────────────┬────────────────────────────────────┐ +* │ cc(0,0,0) cc(1,0,0) ... cc(3,0,0) │ cc(0,1,0) cc(1,1,0) ... cc(3,1,0) │ +* └────────────────────────────────────┴────────────────────────────────────┤ +* k = 1 ─┬────────────────────────────────────┬────────────────────────────────────┤ +* │ cc(0,0,1) cc(1,0,1) ... cc(3,0,1) │ cc(0,1,1) cc(1,1,1) ... cc(3,1,1) │ +* └────────────────────────────────────┴────────────────────────────────────┤ +* k = 2 ─┬────────────────────────────────────┬────────────────────────────────────┤ +* │ cc(0,0,2) cc(1,0,2) ... cc(3,0,2) │ cc(0,1,2) cc(1,1,2) ... cc(3,1,2) │ +* └────────────────────────────────────┴────────────────────────────────────┘ +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 1 M-1 0 1 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short "column" sub-sequence. +* - `j` selects between the even and odd half-spectra (i.e., the real or imaginary part of a folded complex vector). +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | cc(0,0,0) ... cc(3,0,0) | cc(0,1,0) ... cc(3,1,0) | cc(0,0,1) ... cc(3,0,1) | ... | cc(0,1,2) ... cc(3,1,2) | +* ``` * * @private -* @param {NonNegativeInteger} a1 - first parameter -* @param {NonNegativeInteger} a2 - second parameter -* @param {NonNegativeInteger} a3 - third parameter -* @param {NonNegativeInteger} ido - fourth parameter -* @param {NonNegativeInteger} offset - index offset -* @returns {NonNegativeInteger} index +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} j - index specifying which of the two complex halves we are in (either `0` or `1`) +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the input array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the input array +* @returns {NonNegativeInteger} computed index */ -function iptr( a1, a2, a3, ido, offset ) { // FIXME: update with more descriptive parameter descriptions - return ( ( (a3*2) + a2) * ido ) + a1 + offset; // FIXME: support strides +function iptr( i, j, k, M, stride, offset ) { + var n = i + ( ( j+(k*2) ) * M ); + return ( n*stride ) + offset; } /** -* Resolves an index into the output array. +* Resolves an index in the output array. +* +* ## Notes +* +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the real and imaginary parts of a folded complex vector and where each "column" has `M` elements. +* +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: * * @private -* @param {NonNegativeInteger} a1 - first parameter -* @param {NonNegativeInteger} a2 - second parameter -* @param {NonNegativeInteger} a3 - third parameter -* @param {NonNegativeInteger} l1 - fourth parameter -* @param {NonNegativeInteger} ido - fifth parameter -* @param {NonNegativeInteger} offset - index offset -* @returns {NonNegativeInteger} index +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} j - output row +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the output array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index */ -function optr( a1, a2, a3, l1, ido, offset ) { // FIXME: update with more descriptive parameter descriptions - return ( ( (a3*l1) + a2) * ido ) + a1 + offset; // FIXME: support strides +function optr( i, k, j, L, M, stride, offset ) { + var n = i + ( ( k+(j*L) ) * M ); + return ( n*stride ) + offset; } // MAIN // /** -* Performs the backward Fourier transform of length 2 for real-valued sequences. +* Performs the backward Fourier radix-2 transform for a real-valued sequence. * * @private -* @param {NonNegativeInteger} ido - number of real values for each transform -* @param {NonNegativeInteger} l1 - length of the input sequences -* @param {Float64Array} cc - input array containing the sequences to be transformed -* @param {NonNegativeInteger} offsetCC - offset for `cc` -* @param {Float64Array} out - output array containing transformed sequences -* @param {NonNegativeInteger} offsetOut - offset for `out` +* @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed +* @param {NonNegativeInteger} L - number of sub-sequences to be transformed +* @param {Float64Array} cc - input array containing the sub-sequences to be transformed +* @param {NonNegativeInteger} oc - offset for `cc` +* @param {Float64Array} out - output array containing transformed sub-sequences +* @param {NonNegativeInteger} oo - offset for `out` * @param {Float64Array} twiddles - array of twiddle factors -* @param {NonNegativeInteger} offsetT - offset for `twiddles` +* @param {NonNegativeInteger} ot - offset for `twiddles` * @returns {void} */ -function radb2( ido, l1, cc, offsetCC, out, offsetOut, twiddles, offsetT ) { // FIXME: support strides +function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support strides var idp2; var tr2; var ti2; @@ -120,73 +163,86 @@ function radb2( ido, l1, cc, offsetCC, out, offsetOut, twiddles, offsetT ) { // var it2; var io; var ic; + var sc = 1; + var so = 1; var i; - var k; - - // Adjust offsets: // FIXME: why are these adjustments necessary? Describe here what is happening. - offsetOut -= 1 + ( ido*(1+l1) ); - offsetCC -= 1 + ( ido*3 ); - - // FIXME: describe what is happening below - for ( k = 1; k <= l1; k++ ) { - ip1 = iptr( 1, 1, k, ido, offsetCC ); - ip2 = iptr( ido, 2, k, ido, offsetCC ); - - io = optr( 1, k, 1, l1, ido, offsetOut ); - out[ io ] = cc[ ip1 ] + cc[ ip2 ]; - - io = optr( 1, k, 2, l1, ido, offsetOut ); - out[ io ] = cc[ ip1 ] - cc[ ip2 ]; + var k; // FIXME: make a parameter + + /* + * Perform the core butterfly for each sub-sequence being transformed. + * + * In the following loop, we combine two half-length complex vectors. + * + * cc(:, 0, k) holds Re(X_even) + j Im(X_even) + * cc(:, 1, k) holds Re(X_odd) + j Im(X_odd) + * + * For a radix-2 backward FFT, the twiddle factor for the first column is +1, so we can compute to real outputs with just + * + * out(even) = even + odd + * out(odd) = even - odd + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( 0, 0, k, M, sc, oc ); + ip2 = iptr( M-1, 1, k, M, sc, oc ); + + io = optr( 0, k, 0, L, M, so, oo ); + out[ io ] = cc[ ip1 ] + cc[ ip2 ]; // out(even) = even + odd + + io = optr( 0, k, 1, L, M, so, oo ); + out[ io ] = cc[ ip1 ] - cc[ ip2 ]; // out(odd) = even - odd } // FIXME: describe why this check is necessary - if ( ido < 2 ) { + if ( M < 2 ) { return; } - if ( ido !== 2 ) { - idp2 = ido + 2; + + // FIXME: everything below needs updating as `iptr` and `optr` have been converted to zero-based indexing + + if ( M !== 2 ) { + idp2 = M + 2; // FIXME: describe what is happening in the loops below - for ( k = 1; k <= l1; k++ ) { - for ( i = 3; i <= ido; i += 2 ) { + for ( k = 0; k < L; k++ ) { + for ( i = 3; i <= M; i += 2 ) { ic = idp2 - i; - it1 = i - 2 + offsetT; - it2 = i - 1 + offsetT; + it1 = i - 2 + ot; + it2 = i - 1 + ot; - ip1 = iptr( i-1, 1, k, ido, offsetCC ); - ip2 = iptr( ic-1, 2, k, ido, offsetCC ); + ip1 = iptr( i-1, 1, k, M, oc ); + ip2 = iptr( ic-1, 2, k, M, oc ); tr2 = cc[ ip1 ] - cc[ ip2 ]; - io = optr( i-1, k, 1, l1, ido, offsetOut ); + io = optr( i-1, k, 1, L, M, oo ); out[ io ] = cc[ ip1 ] + cc[ ip2 ]; - ip1 = iptr( i, 1, k, ido, offsetCC ); - ip2 = iptr( ic, 2, k, ido, offsetCC ); + ip1 = iptr( i, 1, k, M, oc ); + ip2 = iptr( ic, 2, k, M, oc ); ti2 = cc[ ip1 ] + cc[ ip2 ]; - io = optr( i, k, 1, l1, ido, offsetOut ); + io = optr( i, k, 1, L, M, oo ); out[ io ] = cc[ ip1 ] - cc[ ip2 ]; - io = optr( i-1, k, 2, l1, ido, offsetOut ); + io = optr( i-1, k, 2, L, M, oo ); out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); - io = optr( i, k, 2, l1, ido, offsetOut ); + io = optr( i, k, 2, L, M, oo ); out[ io ] = ( twiddles[ it1 ] * ti2 ) + ( twiddles[ it2 ] * tr2 ); } } - // FIXME: explain why we are checking whether `ido` is odd - if ( ido%2 === 1 ) { + // FIXME: explain why we are checking whether `M` is odd + if ( M%2 === 1 ) { return; } } // FIXME: describe what is happening here - for ( k = 1; k <= l1; k++ ) { - ip1 = iptr( ido, 1, k, ido, offsetCC ); - io = optr( ido, k, 1, l1, ido, offsetOut ); + for ( k = 0; k < L; k++ ) { + ip1 = iptr( M, 1, k, M, oc ); + io = optr( M, k, 1, L, M, oo ); out[ io ] = cc[ ip1 ] + cc[ ip1 ]; - ip1 = iptr( 1, 2, k, ido, offsetCC ); - io = optr( ido, k, 2, l1, ido, offsetOut ); + ip1 = iptr( 1, 2, k, M, oc ); + io = optr( M, k, 2, L, M, oo ); out[ io ] = -( cc[ ip1 ] + cc[ ip1 ] ); } } From 7e66211361a161dc8104d7d0103536c346023c0f Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 02:57:37 -0700 Subject: [PATCH 063/102] docs: fix comments --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 2cf1868489e4..f81380ba3345 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -163,10 +163,10 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride var it2; var io; var ic; - var sc = 1; - var so = 1; + var sc = 1; // FIXME: make a parameter + var so = 1; // FIXME: make a parameter var i; - var k; // FIXME: make a parameter + var k; /* * Perform the core butterfly for each sub-sequence being transformed. From 410012ee521d9161d14f4f020218b4af768c8628 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 03:13:14 -0700 Subject: [PATCH 064/102] refactor: to use zero-based indexing --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/radb2.js | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index f81380ba3345..a7508e00343c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -154,7 +154,7 @@ function optr( i, k, j, L, M, stride, offset ) { * @returns {void} */ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support strides - var idp2; + var MP1; var tr2; var ti2; var ip1; @@ -196,37 +196,35 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride return; } - // FIXME: everything below needs updating as `iptr` and `optr` have been converted to zero-based indexing - if ( M !== 2 ) { - idp2 = M + 2; + MP1 = M + 1; // FIXME: describe what is happening in the loops below for ( k = 0; k < L; k++ ) { - for ( i = 3; i <= M; i += 2 ) { - ic = idp2 - i; + for ( i = 2; i < M; i += 2 ) { + ic = MP1 - i; - it1 = i - 2 + ot; - it2 = i - 1 + ot; + it1 = i - 1 + ot; + it2 = i + ot; - ip1 = iptr( i-1, 1, k, M, oc ); - ip2 = iptr( ic-1, 2, k, M, oc ); + ip1 = iptr( i, 0, k, M, sc, oc ); + ip2 = iptr( ic-1, 1, k, M, sc, oc ); tr2 = cc[ ip1 ] - cc[ ip2 ]; - io = optr( i-1, k, 1, L, M, oo ); + io = optr( i, k, 0, L, M, so, oo ); out[ io ] = cc[ ip1 ] + cc[ ip2 ]; - ip1 = iptr( i, 1, k, M, oc ); - ip2 = iptr( ic, 2, k, M, oc ); + ip1 = iptr( i+1, 0, k, M, sc, oc ); + ip2 = iptr( ic, 1, k, M, sc, oc ); ti2 = cc[ ip1 ] + cc[ ip2 ]; - io = optr( i, k, 1, L, M, oo ); + io = optr( i+1, k, 0, L, M, so, oo ); out[ io ] = cc[ ip1 ] - cc[ ip2 ]; - io = optr( i-1, k, 2, L, M, oo ); + io = optr( i, k, 1, L, M, so, oo ); out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); - io = optr( i, k, 2, L, M, oo ); + io = optr( i+1, k, 1, L, M, so, oo ); out[ io ] = ( twiddles[ it1 ] * ti2 ) + ( twiddles[ it2 ] * tr2 ); } } @@ -237,12 +235,12 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride } // FIXME: describe what is happening here for ( k = 0; k < L; k++ ) { - ip1 = iptr( M, 1, k, M, oc ); - io = optr( M, k, 1, L, M, oo ); + ip1 = iptr( M-1, 0, k, M, sc, oc ); + io = optr( M-1, k, 0, L, M, so, oo ); out[ io ] = cc[ ip1 ] + cc[ ip1 ]; - ip1 = iptr( 1, 2, k, M, oc ); - io = optr( M, k, 2, L, M, oo ); + ip1 = iptr( 0, 1, k, M, sc, oc ); + io = optr( M-1, k, 1, L, M, so, oo ); out[ io ] = -( cc[ ip1 ] + cc[ ip1 ] ); } } From b773d06799fd2e58e7bd2199d2d1b3f63ce8fec6 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 16:41:16 -0700 Subject: [PATCH 065/102] docs: add comment and TODOs --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/cosqb.js | 2 +- .../@stdlib/fft/base/fftpack/lib/cosqf.js | 2 +- .../@stdlib/fft/base/fftpack/lib/cosqi.js | 2 +- .../@stdlib/fft/base/fftpack/lib/cost.js | 2 +- .../@stdlib/fft/base/fftpack/lib/costi.js | 2 +- .../@stdlib/fft/base/fftpack/lib/decompose.js | 10 ++--- .../base/fftpack/lib/print_real_workspace.js | 2 +- .../@stdlib/fft/base/fftpack/lib/radb2.js | 37 ++++++++++++++++--- .../@stdlib/fft/base/fftpack/lib/sinqb.js | 2 +- .../@stdlib/fft/base/fftpack/lib/sinqf.js | 2 +- .../@stdlib/fft/base/fftpack/lib/sinqi.js | 2 +- .../@stdlib/fft/base/fftpack/lib/sint.js | 2 +- .../@stdlib/fft/base/fftpack/lib/sinti.js | 2 +- 13 files changed, 48 insertions(+), 21 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js index d6992df13679..cea38e40a6bf 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js @@ -82,7 +82,7 @@ var TSQRT2 = 2.0 * SQRT_TWO; * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqb( n, x, xptr, wsave, wptr ) { +function cosqb( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cosqb` after this package has been refactored var x1; wptr -= 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js index 23c4edb4cc50..711144a30ee3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js @@ -76,7 +76,7 @@ var cosqf1 = require( './cosqf1.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqf( n, x, xptr, wsave, wptr ) { +function cosqf( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cosqf` after this package has been refactored var tsqx; wptr -= 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js index 46e70a4c57f3..e7bc8405e1dd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js @@ -75,7 +75,7 @@ var rffti = require( './rffti.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqi( n, wsave, wptr ) { +function cosqi( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cosqi` after this package has been refactored var fk; var dt; var k; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js index 951e6350c204..955995c38d9c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js @@ -75,7 +75,7 @@ var rfftf = require( './rfftf.js' ); * @param {number} wptr - starting index for wsave * @returns {void} */ -function cost( n, x, xptr, wsave, wptr ) { +function cost( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cost` after this package has been refactored var x1p3; var xim2; var modn; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js index 0393bd663161..ef8b2f58ec39 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js @@ -75,7 +75,7 @@ var rffti = require( './rffti.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function costi( n, wsave, wptr ) { +function costi( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/costi` after this package has been refactored var nm1; var np1; var ns2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js index 5fe84ac83a44..594ce1168038 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js @@ -66,14 +66,14 @@ var floor = require( '@stdlib/math/base/special/floor' ); // MAIN // /** -* Factorizes a sequence length into its prime factors. +* Factorizes a sequence length into a product of integers. * * ## Notes * * - Factorization results are stored in the input array as follows: * * ```text -* [ sequence_length | number_of_factors | prime_factors | unused_storage ] +* [ sequence_length | number_of_factors | integer_factors | unused_storage ] * ``` * * - The function mutates the input array. @@ -96,7 +96,7 @@ var floor = require( '@stdlib/math/base/special/floor' ); * // Initialize an array for storing factorization results: * var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; * -* // Factorize the sequence length into its prime factors: +* // Factorize the sequence length into a product of integers: * var numFactors = decompose( N, initial, factors, 1, 0 ); * // returns 5 * @@ -113,14 +113,14 @@ var floor = require( '@stdlib/math/base/special/floor' ); * // Initialize an array for storing factorization results: * var factors = [ 0, 0, 0, 0 ]; * -* // Factorize the sequence length into its prime factors: +* // Factorize the sequence length into its a product of integers: * var numFactors = decompose( N, initial, factors, 1, 0 ); * // returns 2 * * var f = factors.slice(); * // returns [ 8, 2, 2, 4 ] */ -function decompose( N, initial, out, stride, offset ) { +function decompose( N, initial, out, stride, offset ) { // TODO: consider moving to a separate utility package var divisor; var ntrials; var nl; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js index e43c9c26b76e..55d984f19792 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js @@ -35,7 +35,7 @@ var strided2array = require( '@stdlib/array/base/from-strided' ); * @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} */ -function printWorkspace( N, workspace, strideW, offsetW ) { +function printWorkspace( N, workspace, strideW, offsetW ) { // FIXME: remove this file and function once we've clean-up this package var offsetT; var offsetF; var tmp; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index a7508e00343c..44da00a271db 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -117,9 +117,36 @@ function iptr( i, j, k, M, stride, offset ) { * * ## Notes * -* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the real and imaginary parts of a folded complex vector and where each "column" has `M` elements. +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" corresponding to the two parts of the butterfly (`even + odd` and `even - odd`, respectively) and where each "row" has `M*L` elements. * -* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: +* +* ```text +* │ k = 0 k = 1 k = 2 +* │ ───────────────────────────────────────────────────────────────────────────────→ k +* j = 0 (even+odd) │ out(0,0,0) ... out(3,0,0) out(0,1,0) ... out(3,1,0) out(0,2,0) ... out(3,2,0) +* │ +* j = 1 (even-odd) │ out(0,0,1) ... out(3,0,1) out(0,1,1) ... out(3,1,1) out(0,2,1) ... out(3,2,1) +* └────────────────────────────────────────────────────────────────────────────────→ i +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 0 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to either the `even + odd` or `even - odd` part of the butterfly. +* - `j` selects between the `even + odd` and `even - odd` part of the butterfly. +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | out(0,0,0)...out(3,0,0) ... out(0,2,0)...out(3,2,0) | out(0,0,1)...out(3,0,1) ... out(0,2,1)...out(3,2,1) | +* ``` +* +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `ch` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* +* Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. * * @private * @param {NonNegativeInteger} i - index of an element within a sub-sequence @@ -204,9 +231,6 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride for ( i = 2; i < M; i += 2 ) { ic = MP1 - i; - it1 = i - 1 + ot; - it2 = i + ot; - ip1 = iptr( i, 0, k, M, sc, oc ); ip2 = iptr( ic-1, 1, k, M, sc, oc ); tr2 = cc[ ip1 ] - cc[ ip2 ]; @@ -221,6 +245,9 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride io = optr( i+1, k, 0, L, M, so, oo ); out[ io ] = cc[ ip1 ] - cc[ ip2 ]; + it1 = i - 1 + ot; + it2 = i + ot; + io = optr( i, k, 1, L, M, so, oo ); out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js index 40d003aa63b1..5a35eb1d5244 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js @@ -75,7 +75,7 @@ var cosqb = require( './cosqb.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinqb( n, x, xptr, wsave, wptr ) { +function sinqb( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinqb` after this package has been refactored var xhold; var ns2; var kc; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js index 5555c56daf3b..3bf6cb738109 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js @@ -75,7 +75,7 @@ var cosqb = require( './cosqb.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinqf( n, x, xptr, wsave, wptr ) { +function sinqf( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinqf` after this package has been refactored var xhold; var ns2; var kc; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js index 79ac3914670b..b17a043ba8b3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js @@ -73,7 +73,7 @@ var cosqi = require( './cosqi.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinqi( n, wsave, wptr ) { +function sinqi( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinqi` after this package has been refactored wptr -= 1; cosqi( n, wsave, wptr + 1 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js index d2cc827dd90d..b0a6deb6c6cb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js @@ -76,7 +76,7 @@ var sint1 = require( './sint1.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sint( n, x, xptr, wsave, wptr ) { +function sint( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sint` after this package has been refactored var iw1; var iw2; var iw3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js index 9dc9c9edb034..9f68ffd6a7ae 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js @@ -76,7 +76,7 @@ var rffti = require( './rffti.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinti( n, wsave, wptr ) { +function sinti( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinti` after this package has been refactored var np1; var ns2; var dt; From f98235603149d1ceb4e5573899dc649829542579 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 16:42:22 -0700 Subject: [PATCH 066/102] docs: fix typo --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 44da00a271db..aedf5060e705 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -119,7 +119,7 @@ function iptr( i, j, k, M, stride, offset ) { * * When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" corresponding to the two parts of the butterfly (`even + odd` and `even - odd`, respectively) and where each "row" has `M*L` elements. * -* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: +* Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: * * ```text * │ k = 0 k = 1 k = 2 From 376ec9d4bee57aeddec0f836ed496e048738619e Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 17:17:05 -0700 Subject: [PATCH 067/102] docs: add examples --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/radb2.js | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index aedf5060e705..6e7f37d6405f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -96,6 +96,8 @@ * * ```text * | cc(0,0,0) ... cc(3,0,0) | cc(0,1,0) ... cc(3,1,0) | cc(0,0,1) ... cc(3,0,1) | ... | cc(0,1,2) ... cc(3,1,2) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 M 2M-1 2M 3M-1 (2L-1)M 2LM-1 * ``` * * @private @@ -106,6 +108,30 @@ * @param {integer} stride - stride length of the input array * @param {NonNegativeInteger} offset - index specifying the first indexed element in the input array * @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = iptr( 0, 0, 0, M, stride, offset ); +* // returns 0 +* +* idx = iptr( 1, 0, 0, M, stride, offset ); +* // returns 1 +* +* idx = iptr( M-1, 0, 0, M, stride, offset ); +* // returns 3 +* +* idx = iptr( 0, 1, 0, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = iptr( M-1, 1, L-1, M, stride, offset ); +* // returns 23 */ function iptr( i, j, k, M, stride, offset ) { var n = i + ( ( j+(k*2) ) * M ); @@ -142,6 +168,8 @@ function iptr( i, j, k, M, stride, offset ) { * * ```text * | out(0,0,0)...out(3,0,0) ... out(0,2,0)...out(3,2,0) | out(0,0,1)...out(3,0,1) ... out(0,2,1)...out(3,2,1) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 LM LM-1 LM (L+1)M-1 (2L-1)M 2LM-1 * ``` * * As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `ch` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. @@ -157,6 +185,30 @@ function iptr( i, j, k, M, stride, offset ) { * @param {integer} stride - stride length of the output array * @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array * @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = optr( 0, 0, 0, L, M, stride, offset ); +* // returns 0 +* +* idx = optr( 1, 0, 0, L, M, stride, offset ); +* // returns 1 +* +* idx = optr( M-1, 0, 0, L, M, stride, offset ); +* // returns 3 +* +* idx = optr( 0, 1, 0, L, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = optr( M-1, L-1, 1, L, M, stride, offset ); +* // returns 23 */ function optr( i, k, j, L, M, stride, offset ) { var n = i + ( ( k+(j*L) ) * M ); From e1e4446be7ac7f765483b87f80330230339325e8 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 19:14:21 -0700 Subject: [PATCH 068/102] docs: add comments --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/radb2.js | 124 +++++++++++++----- 1 file changed, 88 insertions(+), 36 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 6e7f37d6405f..b15080a0f211 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -67,7 +67,7 @@ * * ## Notes * -* When transforming an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the real and imaginary parts of a folded complex vector and where each "column" has `M` elements. +* When transforming an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the even and odd half-spectrum of a folded complex vector (with real and imaginary parts of each half-spectrum interleaved along each sub-sequence) and where each "column" has `M` elements. * * Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: * @@ -89,7 +89,7 @@ * In the above, * * - `i` is the fastest varying index, which walks within one short "column" sub-sequence. -* - `j` selects between the even and odd half-spectra (i.e., the real or imaginary part of a folded complex vector). +* - `j` selects between the even and odd half-spectra. * - `k` specifies the index of one of the `L` independent transforms we are processing. * * In linear memory, the three-dimensional logical view is arranged as follows: @@ -143,7 +143,7 @@ function iptr( i, j, k, M, stride, offset ) { * * ## Notes * -* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" corresponding to the two parts of the butterfly (`even + odd` and `even - odd`, respectively) and where each "row" has `M*L` elements. +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" corresponding to the two parts of the butterfly (`even + odd` and `even - odd`, respectively) and where each "row" is arranged as `M*L` contiguous elements. * * Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: * @@ -169,10 +169,10 @@ function iptr( i, j, k, M, stride, offset ) { * ```text * | out(0,0,0)...out(3,0,0) ... out(0,2,0)...out(3,2,0) | out(0,0,1)...out(3,0,1) ... out(0,2,1)...out(3,2,1) | * ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ -* 0 M-1 LM LM-1 LM (L+1)M-1 (2L-1)M 2LM-1 +* 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 * ``` * -* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `ch` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `ch` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. * * Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. * @@ -219,7 +219,7 @@ function optr( i, k, j, L, M, stride, offset ) { // MAIN // /** -* Performs the backward Fourier radix-2 transform for a real-valued sequence. +* Performs one radix-2 stage within a backward Fourier transform for a real-valued sequence. * * @private * @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed @@ -241,21 +241,21 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride var it1; var it2; var io; - var ic; + var im; var sc = 1; // FIXME: make a parameter var so = 1; // FIXME: make a parameter var i; var k; /* - * Perform the core butterfly for each sub-sequence being transformed. + * First, perform the core butterfly for each sub-sequence being transformed. * * In the following loop, we combine two half-length complex vectors. * - * cc(:, 0, k) holds Re(X_even) + j Im(X_even) - * cc(:, 1, k) holds Re(X_odd) + j Im(X_odd) + * cc(0, 0, k) holds the even half-spectrum: Re(X_even) + j Im(X_even) => [Re0, Im0, Re1, Im1, ...] + * cc(M-1, 1, k) holds the odd half-spectrum: Re(X_odd) + j Im(X_odd) => [Re0, Im0, Re1, Im1, ...] * - * For a radix-2 backward FFT, the twiddle factor for the first column is +1, so we can compute to real outputs with just + * For a radix-2 backward FFT, the twiddle factor for the first column is +1, so we can compute two real outputs with just * * out(even) = even + odd * out(odd) = even - odd @@ -270,57 +270,109 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride io = optr( 0, k, 1, L, M, so, oo ); out[ io ] = cc[ ip1 ] - cc[ ip2 ]; // out(odd) = even - odd } - // FIXME: describe why this check is necessary + // When the number of elements in a sub-sequence is less than `2`, there is nothing more to do, as the above butterfly produced the full result... if ( M < 2 ) { return; } - - if ( M !== 2 ) { + /* + * Next, apply the general case where we need to loop through the non-trivial harmonics of each complex sub-vector. + * + * While this function performs an FFT on a real-valued sequence, we should note that the Fourier transform of a real sequence is not actually real. Instead, the transform is a complex sequence with a special symmetry: + * + * X[im] = conj(X[i]) + * + * where `i` is the index of a real component, `im = M-i` is the real component's "mirror" index, and `conj` refers to the complex conjugate. + * + * A sequence with this symmetry is called **conjugate-complex** or **half-complex**. This symmetry subsequently implies that only half of the complex numbers in the output actually need to be stored, with the remaining half being constructed according to the symmetry condition. + * + * cc( i,0,k) = Re(E_n) <= real part of even half-spectrum at bin `n` + * cc( i+1,0,k) = Im(E_n) + * cc(im-1,1,k) = Re(O_n) <= real part of odd half-spectrum at bin `n` + * cc( im,1,k) = -Im(O_n) (stored as conjugate) + * + * where `n = (i/2)-1` and the twiddle factor for the odd part is + * + * W_n = cos(θ) - j sin(θ), θ = nπ/M + * + * In the following nested loops, we only load each symmetry pair once, combine them, and then multiply by pre-computed twiddle factors (i.e., sines and cosines) which are stored in `twiddles`. + */ + if ( M >= 3 ) { MP1 = M + 1; - // FIXME: describe what is happening in the loops below + // Loop over each sub-subsequence to be transformed... for ( k = 0; k < L; k++ ) { + // Loop over the elements in each sub-sequence... for ( i = 2; i < M; i += 2 ) { - ic = MP1 - i; + im = MP1 - i; // "mirror" index => Re/Im(O_n) - ip1 = iptr( i, 0, k, M, sc, oc ); - ip2 = iptr( ic-1, 1, k, M, sc, oc ); - tr2 = cc[ ip1 ] - cc[ ip2 ]; + // Load the real parts... + ip1 = iptr( i, 0, k, M, sc, oc ); // a = Re(E_n) + ip2 = iptr( im-1, 1, k, M, sc, oc ); // c = Re(O_n) "mirror" component + tr2 = cc[ ip1 ] - cc[ ip2 ]; // a - c (difference of real components) - io = optr( i, k, 0, L, M, so, oo ); - out[ io ] = cc[ ip1 ] + cc[ ip2 ]; + /* + * `even + odd` part of the butterfly. + * + * x[2n] = E_n + O_n + * + * with `x[⋅]` representing the sample of the time-domain signal. + */ + io = optr( i, k, 0, L, M, so, oo ); // Re(x[2n]) + out[ io ] = cc[ ip1 ] + cc[ ip2 ]; // a + c - ip1 = iptr( i+1, 0, k, M, sc, oc ); - ip2 = iptr( ic, 1, k, M, sc, oc ); - ti2 = cc[ ip1 ] + cc[ ip2 ]; + // Load the imaginary parts... + ip1 = iptr( i+1, 0, k, M, sc, oc ); // b = Im(E_n) + ip2 = iptr( im, 1, k, M, sc, oc ); // -d = -Im(O_n) (stored conjugate) + ti2 = cc[ ip1 ] + cc[ ip2 ]; // b + d (sum of imaginary components) - io = optr( i+1, k, 0, L, M, so, oo ); - out[ io ] = cc[ ip1 ] - cc[ ip2 ]; + io = optr( i+1, k, 0, L, M, so, oo ); // Im(x[2n]) + out[ io ] = cc[ ip1 ] - cc[ ip2 ]; // b - d - it1 = i - 1 + ot; - it2 = i + ot; + /* + * `even - odd` part of the butterfly. + * + * x[2n+1] = (E_n - O_n) * W_n, W_n = e^{-jπn/M} + * + * where + * + * E_n - O_n = (a-c) + j(b+d) = tr2 + j ti2 + * W_n = cos(θ) - j sin(θ) + * ↑ ↑ + * cos twiddle sine twiddle + */ + it1 = i - 1 + ot; // cos(θ) + it2 = i + ot; // sin(θ) - io = optr( i, k, 1, L, M, so, oo ); - out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); + io = optr( i, k, 1, L, M, so, oo ); // Re(x[2n+1]) + out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); // real part - io = optr( i+1, k, 1, L, M, so, oo ); - out[ io ] = ( twiddles[ it1 ] * ti2 ) + ( twiddles[ it2 ] * tr2 ); + io = optr( i+1, k, 1, L, M, so, oo ); // Im(x[2n+1]) + out[ io ] = ( twiddles[ it1 ] * ti2 ) + ( twiddles[ it2 ] * tr2 ); // imaginary part } } - // FIXME: explain why we are checking whether `M` is odd + // When `M` is odd, there is no Nyquist pair to process, and, thus, the central element is purely real and was handled in the very first butterfly, so we do not need to perform any further transformations... if ( M%2 === 1 ) { return; } } - // FIXME: describe what is happening here + /* + * Lastly, handle the Nyquist frequency where `i = M-1` (i.e., the last element of each sub-sequence). + * + * When `M` is even, the Nyquist index is `i = M/2`. In this stage, we've stored that element at the end of each sub-sequence (i.e., `i = M-1` in the packed layout). + * + * At this point, the cosine term is ±1, and the sine term is 0, so the twiddle multiplication collapses to simple addition/subtraction. + * + * out(even, i) = 2 * Re(cc(i,0,k)) + * out(odd, i) = -2 * Im(cc(0,1,k)) + */ for ( k = 0; k < L; k++ ) { ip1 = iptr( M-1, 0, k, M, sc, oc ); io = optr( M-1, k, 0, L, M, so, oo ); - out[ io ] = cc[ ip1 ] + cc[ ip1 ]; + out[ io ] = cc[ ip1 ] + cc[ ip1 ]; // 2 * Re(cc(i,0,k)) ip1 = iptr( 0, 1, k, M, sc, oc ); io = optr( M-1, k, 1, L, M, so, oo ); - out[ io ] = -( cc[ ip1 ] + cc[ ip1 ] ); + out[ io ] = -( cc[ ip1 ] + cc[ ip1 ] ); // -2 * Im(cc(0,1,k)) } } From 3cff9af7d9da4388317dae8f34763cb02e7d6278 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 19:19:53 -0700 Subject: [PATCH 069/102] refactor: add support for strides --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/radb2.js | 11 ++++++----- .../@stdlib/fft/base/fftpack/lib/rfftb1.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index b15080a0f211..0d9fdd764e7c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -225,14 +225,17 @@ function optr( i, k, j, L, M, stride, offset ) { * @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed * @param {NonNegativeInteger} L - number of sub-sequences to be transformed * @param {Float64Array} cc - input array containing the sub-sequences to be transformed +* @param {integer} sc - stride length for `cc` * @param {NonNegativeInteger} oc - offset for `cc` * @param {Float64Array} out - output array containing transformed sub-sequences +* @param {integer} so - stride length for `out` * @param {NonNegativeInteger} oo - offset for `out` * @param {Float64Array} twiddles - array of twiddle factors +* @param {integer} st - stride length for `twiddles` * @param {NonNegativeInteger} ot - offset for `twiddles` * @returns {void} */ -function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support strides +function radb2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-disable-line max-params var MP1; var tr2; var ti2; @@ -242,8 +245,6 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride var it2; var io; var im; - var sc = 1; // FIXME: make a parameter - var so = 1; // FIXME: make a parameter var i; var k; @@ -340,8 +341,8 @@ function radb2( M, L, cc, oc, out, oo, twiddles, ot ) { // FIXME: support stride * ↑ ↑ * cos twiddle sine twiddle */ - it1 = i - 1 + ot; // cos(θ) - it2 = i + ot; // sin(θ) + it1 = ( (i-1)*st ) + ot; // cos(θ) + it2 = ( i*st ) + ot; // sin(θ) io = optr( i, k, 1, L, M, so, oo ); // Re(x[2n+1]) out[ io ] = ( twiddles[ it1 ] * tr2 ) - ( twiddles[ it2 ] * ti2 ); // real part diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js index 440aebd21edd..364b28f6d2e4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js @@ -129,7 +129,7 @@ function rfftb1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { FLG = 1 - FLG; break; case 2: - radb2( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset ); + radb2( ido, l1, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset ); FLG = 1 - FLG; break; case 3: From ca0887de5c147b2cbaeda93ee80a56f09101fe6c Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Jun 2025 19:24:54 -0700 Subject: [PATCH 070/102] docs: fix comment --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 0d9fdd764e7c..30072f0b38c7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -172,7 +172,7 @@ function iptr( i, j, k, M, stride, offset ) { * 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 * ``` * -* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `ch` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radb2` being only one stage in a multi-stage driver which alternates between using `cc` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. * * Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. * From 6aedb5612d0a61a3019fd05745df037b6777ffd5 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 13 Jun 2025 20:23:13 -0700 Subject: [PATCH 071/102] chore: refactor and add docs --- 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 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: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/cfftb.js | 35 +- .../@stdlib/fft/base/fftpack/lib/radb2.js | 8 +- .../@stdlib/fft/base/fftpack/lib/radf2.js | 298 +++++++++++++----- .../@stdlib/fft/base/fftpack/lib/rfftb.js | 3 +- .../@stdlib/fft/base/fftpack/lib/rfftf.js | 5 +- .../@stdlib/fft/base/fftpack/lib/rfftf1.js | 2 +- .../@stdlib/fft/base/fftpack/lib/rffti.js | 75 ++++- .../@stdlib/fft/base/fftpack/lib/rffti1.js | 101 ++++-- .../fft/base/fftpack/test/test.rfft.js | 2 +- 9 files changed, 380 insertions(+), 149 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js index 3ae57d1bc986..ec2d606855a5 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js @@ -110,42 +110,11 @@ function cfftb( N, c, offsetC, workspace, offsetW ) { var offsetT; var offsetF; + // When a sub-sequence is a single data point, the FFT is the identity, so no transformation necessary... if ( N <= 1 ) { - // FFT of one data point is the identity... return; } - - // TODO: roll the above comment into the extended description above; or perhaps, better yet, create a README file in the `/lib` folder providing a high level overview to the implementation, as the content below also applies to the `rfft*` variants, as well, albeit with slightly different storage requirements. - - /* - * The workspace array is divided into three sections: - * - * [ intermediate_results | twiddle_factors | factors ] - * - * The first two sections each contain `2*N` elements. - * - * Twiddle factors are small, reusable complex-exponential constants that appear inside each "butterfly" stage of a Cooley–Tukey–style FFT. Formally, - * - * ```tex - * W_N^k = e^{-2\pi ik/N} - * ``` - * - * is an N-th root of unity, and every arithmetic step in a radix-2 FFT multiplies one intermediate value by some - * - * ```tex - * W_N^k - * ``` - * - * Because these constants only depend on the transform length `N` (and **not** on the input data), we can pre-compute and store them once, then "twiddle" them (i.e., reuse them with different indices) as we proceed through the factorization. - * - * As a quick aside regarding the name "twiddle", early FFT papers (notably Gentleman & Sande, 1966) described how you "twiddle" one branch of each butterfly by a complex rotation before adding/subtracting. The coefficients themselves inherited the nickname "twiddle factors," and the term stuck. - * - * In the context, of this implementation, apart from the intermediate FFT results, the workspace stores the sine/cosine pairs that make up all required \\( W_N^K \\) (i.e., the "twiddle factors") and a small table of radix factors (i.e., the factorization of `N`). - * - * By reusing the workspace array when computing multiple transforms of the same length `N`, every subsequent `*f` (forward) or `*b` (backward) call simply looks up the pre-stored twiddle factors instead of recomputing sine and cosine on-the-fly. - * - * In short, twiddle factors are cached roots of unity that allow each stage of the algorithm to rotate data quickly and predictably. - */ + // Resolve the starting indices for storing twiddle factors and factorization results: offsetT = offsetW + ( 2*N ); // index offset for twiddle factors offsetF = offsetT + ( 2*N ); // index offset for factors describing the sub-transforms diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js index 30072f0b38c7..a97c7d12b33b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js @@ -226,13 +226,13 @@ function optr( i, k, j, L, M, stride, offset ) { * @param {NonNegativeInteger} L - number of sub-sequences to be transformed * @param {Float64Array} cc - input array containing the sub-sequences to be transformed * @param {integer} sc - stride length for `cc` -* @param {NonNegativeInteger} oc - offset for `cc` +* @param {NonNegativeInteger} oc - index offset for `cc` * @param {Float64Array} out - output array containing transformed sub-sequences * @param {integer} so - stride length for `out` -* @param {NonNegativeInteger} oo - offset for `out` -* @param {Float64Array} twiddles - array of twiddle factors +* @param {NonNegativeInteger} oo - index offset for `out` +* @param {Float64Array} twiddles - array containing twiddle factors * @param {integer} st - stride length for `twiddles` -* @param {NonNegativeInteger} ot - offset for `twiddles` +* @param {NonNegativeInteger} ot - index offset for `twiddles` * @returns {void} */ function radb2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-disable-line max-params diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 0364c31a98d4..08017876c703 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -65,53 +65,180 @@ /** * Resolves an index into the input array. * +* ## Notes +* +* In a forward real FFT, the previous stage writes its results as two "rows" per sub-sequence. +* +* Thus, when reading from an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" (`even + odd` and `even - odd`, respectively) and where each "row" is arranged as `M*L` contiguous elements corresponding to interleaved real and imaginary components. +* +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: +* +* ```text +* │ k = 0 k = 1 k = 2 +* │ ──────────────────────────────────────────────────────────────────────────→ k +* j = 0 (even+odd) │ cc(0,0,0) ... cc(3,0,0) cc(0,1,0) ... cc(3,1,0) cc(0,2,0) ... cc(3,2,0) +* │ +* j = 1 (even-odd) │ cc(0,0,1) ... cc(3,0,1) cc(0,1,1) ... cc(3,1,1) cc(0,2,1) ... cc(3,2,1) +* └───────────────────────────────────────────────────────────────────────────→ i +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 0 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to either the `even + odd` or `even - odd` row of the previous stage. +* - `j` selects between the `even + odd` and `even - odd` row of the previous stage. +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | cc(0,0,0)...cc(3,0,0) ... cc(0,2,0)...cc(3,2,0) | cc(0,0,1)...cc(3,0,1) ... cc(0,2,1)...cc(3,2,1) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 +* ``` +* * @private -* @param {NonNegativeInteger} a1 - first parameter -* @param {NonNegativeInteger} a2 - second parameter -* @param {NonNegativeInteger} a3 - third parameter -* @param {NonNegativeInteger} l1 - fourth parameter -* @param {NonNegativeInteger} ido - fifth parameter -* @param {NonNegativeInteger} offset - index offset -* @returns {NonNegativeInteger} index +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} j - input row +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the input array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = iptr( 0, 0, 0, L, M, stride, offset ); +* // returns 0 +* +* idx = iptr( 1, 0, 0, L, M, stride, offset ); +* // returns 1 +* +* idx = iptr( M-1, 0, 0, L, M, stride, offset ); +* // returns 3 +* +* idx = iptr( 0, 1, 0, L, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = iptr( M-1, L-1, 1, L, M, stride, offset ); +* // returns 23 */ -function iptr( a1, a2, a3, l1, ido, offset ) { // FIXME: update with more descriptive parameter descriptions - return ( ( (a3*l1) + a2) * ido ) + a1 + offset; // FIXME: support strides +function iptr( i, k, j, L, M, stride, offset ) { + var n = i + ( ( k+(j*L) ) * M ); + return ( n*stride ) + offset; } /** * Resolves an index into the output array. * +* ## Notes +* +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "columns" corresponding to the even and odd half-spectrum of a folded complex vector (with real and imaginary parts of each half-spectrum interleaved along each sub-sequence) and where each "column" has `M` elements. +* +* Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: +* +* ```text +* j = 0 ("even" column) j = 1 ("odd" column) +* k = 0 ─┬───────────────────────────────────────┬───────────────────────────────────────┐ +* │ out(0,0,0) out(1,0,0) ... out(3,0,0) │ out(0,1,0) out(1,1,0) ... out(3,1,0) │ +* └───────────────────────────────────────┴───────────────────────────────────────┤ +* k = 1 ─┬───────────────────────────────────────┬───────────────────────────────────────┤ +* │ out(0,0,1) out(1,0,1) ... out(3,0,1) │ out(0,1,1) out(1,1,1) ... out(3,1,1) │ +* └───────────────────────────────────────┴───────────────────────────────────────┤ +* k = 2 ─┬───────────────────────────────────────┬───────────────────────────────────────┤ +* │ out(0,0,2) out(1,0,2) ... out(3,0,2) │ out(0,1,2) out(1,1,2) ... out(3,1,2) │ +* └───────────────────────────────────────┴───────────────────────────────────────┘ +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 1 M-1 0 1 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short "column" sub-sequence. +* - `j` selects between the even (0) and odd (1) column. +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | out(0,0,0)...out(3,0,0) | out(0,1,0)...out(3,1,0) | out(0,0,1)...out(3,0,1) | ... | out(0,1,2)...out(3,1,2) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 M 2M-1 2M 3M-1 (2L-1)M 2LM-1 +* ``` +* +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radf2` being only one stage in a multi-stage driver which alternates between using `cc` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* +* Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. +* * @private -* @param {NonNegativeInteger} a1 - first parameter -* @param {NonNegativeInteger} a2 - second parameter -* @param {NonNegativeInteger} a3 - third parameter -* @param {NonNegativeInteger} ido - fourth parameter -* @param {NonNegativeInteger} offset - index offset -* @returns {NonNegativeInteger} index +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} j - index specifying which of the two complex halves we are in (either `0` or `1`) +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the output array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = optr( 0, 0, 0, M, stride, offset ); +* // returns 0 +* +* idx = optr( 1, 0, 0, M, stride, offset ); +* // returns 1 +* +* idx = optr( M-1, 0, 0, M, stride, offset ); +* // returns 3 +* +* idx = optr( 0, 1, 0, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = optr( M-1, 1, L-1, M, stride, offset ); +* // returns 23 */ -function optr( a1, a2, a3, ido, offset ) { // FIXME: update with more descriptive parameter descriptions - return ( ( (a3*2) + a2) * ido ) + a1 + offset; // FIXME: support strides +function optr( i, j, k, M, stride, offset ) { + var n = i + ( ( j+(k*2) ) * M ); + return ( n*stride ) + offset; } // MAIN // /** -* Performs the forward Fourier transform of length 2 for real-valued sequences. +* Performs one radix-2 stage within a forward Fourier transform for a real-valued sequence. * * @private -* @param {NonNegativeInteger} ido - number of real values for each transform -* @param {NonNegativeInteger} l1 - length of the input sequences -* @param {Float64Array} cc - input array containing the sequences to be transformed -* @param {NonNegativeInteger} offsetCC - offset for `cc` -* @param {Float64Array} out - output array for storing transformed sequences -* @param {NonNegativeInteger} offsetOut - offset for `out` +* @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed +* @param {NonNegativeInteger} L - number of sub-sequences to be transformed +* @param {Float64Array} cc - input array containing the sub-sequences to be transformed +* @param {integer} sc - stride length for `cc` +* @param {NonNegativeInteger} oc - index offset for `cc` +* @param {Float64Array} out - output array containing transformed sub-sequences +* @param {integer} so - stride length for `out`` +* @param {NonNegativeInteger} oo - index offset for `out` * @param {Float64Array} twiddles - array containing twiddle factors -* @param {NonNegativeInteger} offsetT - index offset for `twiddles` +* @param {integer} st - stride length for `twiddles` +* @param {NonNegativeInteger} ot - index offset for `twiddles` * @returns {void} */ -function radf2( ido, l1, cc, offsetCC, out, offsetOut, twiddles, offsetT ) { // FIXME: support strides - var idp2; +function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-disable-line max-params + var MP1; var tr2; var ti2; var ip1; @@ -119,73 +246,102 @@ function radf2( ido, l1, cc, offsetCC, out, offsetOut, twiddles, offsetT ) { // var it1; var it2; var io; - var ic; + var im; var i; var k; - // Adjust offsets: // FIXME: why are these adjustments necessary? Describe here what is happening. - offsetOut -= 1 + ( ido*3 ); - offsetCC -= 1 + ( ido*(1+l1) ); + /* + * First, perform the core butterfly for each sub-sequence being transformed. + * + * In the following loop, we FIXME: ???? - // FIXME: describe what is happening below - for ( k = 1; k <= l1; k++ ) { - ip1 = iptr( 1, k, 1, l1, ido, offsetCC ); - ip2 = iptr( 1, k, 2, l1, ido, offsetCC ); + * Input rows (length-M complex vectors, Re/Im interleaved): + * + * row0 = even + odd = [a0, b0, a1, b1, …] + * row1 = even − odd = [c0, d0, c1, d1, …] + * + * For n = 0 (elements i = 0,1) the twiddle factor is +1, so + * + * E₀ = ½(row0 + row1) and O₀ = ½(row0 − row1) + * + * The forward radix-2 butterfly stores two **columns**: + * + * CH(1,1,K) ← row0 + row1 ⟶ optr( 0 , 0, k, … ) + * CH(IDO,2,K) ← row0 − row1 ⟶ optr( M-1 , 1, k, … ) + * + * i.e. column j = 0 holds “even + odd” starting at i = 0, + * column j = 1 holds “even − odd” starting at i = M-1. + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( 0, k, 0, L, M, sc, oc ); // real part row 0 + ip2 = iptr( 0, k, 1, L, M, sc, oc ); // real part row 1 - io = optr( 1, 1, k, ido, offsetOut ); - out[ io ] = cc[ ip1 ] + cc[ ip2 ]; + io = optr( 0, 0, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + cc[ ip2 ]; // even + odd - io = optr( ido, 2, k, ido, offsetOut ); - out[ io ] = cc[ ip1 ] - cc[ ip2 ]; + io = optr( M-1, 1, k, M, so, oo ); + out[ io ] = cc[ ip1 ] - cc[ ip2 ]; // even - odd } - // FIXME: describe why this check is necessary - if ( ido < 2 ) { + // When the number of elements in a sub-sequence is less than `2`, there is nothing more to do, as the above butterfly produced the full result... + if ( M < 2 ) { return; } - if ( ido !== 2 ) { - idp2 = ido + 2; + /* + * Next, apply the general case where we need to loop through the non-trivial harmonics of each complex sub-vector. + * + * // FIXME: complete extended description + */ + if ( M >= 3 ) { + MP1 = M + 1; - // FIXME: describe what is happening in the loops below - for ( k = 1; k <= l1; k++ ) { - for ( i = 3; i <= ido; i += 2 ) { - ic = idp2 - i; + // Loop over each sub-subsequence to be transformed... + for ( k = 0; k < L; k++ ) { + // Loop over the elements in each sub-sequence... + for ( i = 2; i < M; i += 2 ) { + im = MP1 - i; // "mirror" index => ???? - it1 = i - 2 + offsetT; - it2 = i - 1 + offsetT; + it1 = ( (i-1)*st ) + ot; // ???? + it2 = ( i*st ) + ot; // ???? - ip1 = iptr( i-1, k, 2, l1, ido, offsetCC ); - ip2 = iptr( i, k, 2, l1, ido, offsetCC ); - tr2 = ( twiddles[ it1 ] * cc[ ip1 ] ) + ( twiddles[ it2 ] * cc[ ip2 ] ); - ti2 = ( twiddles[ it1 ] * cc[ ip2 ] ) - ( twiddles[ it2 ] * cc[ ip1 ] ); + ip1 = iptr( i, k, 1, L, M, sc, oc ); // ???? + ip2 = iptr( i+1, k, 1, L, M, sc, oc ); // ???? + tr2 = ( twiddles[ it1 ] * cc[ ip1 ] ) + ( twiddles[ it2 ] * cc[ ip2 ] ); // ???? + ti2 = ( twiddles[ it1 ] * cc[ ip2 ] ) - ( twiddles[ it2 ] * cc[ ip1 ] ); // ???? - ip1 = iptr( i, k, 1, l1, ido, offsetCC ); - io = optr( i, 1, k, ido, offsetOut ); - out[ optr ] = cc[ ip1 ] + ti2; + ip1 = iptr( i+1, k, 0, L, M, sc, oc ); // ???? + io = optr( i+1, 0, k, M, so, oo ); // ???? + out[ io ] = cc[ ip1 ] + ti2; // ???? - io = optr( ic, 2, k, ido, offsetOut ); - out[ io ] = ti2 - cc[ ip1 ]; + io = optr( im, 1, k, M, so, oo ); // ???? + out[ io ] = ti2 - cc[ ip1 ]; // ???? - ip1 = iptr( i-1, k, 1, l1, ido, offsetCC ); - io = optr( i-1, 1, k, ido, offsetOut ); - out[ io ] = cc[ ip1 ] + tr2; + ip1 = iptr( i, k, 0, L, M, sc, oc ); // ???? + io = optr( i, 0, k, M, so, oo ); // ???? + out[ io ] = cc[ ip1 ] + tr2; // ???? - io = optr( ic-1, 2, k, ido, offsetOut ); - out[ io ] = cc[ ip1 ] - tr2; + io = optr( im-1, 1, k, M, so, oo ); // ???? + out[ io ] = cc[ ip1 ] - tr2; // ???? } } - // FIXME: explain why we are checking whether `ido` is odd - if ( ido%2 === 1 ) { + // When `M` is odd, there is no Nyquist pair to process, and, thus, the central element is purely real and was handled in the very first butterfly, so we do not need to perform any further transformations... + if ( M%2 === 1 ) { return; } } - // FIXME: describe what is happening here - for ( k = 1; k <= l1; k++ ) { - ip1 = iptr( ido, k, 2, l1, ido, offsetCC ); - io = optr( 1, 2, k, ido, offsetOut ); + /* + * Lastly, handle the Nyquist frequency where `i = M-1` (i.e., the last element of each sub-sequence). + * + * When `M` is even, the Nyquist index is `i = M/2`. In this stage, we've stored that element at the end of each sub-sequence (i.e., `i = M-1` in the packed layout). + * + * At this point, FIXME: ???? + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( M-1, k, 1, L, M, sc, oc ); + io = optr( 0, 1, k, M, so, oo ); out[ io ] = -cc[ ip1 ]; - ip1 = iptr( ido, k, 1, l1, ido, offsetCC ); - io = optr( ido, 1, k, ido, offsetOut ); + ip1 = iptr( M-1, k, 0, L, M, sc, oc ); + io = optr( M-1, 0, k, M, so, oo ); out[ io ] = cc[ ip1 ]; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js index 00f6cd88f2a6..a435df1cd4c0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js @@ -79,10 +79,11 @@ function rfftb( N, r, offsetR, workspace, offsetW ) { var offsetT; var offsetF; + // When a sub-sequence is a single data point, the FFT is the identity, so no transformation necessary... if ( N === 1 ) { - // FFT of one data point is the identity... return; } + // Resolve the starting indices for storing twiddle factors and factorization results: offsetT = offsetW + N; // index offset for twiddle factors offsetF = offsetT + N; // index offset for factors describing the sub-transforms diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js index ccde23b93f1b..b1a85e7c6673 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js @@ -75,14 +75,15 @@ var rfftf1 = require( './rfftf1.js' ); * @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} */ -function rfftf( N, r, offsetR, workspace, offsetW ) { +function rfftf( N, r, offsetR, workspace, offsetW ) { // FIXME: add stride support var offsetT; var offsetF; + // When a sub-sequence is a single data point, the FFT is the identity, so no transformation necessary... if ( N === 1 ) { - // FFT of one data point is the identity... return; } + // Resolve the starting indices for storing twiddle factors and factorization results: offsetT = offsetW + N; // index offset for twiddle factors offsetF = offsetT + N; // index offset for factors describing the sub-transforms diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js index 03effe6c9080..e960afe06abc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js @@ -142,7 +142,7 @@ function rfftf1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { radf4( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset ); break; case 2: - radf2( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset ); + radf2( ido, l1, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset ); break; case 3: ix2 = iw + ido; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js index 69633ecaf3c1..db948e28ab44 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js @@ -66,25 +66,88 @@ var rffti1 = require( './rffti1.js' ); // MAIN // /** -* Initializes the workspace array for performing a real-valued Fourier transform. +* Initializes a workspace array for performing a real-valued Fourier transform. +* +* ## Notes +* +* The workspace array is divided into three sections: +* +* ```text +* size = N N 2+ceil(log2(N)/2) +* ↓ ↓ ↓ +* | scratch / workspace | twiddle factors | radix factor table | +* ↑ ↑ ↑ +* i = 0 ... N ... 2N ... +* ``` +* +* where +* +* - **scratch/workspace**: used as a scratch space when performing transforms. This section is not updated during initialization. +* - **twiddle factors**: a table of reusable complex-exponential constants stored as cosine/sine pairs. +* - **radix factor table**: a table containing the radix factorization of `N`. +* +* In general, a workspace array should have `2N + 34` indexed elements (as `log2(N)/2 ≤ 32` for all `2^64`). During initialization, only the sections for storing twiddle factors and the factorization of `N` are updated. +* +* > Note: FFTPACK only requires `2N+15`, but we increase that number here to accommodate larger workspace arrays, where `N` may exceed `2^30` indexed elements. +* +* The first two sections each contain `N` elements, while the last section contains the sequence length, the number of integer factors, and, at most, `ceil(log2(N)/2)` integer radix factors. +* +* The factorization section is comprised as follows: +* +* ```text +* | sequence_length | number_of_factors | integer_factors | +* ``` +* +* The sequence length and number of factors (`nf`) comprise a single element each. Only the first `nf` elements in the integer factors section are written to, with the rest being unused. +* +* As for twiddle factors, these are small, reusable complex-exponential constants that appear inside each "butterfly" stage of a Cooley–Tukey–style FFT. Every arithmetic step in an FFT multiplies one intermediate value by some +* +* ```tex +* W_N^k +* ``` +* +* where `W_N^k` is an N-th root of unity. Formally, in a forward FFT, +* +* ```tex +* W_N^k = e^{-2\pi ik/N} +* ``` +* +* In a backward FFT, +* +* ```tex +* W_N^k = e^{+2\pi ik/N} +* ``` +* +* As may be observed, `W_N^k` for forward and backward FFTs is the same, except the sign of the exponent is flipped. As a consequence, both real and backward FFT callers can reuse the same set of twiddle factors, with those performing a forward transform (e.g., `rfftf`) multiplying with `(cos,-sin)` and those performing a backward transform (e.g., `rfftb`) multiplying with `(cos,+sin)`. +* +* Because these constants only depend on the transform length `N` (and **not** on the input data), we can pre-compute and store them once, then "twiddle" them (i.e., reuse them with different indices) as we proceed through the factorization. +* +* > As a quick aside regarding the name "twiddle", early FFT papers (notably Gentleman & Sande, 1966) described how you "twiddle" one branch of each butterfly by a complex rotation before adding/subtracting. The coefficients themselves inherited the nickname "twiddle factors," and the term stuck. +* +* By reusing the workspace array when computing multiple transforms of the same length `N`, every subsequent `*f` (forward) or `*b` (backward) call can simply look up the pre-stored twiddle factors instead of recomputing sine and cosine on-the-fly. +* +* In short, twiddle factors are cached roots of unity that allow each stage of the algorithm to rotate data quickly and predictably. * * @param {NonNegativeInteger} N - length of the sequence to transform * @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` * @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} */ -function rffti( N, workspace, offsetW ) { // FIXME: add support for stride +function rffti( N, workspace, strideW, offsetW ) { var offsetT; var offsetF; + // When a sub-sequence is a single data point, the FFT is the identity, so no initialization necessary... if ( N === 1 ) { - // FFT of one data point is the identity, so no initialization necessary... return; } - offsetT = offsetW + N; // index offset for twiddle factors - offsetF = offsetT + N; // index offset for factors describing the sub-transforms + // Resolve the starting indices for storing twiddle factors and factorization results: + offsetT = offsetW + ( N*strideW ); // index offset for twiddle factors + offsetF = offsetT + ( N*strideW ); // index offset for factorization results - rffti1( N, workspace, offsetT, workspace, offsetF ); + // Initialize a provided workspace array: + rffti1( N, workspace, strideW, offsetT, workspace, strideW, offsetF ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js index 3a379a8dd40d..d9f218681fcf 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js @@ -80,59 +80,100 @@ var TRIAL_FACTORS = [ 4, 2, 3, 5 ]; * @private * @param {NonNegativeInteger} N - length of the sequence * @param {Collection} twiddles - array of twiddle factors -* @param {NonNegativeInteger} offsetT - starting index for twiddles -* @param {Collection} factors - array containing factorization information -* @param {NonNegativeInteger} offsetF - starting index for factors +* @param {integer} strideT - stride length for `twiddles` +* @param {NonNegativeInteger} offsetT - starting index for `twiddles` +* @param {Collection} factors - array containing a radix factorization +* @param {integer} strideF - stride length for `factors` +* @param {NonNegativeInteger} offsetF - starting index for `factors` * @returns {void} */ -function rffti1( N, twiddles, offsetT, factors, offsetF ) { // FIXME: accommodate strides for twiddles and factors +function rffti1( N, twiddles, strideT, offsetT, factors, strideF, offsetF ) { + var factor; var argld; var argh; - var ido; - var arg; + var fidx; var nf; - var ip; - var is; - var ii; - var ld; var fi; var l2; var l1; + var ld; + var st; + var it; + var im; + var M; + var m; var k; var j; - var i; - // Decompose the sequence length into its prime factors: - nf = decompose( N, TRIAL_FACTORS, factors, 1, offsetF ); // FIXME: allow non-unit stride + // Decompose the sequence length into its radix factors: + nf = decompose( N, TRIAL_FACTORS, factors, strideF, offsetF ); + + // If the number of radix factors is `1`, the only twiddle factor we need is `W_N^0 = 1`, which the main transform kernels already hard-code, so nothing to pre-compute... if ( nf-1 === 0 ) { return; } - - // FIXME: document this loop sequence + // Compute the master angular step (i.e., the basic angle that generates all twiddles): argh = TWO_PI / N; - is = 0; + + // Define the location of the first sine term we want to compute: + im = 3; + + // Initialize a running product of factors already processed: l1 = 1; - for ( k = 1; k < nf; k++ ) { - ip = factors[ offsetF+k+1 ]; // FIXME: adjust for a stride in factors + + // Compute the index of the first radix factor: + fidx = offsetF + ( 2*strideF ); + + // Compute the stride length for each cosine/sine pair: + st = 2 * strideT; + + // Generate twiddle factors... + for ( k = 0; k < nf-1; k++ ) { + // Resolve the next radix factor: + factor = factors[ fidx ]; + + // Compute the length of the transform after including the current radix: + l2 = factor * l1; + + // Compute the number of the "butterfly wings" (at this stage, the data is viewed as a `factor`-point transform of sub-vectors of length `l1`; `M` describes how many such vectors fit in the full array of length `N`): + M = floor( N / l2 ); + + // Initialize a running offset used to step the angle: ld = 0; - l2 = ip * l1; - ido = floor( N / l2 ); - for ( j = 1; j < ip; j++ ) { + + // Iterate over each butterfly column within the current radix... + for ( j = 1; j < factor; j++ ) { + // Advance to the next column: ld += l1; - i = is; - argld = ld * argh; - fi = 0.0; - for ( ii = 3; ii <= ido; ii += 2 ) { - i += 2; + + // Compute the angle step for this column: + argld = ld * argh; // 2π ⋅ j ⋅ li / N, which is the j-th column's base angle + + // Initialize a counter which counts from `1` to `(M/2)-1` (i.e., all non-trivial harmonics): + fi = 1.0; + + // Compute the index of the sine term: + it = offsetT + ( im*strideT ); + + // Iterate over each non-trivial harmonic in the column (note: we skip the `m=0` and `m=1` (i.e., the first cosine/sine pair, the first harmonic `W_N^0 = cos(0) + j sin(0) = 1 + j⋅0` is trivial and hard-coded by transform kernels)... + for ( m = 2; m < M; m += 2 ) { + // Compute `(cos(fi*argld), sin(fi*argld))`: + sincos( fi*argld, twiddles, -strideT, it ); // note: `sincos` returns the sine and cosine, in that order, so we need to use a negative stride when assigning the values to `twiddles` to ensure that cosine comes before sine in the twiddles table + + // Update for the next harmonic: fi += 1.0; - arg = fi * argld; - // FIXME: adjust for a stride in twiddles - sincos( arg, twiddles, -1, offsetT+i+1 ); // note: cosine before sine + // Resolve the index of the next sine term: + it += st; } - is += ido; + // Advance `im` by the size of the current block, skipping the cosine/sine pairs we have just written: + im += M; } + // Update the running product of factors already processed: l1 = l2; + + // Resolve the index of the next radix factor: + fidx += strideF; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 750c8db8aaf5..05b858709e6a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -97,7 +97,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl } // TEST SUBROUTINES RFFTI,RFFTF AND RFFTB: - rffti( n, w, 0 ); + rffti( n, w, 1, 0 ); dt = TWO_PI / n; ns2 = floor( ( n + 1 ) / 2 ); if ( ns2 > 1 ) { From e848427c5c915cc3fbf1d54feb3f578d72b9dcac Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 14 Jun 2025 03:29:19 -0700 Subject: [PATCH 072/102] docs: add comments --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/lib/radf2.js | 98 +++++++++++-------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 08017876c703..47b1e4c2bfdd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -250,27 +250,20 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di var i; var k; - /* + /** * First, perform the core butterfly for each sub-sequence being transformed. * - * In the following loop, we FIXME: ???? - - * Input rows (length-M complex vectors, Re/Im interleaved): - * - * row0 = even + odd = [a0, b0, a1, b1, …] - * row1 = even − odd = [c0, d0, c1, d1, …] - * - * For n = 0 (elements i = 0,1) the twiddle factor is +1, so + * In the following loop, we handle harmonic `n = 0` for every transform. As described for `iptr`, the input array is interpreted as a three-dimensional array, containing two "rows" per sub-sequence. * - * E₀ = ½(row0 + row1) and O₀ = ½(row0 − row1) + * row0 = even + odd (j = 0) + * row1 = even - odd (j = 1) * - * The forward radix-2 butterfly stores two **columns**: + * For a radix-2 forward FFT of a real-valued signal `x` and `n = 0`, * - * CH(1,1,K) ← row0 + row1 ⟶ optr( 0 , 0, k, … ) - * CH(IDO,2,K) ← row0 − row1 ⟶ optr( M-1 , 1, k, … ) + * x[0] = row0 + row1 = 2⋅even + * x[M] = row0 - row1 = 2⋅odd * - * i.e. column j = 0 holds “even + odd” starting at i = 0, - * column j = 1 holds “even − odd” starting at i = M-1. + * Because `W_N^0 = 1`, no twiddle multiplication is necessary. */ for ( k = 0; k < L; k++ ) { ip1 = iptr( 0, k, 0, L, M, sc, oc ); // real part row 0 @@ -286,10 +279,19 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di if ( M < 2 ) { return; } - /* - * Next, apply the general case where we need to loop through the non-trivial harmonics of each complex sub-vector. + /** + * Next, apply the general case where we need to loop through the non-trivial harmonics. + * + * For each harmonic `n = 1, ..., M/2-1`, we need to + * + * - recover even/odd spectra from the two input rows. + * - multiply the odd part by the twiddle factor `W_n = cos(θ) - j sin(θ)`. + * - form the following + * + * x[2n] = E_n + W_n⋅O_n => column 0 + * x[2n+1] = E_n - W_n⋅O_n => column 1 * - * // FIXME: complete extended description + * The mirror index `im = M + 1 - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. */ if ( M >= 3 ) { MP1 = M + 1; @@ -298,49 +300,63 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di for ( k = 0; k < L; k++ ) { // Loop over the elements in each sub-sequence... for ( i = 2; i < M; i += 2 ) { - im = MP1 - i; // "mirror" index => ???? + im = MP1 - i; // "mirror" index - it1 = ( (i-1)*st ) + ot; // ???? - it2 = ( i*st ) + ot; // ???? + // Resolve twiddle factor indices: + it1 = ( (i-1)*st ) + ot; // cos(θ) + it2 = ( i*st ) + ot; // sin(θ) - ip1 = iptr( i, k, 1, L, M, sc, oc ); // ???? - ip2 = iptr( i+1, k, 1, L, M, sc, oc ); // ???? - tr2 = ( twiddles[ it1 ] * cc[ ip1 ] ) + ( twiddles[ it2 ] * cc[ ip2 ] ); // ???? - ti2 = ( twiddles[ it1 ] * cc[ ip2 ] ) - ( twiddles[ it2 ] * cc[ ip1 ] ); // ???? + // Load the `even-odd` row... + ip1 = iptr( i, k, 1, L, M, sc, oc ); // c = Re(row1) + ip2 = iptr( i+1, k, 1, L, M, sc, oc ); // d = Im(row1) - ip1 = iptr( i+1, k, 0, L, M, sc, oc ); // ???? - io = optr( i+1, 0, k, M, so, oo ); // ???? - out[ io ] = cc[ ip1 ] + ti2; // ???? + // tmp = W_n ⋅ (c + j⋅d) + tr2 = ( twiddles[ it1 ] * cc[ ip1 ] ) + ( twiddles[ it2 ] * cc[ ip2 ] ); // Re(tmp) + ti2 = ( twiddles[ it1 ] * cc[ ip2 ] ) - ( twiddles[ it2 ] * cc[ ip1 ] ); // Im(tmp) - io = optr( im, 1, k, M, so, oo ); // ???? - out[ io ] = ti2 - cc[ ip1 ]; // ???? + // Load the `even+odd` row... + ip1 = iptr( i+1, k, 0, L, M, sc, oc ); // b = Im(row0) + io = optr( i+1, 0, k, M, so, oo ); // Im(x[2n]) + out[ io ] = cc[ ip1 ] + ti2; - ip1 = iptr( i, k, 0, L, M, sc, oc ); // ???? - io = optr( i, 0, k, M, so, oo ); // ???? - out[ io ] = cc[ ip1 ] + tr2; // ???? + io = optr( im, 1, k, M, so, oo ); // Im(x[2n+1]) + out[ io ] = ti2 - cc[ ip1 ]; - io = optr( im-1, 1, k, M, so, oo ); // ???? - out[ io ] = cc[ ip1 ] - tr2; // ???? + ip1 = iptr( i, k, 0, L, M, sc, oc ); // a = Re(row0) + io = optr( i, 0, k, M, so, oo ); // Re(x[2n]) + out[ io ] = cc[ ip1 ] + tr2; + + io = optr( im-1, 1, k, M, so, oo ); // Re(x[2n+1]) + out[ io ] = cc[ ip1 ] - tr2; } } - // When `M` is odd, there is no Nyquist pair to process, and, thus, the central element is purely real and was handled in the very first butterfly, so we do not need to perform any further transformations... + // When `M` is odd, there is no Nyquist pair to process, so we do not need to perform any further transformations... if ( M%2 === 1 ) { return; } } - /* + /** * Lastly, handle the Nyquist frequency where `i = M-1` (i.e., the last element of each sub-sequence). * * When `M` is even, the Nyquist index is `i = M/2`. In this stage, we've stored that element at the end of each sub-sequence (i.e., `i = M-1` in the packed layout). * - * At this point, FIXME: ???? + * At this point, the cosine term is -1 and the sine term is 0, so the twiddle multiplication collapses to simple addition/subtraction. + * + * In this case, + * + * W_n⋅O_n = ±Re(O_n) + * + * where + * + * row0 = Re(E_n) + * row1 = -Re(O_n) */ for ( k = 0; k < L; k++ ) { - ip1 = iptr( M-1, k, 1, L, M, sc, oc ); + ip1 = iptr( M-1, k, 1, L, M, sc, oc ); // -Re(O_n) io = optr( 0, 1, k, M, so, oo ); - out[ io ] = -cc[ ip1 ]; + out[ io ] = -cc[ ip1 ]; // -(-Re(O_n)) = Re(O_n) - ip1 = iptr( M-1, k, 0, L, M, sc, oc ); + ip1 = iptr( M-1, k, 0, L, M, sc, oc ); // Re(E_n) io = optr( M-1, 0, k, M, so, oo ); out[ io ] = cc[ ip1 ]; } From 2dcaa44a889c3c50ae1b25bbf181e79fe815f4fe Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 14 Jun 2025 03:36:43 -0700 Subject: [PATCH 073/102] docs: fix comment style --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js index 47b1e4c2bfdd..17cbb175113c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js @@ -250,7 +250,7 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di var i; var k; - /** + /* * First, perform the core butterfly for each sub-sequence being transformed. * * In the following loop, we handle harmonic `n = 0` for every transform. As described for `iptr`, the input array is interpreted as a three-dimensional array, containing two "rows" per sub-sequence. @@ -279,7 +279,7 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di if ( M < 2 ) { return; } - /** + /* * Next, apply the general case where we need to loop through the non-trivial harmonics. * * For each harmonic `n = 1, ..., M/2-1`, we need to @@ -335,7 +335,7 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di return; } } - /** + /* * Lastly, handle the Nyquist frequency where `i = M-1` (i.e., the last element of each sub-sequence). * * When `M` is even, the Nyquist index is `i = M/2`. In this stage, we've stored that element at the end of each sub-sequence (i.e., `i = M-1` in the packed layout). From 91cbfa39a6b3109fb13c61e850bee661432c093c Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 21 Jun 2025 18:42:00 -0700 Subject: [PATCH 074/102] refactor: move files into separate packages --- .../base/fftpack/{ => cfftb}/lib/c1_ref.js | 0 .../base/fftpack/{ => cfftb}/lib/c2_ref.js | 0 .../base/fftpack/{ => cfftb}/lib/cc_ref.js | 0 .../base/fftpack/{ => cfftb}/lib/cfftb1.js | 0 .../base/fftpack/{ => cfftb}/lib/ch2_ref.js | 0 .../base/fftpack/{ => cfftb}/lib/ch_ref.js | 0 .../fft/base/fftpack/{ => cfftb}/lib/index.js | 34 +-- .../{lib/cfftb.js => cfftb/lib/main.js} | 0 .../base/fftpack/{ => cfftb}/lib/passb2.js | 0 .../base/fftpack/{ => cfftb}/lib/passb3.js | 0 .../base/fftpack/{ => cfftb}/lib/passb4.js | 0 .../base/fftpack/{ => cfftb}/lib/passfb.js | 0 .../base/fftpack/{ => cfftb}/lib/passfb5.js | 0 .../fft/base/fftpack/cfftb/package.json | 56 ++++ .../fft/base/fftpack/cfftf/lib/c1_ref.js | 81 ++++++ .../fft/base/fftpack/cfftf/lib/c2_ref.js | 79 ++++++ .../fft/base/fftpack/cfftf/lib/cc_ref.js | 85 ++++++ .../base/fftpack/{ => cfftf}/lib/cfftf1.js | 0 .../fft/base/fftpack/cfftf/lib/ch2_ref.js | 79 ++++++ .../fft/base/fftpack/cfftf/lib/ch_ref.js | 81 ++++++ .../fft/base/fftpack/cfftf/lib/index.js | 39 +++ .../{lib/cfftf.js => cfftf/lib/main.js} | 0 .../base/fftpack/{ => cfftf}/lib/passf2.js | 0 .../base/fftpack/{ => cfftf}/lib/passf3.js | 0 .../base/fftpack/{ => cfftf}/lib/passf4.js | 0 .../fft/base/fftpack/cfftf/lib/passfb.js | 246 ++++++++++++++++++ .../fft/base/fftpack/cfftf/lib/passfb5.js | 218 ++++++++++++++++ .../fft/base/fftpack/cfftf/package.json | 56 ++++ .../base/fftpack/{ => cffti}/lib/cffti1.js | 2 +- .../fft/base/fftpack/cffti/lib/index.js | 39 +++ .../{lib/cffti.js => cffti/lib/main.js} | 0 .../fft/base/fftpack/cffti/package.json | 56 ++++ .../base/fftpack/{ => cosqb}/lib/cosqb1.js | 2 +- .../fft/base/fftpack/cosqb/lib/index.js | 39 +++ .../{lib/cosqb.js => cosqb/lib/main.js} | 2 +- .../fft/base/fftpack/cosqb/package.json | 56 ++++ .../base/fftpack/{ => cosqf}/lib/cosqf1.js | 2 +- .../fft/base/fftpack/cosqf/lib/index.js | 39 +++ .../{lib/cosqf.js => cosqf/lib/main.js} | 2 +- .../fft/base/fftpack/cosqf/package.json | 56 ++++ .../fft/base/fftpack/cosqi/lib/index.js | 39 +++ .../{lib/cosqi.js => cosqi/lib/main.js} | 2 +- .../fft/base/fftpack/cosqi/package.json | 56 ++++ .../fft/base/fftpack/cost/lib/index.js | 39 +++ .../fftpack/{lib/cost.js => cost/lib/main.js} | 4 +- .../fft/base/fftpack/cost/package.json | 56 ++++ .../fft/base/fftpack/costi/lib/index.js | 39 +++ .../{lib/costi.js => costi/lib/main.js} | 4 +- .../fft/base/fftpack/costi/package.json | 56 ++++ .../fft/base/fftpack/decompose/lib/index.js | 72 +++++ .../decompose.js => decompose/lib/main.js} | 2 +- .../fft/base/fftpack/decompose/package.json | 56 ++++ .../fft/base/fftpack/rfftb/lib/c1_ref.js | 81 ++++++ .../fft/base/fftpack/rfftb/lib/c2_ref.js | 79 ++++++ .../fft/base/fftpack/rfftb/lib/cc_ref.js | 85 ++++++ .../fft/base/fftpack/rfftb/lib/ch2_ref.js | 79 ++++++ .../fft/base/fftpack/rfftb/lib/ch_ref.js | 81 ++++++ .../fft/base/fftpack/rfftb/lib/index.js | 39 +++ .../{lib/rfftb.js => rfftb/lib/main.js} | 0 .../{ => rfftb}/lib/print_real_workspace.js | 0 .../fft/base/fftpack/{ => rfftb}/lib/radb2.js | 0 .../fft/base/fftpack/{ => rfftb}/lib/radb3.js | 0 .../fft/base/fftpack/{ => rfftb}/lib/radb4.js | 0 .../fft/base/fftpack/{ => rfftb}/lib/radb5.js | 0 .../fft/base/fftpack/{ => rfftb}/lib/radbg.js | 0 .../base/fftpack/{ => rfftb}/lib/rfftb1.js | 0 .../fft/base/fftpack/rfftb/package.json | 56 ++++ .../fft/base/fftpack/rfftf/lib/c1_ref.js | 81 ++++++ .../fft/base/fftpack/rfftf/lib/c2_ref.js | 79 ++++++ .../fft/base/fftpack/rfftf/lib/cc_ref.js | 85 ++++++ .../fft/base/fftpack/rfftf/lib/ch2_ref.js | 79 ++++++ .../fft/base/fftpack/rfftf/lib/ch_ref.js | 81 ++++++ .../fft/base/fftpack/rfftf/lib/index.js | 39 +++ .../{lib/rfftf.js => rfftf/lib/main.js} | 0 .../fftpack/rfftf/lib/print_real_workspace.js | 64 +++++ .../fft/base/fftpack/{ => rfftf}/lib/radf2.js | 0 .../fft/base/fftpack/{ => rfftf}/lib/radf3.js | 0 .../fft/base/fftpack/{ => rfftf}/lib/radf4.js | 0 .../fft/base/fftpack/{ => rfftf}/lib/radf5.js | 0 .../fft/base/fftpack/{ => rfftf}/lib/radfg.js | 0 .../base/fftpack/{ => rfftf}/lib/rfftf1.js | 0 .../fft/base/fftpack/rfftf/package.json | 56 ++++ .../fft/base/fftpack/rffti/lib/index.js | 39 +++ .../{lib/rffti.js => rffti/lib/main.js} | 3 + .../base/fftpack/{ => rffti}/lib/rffti1.js | 2 +- .../fft/base/fftpack/rffti/package.json | 56 ++++ .../fft/base/fftpack/sinqb/lib/index.js | 39 +++ .../{lib/sinqb.js => sinqb/lib/main.js} | 4 +- .../fft/base/fftpack/sinqb/package.json | 56 ++++ .../fft/base/fftpack/sinqf/lib/index.js | 39 +++ .../{lib/sinqf.js => sinqf/lib/main.js} | 4 +- .../fft/base/fftpack/sinqf/package.json | 56 ++++ .../fft/base/fftpack/sinqi/lib/index.js | 39 +++ .../{lib/sinqi.js => sinqi/lib/main.js} | 4 +- .../fft/base/fftpack/sinqi/package.json | 56 ++++ .../fft/base/fftpack/sint/lib/index.js | 39 +++ .../fftpack/{lib/sint.js => sint/lib/main.js} | 2 +- .../fft/base/fftpack/{ => sint}/lib/sint1.js | 4 +- .../fft/base/fftpack/sint/package.json | 56 ++++ .../fft/base/fftpack/sinti/lib/index.js | 39 +++ .../{lib/sinti.js => sinti/lib/main.js} | 4 +- .../fft/base/fftpack/sinti/package.json | 56 ++++ .../fft/base/fftpack/test/test.rfft.js | 6 +- 103 files changed, 3393 insertions(+), 48 deletions(-) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/c1_ref.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/c2_ref.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/cc_ref.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/cfftb1.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/ch2_ref.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/ch_ref.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/index.js (59%) rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cfftb.js => cfftb/lib/main.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/passb2.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/passb3.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/passb4.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/passfb.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftb}/lib/passfb5.js (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftb/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftf}/lib/cfftf1.js (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cfftf.js => cfftf/lib/main.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftf}/lib/passf2.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftf}/lib/passf3.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cfftf}/lib/passf4.js (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cfftf/package.json rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cffti}/lib/cffti1.js (98%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cffti.js => cffti/lib/main.js} (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cffti/package.json rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cosqb}/lib/cosqb1.js (98%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cosqb.js => cosqb/lib/main.js} (95%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cosqb/package.json rename lib/node_modules/@stdlib/fft/base/fftpack/{ => cosqf}/lib/cosqf1.js (98%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cosqf.js => cosqf/lib/main.js} (95%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cosqf/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cosqi.js => cosqi/lib/main.js} (98%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cosqi/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/cost.js => cost/lib/main.js} (95%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/cost/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/costi.js => costi/lib/main.js} (94%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/costi/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/decompose.js => decompose/lib/main.js} (98%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/rfftb.js => rfftb/lib/main.js} (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/print_real_workspace.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/radb2.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/radb3.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/radb4.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/radb5.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/radbg.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftb}/lib/rfftb1.js (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftb/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/rfftf.js => rfftf/lib/main.js} (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftf}/lib/radf2.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftf}/lib/radf3.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftf}/lib/radf4.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftf}/lib/radf5.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftf}/lib/radfg.js (100%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rfftf}/lib/rfftf1.js (100%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/rffti.js => rffti/lib/main.js} (99%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => rffti}/lib/rffti1.js (98%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/sinqb.js => sinqb/lib/main.js} (94%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinqb/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/sinqf.js => sinqf/lib/main.js} (94%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinqf/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/sinqi.js => sinqi/lib/main.js} (93%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinqi/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/sint.js => sint/lib/main.js} (95%) rename lib/node_modules/@stdlib/fft/base/fftpack/{ => sint}/lib/sint1.js (94%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sint/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js rename lib/node_modules/@stdlib/fft/base/fftpack/{lib/sinti.js => sinti/lib/main.js} (94%) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/sinti/package.json diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js similarity index 59% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js index ff2caab5e16e..3699b745e746 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js @@ -18,34 +18,22 @@ 'use strict'; -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); - - -// MAIN // - /** -* Top-level namespace. +* TODO: description. * -* @namespace ns +* @module @stdlib/fft/base/fftpack/cfftb +* +* @example +* var cfftb = require( '@stdlib/fft/base/fftpack/cfftb' ); +* +* // TODO */ -var ns = {}; -/** -* @name cfftb -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/fft/base/fftpack/cfftb} -*/ -setReadOnly( ns, 'cfftb', require( './cfftb.js' ) ); +// MODULES // + +var main = require( './main.js' ); // EXPORTS // -module.exports = ns; +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftb.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passb2.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passb3.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passb4.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb5.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/package.json new file mode 100644 index 000000000000..33d23184678d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cfftb", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js new file mode 100644 index 000000000000..942378815633 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js @@ -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 // + +/** +* Computes an index into the intermediate array `c1`. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index +*/ +function c1Ref( a1, a2, a3, l1, ido ) { + return ( ( (a3*l1)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = c1Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js new file mode 100644 index 000000000000..3b4910a3f245 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js @@ -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 // + +/** +* Computes an index into the intermediate array `c2`. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index +*/ +function c2Ref( a1, a2, idl1 ) { + return ( a2*idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = c2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js new file mode 100644 index 000000000000..c9491438a35c --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js @@ -0,0 +1,85 @@ +/** +* @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 // + +/** +* Computes an index into an input array `cc` containing complex-valued data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} ip - number of sub-steps or prime factors in the FFT +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index +* +* @example +* var out = ccRef( 3, 2, 1, 2, 2 ); +* // returns 11 +*/ +function ccRef( a1, a2, a3, ip, ido ) { + return ( ( (a3*ip)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = ccRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js new file mode 100644 index 000000000000..b53f3d8579d4 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js @@ -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 // + +/** +* Computes an index into an output array `ch2` for storing processed FFT data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index +*/ +function ch2Ref( a1, a2, idl1 ) { + return ( a2*idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = ch2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js new file mode 100644 index 000000000000..1e4de83a80f1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js @@ -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 // + +/** +* Computes an index into an output array `ch` for storing processed FFT data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} radix - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} - calculated index +*/ +function chRef( a1, a2, a3, radix, ido ) { + return ( ( (a3*radix)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = chRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js new file mode 100644 index 000000000000..a64055bae4ee --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/cfftf +* +* @example +* var cfftf = require( '@stdlib/fft/base/fftpack/cfftf' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cfftf.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passf2.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passf3.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/passf4.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js new file mode 100644 index 000000000000..8ccb832f674a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js @@ -0,0 +1,246 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var c1Ref = require( './c1_ref.js' ); +var c2Ref = require( './c2_ref.js' ); +var chRef = require( './ch_ref.js' ); +var ch2Ref = require( './ch2_ref.js' ); +var ccRef = require( './cc_ref.js' ); + + +// MAIN // + +/** +* Performs a pass of the FFT algorithm. +* +* @private +* @param {Float64Array} nac - number of FFT passes +* @param {number} ido - dimension order for input/output arrays +* @param {number} ip - number of sub-steps or prime factors in the FFT +* @param {number} l1 - length parameter related to the FFT stage +* @param {number} idl1 - stride related to the `l1` parameter +* @param {Float64Array} cc - input array containing complex data for FFT computation +* @param {number} ccOffset - index of first element in `cc` +* @param {Float64Array} c1 - intermediate array for FFT computations +* @param {number} c1Offset - index of first element in `c1` +* @param {Float64Array} c2 - secondary intermediate array for FFT computations +* @param {number} c2Offset - index of first element in `c2` +* @param {Float64Array} ch - output array for storing processed FFT data +* @param {number} chOffset - index of first element in `ch` +* @param {Float64Array} ch2 - secondary output array for storing processed FFT data +* @param {number} ch2Offset - index of first element in `ch2` +* @param {Float64Array} wa - twiddle factor array used in FFT calculations +* @param {number} waOffset - index of first element in `wa` +* @param {number} fsign - sign factor indicating the direction of the FFT (e.g., +1 for forward, -1 for inverse) +* @returns {void} +*/ +function passfb( nac, ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset, fsign ) { // eslint-disable-line max-params, max-statements + var ipp2; + var idij; + var idlj; + var idot; + var ipph; + var idj; + var idl; + var inc; + var idp; + var wai; + var war; + var jc; + var lc; + var ik; + var i; + var j; + var k; + var l; + + // Parameter adjustments... + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + c1Offset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * ( 1 + ip ) ); + ch2Offset -= 1 + idl1; + c2Offset -= 1 + idl1; + waOffset -= 1; + + // Function body: + idot = ido / 2; + ipp2 = ip + 2; + ipph = ( ip + 1 ) / 2; + idp = ip * ido; + if ( ido >= l1 ) { + for ( j = 2; j <= ipph; j++ ) { + jc = ipp2 - j; + for ( k = 1; k <= l1; k++ ) { + for ( i = 1; i <= ido; i++ ) { + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; + } + } + } + for ( k = 1; k <= l1; k++ ) { + for ( i = 1; i <= ido; i++ ) { + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ]; + } + } + } else { + for ( j = 2; j <= ipph; j++ ) { + jc = ipp2 - j; + for ( i = 1; i <= ido; i++ ) { + for ( k = 1; k <= l1; k++ ) { + ch[ chRef( i, k, j, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] + cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; + ch[ chRef( i, k, jc, l1, ido ) + chOffset ] = cc[ ccRef( i, j, k, ip, ido ) + ccOffset ] - cc[ ccRef( i, jc, k, ip, ido ) + ccOffset ]; + } + } + } + for ( i = 1; i <= ido; i++ ) { + for ( k = 1; k <= l1; k++ ) { + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ]; + } + } + } + idl = 2 - ido; + inc = 0; + for ( l = 2; l <= ipph; l++ ) { + lc = ipp2 - l; + idl += ido; + for ( ik = 1; ik <= idl1; ik++ ) { + c2[ c2Ref( ik, l, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] + ( wa[ idl - 1 + waOffset ] * ch2[ ch2Ref( ik, 2, idl1 ) + ch2Offset ] ); + c2[ c2Ref( ik, lc, idl1 ) + c2Offset ] = fsign * wa[ idl + waOffset ] * ch2[ ch2Ref( ik, ip, idl1 ) + ch2Offset ]; + } + idlj = idl; + inc += ido; + for ( j = 3; j <= ipph; j++ ) { + jc = ipp2 - j; + idlj += inc; + if ( idlj > idp ) { + idlj -= idp; + } + war = wa[ idlj - 1 + waOffset ]; + wai = wa[ idlj + waOffset ]; + for ( ik = 1; ik <= idl1; ik++ ) { + c2[ c2Ref( ik, l, idl1 ) + c2Offset ] += war * ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ]; + c2[ c2Ref( ik, lc, idl1 ) + c2Offset ] += fsign * wai * ch2[ ch2Ref( ik, jc, idl1 ) + ch2Offset ]; + } + } + } + for ( j = 2; j <= ipph; j++ ) { + for ( ik = 1; ik <= idl1; ik++ ) { + ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] += ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ]; + } + } + for ( j = 2; j <= ipph; j++ ) { + jc = ipp2 - j; + for ( ik = 2; ik <= idl1; ik += 2 ) { + ch2[ ch2Ref( ik - 1, j, idl1 ) + ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) + c2Offset ] - c2[ c2Ref( ik, jc, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik - 1, jc, idl1 ) + ch2Offset ] = c2[ c2Ref( ik - 1, j, idl1 ) + c2Offset ] + c2[ c2Ref( ik, jc, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik, j, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) + c2Offset ] + c2[ c2Ref( ik - 1, jc, idl1 ) + c2Offset ]; + ch2[ ch2Ref( ik, jc, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, j, idl1 ) + c2Offset ] - c2[ c2Ref( ik - 1, jc, idl1 ) + c2Offset ]; + } + } + nac[ 0 ] = 1; + if ( ido === 2 ) { + return; + } + nac[ 0 ] = 0; + for ( ik = 1; ik <= idl1; ik++ ) { + c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ]; + } + for ( j = 2; j <= ip; j++ ) { + for ( k = 1; k <= l1; k++ ) { + c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; + c1[ c1Ref( 2, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 2, k, j, l1, ido ) + chOffset ]; + } + } + if ( idot <= l1 ) { + idij = 0; + for ( j = 2; j <= ip; j++ ) { + idij += 2; + for ( i = 4; i <= ido; i += 2 ) { + idij += 2; + for ( k = 1; k <= l1; k++ ) { + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ) - ( fsign * wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ( wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ) + ( fsign * wa[ idij + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ); + } + } + } + return; + } + idj = 2 - ido; + for ( j = 2; j <= ip; j++ ) { + idj += ido; + for ( k = 1; k <= l1; k++ ) { + idij = idj; + for ( i = 4; i <= ido; i += 2 ) { + idij += 2; + c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ) - ( fsign * wa[ idij + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ); + c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ( wa[ idij - 1 + waOffset ] * ch[ chRef( i, k, j, l1, ido ) + chOffset ] ) + ( fsign * wa[ idij + waOffset ] * ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] ); + } + } + } +} + + +// EXPORTS // + +module.exports = passfb; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js new file mode 100644 index 000000000000..af2f8689ce72 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js @@ -0,0 +1,218 @@ +/** +* @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. +* ``` +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var sincos = require( '@stdlib/math/base/special/sincos' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var chRef = require( './ch_ref.js' ); +var ccRef = require( './cc_ref.js' ); + + +// VARIABLES // + +var sc1 = sincos( TWO_PI / 5 ); +var sc2 = sincos( ( 2 * TWO_PI ) / 5 ); +var TR11 = sc1[ 1 ]; // 0.309016994374947 +var TI11 = sc1[ 0 ]; // 0.951056516295154 +var TR12 = sc2[ 1 ]; // -0.809016994374947 +var TI12 = sc2[ 0 ]; // 0.587785252292473 + + +// MAIN // + +/** +* Performs a pass of length 5 of the FFT algorithm with a sign factor. +* +* @private +* @param {integer} ido - number of real values for each transform +* @param {integer} l1 - length of the input sequences +* @param {Float64Array} cc - input array containing sequences to be transformed +* @param {number} ccOffset - offset for the input array +* @param {Float64Array} ch - output array containing transformed sequences +* @param {number} chOffset - offset for the output array +* @param {Float64Array} wa1 - first array of twiddle factors +* @param {number} wa1Offset - offset for the first twiddle factors array +* @param {Float64Array} wa2 - second array of twiddle factors +* @param {number} wa2Offset - offset for the second twiddle factors array +* @param {Float64Array} wa3 - third array of twiddle factors +* @param {number} wa3Offset - offset for the third twiddle factors array +* @param {Float64Array} wa4 - fourth array of twiddle factors +* @param {number} wa4Offset - offset for the fourth twiddle factors array +* @param {number} fsign - sign factor for the FFT computation +* @returns {void} +*/ +function passfb5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset, wa4, wa4Offset, fsign ) { // eslint-disable-line max-params + var ci2; + var ci3; + var ci4; + var ci5; + var di2; + var di3; + var di4; + var di5; + var cr2; + var cr3; + var cr4; + var cr5; + var ti2; + var ti3; + var ti4; + var ti5; + var dr2; + var dr3; + var dr4; + var dr5; + var tr2; + var tr3; + var tr4; + var tr5; + var i; + var k; + + TI11 *= fsign; + TI12 *= fsign; + + // Parameter adjustments... + chOffset -= 1 + ( ido * ( 1 + l1 ) ); + ccOffset -= 1 + ( ido * 6 ); + wa1Offset -= 1; + wa2Offset -= 1; + wa3Offset -= 1; + wa4Offset -= 1; + + // Function body: + if ( ido === 2 ) { + for ( k = 1; k <= l1; k++ ) { + ti5 = cc[ ccRef( 2, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( 2, 5, k, 5, ido ) + ccOffset ]; + ti2 = cc[ ccRef( 2, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( 2, 5, k, 5, ido ) + ccOffset ]; + ti4 = cc[ ccRef( 2, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( 2, 4, k, 5, ido ) + ccOffset ]; + ti3 = cc[ ccRef( 2, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( 2, 4, k, 5, ido ) + ccOffset ]; + tr5 = cc[ ccRef( 1, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( 1, 5, k, 5, ido ) + ccOffset ]; + tr2 = cc[ ccRef( 1, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( 1, 5, k, 5, ido ) + ccOffset ]; + tr4 = cc[ ccRef( 1, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( 1, 4, k, 5, ido ) + ccOffset ]; + tr3 = cc[ ccRef( 1, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( 1, 4, k, 5, ido ) + ccOffset ]; + ch[ chRef( 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + tr2 + tr3; + ch[ chRef( 2, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( 2, 1, k, 5, ido ) + ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( 2, 1, k, 5, ido ) + ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( 1, 1, k, 5, ido ) + ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( 2, 1, k, 5, ido ) + ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); + ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); + cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); + ci4 = ( TI12 * ti5 ) - ( TI11 * ti4 ); + ch[ chRef( 1, k, 2, l1, ido ) + chOffset ] = cr2 - ci5; + ch[ chRef( 1, k, 5, l1, ido ) + chOffset ] = cr2 + ci5; + ch[ chRef( 2, k, 2, l1, ido ) + chOffset ] = ci2 + cr5; + ch[ chRef( 2, k, 3, l1, ido ) + chOffset ] = ci3 + cr4; + ch[ chRef( 1, k, 3, l1, ido ) + chOffset ] = cr3 - ci4; + ch[ chRef( 1, k, 4, l1, ido ) + chOffset ] = cr3 + ci4; + ch[ chRef( 2, k, 4, l1, ido ) + chOffset ] = ci3 - cr4; + ch[ chRef( 2, k, 5, l1, ido ) + chOffset ] = ci2 - cr5; + } + } else { + for ( k = 1; k <= l1; k++ ) { + for ( i = 2; i <= ido; i += 2 ) { + ti5 = cc[ ccRef( i, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( i, 5, k, 5, ido ) + ccOffset ]; + ti2 = cc[ ccRef( i, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( i, 5, k, 5, ido ) + ccOffset ]; + ti4 = cc[ ccRef( i, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( i, 4, k, 5, ido ) + ccOffset ]; + ti3 = cc[ ccRef( i, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( i, 4, k, 5, ido ) + ccOffset ]; + tr5 = cc[ ccRef( i - 1, 2, k, 5, ido ) + ccOffset ] - cc[ ccRef( i - 1, 5, k, 5, ido ) + ccOffset ]; + tr2 = cc[ ccRef( i - 1, 2, k, 5, ido ) + ccOffset ] + cc[ ccRef( i - 1, 5, k, 5, ido ) + ccOffset ]; + tr4 = cc[ ccRef( i - 1, 3, k, 5, ido ) + ccOffset ] - cc[ ccRef( i - 1, 4, k, 5, ido ) + ccOffset ]; + tr3 = cc[ ccRef( i - 1, 3, k, 5, ido ) + ccOffset ] + cc[ ccRef( i - 1, 4, k, 5, ido ) + ccOffset ]; + ch[ chRef( i - 1, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + tr2 + tr3; + ch[ chRef( i, k, 1, l1, ido ) + chOffset ] = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ti2 + ti3; + cr2 = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + ( TR11 * tr2 ) + ( TR12 * tr3 ); + ci2 = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ( TR11 * ti2 ) + ( TR12 * ti3 ); + cr3 = cc[ ccRef( i - 1, 1, k, 5, ido ) + ccOffset ] + ( TR12 * tr2 ) + ( TR11 * tr3 ); + ci3 = cc[ ccRef( i, 1, k, 5, ido ) + ccOffset ] + ( TR12 * ti2 ) + ( TR11 * ti3 ); + cr5 = ( TI11 * tr5 ) + ( TI12 * tr4 ); + ci5 = ( TI11 * ti5 ) + ( TI12 * ti4 ); + cr4 = ( TI12 * tr5 ) - ( TI11 * tr4 ); + ci4 = ( TI12 * ti5 ) - ( TI11 * ti4 ); + dr3 = cr3 - ci4; + dr4 = cr3 + ci4; + di3 = ci3 + cr4; + di4 = ci3 - cr4; + dr5 = cr2 + ci5; + dr2 = cr2 - ci5; + di5 = ci2 - cr5; + di2 = ci2 + cr5; + ch[ chRef( i - 1, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * dr2 ) - ( fsign * wa1[ i + wa1Offset ] * di2 ); + ch[ chRef( i, k, 2, l1, ido ) + chOffset ] = ( wa1[ i - 1 + wa1Offset ] * di2 ) + ( fsign * wa1[ i + wa1Offset ] * dr2 ); + ch[ chRef( i - 1, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * dr3 ) - ( fsign * wa2[ i + wa2Offset ] * di3 ); + ch[ chRef( i, k, 3, l1, ido ) + chOffset ] = ( wa2[ i - 1 + wa2Offset ] * di3 ) + ( fsign * wa2[ i + wa2Offset ] * dr3 ); + ch[ chRef( i - 1, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * dr4 ) - ( fsign * wa3[ i + wa3Offset ] * di4 ); + ch[ chRef( i, k, 4, l1, ido ) + chOffset ] = ( wa3[ i - 1 + wa3Offset ] * di4 ) + ( fsign * wa3[ i + wa3Offset ] * dr4 ); + ch[ chRef( i - 1, k, 5, l1, ido ) + chOffset ] = ( wa4[ i - 1 + wa4Offset ] * dr5 ) - ( fsign * wa4[ i + wa4Offset ] * di5 ); + ch[ chRef( i, k, 5, l1, ido ) + chOffset ] = ( wa4[ i - 1 + wa4Offset ] * di5 ) + ( fsign * wa4[ i + wa4Offset ] * dr5 ); + } + } + } +} + + +// EXPORTS // + +module.exports = passfb5; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/package.json new file mode 100644 index 000000000000..8dee05fb9399 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cfftf", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js similarity index 98% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js index c51b132a74ea..ae6aadf84cc4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js @@ -62,7 +62,7 @@ var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); -var decompose = require( './decompose.js' ); +var decompose = require( '@stdlib/fft/base/fftpack/decompose' ); // VARIABLES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js new file mode 100644 index 000000000000..9b77cb2302e2 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/cffti +* +* @example +* var cffti = require( '@stdlib/fft/base/fftpack/cffti' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cffti.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/package.json new file mode 100644 index 000000000000..0bec62f998f8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cffti", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js similarity index 98% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js index 6bdc7c3cd888..e8601ef86570 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js @@ -63,7 +63,7 @@ // MODULES // var floor = require( '@stdlib/math/base/special/floor' ); -var rfftb = require( './rfftb.js' ); +var rfftb = require( '@stdlib/fft/base/fftpack/rfftb' ); // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js new file mode 100644 index 000000000000..d3424d7471a8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/cosqb +* +* @example +* var cosqb = require( '@stdlib/fft/base/fftpack/cosqb' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js similarity index 95% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js index cea38e40a6bf..1ded0d7ecac4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js @@ -82,7 +82,7 @@ var TSQRT2 = 2.0 * SQRT_TWO; * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqb( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cosqb` after this package has been refactored +function cosqb( n, x, xptr, wsave, wptr ) { // FIXME: refactor var x1; wptr -= 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/package.json new file mode 100644 index 000000000000..9372412a4c3a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cosqb", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js similarity index 98% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js index f4d28647c1bf..2970e1ebf8c4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js @@ -62,7 +62,7 @@ // MODULES // -var rfftf = require( './rfftf.js' ); +var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js new file mode 100644 index 000000000000..94292b3659cd --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/cosqf +* +* @example +* var cosqf = require( '@stdlib/fft/base/fftpack/cosqf' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js similarity index 95% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js index 711144a30ee3..e1f6371dc06b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js @@ -76,7 +76,7 @@ var cosqf1 = require( './cosqf1.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function cosqf( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cosqf` after this package has been refactored +function cosqf( n, x, xptr, wsave, wptr ) { // FIXME: refactor var tsqx; wptr -= 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/package.json new file mode 100644 index 000000000000..49d1f86d3e74 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cosqf", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js new file mode 100644 index 000000000000..58b23230d462 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/cosqi +* +* @example +* var cosqi = require( '@stdlib/fft/base/fftpack/cosqi' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js similarity index 98% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js index e7bc8405e1dd..422170d0c73b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cosqi.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js @@ -62,7 +62,7 @@ var HALF_PI = require( '@stdlib/constants/float64/half-pi' ); var cos = require( '@stdlib/math/base/special/cos' ); -var rffti = require( './rffti.js' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/package.json new file mode 100644 index 000000000000..6195e1c070e9 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cosqi", + "version": "0.0.0", + "description": "TODO: description.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js new file mode 100644 index 000000000000..2f99c7c0153d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/cost +* +* @example +* var cost = require( '@stdlib/fft/base/fftpack/cost' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js similarity index 95% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js rename to lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js index 955995c38d9c..ba78d05ad705 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/cost.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js @@ -60,7 +60,7 @@ // MODULES // -var rfftf = require( './rfftf.js' ); +var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); // MAIN // @@ -75,7 +75,7 @@ var rfftf = require( './rfftf.js' ); * @param {number} wptr - starting index for wsave * @returns {void} */ -function cost( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/cost` after this package has been refactored +function cost( n, x, xptr, wsave, wptr ) { // FIXME: refactor var x1p3; var xim2; var modn; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cost/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/cost/package.json new file mode 100644 index 000000000000..7b08af457368 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cost/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/cost", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js new file mode 100644 index 000000000000..8d694f672f4d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/costi +* +* @example +* var costi = require( '@stdlib/fft/base/fftpack/costi' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js similarity index 94% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js rename to lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js index ef8b2f58ec39..521c9c37a36a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/costi.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js @@ -62,7 +62,7 @@ var sincos = require( '@stdlib/math/base/special/sincos' ); var PI = require( '@stdlib/constants/float64/pi' ); -var rffti = require( './rffti.js' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); // MAIN // @@ -75,7 +75,7 @@ var rffti = require( './rffti.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function costi( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/costi` after this package has been refactored +function costi( n, wsave, wptr ) { // FIXME: refactor var nm1; var np1; var ns2; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/costi/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/costi/package.json new file mode 100644 index 000000000000..e838a76c3c1b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/costi/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/costi", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js new file mode 100644 index 000000000000..f497a5d7bcff --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js @@ -0,0 +1,72 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* Factorize a sequence length into a product of integers. +* +* @module @stdlib/fft/base/fftpack/decompose +* +* @example +* var decompose = require( '@stdlib/fft/base/fftpack/decompose' ); +* +* // Specify an initial list of potential divisors: +* var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK +* +* // Define a sequence length: +* var N = 630; +* +* // Initialize an array for storing factorization results: +* var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; +* +* // Factorize the sequence length into a product of integers: +* var numFactors = decompose( N, initial, factors, 1, 0 ); +* // returns 5 +* +* var f = factors.slice(); +* // returns [ 630, 5, 2, 3, 3, 5, 7 ] +* +* @example +* var decompose = require( '@stdlib/fft/base/fftpack/decompose' ); +* +* // Specify an initial list of potential divisors: +* var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK +* +* // Define a sequence length: +* var N = 8; +* +* // Initialize an array for storing factorization results: +* var factors = [ 0, 0, 0, 0 ]; +* +* // Factorize the sequence length into its a product of integers: +* var numFactors = decompose( N, initial, factors, 1, 0 ); +* // returns 2 +* +* var f = factors.slice(); +* // returns [ 8, 2, 2, 4 ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js similarity index 98% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js rename to lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js index 594ce1168038..d2c6d72214c9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/decompose.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js @@ -120,7 +120,7 @@ var floor = require( '@stdlib/math/base/special/floor' ); * var f = factors.slice(); * // returns [ 8, 2, 2, 4 ] */ -function decompose( N, initial, out, stride, offset ) { // TODO: consider moving to a separate utility package +function decompose( N, initial, out, stride, offset ) { var divisor; var ntrials; var nl; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/package.json new file mode 100644 index 000000000000..bbbff65c2388 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/decompose", + "version": "0.0.0", + "description": "Factorize a sequence length into a product of integers.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js new file mode 100644 index 000000000000..942378815633 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js @@ -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 // + +/** +* Computes an index into the intermediate array `c1`. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index +*/ +function c1Ref( a1, a2, a3, l1, ido ) { + return ( ( (a3*l1)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = c1Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js new file mode 100644 index 000000000000..3b4910a3f245 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js @@ -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 // + +/** +* Computes an index into the intermediate array `c2`. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index +*/ +function c2Ref( a1, a2, idl1 ) { + return ( a2*idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = c2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js new file mode 100644 index 000000000000..c9491438a35c --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js @@ -0,0 +1,85 @@ +/** +* @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 // + +/** +* Computes an index into an input array `cc` containing complex-valued data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} ip - number of sub-steps or prime factors in the FFT +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index +* +* @example +* var out = ccRef( 3, 2, 1, 2, 2 ); +* // returns 11 +*/ +function ccRef( a1, a2, a3, ip, ido ) { + return ( ( (a3*ip)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = ccRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js new file mode 100644 index 000000000000..b53f3d8579d4 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js @@ -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 // + +/** +* Computes an index into an output array `ch2` for storing processed FFT data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index +*/ +function ch2Ref( a1, a2, idl1 ) { + return ( a2*idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = ch2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js new file mode 100644 index 000000000000..1e4de83a80f1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js @@ -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 // + +/** +* Computes an index into an output array `ch` for storing processed FFT data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} radix - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} - calculated index +*/ +function chRef( a1, a2, a3, radix, ido ) { + return ( ( (a3*radix)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = chRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js new file mode 100644 index 000000000000..11dfd99dd6d7 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/rfftb +* +* @example +* var rfftb = require( '@stdlib/fft/base/fftpack/rfftb' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/print_real_workspace.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radb2.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radb3.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radb4.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radb5.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radbg.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftb1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/package.json new file mode 100644 index 000000000000..05938eb2999a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/rfftb", + "version": "0.0.0", + "description": "TODO: description.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js new file mode 100644 index 000000000000..942378815633 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js @@ -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 // + +/** +* Computes an index into the intermediate array `c1`. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index +*/ +function c1Ref( a1, a2, a3, l1, ido ) { + return ( ( (a3*l1)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = c1Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js new file mode 100644 index 000000000000..3b4910a3f245 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js @@ -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 // + +/** +* Computes an index into the intermediate array `c2`. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index +*/ +function c2Ref( a1, a2, idl1 ) { + return ( a2*idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = c2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js new file mode 100644 index 000000000000..c9491438a35c --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js @@ -0,0 +1,85 @@ +/** +* @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 // + +/** +* Computes an index into an input array `cc` containing complex-valued data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} ip - number of sub-steps or prime factors in the FFT +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} computed index +* +* @example +* var out = ccRef( 3, 2, 1, 2, 2 ); +* // returns 11 +*/ +function ccRef( a1, a2, a3, ip, ido ) { + return ( ( (a3*ip)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = ccRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js new file mode 100644 index 000000000000..b53f3d8579d4 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js @@ -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 // + +/** +* Computes an index into an output array `ch2` for storing processed FFT data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {integer} idl1 - stride related to the `l1` parameter +* @returns {NonNegativeInteger} computed index +*/ +function ch2Ref( a1, a2, idl1 ) { + return ( a2*idl1 ) + a1; +} + + +// EXPORTS // + +module.exports = ch2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js new file mode 100644 index 000000000000..1e4de83a80f1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js @@ -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 // + +/** +* Computes an index into an output array `ch` for storing processed FFT data. +* +* @private +* @param {NonNegativeInteger} a1 - index of first dimension +* @param {NonNegativeInteger} a2 - index of second dimension +* @param {NonNegativeInteger} a3 - index of third dimension +* @param {NonNegativeInteger} radix - length parameter related to the FFT stage +* @param {NonNegativeInteger} ido - dimension order +* @returns {NonNegativeInteger} - calculated index +*/ +function chRef( a1, a2, a3, radix, ido ) { + return ( ( (a3*radix)+a2 ) * ido ) + a1; +} + + +// EXPORTS // + +module.exports = chRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js new file mode 100644 index 000000000000..6d5acd2c208a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/rfftf +* +* @example +* var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js new file mode 100644 index 000000000000..55d984f19792 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js @@ -0,0 +1,64 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var strided2array = require( '@stdlib/array/base/from-strided' ); + + +// MAIN // + +/** +* Prints the contents of a workspace array for a real-valued Fourier transform. +* +* @private +* @param {NonNegativeInteger} N - sequence length +* @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` +* @param {NonNegativeInteger} offsetW - starting index for `workspace` +* @returns {void} +*/ +function printWorkspace( N, workspace, strideW, offsetW ) { // FIXME: remove this file and function once we've clean-up this package + var offsetT; + var offsetF; + var tmp; + + tmp = strided2array( N, workspace, strideW, offsetW ); + console.log( 'INTERMEDIATE RESULTS:' ); + console.log( tmp ); + console.log( ' ' ); + + offsetT = offsetW + ( N*strideW ); + tmp = strided2array( N, workspace, strideW, offsetT ); + console.log( 'TWIDDLE FACTORS:' ); + console.log( tmp ); + console.log( ' ' ); + + offsetF = offsetT + ( N*strideW ); + tmp = strided2array( N, workspace, strideW, offsetF ); + console.log( 'FACTORIZATION:' ); + console.log( tmp ); + console.log( ' ' ); +} + + +// EXPORTS // + +module.exports = printWorkspace; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radf2.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radf3.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radf4.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radf5.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/radfg.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js similarity index 100% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rfftf1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json new file mode 100644 index 000000000000..ea90c07e9bf4 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/rfftf", + "version": "0.0.0", + "description": "TODO: description.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js new file mode 100644 index 000000000000..e258e5af1d3b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* Initialize a workspace array for performing a real-valued Fourier transform. +* +* @module @stdlib/fft/base/fftpack/rffti +* +* @example +* var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js similarity index 99% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js index db948e28ab44..bb91deaabac9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js @@ -133,6 +133,9 @@ var rffti1 = require( './rffti1.js' ); * @param {integer} strideW - stride length for `workspace` * @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} +* +* @example +* // TODO */ function rffti( N, workspace, strideW, offsetW ) { var offsetT; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js similarity index 98% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js index d9f218681fcf..0a795762c651 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js @@ -63,7 +63,7 @@ var sincos = require( '@stdlib/math/base/special/sincos' ).assign; var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var floor = require( '@stdlib/math/base/special/floor' ); -var decompose = require( './decompose.js' ); +var decompose = require( '@stdlib/fft/base/fftpack/decompose' ); // VARIABLES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/package.json new file mode 100644 index 000000000000..449dabea170a --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/rffti", + "version": "0.0.0", + "description": "Initialize a workspace array for performing a real-valued Fourier transform.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js new file mode 100644 index 000000000000..9f809837adee --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/sinqb +* +* @example +* var sinqb = require( '@stdlib/fft/base/fftpack/sinqb' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js similarity index 94% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js rename to lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js index 5a35eb1d5244..ffb313646520 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js @@ -60,7 +60,7 @@ // MODULES // -var cosqb = require( './cosqb.js' ); +var cosqb = require( '@stdlib/fft/base/fftpack/cosqb' ); // MAIN // @@ -75,7 +75,7 @@ var cosqb = require( './cosqb.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinqb( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinqb` after this package has been refactored +function sinqb( n, x, xptr, wsave, wptr ) { // FIXME: refactor var xhold; var ns2; var kc; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/package.json new file mode 100644 index 000000000000..ca86a818dea8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/sinqb", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js new file mode 100644 index 000000000000..ea0678fc0606 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/sinqf +* +* @example +* var sinqf = require( '@stdlib/fft/base/fftpack/sinqf' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js similarity index 94% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js rename to lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js index 3bf6cb738109..af248890baf0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqf.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js @@ -60,7 +60,7 @@ // MODULES // -var cosqb = require( './cosqb.js' ); +var cosqb = require( '@stdlib/fft/base/fftpack/cosqb' ); // MAIN // @@ -75,7 +75,7 @@ var cosqb = require( './cosqb.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinqf( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinqf` after this package has been refactored +function sinqf( n, x, xptr, wsave, wptr ) { // FIXME: refactor var xhold; var ns2; var kc; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/package.json new file mode 100644 index 000000000000..57ae9f2de5c5 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/sinqf", + "version": "0.0.0", + "description": "{{TODO:description}}", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js new file mode 100644 index 000000000000..76f4974dba02 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/sinqi +* +* @example +* var sinqi = require( '@stdlib/fft/base/fftpack/sinqi' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js similarity index 93% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js rename to lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js index b17a043ba8b3..30c8dd1cfe07 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinqi.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js @@ -60,7 +60,7 @@ // MODULES // -var cosqi = require( './cosqi.js' ); +var cosqi = require( '@stdlib/fft/base/fftpack/cosqi' ); // MAIN // @@ -73,7 +73,7 @@ var cosqi = require( './cosqi.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinqi( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinqi` after this package has been refactored +function sinqi( n, wsave, wptr ) { // FIXME: refactor wptr -= 1; cosqi( n, wsave, wptr + 1 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/package.json new file mode 100644 index 000000000000..61309a346fd2 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/sinqi", + "version": "0.0.0", + "description": "TODO: description.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js new file mode 100644 index 000000000000..d3dae9453a23 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/sint +* +* @example +* var sint = require( '@stdlib/fft/base/fftpack/sint' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js similarity index 95% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js rename to lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js index b0a6deb6c6cb..166cb7f8e87a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js @@ -76,7 +76,7 @@ var sint1 = require( './sint1.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sint( n, x, xptr, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sint` after this package has been refactored +function sint( n, x, xptr, wsave, wptr ) { // FIXME: refactor var iw1; var iw2; var iw3; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js similarity index 94% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js rename to lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js index a6eb16c6328d..8ddf6f38e06a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sint1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js @@ -61,7 +61,9 @@ // MODULES // var SQRT3 = require( '@stdlib/constants/float64/sqrt-three' ); -var rfftf1 = require( './rfftf1.js' ); + +// FIXME: refactor implementation to avoid needing to reach into package; dependent on changes to `rfftf` in supporting strides and offsets +var rfftf1 = require( '@stdlib/fft/base/fftpack/rfft1/lib/rfftf1.js' ); // eslint-disable-line stdlib/no-internal-require, stdlib/require-file-extensions // MAIN // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sint/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/sint/package.json new file mode 100644 index 000000000000..396dad4834a9 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/sint", + "version": "0.0.0", + "description": "TODO: description.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js new file mode 100644 index 000000000000..d8186d88b0cd --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* TODO: description. +* +* @module @stdlib/fft/base/fftpack/sinti +* +* @example +* var sinti = require( '@stdlib/fft/base/fftpack/sinti' ); +* +* // TODO +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js similarity index 94% rename from lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js rename to lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js index 9f68ffd6a7ae..3162039ff322 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/lib/sinti.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js @@ -62,7 +62,7 @@ var sin = require( '@stdlib/math/base/special/sin' ); var PI = require( '@stdlib/constants/float64/pi' ); -var rffti = require( './rffti.js' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); // MAIN // @@ -76,7 +76,7 @@ var rffti = require( './rffti.js' ); * @param {number} wptr - starting index for `wsave` * @returns {void} */ -function sinti( n, wsave, wptr ) { // TODO: consider moving to a separate package `fft/base/fftpack/sinti` after this package has been refactored +function sinti( n, wsave, wptr ) { // FIXME: refactor var np1; var ns2; var dt; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinti/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/package.json new file mode 100644 index 000000000000..78b70bdb84f0 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/package.json @@ -0,0 +1,56 @@ +{ + "name": "@stdlib/fft/base/fftpack/sinti", + "version": "0.0.0", + "description": "TODO: description.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "{{TODO:keywords}}" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 05b858709e6a..02b2ff99e4e1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -30,9 +30,9 @@ var abs = require( '@stdlib/math/base/special/abs' ); var max = require( '@stdlib/math/base/special/max' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); -var rffti = require( './../lib/rffti.js' ); -var rfftf = require( './../lib/rfftf.js' ); -var rfftb = require( './../lib/rfftb.js' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); +var rfftb = require( '@stdlib/fft/base/fftpack/rfftb' ); // VARIABLES // From 58764b4d259e887f6e4831bdd65aa9102d0a121f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 29 Jun 2025 12:51:56 +0530 Subject: [PATCH 075/102] test: add tests for the decompose function --- 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 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: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../fft/base/fftpack/decompose/lib/main.js | 9 + .../fft/base/fftpack/decompose/test/test.js | 260 ++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js index d2c6d72214c9..965cf9e7bfc3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js @@ -61,6 +61,9 @@ // MODULES // var floor = require( '@stdlib/math/base/special/floor' ); +var isNonNegativeInteger = require( '@stdlib/math/base/assert/is-nonnegative-integer' ); +var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; +var isCollection = require( '@stdlib/assert/is-collection' ); // MAIN // @@ -131,6 +134,12 @@ function decompose( N, initial, out, stride, offset ) { var i; var j; + if ( !isNonNegativeInteger( N ) || !isNonNegativeIntegerArray( initial ) || + !isCollection( out ) || !isNonNegativeInteger( stride ) || + !isNonNegativeInteger( offset ) ) { + return NaN; + } + // Resolve the number of trial divisors: ntrials = initial.length; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js new file mode 100644 index 000000000000..2c6500d458ac --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js @@ -0,0 +1,260 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var decompose = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof decompose, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided a sequence length which is not a nonnegative integer, the function returns NaN', function test( t ) { + var factors; + var initial; + var result; + var values; + var i; + + values = [ + '5', + -5, + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [], + function foo() {} + ]; + + initial = [ 3, 4, 2, 5 ]; + factors = [ 0, 0, 0, 0, 0 ]; + + for ( i = 0; i < values.length; i++ ) { + result = decompose( values[ i ], initial, factors, 1, 0 ); + t.strictEqual( isnan( result ), true, 'returns NaN when provided ' + values[ i ] ); + } + t.end(); +}); + +tape( 'if provided an array of initial trial divisors which is not an array of nonnegative integers, the function returns NaN', function test( t ) { + var factors; + var result; + var values; + var i; + + values = [ + '5', + 5, + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [ '1', '2' ], + [ -1, 2, 3 ], + [ 1.1, 2, 3 ], + function foo() {} + ]; + + factors = [ 0, 0, 0, 0, 0 ]; + + for ( i = 0; i < values.length; i++ ) { + result = decompose( 10, values[ i ], factors, 1, 0 ); + t.strictEqual( isnan( result ), true, 'returns NaN when provided ' + values[ i ] ); + } + t.end(); +}); + +tape( 'if provided an output array which is not a collection, the function returns NaN', function test( t ) { + var initial; + var result; + var values; + var i; + + values = [ + '5', + 5, + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + function foo() {} + ]; + + initial = [ 3, 4, 2, 5 ]; + + for ( i = 0; i < values.length; i++ ) { + result = decompose( 10, initial, values[ i ], 1, 0 ); + t.strictEqual( isnan( result ), true, 'returns NaN when provided ' + values[ i ] ); + } + t.end(); +}); + +tape( 'if provided a stride which is not an integer, the function returns NaN', function test( t ) { + var factors; + var initial; + var result; + var values; + var i; + + values = [ + '5', + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [], + function foo() {} + ]; + + initial = [ 3, 4, 2, 5 ]; + factors = [ 0, 0, 0, 0, 0 ]; + + for ( i = 0; i < values.length; i++ ) { + result = decompose( 10, initial, factors, values[ i ], 0 ); + t.strictEqual( isnan( result ), true, 'returns NaN when provided ' + values[ i ] ); + } + t.end(); +}); + +tape( 'if provided an offset which is not a nonnegative integer, the function returns NaN', function test( t ) { + var factors; + var initial; + var result; + var values; + var i; + + values = [ + '5', + -5, + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [], + function foo() {} + ]; + + initial = [ 3, 4, 2, 5 ]; + factors = [ 0, 0, 0, 0, 0 ]; + + for ( i = 0; i < values.length; i++ ) { + result = decompose( 10, initial, factors, 1, values[ i ] ); + t.strictEqual( isnan( result ), true, 'returns NaN when provided ' + values[ i ] ); + } + t.end(); +}); + +tape( 'the function correctly factorizes a sequence length into a product of integers', function test( t ) { + var initial; + var factors; + var nf; + + initial = [ 3, 4, 2, 5 ]; + factors = [ 0, 0, 0, 0, 0, 0, 0 ]; + nf = decompose( 630, initial, factors, 1, 0 ); + + t.strictEqual( nf, 5, 'returns expected number of factors' ); + t.strictEqual( factors[ 0 ], 630, 'stores sequence length' ); + t.strictEqual( factors[ 1 ], 5, 'stores number of factors' ); + t.strictEqual( factors[ 2 ], 2, 'stores first factor' ); + t.strictEqual( factors[ 3 ], 3, 'stores second factor' ); + t.strictEqual( factors[ 4 ], 3, 'stores third factor' ); + t.strictEqual( factors[ 5 ], 5, 'stores fourth factor' ); + t.strictEqual( factors[ 6 ], 7, 'stores fifth factor' ); + + initial = [ 3, 4, 2, 5 ]; + factors = [ 0, 0, 0, 0 ]; + nf = decompose( 8, initial, factors, 1, 0 ); + + t.strictEqual( nf, 2, 'returns expected number of factors' ); + t.strictEqual( factors[ 0 ], 8, 'stores sequence length' ); + t.strictEqual( factors[ 1 ], 2, 'stores number of factors' ); + t.strictEqual( factors[ 2 ], 2, 'stores first factor' ); + t.strictEqual( factors[ 3 ], 4, 'stores second factor' ); + + t.end(); +}); + +tape( 'the function correctly factorizes prime numbers', function test( t ) { + var initial; + var factors; + var primes; + var nf; + var i; + + initial = [ 3, 4, 2, 5 ]; + primes = [ 7, 11, 13, 17, 19, 23, 29, 31 ]; + + for ( i = 0; i < primes.length; i++ ) { + factors = [ 0, 0, 0 ]; + nf = decompose( primes[ i ], initial, factors, 1, 0 ); + + t.strictEqual( nf, 1, 'returns expected number of factors for prime ' + primes[ i ] ); + t.strictEqual( factors[ 0 ], primes[ i ], 'stores sequence length' ); + t.strictEqual( factors[ 1 ], 1, 'stores number of factors' ); + t.strictEqual( factors[ 2 ], primes[ i ], 'stores the prime as its own factor' ); + } + + t.end(); +}); + +tape( 'the function correctly handles stride and offset parameters', function test( t ) { + var initial; + var factors; + var stride = 2; + var offset = 1; + var nf; + + initial = [ 3, 4, 2, 5 ]; + + factors = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + nf = decompose( 12, initial, factors, stride, offset ); + + t.strictEqual( nf, 2, 'returns expected number of factors' ); + t.strictEqual( factors[ offset ], 12, 'stores sequence length at offset' ); + t.strictEqual( factors[ offset+stride ], 2, 'stores number of factors at offset + stride' ); + t.strictEqual( factors[ offset+(2*stride) ], 3, 'stores first factor at offset + 2*stride' ); + t.strictEqual( factors[ offset+(3*stride) ], 4, 'stores second factor at offset + 3*stride' ); + + t.end(); +}); From 073714c7d63c31c96719c7b161c6794f29b578dc Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 29 Jun 2025 14:27:34 +0530 Subject: [PATCH 076/102] docs: add examples for the decompose function --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/fftpack/decompose/examples/index.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js new file mode 100644 index 000000000000..7eaec65495fc --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js @@ -0,0 +1,39 @@ +/** +* @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. +*/ + +'use strict'; + +var decompose = require( './../lib' ); + +var factors = [ 0, 0, 0, 0 ]; +var initial = [ 3, 4, 2, 5 ]; +var nf; +var j; + +for ( j = 0; j < factors.length; j++ ) { + factors[ j ] = 0; +} + +nf = decompose( 12, initial, factors, 1, 0 ); + +console.log( 'Sequence length: %d', 12 ); +console.log( 'Number of factors: %d', nf ); +console.log( 'Factors:' ); +for ( j = 0; j < nf; j++ ) { + console.log( ' %d', factors[ j+2 ] ); +} From 5ed23e75fccb747acd828915b55fc0352271f86a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 30 Jun 2025 07:49:35 +0530 Subject: [PATCH 077/102] docs: add docs and benchmark --- 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 status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - 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: passed - task: lint_license_headers status: passed --- --- .../fftpack/decompose/benchmark/benchmark.js | 103 ++++++++++++++++ .../fft/base/fftpack/decompose/docs/repl.txt | 39 ++++++ .../fftpack/decompose/docs/types/index.d.ts | 66 ++++++++++ .../base/fftpack/decompose/docs/types/test.ts | 114 ++++++++++++++++++ 4 files changed, 322 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js new file mode 100644 index 000000000000..7c98f25cd545 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js @@ -0,0 +1,103 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var zeros = require( '@stdlib/array/zeros' ); +var pkg = require( './../package.json' ).name; +var decompose = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - sequence length to factorize +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var initial = [ 3, 4, 2, 5 ]; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var factors; + var out; + var i; + + factors = zeros( 6 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = decompose( N, initial, factors, 1, 0 ); + if ( isnan( out ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + + if ( isnan( out ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var lengths; + var N; + var f; + var i; + + lengths = [ + 12, + 24, + 36, + 48, + 60, + 120 + ]; + + for ( i = 0; i < lengths.length; i++ ) { + N = lengths[i]; + f = createBenchmark( N ); + bench( pkg+':N='+N, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/repl.txt new file mode 100644 index 000000000000..64489085458b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/repl.txt @@ -0,0 +1,39 @@ + +{{alias}}( N, initial, out, stride, offset ) + Factorizes a sequence length into a product of integers. + + Parameters + ---------- + N: number + Length of the sequence. + + initial: Array + Array of initial trial divisors. + + out: Collection + Output array for storing factorization results. + + stride: number + Stride length for `out`. + + offset: number + Starting index for `out`. + + Returns + ------- + numFactors: number + Number of factors into which N was decomposed. + + Examples + -------- + > var initial = [ 3, 4, 2, 5 ]; + > var N = 630; + > var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; + > var numFactors = {{alias}}( N, initial, factors, 1, 0 ) + 5 + > factors.slice() + [ 630, 5, 2, 3, 3, 5, 7 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts new file mode 100644 index 000000000000..74b73ad265e0 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts @@ -0,0 +1,66 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Collection } from '@stdlib/types/array'; + +/** +* Factorizes a sequence length into a product of integers. +* +* ## Notes +* +* - If provided a sequence length which is not a nonnegative integer, the function returns `NaN`. +* - If provided an array of initial trial divisors which is not an array of nonnegative integers, the function returns `NaN`. +* - If provided an output array which is not an array-like object, the function returns `NaN`. +* - If provided a stride which is not a nonnegative integer, the function returns `NaN`. +* - If provided an offset which is not a nonnegative integer, the function returns `NaN`. +* +* @param N - length of the sequence +* @param initial - array of initial trial divisors +* @param out - output array for storing factorization results +* @param stride - stride length for `out` +* @param offset - starting index for `out` +* @returns number of factors into which `N` was decomposed +* +* @example +* // Specify an initial list of potential divisors: +* var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK +* +* // Define a sequence length: +* var N = 630; +* +* // Initialize an array for storing factorization results: +* var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; +* +* // Factorize the sequence length into a product of integers: +* var numFactors = decompose( N, initial, factors, 1, 0 ); +* // returns 5 +* +* var f = factors.slice(); +* // returns [ 630, 5, 2, 3, 3, 5, 7 ] +*/ +declare function decompose( N: number, initial: Array, out: Collection, stride: number, offset: number ): number; + + +// EXPORTS // + +export = decompose; + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts new file mode 100644 index 000000000000..26a1c0508adc --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts @@ -0,0 +1,114 @@ +/* +* @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. +*/ + +import decompose = require( './index' ); + +// TESTS // + +// The function returns a number... +{ + const initial = [ 4, 2, 3, 5 ]; + const out = [ 0, 0, 0, 0, 0, 0, 0 ]; + + decompose( 12, initial, out, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a sequence length which is not a number... +{ + const initial = [ 4, 2, 3, 5 ]; + const out = [ 0, 0, 0, 0, 0, 0, 0 ]; + + decompose( '12', initial, out, 1, 0 ); // $ExpectError + decompose( true, initial, out, 1, 0 ); // $ExpectError + decompose( false, initial, out, 1, 0 ); // $ExpectError + decompose( null, initial, out, 1, 0 ); // $ExpectError + decompose( undefined, initial, out, 1, 0 ); // $ExpectError + decompose( [], initial, out, 1, 0 ); // $ExpectError + decompose( {}, initial, out, 1, 0 ); // $ExpectError + decompose( ( x: number ): number => x, initial, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided initial trial divisors which is not an array of numbers... +{ + const out = [ 0, 0, 0, 0, 0, 0, 0 ]; + + decompose( 12, '4,2,3,5', out, 1, 0 ); // $ExpectError + decompose( 12, 5, out, 1, 0 ); // $ExpectError + decompose( 12, true, out, 1, 0 ); // $ExpectError + decompose( 12, false, out, 1, 0 ); // $ExpectError + decompose( 12, null, out, 1, 0 ); // $ExpectError + decompose( 12, undefined, out, 1, 0 ); // $ExpectError + decompose( 12, {}, out, 1, 0 ); // $ExpectError + decompose( 12, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an output array which is not an array-like object... +{ + const initial = [ 4, 2, 3, 5 ]; + + decompose( 12, initial, 123, 1, 0 ); // $ExpectError + decompose( 12, initial, true, 1, 0 ); // $ExpectError + decompose( 12, initial, false, 1, 0 ); // $ExpectError + decompose( 12, initial, null, 1, 0 ); // $ExpectError + decompose( 12, initial, undefined, 1, 0 ); // $ExpectError + decompose( 12, initial, {}, 1, 0 ); // $ExpectError + decompose( 12, initial, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a stride which is not a number... +{ + const initial = [ 4, 2, 3, 5 ]; + const out = [ 0, 0, 0, 0, 0, 0, 0 ]; + + decompose( 12, initial, out, '1', 0 ); // $ExpectError + decompose( 12, initial, out, true, 0 ); // $ExpectError + decompose( 12, initial, out, false, 0 ); // $ExpectError + decompose( 12, initial, out, null, 0 ); // $ExpectError + decompose( 12, initial, out, undefined, 0 ); // $ExpectError + decompose( 12, initial, out, [], 0 ); // $ExpectError + decompose( 12, initial, out, {}, 0 ); // $ExpectError + decompose( 12, initial, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an offset which is not a number... +{ + const initial = [ 4, 2, 3, 5 ]; + const out = [ 0, 0, 0, 0, 0, 0, 0 ]; + + decompose( 12, initial, out, 1, '0' ); // $ExpectError + decompose( 12, initial, out, 1, true ); // $ExpectError + decompose( 12, initial, out, 1, false ); // $ExpectError + decompose( 12, initial, out, 1, null ); // $ExpectError + decompose( 12, initial, out, 1, undefined ); // $ExpectError + decompose( 12, initial, out, 1, [] ); // $ExpectError + decompose( 12, initial, out, 1, {} ); // $ExpectError + decompose( 12, initial, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const initial = [ 4, 2, 3, 5 ]; + const out = [ 0, 0, 0, 0, 0, 0, 0 ]; + + decompose(); // $ExpectError + decompose( 12 ); // $ExpectError + decompose( 12, initial ); // $ExpectError + decompose( 12, initial, out ); // $ExpectError + decompose( 12, initial, out, 1 ); // $ExpectError + decompose( 12, initial, out, 1, 0, 123 ); // $ExpectError +} From 66a24b7912ced9ad940a680458a6facb838ce712 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 1 Jul 2025 19:42:26 +0530 Subject: [PATCH 078/102] docs: add readme for the decompose function --- 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 status: passed - 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: 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../fft/base/fftpack/decompose/README.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md new file mode 100644 index 000000000000..8d419dac01a2 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md @@ -0,0 +1,145 @@ + + +# decompose + +> Factorize a sequence length into a product of integers. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var decompose = require( '@stdlib/fft/base/fftpack/decompose' ); +``` + +#### decompose( N, initial, out, stride, offset ) + +Factorizes a sequence length into a product of integers. + +```javascript +var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK +var N = 630; +var factors = [ 0, 0, 0, 0, 0, 0, 0 ]; + +var numFactors = decompose( N, initial, factors, 1, 0 ); +// returns 5 + +console.log( factors ); +// => [ 630, 5, 2, 3, 3, 5, 7 ] +``` + +The function accepts the following arguments: + +- **N**: length of the sequence. +- **initial**: array of initial trial divisors. +- **out**: output array for storing factorization results. +- **stride**: stride length for `out`. +- **offset**: starting index for `out`. + +The function returns the number of factors into which `N` was decomposed. + +
+ + + + + +
+ +## Notes + +- Factorization results are stored in the output array as follows: + + ```text + [ sequence_length | number_of_factors | integer_factors | unused_storage ] + ``` + +- The function mutates the input array. + +
+ + + +
+ +## Examples + + + +```javascript +var decompose = require( '@stdlib/fft/base/fftpack/decompose' ); + +var factors = [ 0, 0, 0, 0 ]; +var initial = [ 3, 4, 2, 5 ]; +var nf; +var j; + +for ( j = 0; j < factors.length; j++ ) { + factors[ j ] = 0; +} + +nf = decompose( 12, initial, factors, 1, 0 ); + +console.log( 'Sequence length: %d', 12 ); +console.log( 'Number of factors: %d', nf ); +console.log( 'Factors:' ); +for ( j = 0; j < nf; j++ ) { + console.log( ' %d', factors[ j+2 ] ); +} +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + From c323438b0144d08da4c7df61c865e5f2a83febd4 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 7 Jul 2025 22:25:42 +0530 Subject: [PATCH 079/102] chore: add tests, docs, examples, benchmark for rffti --- 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 status: passed - 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: 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 --- --- .../base/fftpack/decompose/examples/index.js | 4 - .../@stdlib/fft/base/fftpack/rffti/README.md | 131 ++++++++++ .../base/fftpack/rffti/benchmark/benchmark.js | 99 ++++++++ .../base/fftpack/rffti/docs/types/index.d.ts | 53 ++++ .../fft/base/fftpack/rffti/docs/types/test.ts | 93 +++++++ .../fft/base/fftpack/rffti/examples/index.js | 36 +++ .../fft/base/fftpack/rffti/lib/index.js | 11 +- .../fft/base/fftpack/rffti/lib/main.js | 24 +- .../fft/base/fftpack/rffti/test/test.js | 237 ++++++++++++++++++ 9 files changed, 682 insertions(+), 6 deletions(-) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js index 7eaec65495fc..e95883191868 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js @@ -25,10 +25,6 @@ var initial = [ 3, 4, 2, 5 ]; var nf; var j; -for ( j = 0; j < factors.length; j++ ) { - factors[ j ] = 0; -} - nf = decompose( 12, initial, factors, 1, 0 ); console.log( 'Sequence length: %d', 12 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md new file mode 100644 index 000000000000..3c23d279085b --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md @@ -0,0 +1,131 @@ + + +# rffti + +> Initialize a workspace array for performing a real-valued Fourier transform. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +``` + +#### rffti( N, workspace, strideW, offsetW ) + +Initializes a workspace array for performing a real-valued Fourier transform. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var workspace; +var N = 8; + +workspace = new Float64Array( (2*N) + 34 ); +rffti( N, workspace, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: length of the sequence to transform. +- **workspace**: workspace array. +- **strideW**: stride length for `workspace`. +- **offsetW**: starting index for `workspace`. + +
+ + + + + +
+ +## Notes + +- The workspace array should have a length of at least `(2*N) + 34` elements. +- For single-point sequences ( N=1 ), the function returns immediately as the FFT is the identity operation. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); + +var workspace; +var N = 8; +var i; + +workspace = new Float64Array( (2*N) + 34 ); + +rffti( N, workspace, 1, 0 ); + +console.log( 'Sequence length: %d', N ); +console.log( 'Workspace array:' ); +for ( i = 0; i < workspace.length; i++ ) { + console.log( ' %d: %d', i, workspace[ i ] ); +} +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js new file mode 100644 index 000000000000..ba2f503f3764 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js @@ -0,0 +1,99 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pkg = require( './../package.json' ).name; +var rffti = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - sequence length to transform +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var workspace; + var i; + + workspace = new Float64Array( (2*N) + 34 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + rffti( N, workspace, 1, 0 ); + if ( workspace[ 2*N ] !== N ) { + b.fail( 'unexpected result' ); + } + } + b.toc(); + + if ( workspace[ 2*N ] !== N ) { + b.fail( 'unexpected result' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var lengths; + var N; + var f; + var i; + + lengths = [ + 8, + 16, + 32, + 64, + 128 + ]; + + for ( i = 0; i < lengths.length; i++ ) { + N = lengths[ i ]; + f = createBenchmark( N ); + bench( pkg+':N='+N, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts new file mode 100644 index 000000000000..bfaa4251e923 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts @@ -0,0 +1,53 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +/// + +/** +* Initializes a workspace array for performing a real-valued Fourier transform. +* +* ## Notes +* +* - The workspace array should have a length of at least `(2*N) + 34` elements. +* - For single-point sequences (N=1), the function returns immediately as the FFT is the identity operation. +* +* @param N - length of the sequence to transform +* @param workspace - workspace array +* @param strideW - stride length for `workspace` +* @param offsetW - starting index for `workspace` +* +* @example +* // Define a sequence length: +* var N = 8; +* +* // Initialize a workspace array: +* var workspace = new Float64Array( (2*N) + 34 ); +* +* rffti( N, workspace, 1, 0 ); +* +* var f = workspace.slice(); +* // returns [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] +*/ +declare function rffti( N: number, workspace: Float64Array, strideW: number, offsetW: number ): void; + + +// EXPORTS // + +export = rffti; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts new file mode 100644 index 000000000000..bc04a38a4ec8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts @@ -0,0 +1,93 @@ +/* +* @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. +*/ + +import rffti = require( './index' ); + +// TESTS // + +// The function returns void... +{ + const workspace = new Float64Array( 50 ); + rffti( 8, workspace, 1, 0 ); // $ExpectType void +} + +// The compiler throws an error if the function is provided a sequence length which is not a number... +{ + const workspace = new Float64Array( 50 ); + + rffti( '12', workspace, 1, 0 ); // $ExpectError + rffti( true, workspace, 1, 0 ); // $ExpectError + rffti( false, workspace, 1, 0 ); // $ExpectError + rffti( null, workspace, 1, 0 ); // $ExpectError + rffti( undefined, workspace, 1, 0 ); // $ExpectError + rffti( [], workspace, 1, 0 ); // $ExpectError + rffti( {}, workspace, 1, 0 ); // $ExpectError + rffti( ( x: number ): number => x, workspace, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a workspace which is not a Float64Array... +{ + rffti( 8, '4,2,3,5', 1, 0 ); // $ExpectError + rffti( 8, 5, 1, 0 ); // $ExpectError + rffti( 8, true, 1, 0 ); // $ExpectError + rffti( 8, false, 1, 0 ); // $ExpectError + rffti( 8, null, 1, 0 ); // $ExpectError + rffti( 8, undefined, 1, 0 ); // $ExpectError + rffti( 8, [], 1, 0 ); // $ExpectError + rffti( 8, {}, 1, 0 ); // $ExpectError + rffti( 8, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a stride which is not a number... +{ + const workspace = new Float64Array( 50 ); + + rffti( 8, workspace, '1', 0 ); // $ExpectError + rffti( 8, workspace, true, 0 ); // $ExpectError + rffti( 8, workspace, false, 0 ); // $ExpectError + rffti( 8, workspace, null, 0 ); // $ExpectError + rffti( 8, workspace, undefined, 0 ); // $ExpectError + rffti( 8, workspace, [], 0 ); // $ExpectError + rffti( 8, workspace, {}, 0 ); // $ExpectError + rffti( 8, workspace, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an offset which is not a number... +{ + const workspace = new Float64Array( 50 ); + + rffti( 8, workspace, 1, '0' ); // $ExpectError + rffti( 8, workspace, 1, true ); // $ExpectError + rffti( 8, workspace, 1, false ); // $ExpectError + rffti( 8, workspace, 1, null ); // $ExpectError + rffti( 8, workspace, 1, undefined ); // $ExpectError + rffti( 8, workspace, 1, [] ); // $ExpectError + rffti( 8, workspace, 1, {} ); // $ExpectError + rffti( 8, workspace, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const workspace = new Float64Array( 50 ); + + rffti(); // $ExpectError + rffti( 8 ); // $ExpectError + rffti( 8, workspace ); // $ExpectError + rffti( 8, workspace, 1 ); // $ExpectError + rffti( 8, workspace, 1, 0, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js new file mode 100644 index 000000000000..4023031e61ba --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js @@ -0,0 +1,36 @@ +/** +* @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. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( './../lib' ); + +var workspace; +var N = 8; +var i; + +workspace = new Float64Array( (2*N) + 34 ); + +rffti( N, workspace, 1, 0 ); + +console.log( 'Sequence length: %d', N ); +console.log( 'Workspace array:' ); +for ( i = 0; i < workspace.length; i++ ) { + console.log( ' %d: %d', i, workspace[ i ] ); +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js index e258e5af1d3b..51b243964906 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js @@ -26,7 +26,16 @@ * @example * var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); * -* // TODO +* // Define a sequence length: +* var N = 8; +* +* // Initialize a workspace array: +* var workspace = new Float64Array( (2*N) + 34 ); +* +* rffti( N, workspace, 1, 0 ); +* +* var f = workspace.slice(); +* // returns [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js index bb91deaabac9..55adab1efcd6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js @@ -60,6 +60,9 @@ // MODULES // +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ); +var isInteger = require( '@stdlib/assert/is-integer' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); var rffti1 = require( './rffti1.js' ); @@ -135,12 +138,31 @@ var rffti1 = require( './rffti1.js' ); * @returns {void} * * @example -* // TODO +* // Define a sequence length: +* var N = 8; +* +* // Initialize a workspace array: +* var workspace = new Float64Array( (2*N) + 34 ); +* +* rffti( N, workspace, 1, 0 ); +* +* var f = workspace.slice(); +* // returns [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] */ function rffti( N, workspace, strideW, offsetW ) { var offsetT; var offsetF; + if ( + !isNonNegativeInteger( N ) || + !isFloat64Array( workspace ) || + !isInteger( strideW ) || + !isNonNegativeInteger( offsetW ) || + workspace.length < offsetW + ( ( (2*N) + 34 ) * strideW ) + ) { + return; + } + // When a sub-sequence is a single data point, the FFT is the identity, so no initialization necessary... if ( N === 1 ) { return; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js new file mode 100644 index 000000000000..88365c1d922f --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js @@ -0,0 +1,237 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof rffti, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function initializes a workspace array for performing a real-valued Fourier transform', function test( t ) { + var hasNonZero; + var workspace; + var N; + var i; + + N = 8; + workspace = new Float64Array( (2*N) + 34 ); + rffti( N, workspace, 1, 0 ); + + // Checking that the workspace has been initialized with non-zero values: + hasNonZero = false; + for ( i = 0; i < workspace.length; i++ ) { + if ( workspace[ i ] !== 0 ) { + hasNonZero = true; + break; + } + } + t.ok( hasNonZero, 'workspace contains non-zero values' ); + t.end(); +}); + +tape( 'the function handles N=1 case (identity transform)', function test( t ) { + var workspace; + var original; + var N; + var i; + + N = 1; + workspace = new Float64Array( (2*N) + 34 ); + + // Filling with non-zero values to check if they remain unchanged: + for ( i = 0; i < workspace.length; i++ ) { + workspace[ i ] = i + 1; + } + + original = workspace.slice(); + rffti( N, workspace, 1, 0 ); + + t.deepEqual( workspace, original, 'workspace remains unchanged for N=1' ); + t.end(); +}); + +tape( 'the function correctly initializes workspace for various sequence lengths', function test( t ) { + var workspace; + var lengths; + var N; + var i; + + lengths = [ 2, 4, 8, 16, 32 ]; + + for ( i = 0; i < lengths.length; i++ ) { + N = lengths[ i ]; + workspace = new Float64Array( (2*N) + 34 ); + rffti( N, workspace, 1, 0 ); + t.strictEqual( workspace[ 2*N ], N, 'stores sequence length N = ' + N + ' in workspace' ); + } + t.end(); +}); + +tape( 'the function handles stride parameter correctly', function test( t ) { + var hasNonZeroAtStride; + var workspace; + var stride; + var N; + var i; + + N = 8; + stride = 2; + workspace = new Float64Array( ( (2*N) + 34 ) * stride ); + rffti( N, workspace, stride, 0 ); + + // Checking that values are stored with the correct stride: + hasNonZeroAtStride = false; + for ( i = 0; i < workspace.length; i += stride ) { + if ( workspace[ i ] !== 0 ) { + hasNonZeroAtStride = true; + break; + } + } + t.ok( hasNonZeroAtStride, 'workspace contains non-zero values at stride intervals' ); + t.end(); +}); + +tape( 'the function handles offset parameter correctly', function test( t ) { + var hasNonZeroAfterOffset; + var allZerosBeforeOffset; + var workspace; + var offset; + var N; + var j; + var i; + + N = 8; + offset = 5; + workspace = new Float64Array( (2*N) + 34 + offset ); + rffti( N, workspace, 1, offset ); + + // Checking that values are stored with the correct offset: + hasNonZeroAfterOffset = false; + for ( i = offset; i < workspace.length; i++ ) { + if ( workspace[ i ] !== 0 ) { + hasNonZeroAfterOffset = true; + break; + } + } + t.ok( hasNonZeroAfterOffset, 'workspace contains non-zero values after offset' ); + + // Checking that values before offset remain zero: + allZerosBeforeOffset = true; + for ( j = 0; j < offset; j++ ) { + if ( workspace[ j ] !== 0 ) { + allZerosBeforeOffset = false; + break; + } + } + t.ok( allZerosBeforeOffset, 'workspace contains only zeros before offset' ); + t.end(); +}); + +tape( 'the function handles invalid arguments', function test( t ) { + var workspace; + var values; + var i; + + // Testing invalid N values: + values = [ + '5', + -5, + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [], + function foo() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + workspace = new Float64Array( 50 ); + rffti( values[ i ], workspace, 1, 0 ); + t.deepEqual( workspace, new Float64Array( 50 ), 'workspace remains unchanged when provided ' + values[ i ] ); + } + + // Testing invalid stride values: + values = [ + '5', + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [], + function foo() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + workspace = new Float64Array( 50 ); + rffti( 8, workspace, values[ i ], 0 ); + t.deepEqual( workspace, new Float64Array( 50 ), 'workspace remains unchanged when provided ' + values[ i ] ); + } + + // Testing invalid offset values: + values = [ + '5', + -5, + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [], + function foo() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + workspace = new Float64Array( 50 ); + rffti( 8, workspace, 1, values[ i ] ); + t.deepEqual( workspace, new Float64Array( 50 ), 'workspace remains unchanged when provided ' + values[ i ] ); + } + + t.end(); +}); + +tape( 'the function handles workspace array that is too small', function test( t ) { + var workspace; + var N; + + N = 8; + workspace = new Float64Array( 10 ); + rffti( N, workspace, 1, 0 ); + + // If workspace is too small, function should return without modifying workspace: + t.deepEqual( workspace, new Float64Array( 10 ), 'workspace remains unchanged when too small' ); + t.end(); +}); From b602856eb74f294daca0cd48e090049d9cafd3cc Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 8 Jul 2025 18:13:26 +0530 Subject: [PATCH 080/102] docs: add repl --- .../fft/base/fftpack/rffti/docs/repl.txt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt new file mode 100644 index 000000000000..64f4c9a03a46 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt @@ -0,0 +1,34 @@ + +{{alias}}( N, workspace, strideW, offsetW ) + Initializes a workspace array for performing a real-valued + Fourier transform. + + Parameters + ---------- + N: integer + Length of the sequence to transform. + + workspace: Float64Array + Workspace array. + + strideW: integer + Stride length for `workspace`. + + offsetW: integer + Starting index for `workspace`. + + Returns + ------- + void + + Examples + -------- + > var N = 8; + > var workspace = new {{alias:@stdlib/array/float64}}( (2*N) + 34 ); + > {{alias}}( N, workspace, 1, 0 ); + > workspace.slice(); + [ 0, ... 0, 0.7071067811865476, 0.7071067811865475, 0, ... 0, 8, 2, 2, 4, 0, ... 0 ] + + See Also + -------- + From c13936106bedf8e6d51cd72fce119d054cc216e6 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 8 Jul 2025 18:13:59 +0530 Subject: [PATCH 081/102] docs: add repl --- .../@stdlib/fft/base/fftpack/rffti/docs/repl.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt index 64f4c9a03a46..94d0514a4029 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt @@ -25,9 +25,11 @@ -------- > var N = 8; > var workspace = new {{alias:@stdlib/array/float64}}( (2*N) + 34 ); - > {{alias}}( N, workspace, 1, 0 ); - > workspace.slice(); - [ 0, ... 0, 0.7071067811865476, 0.7071067811865475, 0, ... 0, 8, 2, 2, 4, 0, ... 0 ] + > {{alias}}( N, workspace, 1, 0 ) + > workspace.slice() + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, + ... 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ... 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] See Also -------- From 3db30b3b6ee9923a797d5d5d912d43a02245164d Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 12 Jul 2025 16:25:43 +0530 Subject: [PATCH 082/102] docs: fix examples and spacing --- 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 status: passed - 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: 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: na - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/rffti/README.md | 8 ++++---- .../fft/base/fftpack/rffti/benchmark/benchmark.js | 2 +- .../@stdlib/fft/base/fftpack/rffti/docs/repl.txt | 12 ++++++------ .../fft/base/fftpack/rffti/docs/types/index.d.ts | 13 +++++++++---- .../fft/base/fftpack/rffti/examples/index.js | 2 +- .../@stdlib/fft/base/fftpack/rffti/lib/index.js | 11 ++++++++--- .../@stdlib/fft/base/fftpack/rffti/lib/main.js | 13 +++++++++---- .../@stdlib/fft/base/fftpack/rffti/test/test.js | 10 +++++----- 8 files changed, 43 insertions(+), 28 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md index 3c23d279085b..9a8c88d4fb15 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md @@ -49,7 +49,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var workspace; var N = 8; -workspace = new Float64Array( (2*N) + 34 ); +workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); ``` @@ -70,8 +70,8 @@ The function accepts the following arguments: ## Notes -- The workspace array should have a length of at least `(2*N) + 34` elements. -- For single-point sequences ( N=1 ), the function returns immediately as the FFT is the identity operation. +- The workspace array should have a length of at least `( 2*N ) + 34` elements. +- For single-point sequences ( N = 1 ), the function returns immediately as the FFT is the identity operation. @@ -91,7 +91,7 @@ var workspace; var N = 8; var i; -workspace = new Float64Array( (2*N) + 34 ); +workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js index ba2f503f3764..a85bf1370f60 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js @@ -48,7 +48,7 @@ function createBenchmark( N ) { var workspace; var i; - workspace = new Float64Array( (2*N) + 34 ); + workspace = new Float64Array( ( 2*N ) + 34 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt index 94d0514a4029..57ccda8c6ab9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/repl.txt @@ -24,12 +24,12 @@ Examples -------- > var N = 8; - > var workspace = new {{alias:@stdlib/array/float64}}( (2*N) + 34 ); - > {{alias}}( N, workspace, 1, 0 ) - > workspace.slice() - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, - ... 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ... 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + > var workspace = new {{alias:@stdlib/array/float64}}( ( 2*N ) + 34 ); + > {{alias}}( N, workspace, 1, 0 ); + > workspace.slice( N, 2*N ) + [ 0, 0, ~0.707, ~0.707, 0, 0, 0, 0 ] + > workspace.slice( 2*N, ( 2*N ) + 4 ) + [ 8, 2, 2, 4 ] See Also -------- diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts index bfaa4251e923..e1cdc89d9d4a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts @@ -25,7 +25,7 @@ * * ## Notes * -* - The workspace array should have a length of at least `(2*N) + 34` elements. +* - The workspace array should have a length of at least `( 2*N ) + 34` elements. * - For single-point sequences (N=1), the function returns immediately as the FFT is the identity operation. * * @param N - length of the sequence to transform @@ -38,12 +38,17 @@ * var N = 8; * * // Initialize a workspace array: -* var workspace = new Float64Array( (2*N) + 34 ); +* var workspace = new Float64Array( ( 2*N ) + 34 ); * * rffti( N, workspace, 1, 0 ); * -* var f = workspace.slice(); -* // returns [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] +* // Twiddle factors: +* var f = workspace.slice( N, 2*N ); +* // returns [ 0, 0, ~0.707, ~0.707, 0, 0, 0, 0 ] +* +* // Factorization results: +* f = workspace.slice( 2*N, ( 2*N ) + 4 ); +* // returns [ 8, 2, 2, 4 ] */ declare function rffti( N: number, workspace: Float64Array, strideW: number, offsetW: number ): void; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js index 4023031e61ba..14118261d582 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js @@ -25,7 +25,7 @@ var workspace; var N = 8; var i; -workspace = new Float64Array( (2*N) + 34 ); +workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js index 51b243964906..465bdbc2fcfa 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js @@ -30,12 +30,17 @@ * var N = 8; * * // Initialize a workspace array: -* var workspace = new Float64Array( (2*N) + 34 ); +* var workspace = new Float64Array( ( 2*N ) + 34 ); * * rffti( N, workspace, 1, 0 ); * -* var f = workspace.slice(); -* // returns [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] +* // Twiddle factors: +* var f = workspace.slice( N, 2*N ); +* // returns [ 0, 0, ~0.707, ~0.707, 0, 0, 0, 0 ] +* +* // Factorization results: +* f = workspace.slice( 2*N, ( 2*N ) + 4 ); +* // returns [ 8, 2, 2, 4 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js index 55adab1efcd6..d992912a5a21 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js @@ -142,12 +142,17 @@ var rffti1 = require( './rffti1.js' ); * var N = 8; * * // Initialize a workspace array: -* var workspace = new Float64Array( (2*N) + 34 ); +* var workspace = new Float64Array( ( 2*N ) + 34 ); * * rffti( N, workspace, 1, 0 ); * -* var f = workspace.slice(); -* // returns [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, 0, 0, 8, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] +* // Twiddle factors: +* var f = workspace.slice( N, 2*N ); +* // returns [ 0, 0, ~0.707, ~0.707, 0, 0, 0, 0 ] +* +* // Factorization results: +* f = workspace.slice( 2*N, ( 2*N ) + 4 ); +* // returns [ 8, 2, 2, 4 ] */ function rffti( N, workspace, strideW, offsetW ) { var offsetT; @@ -158,7 +163,7 @@ function rffti( N, workspace, strideW, offsetW ) { !isFloat64Array( workspace ) || !isInteger( strideW ) || !isNonNegativeInteger( offsetW ) || - workspace.length < offsetW + ( ( (2*N) + 34 ) * strideW ) + workspace.length < offsetW + ( ( ( 2*N ) + 34 ) * strideW ) ) { return; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js index 88365c1d922f..87435a124561 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js @@ -40,7 +40,7 @@ tape( 'the function initializes a workspace array for performing a real-valued F var i; N = 8; - workspace = new Float64Array( (2*N) + 34 ); + workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); // Checking that the workspace has been initialized with non-zero values: @@ -62,7 +62,7 @@ tape( 'the function handles N=1 case (identity transform)', function test( t ) { var i; N = 1; - workspace = new Float64Array( (2*N) + 34 ); + workspace = new Float64Array( ( 2*N ) + 34 ); // Filling with non-zero values to check if they remain unchanged: for ( i = 0; i < workspace.length; i++ ) { @@ -86,7 +86,7 @@ tape( 'the function correctly initializes workspace for various sequence lengths for ( i = 0; i < lengths.length; i++ ) { N = lengths[ i ]; - workspace = new Float64Array( (2*N) + 34 ); + workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); t.strictEqual( workspace[ 2*N ], N, 'stores sequence length N = ' + N + ' in workspace' ); } @@ -102,7 +102,7 @@ tape( 'the function handles stride parameter correctly', function test( t ) { N = 8; stride = 2; - workspace = new Float64Array( ( (2*N) + 34 ) * stride ); + workspace = new Float64Array( ( ( 2*N ) + 34 ) * stride ); rffti( N, workspace, stride, 0 ); // Checking that values are stored with the correct stride: @@ -128,7 +128,7 @@ tape( 'the function handles offset parameter correctly', function test( t ) { N = 8; offset = 5; - workspace = new Float64Array( (2*N) + 34 + offset ); + workspace = new Float64Array( ( 2*N ) + 34 + offset ); rffti( N, workspace, 1, offset ); // Checking that values are stored with the correct offset: From fdc5fe6fec4dd2b5cdc766087d2879c22adc29f0 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 20 Jul 2025 19:15:55 +0530 Subject: [PATCH 083/102] refactor: update rfftf --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../fft/base/fftpack/rfftf/lib/main.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js index b1a85e7c6673..744440656ea5 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js @@ -60,6 +60,9 @@ // MODULES // +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var isInteger = require( '@stdlib/assert/is-integer' ); var rfftf1 = require( './rfftf1.js' ); @@ -70,24 +73,35 @@ var rfftf1 = require( './rfftf1.js' ); * * @param {NonNegativeInteger} N - length of the sequence to transform * @param {Float64Array} r - real-valued input array containing the sequence to be transformed +* @param {integer} strideR - stride length for `r` * @param {NonNegativeInteger} offsetR - starting index for `r` * @param {Float64Array} workspace - workspace array containing pre-computed values +* @param {integer} strideW - stride length for `workspace` * @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} */ -function rfftf( N, r, offsetR, workspace, offsetW ) { // FIXME: add stride support +function rfftf( N, r, strideR, offsetR, workspace, strideW, offsetW ) { var offsetT; var offsetF; + if ( !isNonNegativeInteger( N ) || !isFloat64Array( r ) || + !isInteger( strideR ) || !isNonNegativeInteger( offsetR ) || + !isFloat64Array( workspace ) || !isInteger( strideW ) || + !isNonNegativeInteger( offsetW ) || + workspace.length < offsetW + ( ( ( 2*N ) + 34 ) * strideW ) ) { + return; + } + // When a sub-sequence is a single data point, the FFT is the identity, so no transformation necessary... if ( N === 1 ) { return; } + // Resolve the starting indices for storing twiddle factors and factorization results: - offsetT = offsetW + N; // index offset for twiddle factors - offsetF = offsetT + N; // index offset for factors describing the sub-transforms + offsetT = offsetW + (N * strideW); // index offset for twiddle factors + offsetF = offsetT + (N * strideW); // index offset for factors describing the sub-transforms - rfftf1( N, r, offsetR, workspace, offsetW, workspace, offsetT, workspace, offsetF ); // eslint-disable-line max-len + rfftf1( N, r, strideR, offsetR, workspace, strideW, offsetW, workspace, strideW, offsetT, workspace, strideW, offsetF ); // eslint-disable-line max-len } From 7bf7cb8d543c333369535b54ae0cd9d7dc41fda9 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 13 Aug 2025 08:29:37 +0530 Subject: [PATCH 084/102] docs: add examples --- .../fft/base/fftpack/rfftf/lib/c1_ref.js | 4 + .../fft/base/fftpack/rfftf/lib/c2_ref.js | 4 + .../fft/base/fftpack/rfftf/lib/ch2_ref.js | 4 + .../fft/base/fftpack/rfftf/lib/ch_ref.js | 4 + .../fft/base/fftpack/rfftf/lib/index.js | 18 +- .../fft/base/fftpack/rfftf/lib/main.js | 20 +- .../fft/base/fftpack/rfftf/lib/radf3.js | 232 ++++++++++++------ 7 files changed, 206 insertions(+), 80 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js index 942378815633..ff6e4bcb31f8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js @@ -70,6 +70,10 @@ * @param {NonNegativeInteger} l1 - length parameter related to the FFT stage * @param {NonNegativeInteger} ido - dimension order * @returns {NonNegativeInteger} computed index +* +* @example +* var out = c1Ref( 0, 1, 2, 4, 8 ); +* // returns 72 */ function c1Ref( a1, a2, a3, l1, ido ) { return ( ( (a3*l1)+a2 ) * ido ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js index 3b4910a3f245..9362f71cf72c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js @@ -68,6 +68,10 @@ * @param {NonNegativeInteger} a2 - index of second dimension * @param {integer} idl1 - stride related to the `l1` parameter * @returns {NonNegativeInteger} computed index +* +* @example +* var out = c2Ref( 0, 1, 2 ); +* // returns 2 */ function c2Ref( a1, a2, idl1 ) { return ( a2*idl1 ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js index b53f3d8579d4..7fb10a486ac1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js @@ -68,6 +68,10 @@ * @param {NonNegativeInteger} a2 - index of second dimension * @param {integer} idl1 - stride related to the `l1` parameter * @returns {NonNegativeInteger} computed index +* +* @example +* var out = ch2Ref( 0, 1, 2 ); +* // returns 2 */ function ch2Ref( a1, a2, idl1 ) { return ( a2*idl1 ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js index 1e4de83a80f1..cef952570341 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js @@ -70,6 +70,10 @@ * @param {NonNegativeInteger} radix - length parameter related to the FFT stage * @param {NonNegativeInteger} ido - dimension order * @returns {NonNegativeInteger} - calculated index +* +* @example +* var out = chRef( 0, 1, 2, 4, 8 ); +* // returns 72 */ function chRef( a1, a2, a3, radix, ido ) { return ( ( (a3*radix)+a2 ) * ido ) + a1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js index 6d5acd2c208a..7a40a5d0cd0a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js @@ -19,14 +19,28 @@ 'use strict'; /** -* TODO: description. +* Compute the forward real FFT. * * @module @stdlib/fft/base/fftpack/rfftf * * @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); * var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); * -* // TODO +* // Define the sequence length: +* var N = 4; +* +* // Initialize a workspace array for the FFT: +* var workspace = new Float64Array( ( 2*N ) + 34 ); +* rffti( N, workspace, 1, 0 ); +* +* // Define a real-valued input sequence: +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* // Perform the forward real FFT: +* rfftf( N, x, 1, 0, workspace, 1, 0 ); +* // x => [ 10.0, -2.0, -2.0, 0.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js index 744440656ea5..501c0f3decbc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js @@ -79,6 +79,24 @@ var rfftf1 = require( './rfftf1.js' ); * @param {integer} strideW - stride length for `workspace` * @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +* +* // Define the sequence length: +* var N = 4; +* +* // Initialize a workspace array for the FFT: +* var workspace = new Float64Array( ( 2*N ) + 34 ); +* rffti( N, workspace, 1, 0 ); +* +* // Define a real-valued input sequence: +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* // Perform the forward real FFT: +* rfftf( N, x, 1, 0, workspace, 1, 0 ); +* // x => [ 10.0, -2.0, -2.0, 2.0 ] */ function rfftf( N, r, strideR, offsetR, workspace, strideW, offsetW ) { var offsetT; @@ -101,7 +119,7 @@ function rfftf( N, r, strideR, offsetR, workspace, strideW, offsetW ) { offsetT = offsetW + (N * strideW); // index offset for twiddle factors offsetF = offsetT + (N * strideW); // index offset for factors describing the sub-transforms - rfftf1( N, r, strideR, offsetR, workspace, strideW, offsetW, workspace, strideW, offsetT, workspace, strideW, offsetF ); // eslint-disable-line max-len + rfftf1( N, r, offsetR, workspace, offsetW, workspace, offsetT, workspace, offsetF ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js index d7e4771eebf5..5490eab9fdd9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js @@ -62,94 +62,172 @@ // MODULES // -var sincos = require( '@stdlib/math/base/special/sincos' ); -var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); -var chRef = require( './ch_ref.js' ); -var ccRef = require( './cc_ref.js' ); +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var PI = require( '@stdlib/constants/float64/pi' ); // VARIABLES // -var sc = sincos( ( 2 * TWO_PI ) / 3 ); -var taur = sc[ 1 ]; // -0.5 -var taui = -sc[ 0 ]; // 0.866025403784439 +var TAUR = cos( ( 2.0 * PI ) / 3.0 ); +var TAUI = sin( ( 2.0 * PI ) / 3.0 ); -// MAIN // +// FUNCTIONS // /** -* Performs the forward FFT of length 3 for real-valued sequences. +* Resolves an index into the input array. +* +* ## Notes +* +* In a forward real FFT, the previous stage writes its results as two "rows" per sub-sequence. +* +* Thus, when reading from an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" (`even + odd` and `even - odd`, respectively) and where each "row" is arranged as `M*L` contiguous elements corresponding to interleaved real and imaginary components. +* +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: +* +* ```text +* │ k = 0 k = 1 k = 2 +* │ ──────────────────────────────────────────────────────────────────────────→ k +* j = 0 (even+odd) │ cc(0,0,0) ... cc(3,0,0) cc(0,1,0) ... cc(3,1,0) cc(0,2,0) ... cc(3,2,0) +* │ +* j = 1 (even-odd) │ cc(0,0,1) ... cc(3,0,1) cc(0,1,1) ... cc(3,1,1) cc(0,2,1) ... cc(3,2,1) +* └───────────────────────────────────────────────────────────────────────────→ i +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 0 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to either the `even + odd` or `even - odd` row of the previous stage. +* - `j` selects between the `even + odd` and `even - odd` row of the previous stage. +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | cc(0,0,0)...cc(3,0,0) ... cc(0,2,0)...cc(3,2,0) | cc(0,0,1)...cc(3,0,1) ... cc(0,2,1)...cc(3,2,1) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 +* ``` * * @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 {number} ccOffset - offset for the input array -* @param {Float64Array} ch - output array containing transformed sequences -* @param {number} chOffset - offset for the output array -* @param {Float64Array} wa1 - first array of twiddle factors -* @param {number} wa1Offset - offset for the first twiddle factors array -* @param {Float64Array} wa2 - second array of twiddle factors -* @param {number} wa2Offset - offset for the second twiddle factors array -* @returns {void} +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} j - input row +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the input array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = iptr( 0, 0, 0, L, M, stride, offset ); +* // returns 0 +* +* idx = iptr( 1, 0, 0, L, M, stride, offset ); +* // returns 1 +* +* idx = iptr( M-1, 0, 0, L, M, stride, offset ); +* // returns 3 +* +* idx = iptr( 0, 1, 0, L, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = iptr( M-1, L-1, 1, L, M, stride, offset ); +* // returns 23 */ -function radf3( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset ) { - 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 ) ); - wa1Offset -= 1; - wa2Offset -= 1; - - // 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 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ]) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); - di2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ]) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); - dr3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ]) + ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ); - di3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ]) - ( wa2[ i - 1 + wa2Offset ] * 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; - } - } +function iptr( i, k, j, L, M, stride, offset ) { + var n = i + ( ( k+(j*L) ) * M ); + return ( n*stride ) + offset; } +/** +* Resolves an index into the output array. +* +* ## Notes +* +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having three "columns" corresponding to the three components of a radix-3 stage (with real and imaginary parts interleaved along each sub-sequence) and where each "column" has `M` elements. +* +* Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: +* +* ```text +* j = 0 (component 0) j = 1 (component 1) j = 2 (component 2) +* k = 0 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┐ +* │ out(0,0,0) out(1,0,0) ... out(3,0,0) │ out(0,1,0) out(1,1,0) ... out(3,1,0) │ out(0,2,0) out(1,2,0) ... out(3,2,0) │ +* └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┤ +* k = 1 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┤ +* │ out(0,0,1) out(1,0,1) ... out(3,0,1) │ out(0,1,1) out(1,1,1) ... out(3,1,1) │ out(0,2,1) out(1,2,1) ... out(3,2,1) │ +* └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┤ +* k = 2 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┤ +* │ out(0,0,2) out(1,0,2) ... out(3,0,2) │ out(0,1,2) out(1,1,2) ... out(3,1,2) │ out(0,2,2) out(1,2,2) ... out(3,2,2) │ +* └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┘ +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 1 M-1 0 1 M-1 0 1 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short "column" sub-sequence. +* - `j` selects which of the three components we are in (0, 1, or 2). +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | out(0,0,0)...out(3,0,0) | out(0,1,0)...out(3,1,0) | out(0,2,0)...out(3,2,0) | out(0,0,1)...out(3,0,1) | ... | out(0,2,2)...out(3,2,2) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 M 2M-1 2M 3M-1 3M 4M-1 (3L-1)M 3LM-1 +* ``` +* +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radf3` being only one stage in a multi-stage driver which alternates between using `cc` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* +* Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. +* +* @private +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} j - index specifying which of the three complex components we are in (0, 1, or 2) +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the output array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = optr( 0, 0, 0, M, stride, offset ); +* // returns 0 +* +* idx = optr( 1, 0, 0, M, stride, offset ); +* // returns 1 +* +* idx = optr( M-1, 0, 0, M, stride, offset ); +* // returns 3 +* +* idx = optr( 0, 1, 0, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = optr( M-1, 2, L-1, M, stride, offset ); +* // returns 35 +*/ +function optr( i, j, k, M, stride, offset ) { + var n = i + ( ( j+(k*3) ) * M ); + return ( n*stride ) + offset; +} -// EXPORTS // - -module.exports = radf3; +// Check diff with radf2 to see JSDoc changes From b40c31214f11de706578759a425ef52c65f27403 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 2 Nov 2025 19:00:36 +0530 Subject: [PATCH 085/102] docs: fix jsdoc example values --- 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 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 --- --- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js index 7a40a5d0cd0a..f8def73fa9eb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js @@ -40,7 +40,7 @@ * * // Perform the forward real FFT: * rfftf( N, x, 1, 0, workspace, 1, 0 ); -* // x => [ 10.0, -2.0, -2.0, 0.0 ] +* // x => [ 10.0, -2.0, 2.0, -2.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js index 501c0f3decbc..443fe6b4c28f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js @@ -96,7 +96,7 @@ var rfftf1 = require( './rfftf1.js' ); * * // Perform the forward real FFT: * rfftf( N, x, 1, 0, workspace, 1, 0 ); -* // x => [ 10.0, -2.0, -2.0, 2.0 ] +* // x => [ 10.0, -2.0, 2.0, -2.0 ] */ function rfftf( N, r, strideR, offsetR, workspace, strideW, offsetW ) { var offsetT; From f85995612d27c3fdbbf5966f04fd9073f92a49f3 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 2 Nov 2025 19:11:32 +0530 Subject: [PATCH 086/102] test: use correct function call --- 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 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: passed - 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 --- --- lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 02b2ff99e4e1..74dcb47608fa 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -84,7 +84,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl x = new Float64Array( n ); y = new Float64Array( n ); xh = new Float64Array( n ); - w = new Float64Array( (n*2)+15 ); + w = new Float64Array( (n*2)+34 ); modn = n % 2; np1 = n + 1; @@ -127,7 +127,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl if ( modn === 0 ) { y[ n - 1 ] = sum1 - sum2; } - rfftf( n, x, 0, w, 0 ); + rfftf( n, x, 1, 0, w, 1, 0 ); rftf = 0.0; for ( i = 1; i <= n; i++ ) { // Computing MAX: @@ -167,7 +167,7 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl } rfftb( n, y, 0, w, 0 ); - rfftf( n, y, 0, w, 0 ); + rfftf( n, y, 1, 0, w, 1, 0 ); cf = 1.0 / n; rftfb = 0.0; for ( i = 1; i <= n; i++ ) { From cf006cdfae560a7c5c161aa03f8d36d76e7a5997 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 3 Nov 2025 19:12:54 +0530 Subject: [PATCH 087/102] feat: implement radf3 --- 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 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 --- --- .../fft/base/fftpack/rfftf/lib/radf3.js | 194 +++++++++++++++++- 1 file changed, 188 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js index 5490eab9fdd9..e3101f99cb08 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js @@ -63,14 +63,15 @@ // MODULES // var sin = require( '@stdlib/math/base/special/sin' ); -var cos = require( '@stdlib/math/base/special/cos' ); +var cosf = require( '@stdlib/math/base/special/cosf' ); var PI = require( '@stdlib/constants/float64/pi' ); // VARIABLES // -var TAUR = cos( ( 2.0 * PI ) / 3.0 ); -var TAUI = sin( ( 2.0 * PI ) / 3.0 ); +// Using `cosf` for `TAUR`, because it gives an exact value of `-0.5`, as given in the reference implementation, while `cos` gives `-0.4999999999999998`... +var TAUR = cosf( ( 2.0 * PI ) / 3.0 ); // -0.5 +var TAUI = sin( ( 2.0 * PI ) / 3.0 ); // ~0.866025403784439 // FUNCTIONS // @@ -155,12 +156,12 @@ function iptr( i, k, j, L, M, stride, offset ) { * * ## Notes * -* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having three "columns" corresponding to the three components of a radix-3 stage (with real and imaginary parts interleaved along each sub-sequence) and where each "column" has `M` elements. +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having three "columns" corresponding to the three components of a radix-3 stage (with real and imaginary parts of each component interleaved along each sub-sequence) and where each "column" has `M` elements. * * Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: * * ```text -* j = 0 (component 0) j = 1 (component 1) j = 2 (component 2) +* j = 0 (component 0) j = 1 (component 1) j = 2 (component 2) * k = 0 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┐ * │ out(0,0,0) out(1,0,0) ... out(3,0,0) │ out(0,1,0) out(1,1,0) ... out(3,1,0) │ out(0,2,0) out(1,2,0) ... out(3,2,0) │ * └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┤ @@ -230,4 +231,185 @@ function optr( i, j, k, M, stride, offset ) { return ( n*stride ) + offset; } -// Check diff with radf2 to see JSDoc changes + +// MAIN // + +/** +* Performs one radix-3 stage within a forward Fourier transform for a real-valued sequence. +* +* @private +* @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed +* @param {NonNegativeInteger} L - number of sub-sequences to be transformed +* @param {Float64Array} cc - input array containing the sub-sequences to be transformed +* @param {integer} sc - stride length for `cc` +* @param {NonNegativeInteger} oc - index offset for `cc` +* @param {Float64Array} out - output array containing transformed sub-sequences +* @param {integer} so - stride length for `out`` +* @param {NonNegativeInteger} oo - index offset for `out` +* @param {Float64Array} twiddles1 - first array of twiddle factors +* @param {integer} st1 - stride length for `twiddles1` +* @param {NonNegativeInteger} ot1 - index offset for `twiddles1` +* @param {Float64Array} twiddles2 - second array of twiddle factors +* @param {integer} st2 - stride length for `twiddles2` +* @param {NonNegativeInteger} ot2 - index offset for `twiddles2` +* @returns {void} +*/ +function radf3( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, st2, ot2 ) { // eslint-disable-line max-params + var it11; + var it12; + var it21; + var it22; + var MP1; + var tr2; + var ti2; + var tr3; + var ti3; + var cr2; + var ci2; + var dr2; + var di2; + var dr3; + var di3; + var ip1; + var ip2; + var ip3; + var io; + var im; + var i; + var k; + + /* + * First, perform the core butterfly for each sub-sequence being transformed. + * + * In the following loop, we handle harmonic `n = 0` for every transform. The input array is interpreted as a three-dimensional array, containing three components per sub-sequence. + * + * For a radix-3 forward FFT of a real-valued signal `x` and `n = 0`, we compute the three output components using the radix-3 butterfly equations. + * + * Because `W_N^0 = 1`, no twiddle multiplication is necessary for the DC component. + */ + + /* + * First, perform the core butterfly for each sub-sequence being transformed. + * + * In the following loop, we handle harmonic `n = 0` for every transform. As described for `iptr`, the input array is interpreted as a three-dimensional array, containing three "rows" per sub-sequence. + * + * row0 = input component 0 (j = 0) + * row1 = input component 1 (j = 1) + * row2 = input component 2 (j = 2) + * + * For a radix-3 forward FFT of a real-valued signal `x` and `n = 0`, + * + * x[0] = row0 + row1 + row2 + * x[M] = row0 + taur*(row1 + row2) + taui*(row2 - row1) + * x[2M] = row0 + taur*(row1 + row2) - taui*(row2 - row1) + * + * where `taur = -0.5` and `taui = √3/2 ≈ 0.866`, representing the complex twiddle factors for radix-3. + * + * Because these are the DC components, no frequency-dependent twiddle multiplication is necessary beyond these constant factors. + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( 0, k, 0, L, M, sc, oc ); // real part row 0 + ip2 = iptr( 0, k, 1, L, M, sc, oc ); // real part row 1 + ip3 = iptr( 0, k, 2, L, M, sc, oc ); // real part row 2 + + cr2 = cc[ ip2 ] + cc[ ip3 ]; + + io = optr( 0, 0, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + cr2; // row0 + row1 + row2 + + io = optr( 0, 2, k, M, so, oo ); + out[ io ] = TAUI * ( cc[ ip3 ] - cc[ ip2 ] ); // row0 + taur*(row1 + row2) + taui*(row2 - row1) + + io = optr( M-1, 1, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + ( TAUR * cr2 ); // row0 + taur*(row1 + row2) - taui*(row2 - row1) + } + + // When the number of elements in a sub-sequence is equal to `1`, there is nothing more to do, as the above butterfly produced the full result... + if ( M === 1 ) { + return; + } + /* + * Next, apply the general case where we need to loop through the non-trivial harmonics. + * + * For each harmonic `n = 1, ..., M/2-1`, we need to + * + * - recover three spectra from the three input rows. + * - apply radix-3 twiddle factors to rows 1 and 2, then combine with row 0 to form three output columns. + * - column 0 receives the simple sum, while columns 1 and 2 receive the modulated combinations using radix-3 constants. + * + * The mirror index `im = M + 1 - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. + */ + MP1 = M + 1; + + // Loop over each sub-sequence to be transformed... + for ( k = 0; k < L; k++ ) { + // Loop over the elements in each sub-sequence... + for ( i = 2; i < M; i += 2 ) { + im = MP1 - i; // "mirror" index + + // Resolve twiddle factor indices for component 1: + it11 = ( (i-1)*st1 ) + ot1; // cos(θ) for component 1 + it12 = ( i*st1 ) + ot1; // sin(θ) for component 1 + + // Resolve twiddle factor indices for component 2: + it21 = ( (i-1)*st2 ) + ot2; // cos(θ) for component 2 + it22 = ( i*st2 ) + ot2; // sin(θ) for component 2 + + // Load component 1 data... + ip1 = iptr( i, k, 1, L, M, sc, oc ); // real part component 1 + ip2 = iptr( i+1, k, 1, L, M, sc, oc ); // imag part component 1 + + // tmp1 = W_n ⋅ (c + j⋅d) for component 1 + dr2 = ( twiddles1[ it11 ] * cc[ ip1 ] ) + ( twiddles1[ it12 ] * cc[ ip2 ] ); // Re(tmp1) + di2 = ( twiddles1[ it11 ] * cc[ ip2 ] ) - ( twiddles1[ it12 ] * cc[ ip1 ] ); // Im(tmp1) + + // Load component 2 data... + ip1 = iptr( i, k, 2, L, M, sc, oc ); // real part component 2 + ip2 = iptr( i+1, k, 2, L, M, sc, oc ); // imag part component 2 + + // tmp2 = W_n ⋅ (c + j⋅d) for component 2 + dr3 = ( twiddles2[ it21 ] * cc[ ip1 ] ) + ( twiddles2[ it22 ] * cc[ ip2 ] ); // Re(tmp2) + di3 = ( twiddles2[ it21 ] * cc[ ip2 ] ) - ( twiddles2[ it22 ] * cc[ ip1 ] ); // Im(tmp2) + + // Combine the twiddled components + cr2 = dr2 + dr3; // sum of real parts + ci2 = di2 + di3; // sum of imag parts + + // Load component 0 data... + ip1 = iptr( i, k, 0, L, M, sc, oc ); // real part component 0 + ip2 = iptr( i+1, k, 0, L, M, sc, oc ); // imag part component 0 + + // Output component 0 = component 0 + (tmp1 + tmp2) + io = optr( i, 0, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + cr2; + + io = optr( i+1, 0, k, M, so, oo ); + out[ io ] = cc[ ip2 ] + ci2; + + // Intermediate results for components 1 and 2 + tr2 = cc[ ip1 ] + ( TAUR * cr2 ); + ti2 = cc[ ip2 ] + ( TAUR * ci2 ); + tr3 = TAUI * ( di2 - di3 ); + ti3 = TAUI * ( dr3 - dr2 ); + + // Output component 1 + io = optr( i, 2, k, M, so, oo ); + out[ io ] = tr2 + tr3; + + io = optr( im-1, 1, k, M, so, oo ); + out[ io ] = tr2 - tr3; + + // Output component 2 + io = optr( i+1, 2, k, M, so, oo ); + out[ io ] = ti2 + ti3; + + io = optr( im, 1, k, M, so, oo ); + out[ io ] = ti3 - ti2; + } + } +} + + +// EXPORTS // + +module.exports = radf3; From 23cb2fccfc1e948614b3f643dd89ff4c9d2a00af Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 4 Nov 2025 10:30:26 +0530 Subject: [PATCH 088/102] docs: remove redundant explanation --- 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 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 --- --- .../@stdlib/fft/base/fftpack/rfftf/lib/radf3.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js index e3101f99cb08..ca4d82d7128a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js @@ -278,16 +278,6 @@ function radf3( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s var i; var k; - /* - * First, perform the core butterfly for each sub-sequence being transformed. - * - * In the following loop, we handle harmonic `n = 0` for every transform. The input array is interpreted as a three-dimensional array, containing three components per sub-sequence. - * - * For a radix-3 forward FFT of a real-valued signal `x` and `n = 0`, we compute the three output components using the radix-3 butterfly equations. - * - * Because `W_N^0 = 1`, no twiddle multiplication is necessary for the DC component. - */ - /* * First, perform the core butterfly for each sub-sequence being transformed. * From 5960bd7dd720a25ea28181d37d0e96f4ea4b8883 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Fri, 9 Jan 2026 23:10:17 +0530 Subject: [PATCH 089/102] fix: use correct indices in radf2 and radf3 --- 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 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 --- --- .../fft/base/fftpack/rfftf/lib/radf2.js | 24 ++++++------ .../fft/base/fftpack/rfftf/lib/radf3.js | 37 +++++++++---------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js index 17cbb175113c..ca69162b6696 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js @@ -238,7 +238,6 @@ function optr( i, j, k, M, stride, offset ) { * @returns {void} */ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-disable-line max-params - var MP1; var tr2; var ti2; var ip1; @@ -291,39 +290,38 @@ function radf2( M, L, cc, sc, oc, out, so, oo, twiddles, st, ot ) { // eslint-di * x[2n] = E_n + W_n⋅O_n => column 0 * x[2n+1] = E_n - W_n⋅O_n => column 1 * - * The mirror index `im = M + 1 - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. + * The mirror index `im = M - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. */ if ( M >= 3 ) { - MP1 = M + 1; - // Loop over each sub-subsequence to be transformed... for ( k = 0; k < L; k++ ) { // Loop over the elements in each sub-sequence... for ( i = 2; i < M; i += 2 ) { - im = MP1 - i; // "mirror" index + im = M - i; // "mirror" index // Resolve twiddle factor indices: - it1 = ( (i-1)*st ) + ot; // cos(θ) - it2 = ( i*st ) + ot; // sin(θ) + it1 = ( (i-2)*st ) + ot; // cos(θ) + it2 = ( (i-1)*st ) + ot; // sin(θ) // Load the `even-odd` row... - ip1 = iptr( i, k, 1, L, M, sc, oc ); // c = Re(row1) - ip2 = iptr( i+1, k, 1, L, M, sc, oc ); // d = Im(row1) + ip1 = iptr( i-1, k, 1, L, M, sc, oc ); // c = Re(row1) + ip2 = iptr( i, k, 1, L, M, sc, oc ); // d = Im(row1) + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment // tmp = W_n ⋅ (c + j⋅d) tr2 = ( twiddles[ it1 ] * cc[ ip1 ] ) + ( twiddles[ it2 ] * cc[ ip2 ] ); // Re(tmp) ti2 = ( twiddles[ it1 ] * cc[ ip2 ] ) - ( twiddles[ it2 ] * cc[ ip1 ] ); // Im(tmp) // Load the `even+odd` row... - ip1 = iptr( i+1, k, 0, L, M, sc, oc ); // b = Im(row0) - io = optr( i+1, 0, k, M, so, oo ); // Im(x[2n]) + ip1 = iptr( i, k, 0, L, M, sc, oc ); // b = Im(row0) + io = optr( i, 0, k, M, so, oo ); // Im(x[2n]) out[ io ] = cc[ ip1 ] + ti2; io = optr( im, 1, k, M, so, oo ); // Im(x[2n+1]) out[ io ] = ti2 - cc[ ip1 ]; - ip1 = iptr( i, k, 0, L, M, sc, oc ); // a = Re(row0) - io = optr( i, 0, k, M, so, oo ); // Re(x[2n]) + ip1 = iptr( i-1, k, 0, L, M, sc, oc ); // a = Re(row0) + io = optr( i-1, 0, k, M, so, oo ); // Re(x[2n]) out[ io ] = cc[ ip1 ] + tr2; io = optr( im-1, 1, k, M, so, oo ); // Re(x[2n+1]) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js index ca4d82d7128a..3c241814d842 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js @@ -56,7 +56,7 @@ * ``` */ -/* eslint-disable max-len */ +/* eslint-disable max-len, @cspell/spellchecker */ 'use strict'; @@ -259,7 +259,6 @@ function radf3( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s var it12; var it21; var it22; - var MP1; var tr2; var ti2; var tr3; @@ -327,35 +326,33 @@ function radf3( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s * - apply radix-3 twiddle factors to rows 1 and 2, then combine with row 0 to form three output columns. * - column 0 receives the simple sum, while columns 1 and 2 receive the modulated combinations using radix-3 constants. * - * The mirror index `im = M + 1 - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. + * The mirror index `im = M - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. */ - MP1 = M + 1; - // Loop over each sub-sequence to be transformed... for ( k = 0; k < L; k++ ) { // Loop over the elements in each sub-sequence... for ( i = 2; i < M; i += 2 ) { - im = MP1 - i; // "mirror" index + im = M - i; // "mirror" index // Resolve twiddle factor indices for component 1: - it11 = ( (i-1)*st1 ) + ot1; // cos(θ) for component 1 - it12 = ( i*st1 ) + ot1; // sin(θ) for component 1 + it11 = ( (i-2)*st1 ) + ot1; // cos(θ) for component 1 + it12 = ( (i-1)*st1 ) + ot1; // sin(θ) for component 1 // Resolve twiddle factor indices for component 2: - it21 = ( (i-1)*st2 ) + ot2; // cos(θ) for component 2 - it22 = ( i*st2 ) + ot2; // sin(θ) for component 2 + it21 = ( (i-2)*st2 ) + ot2; // cos(θ) for component 2 + it22 = ( (i-1)*st2 ) + ot2; // sin(θ) for component 2 // Load component 1 data... - ip1 = iptr( i, k, 1, L, M, sc, oc ); // real part component 1 - ip2 = iptr( i+1, k, 1, L, M, sc, oc ); // imag part component 1 + ip1 = iptr( i-1, k, 1, L, M, sc, oc ); // real part component 1 + ip2 = iptr( i, k, 1, L, M, sc, oc ); // imag part component 1 // tmp1 = W_n ⋅ (c + j⋅d) for component 1 dr2 = ( twiddles1[ it11 ] * cc[ ip1 ] ) + ( twiddles1[ it12 ] * cc[ ip2 ] ); // Re(tmp1) di2 = ( twiddles1[ it11 ] * cc[ ip2 ] ) - ( twiddles1[ it12 ] * cc[ ip1 ] ); // Im(tmp1) // Load component 2 data... - ip1 = iptr( i, k, 2, L, M, sc, oc ); // real part component 2 - ip2 = iptr( i+1, k, 2, L, M, sc, oc ); // imag part component 2 + ip1 = iptr( i-1, k, 2, L, M, sc, oc ); // real part component 2 + ip2 = iptr( i, k, 2, L, M, sc, oc ); // imag part component 2 // tmp2 = W_n ⋅ (c + j⋅d) for component 2 dr3 = ( twiddles2[ it21 ] * cc[ ip1 ] ) + ( twiddles2[ it22 ] * cc[ ip2 ] ); // Re(tmp2) @@ -366,14 +363,14 @@ function radf3( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s ci2 = di2 + di3; // sum of imag parts // Load component 0 data... - ip1 = iptr( i, k, 0, L, M, sc, oc ); // real part component 0 - ip2 = iptr( i+1, k, 0, L, M, sc, oc ); // imag part component 0 + ip1 = iptr( i-1, k, 0, L, M, sc, oc ); // real part component 0 + ip2 = iptr( i, k, 0, L, M, sc, oc ); // imag part component 0 // Output component 0 = component 0 + (tmp1 + tmp2) - io = optr( i, 0, k, M, so, oo ); + io = optr( i-1, 0, k, M, so, oo ); out[ io ] = cc[ ip1 ] + cr2; - io = optr( i+1, 0, k, M, so, oo ); + io = optr( i, 0, k, M, so, oo ); out[ io ] = cc[ ip2 ] + ci2; // Intermediate results for components 1 and 2 @@ -383,14 +380,14 @@ function radf3( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s ti3 = TAUI * ( dr3 - dr2 ); // Output component 1 - io = optr( i, 2, k, M, so, oo ); + io = optr( i-1, 2, k, M, so, oo ); out[ io ] = tr2 + tr3; io = optr( im-1, 1, k, M, so, oo ); out[ io ] = tr2 - tr3; // Output component 2 - io = optr( i+1, 2, k, M, so, oo ); + io = optr( i, 2, k, M, so, oo ); out[ io ] = ti2 + ti3; io = optr( im, 1, k, M, so, oo ); From aa03c1e8f84139145f2081c0a0ff6e18fb4ad5f4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:57:05 +0000 Subject: [PATCH 090/102] chore: update copyright years --- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md | 2 +- .../@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js | 2 +- .../@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts | 2 +- .../@stdlib/fft/base/fftpack/decompose/docs/types/test.ts | 2 +- .../@stdlib/fft/base/fftpack/decompose/examples/index.js | 2 +- .../@stdlib/fft/base/fftpack/decompose/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js | 2 +- .../@stdlib/fft/base/fftpack/decompose/test/test.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js | 2 +- .../@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js | 2 +- .../@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md | 2 +- .../@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js | 2 +- .../@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts | 2 +- .../@stdlib/fft/base/fftpack/rffti/docs/types/test.ts | 2 +- .../@stdlib/fft/base/fftpack/rffti/examples/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js | 2 +- lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js | 2 +- 98 files changed, 98 insertions(+), 98 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js index 942378815633..58cd96796a2a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c1_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js index 3b4910a3f245..5c2090ba8d4b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/c2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js index c9491438a35c..0e34024ee169 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cc_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js index a7ce90d39890..114dd986db94 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/cfftb1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js index b53f3d8579d4..986c9dab3c87 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js index 1e4de83a80f1..4013ceb9d7a7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/ch_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js index 3699b745e746..6e891db05c43 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js index ec2d606855a5..79b40e379381 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js index 753412c594f7..42c798da3376 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js index 2f5ac687b363..5e73533257ec 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js index 9f6c1ef5fa41..b83cd4a83aad 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passb4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js index 8ccb832f674a..78c1d6b56eb7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js index af2f8689ce72..35bc04542705 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftb/lib/passfb5.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js index 942378815633..58cd96796a2a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c1_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js index 3b4910a3f245..5c2090ba8d4b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/c2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js index c9491438a35c..0e34024ee169 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cc_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js index e62ed008d290..a4ee5c2b36ba 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/cfftf1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js index b53f3d8579d4..986c9dab3c87 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js index 1e4de83a80f1..4013ceb9d7a7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/ch_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js index a64055bae4ee..d7962271317b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js index 728f1823acc3..0cb49970416b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js index d0002c188606..bad549315296 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js index 503431a6359b..f7dd9eed662c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js index 44b86c725673..77678286cfb2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passf4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js index 8ccb832f674a..78c1d6b56eb7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js index af2f8689ce72..35bc04542705 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cfftf/lib/passfb5.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js index ae6aadf84cc4..bb3c9b6be816 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/cffti1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js index 9b77cb2302e2..2d10ae8a1552 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js index 1d13edc62b87..36d77bf74c54 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cffti/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js index e8601ef86570..9cf1cf60cf1d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/cosqb1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js index d3424d7471a8..d99612de855a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js index 1ded0d7ecac4..083213c0e4ee 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqb/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js index 2970e1ebf8c4..e9c37b57dc8e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/cosqf1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js index 94292b3659cd..f983f0c6db98 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js index e1f6371dc06b..24062e4922df 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqf/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js index 58b23230d462..42811d947fcb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js index 422170d0c73b..725d0367ed49 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cosqi/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js index 2f99c7c0153d..30078c3ecc71 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js index ba78d05ad705..2b55e1fb1f9e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/cost/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js index 8d694f672f4d..869d7b105e4c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js index 521c9c37a36a..8fb8a502f8c6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/costi/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md index 8d419dac01a2..f22cb31889cd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js index 7c98f25cd545..9e8ffd5c5823 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts index 74b73ad265e0..ead5dc3f37c7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts index 26a1c0508adc..1032643ce1fb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js index e95883191868..9e49148cf7c7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js index f497a5d7bcff..46eaf9d2fa30 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js index 965cf9e7bfc3..7a2ef5ca600c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js index 2c6500d458ac..e4dbdb9d2644 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js index 942378815633..58cd96796a2a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c1_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js index 3b4910a3f245..5c2090ba8d4b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/c2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js index c9491438a35c..0e34024ee169 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/cc_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js index b53f3d8579d4..986c9dab3c87 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js index 1e4de83a80f1..4013ceb9d7a7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/ch_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js index 11dfd99dd6d7..4d897b7867e4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js index a435df1cd4c0..a44f46150f52 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js index 55d984f19792..d426ce55153f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/print_real_workspace.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js index a97c7d12b33b..a5c388ca8104 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js index 1c30914e1d52..a4c75a635df1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js index 7adc501a803a..4197771fa9c9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js index 6f90f17fe014..b7540ca2d7cb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radb5.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js index b025eefe8d81..2419dab4ebba 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/radbg.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js index 364b28f6d2e4..3c99f653803c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftb/lib/rfftb1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js index ff6e4bcb31f8..b889111ca562 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js index 9362f71cf72c..ff2725f333d1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js index c9491438a35c..0e34024ee169 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js index 7fb10a486ac1..ddc19a4da9aa 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js index cef952570341..12f9c1a337de 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js index f8def73fa9eb..6dfc306e9372 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js index 443fe6b4c28f..e021f88ddb12 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js index 55d984f19792..d426ce55153f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/print_real_workspace.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js index ca69162b6696..4d7a4fe4dc6b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js index 3c241814d842..a59b898132ae 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js index bed422791feb..15f18a9b9c28 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js index 159bd7158742..1223207d51e1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js index 52918a172596..e657662edcfa 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js index e960afe06abc..a2b684f28870 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md index 9a8c88d4fb15..55f7735db4eb 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js index a85bf1370f60..4c0f6949a713 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts index e1cdc89d9d4a..18737c941259 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts index bc04a38a4ec8..0513b04502e7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js index 14118261d582..1d7e5dca050c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js index 465bdbc2fcfa..f2180434b5a1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js index d992912a5a21..bce23c17e147 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js index 0a795762c651..d57f1795ed4d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js index 87435a124561..c571b5a4a206 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js index 9f809837adee..14238b92e78f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js index ffb313646520..45f55cf81d72 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqb/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js index ea0678fc0606..a2e485f1f645 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js index af248890baf0..50e1bcc4b125 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqf/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js index 76f4974dba02..694b82d1ebcc 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js index 30c8dd1cfe07..0b10dc1c3ec7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinqi/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js index d3dae9453a23..13e80e2492f6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js index 166cb7f8e87a..a0f7ccea1609 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js index 8ddf6f38e06a..8df3052fc657 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sint/lib/sint1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js index d8186d88b0cd..47fa29d97505 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js index 3162039ff322..4903e52ad398 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/sinti/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 74dcb47608fa..d8dc77ff8bbd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. From 1f66f69c1da15a18ffbbd1dc82868f3476dd553f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 12 Jan 2026 09:47:30 +0530 Subject: [PATCH 091/102] feat: complete rfftf initially --- fftpack.c | 3123 +++++++++++++++++ .../@stdlib/fft/base/fftpack/rfftf/README.md | 151 + .../base/fftpack/rfftf/benchmark/benchmark.js | 124 + .../fft/base/fftpack/rfftf/docs/repl.txt | 49 + .../base/fftpack/rfftf/docs/types/index.d.ts | 63 + .../fft/base/fftpack/rfftf/docs/types/test.ts | 148 + .../fft/base/fftpack/rfftf/examples/index.js | 46 + .../fft/base/fftpack/rfftf/lib/radf2.js | 2 +- .../fft/base/fftpack/rfftf/lib/radf3.js | 32 +- .../fft/base/fftpack/rfftf/lib/radf4.js | 464 ++- .../fft/base/fftpack/rfftf/lib/radf5.js | 483 ++- .../fft/base/fftpack/rfftf/lib/radfg.js | 584 ++- .../fft/base/fftpack/rfftf/lib/rfftf1.js | 10 +- .../fft/base/fftpack/rfftf/package.json | 12 +- .../fft/base/fftpack/rfftf/test/test.js | 256 ++ .../fft/base/fftpack/rffti/lib/rffti1.js | 2 +- .../fft/base/fftpack/test/test.rfft.js | 8 +- 17 files changed, 5239 insertions(+), 318 deletions(-) create mode 100644 fftpack.c create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js diff --git a/fftpack.c b/fftpack.c new file mode 100644 index 000000000000..ed6c96179771 --- /dev/null +++ b/fftpack.c @@ -0,0 +1,3123 @@ +/* + compile with cc -DTESTING_FFTPACK fftpack.c in order to build the + test application. + + This is an f2c translation of the full fftpack sources as found on + http://www.netlib.org/fftpack/ The translated code has been + slightlty edited to remove the ugliest artefacts of the translation + (a hundred of wild GOTOs were wiped during that operation). + + The original fftpack file was written by Paul N. Swarztrauber + (Version 4, 1985), in fortran 77. + + FFTPACK license: + + http://www.cisl.ucar.edu/css/software/fftpack5/ftpk.html + + 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. + + ChangeLog: + 2011/10/02: this is my first release of this file. +*/ + +#include "fftpack.h" +#include + +typedef fftpack_real real; +typedef fftpack_int integer; + +#ifndef FFTPACK_DOUBLE_PRECISION + #define FFTPACK_COS cosf + #define FFTPACK_SIN sinf +#else + #define FFTPACK_COS cos + #define FFTPACK_SIN sin +#endif + + +typedef struct f77complex { + real r, i; +} f77complex; + +#ifdef TESTING_FFTPACK +static real c_abs(f77complex *c) { return sqrt(c->r*c->r + c->i*c->i); } +static double dmax(double a, double b) { return a < b ? b : a; } +#endif + +/* define own constants required to turn off g++ extensions .. */ +#ifndef M_PI + #define M_PI 3.14159265358979323846 /* pi */ +#endif + +#ifndef M_SQRT2 + #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif + +#ifndef M_SQRT8 + #define M_SQRT8 2.82842712474619009760 /* sqrt(8) */ +#endif + + +/* translated by f2c (version 20061008), and slightly edited */ + +static void passfb(integer *nac, integer ido, integer ip, integer l1, integer idl1, + real *cc, real *c1, real *c2, real *ch, real *ch2, const real *wa, real fsign) +{ + /* System generated locals */ + integer ch_offset, cc_offset, + c1_offset, c2_offset, ch2_offset; + + /* Local variables */ + integer i, j, k, l, jc, lc, ik, idj, idl, inc, idp; + real wai, war; + integer ipp2, idij, idlj, idot, ipph; + + +#define c1_ref(a_1,a_2,a_3) c1[((a_3)*l1 + (a_2))*ido + a_1] +#define c2_ref(a_1,a_2) c2[(a_2)*idl1 + a_1] +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*ip + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] +#define ch2_ref(a_1,a_2) ch2[(a_2)*idl1 + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + c1_offset = 1 + ido * (1 + l1); + c1 -= c1_offset; + cc_offset = 1 + ido * (1 + ip); + cc -= cc_offset; + ch2_offset = 1 + idl1; + ch2 -= ch2_offset; + c2_offset = 1 + idl1; + c2 -= c2_offset; + --wa; + + /* Function Body */ + idot = ido / 2; + ipp2 = ip + 2; + ipph = (ip + 1) / 2; + idp = ip * ido; + + if (ido >= l1) { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (k = 1; k <= l1; ++k) { + for (i = 1; i <= ido; ++i) { + ch_ref(i, k, j) = cc_ref(i, j, k) + cc_ref(i, jc, k); + ch_ref(i, k, jc) = cc_ref(i, j, k) - cc_ref(i, jc, k); + } + } + } + for (k = 1; k <= l1; ++k) { + for (i = 1; i <= ido; ++i) { + ch_ref(i, k, 1) = cc_ref(i, 1, k); + } + } + } else { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (i = 1; i <= ido; ++i) { + for (k = 1; k <= l1; ++k) { + ch_ref(i, k, j) = cc_ref(i, j, k) + cc_ref(i, jc, k); + ch_ref(i, k, jc) = cc_ref(i, j, k) - cc_ref(i, jc, k); + } + } + } + for (i = 1; i <= ido; ++i) { + for (k = 1; k <= l1; ++k) { + ch_ref(i, k, 1) = cc_ref(i, 1, k); + } + } + } + idl = 2 - ido; + inc = 0; + for (l = 2; l <= ipph; ++l) { + lc = ipp2 - l; + idl += ido; + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, l) = ch2_ref(ik, 1) + wa[idl - 1] * ch2_ref(ik, 2); + c2_ref(ik, lc) = fsign*wa[idl] * ch2_ref(ik, ip); + } + idlj = idl; + inc += ido; + for (j = 3; j <= ipph; ++j) { + jc = ipp2 - j; + idlj += inc; + if (idlj > idp) { + idlj -= idp; + } + war = wa[idlj - 1]; + wai = wa[idlj]; + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, l) = c2_ref(ik, l) + war * ch2_ref(ik, j); + c2_ref(ik, lc) = c2_ref(ik, lc) + fsign*wai * ch2_ref(ik, jc); + } + } + } + for (j = 2; j <= ipph; ++j) { + for (ik = 1; ik <= idl1; ++ik) { + ch2_ref(ik, 1) = ch2_ref(ik, 1) + ch2_ref(ik, j); + } + } + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (ik = 2; ik <= idl1; ik += 2) { + ch2_ref(ik - 1, j) = c2_ref(ik - 1, j) - c2_ref(ik, jc); + ch2_ref(ik - 1, jc) = c2_ref(ik - 1, j) + c2_ref(ik, jc); + ch2_ref(ik, j) = c2_ref(ik, j) + c2_ref(ik - 1, jc); + ch2_ref(ik, jc) = c2_ref(ik, j) - c2_ref(ik - 1, jc); + } + } + *nac = 1; + if (ido == 2) { + return; + } + *nac = 0; + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, 1) = ch2_ref(ik, 1); + } + for (j = 2; j <= ip; ++j) { + for (k = 1; k <= l1; ++k) { + c1_ref(1, k, j) = ch_ref(1, k, j); + c1_ref(2, k, j) = ch_ref(2, k, j); + } + } + if (idot <= l1) { + idij = 0; + for (j = 2; j <= ip; ++j) { + idij += 2; + for (i = 4; i <= ido; i += 2) { + idij += 2; + for (k = 1; k <= l1; ++k) { + c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) - fsign*wa[idij] * ch_ref(i, k, j); + c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + fsign*wa[idij] * ch_ref(i - 1, k, j); + } + } + } + return; + } + idj = 2 - ido; + for (j = 2; j <= ip; ++j) { + idj += ido; + for (k = 1; k <= l1; ++k) { + idij = idj; + for (i = 4; i <= ido; i += 2) { + idij += 2; + c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) - fsign*wa[idij] * ch_ref(i, k, j); + c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + fsign*wa[idij] * ch_ref(i - 1, k, j); + } + } + } +} /* passb */ + +#undef ch2_ref +#undef ch_ref +#undef cc_ref +#undef c2_ref +#undef c1_ref + + +static void passb2(integer ido, integer l1, const real *cc, real *ch, const real *wa1) +{ + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ti2, tr2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*2 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 3; + cc -= cc_offset; + --wa1; + + /* Function Body */ + if (ido <= 2) { + for (k = 1; k <= l1; ++k) { + ch_ref(1, k, 1) = cc_ref(1, 1, k) + cc_ref(1, 2, k); + ch_ref(1, k, 2) = cc_ref(1, 1, k) - cc_ref(1, 2, k); + ch_ref(2, k, 1) = cc_ref(2, 1, k) + cc_ref(2, 2, k); + ch_ref(2, k, 2) = cc_ref(2, 1, k) - cc_ref(2, 2, k); + } + return; + } + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 2, k); + tr2 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 2, k); + ch_ref(i, k, 1) = cc_ref(i, 1, k) + cc_ref(i, 2, k); + ti2 = cc_ref(i, 1, k) - cc_ref(i, 2, k); + ch_ref(i, k, 2) = wa1[i - 1] * ti2 + wa1[i] * tr2; + ch_ref(i - 1, k, 2) = wa1[i - 1] * tr2 - wa1[i] * ti2; + } + } +} /* passb2 */ + +#undef ch_ref +#undef cc_ref + + +static void passb3(integer ido, integer l1, const real *cc, real *ch, const real *wa1, const real *wa2) +{ + static const real taur = -.5f; + static const real taui = .866025403784439f; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*3 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + (ido << 2); + cc -= cc_offset; + --wa1; + --wa2; + + /* Function Body */ + if (ido == 2) { + for (k = 1; k <= l1; ++k) { + tr2 = cc_ref(1, 2, k) + cc_ref(1, 3, k); + cr2 = cc_ref(1, 1, k) + taur * tr2; + ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2; + ti2 = cc_ref(2, 2, k) + cc_ref(2, 3, k); + ci2 = cc_ref(2, 1, k) + taur * ti2; + ch_ref(2, k, 1) = cc_ref(2, 1, k) + ti2; + cr3 = taui * (cc_ref(1, 2, k) - cc_ref(1, 3, k)); + ci3 = taui * (cc_ref(2, 2, k) - cc_ref(2, 3, k)); + ch_ref(1, k, 2) = cr2 - ci3; + ch_ref(1, k, 3) = cr2 + ci3; + ch_ref(2, k, 2) = ci2 + cr3; + ch_ref(2, k, 3) = ci2 - cr3; + } + } else { + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + tr2 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 3, k); + cr2 = cc_ref(i - 1, 1, k) + taur * tr2; + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2; + ti2 = cc_ref(i, 2, k) + cc_ref(i, 3, k); + ci2 = cc_ref(i, 1, k) + taur * ti2; + ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2; + cr3 = taui * (cc_ref(i - 1, 2, k) - cc_ref(i - 1, 3, k)); + ci3 = taui * (cc_ref(i, 2, k) - cc_ref(i, 3, k)); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + cr3; + di3 = ci2 - cr3; + ch_ref(i, k, 2) = wa1[i - 1] * di2 + wa1[i] * dr2; + ch_ref(i - 1, k, 2) = wa1[i - 1] * dr2 - wa1[i] * di2; + ch_ref(i, k, 3) = wa2[i - 1] * di3 + wa2[i] * dr3; + ch_ref(i - 1, k, 3) = wa2[i - 1] * dr3 - wa2[i] * di3; + } + } + } +} /* passb3 */ + +#undef ch_ref +#undef cc_ref + + +static void passb4(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3) +{ + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*4 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 5; + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + + /* Function Body */ + if (ido == 2) { + for (k = 1; k <= l1; ++k) { + ti1 = cc_ref(2, 1, k) - cc_ref(2, 3, k); + ti2 = cc_ref(2, 1, k) + cc_ref(2, 3, k); + tr4 = cc_ref(2, 4, k) - cc_ref(2, 2, k); + ti3 = cc_ref(2, 2, k) + cc_ref(2, 4, k); + tr1 = cc_ref(1, 1, k) - cc_ref(1, 3, k); + tr2 = cc_ref(1, 1, k) + cc_ref(1, 3, k); + ti4 = cc_ref(1, 2, k) - cc_ref(1, 4, k); + tr3 = cc_ref(1, 2, k) + cc_ref(1, 4, k); + ch_ref(1, k, 1) = tr2 + tr3; + ch_ref(1, k, 3) = tr2 - tr3; + ch_ref(2, k, 1) = ti2 + ti3; + ch_ref(2, k, 3) = ti2 - ti3; + ch_ref(1, k, 2) = tr1 + tr4; + ch_ref(1, k, 4) = tr1 - tr4; + ch_ref(2, k, 2) = ti1 + ti4; + ch_ref(2, k, 4) = ti1 - ti4; + } + } else { + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + ti1 = cc_ref(i, 1, k) - cc_ref(i, 3, k); + ti2 = cc_ref(i, 1, k) + cc_ref(i, 3, k); + ti3 = cc_ref(i, 2, k) + cc_ref(i, 4, k); + tr4 = cc_ref(i, 4, k) - cc_ref(i, 2, k); + tr1 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 3, k); + tr2 = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 3, k); + ti4 = cc_ref(i - 1, 2, k) - cc_ref(i - 1, 4, k); + tr3 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 4, k); + ch_ref(i - 1, k, 1) = tr2 + tr3; + cr3 = tr2 - tr3; + ch_ref(i, k, 1) = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 + tr4; + cr4 = tr1 - tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch_ref(i - 1, k, 2) = wa1[i - 1] * cr2 - wa1[i] * ci2; + ch_ref(i, k, 2) = wa1[i - 1] * ci2 + wa1[i] * cr2; + ch_ref(i - 1, k, 3) = wa2[i - 1] * cr3 - wa2[i] * ci3; + ch_ref(i, k, 3) = wa2[i - 1] * ci3 + wa2[i] * cr3; + ch_ref(i - 1, k, 4) = wa3[i - 1] * cr4 - wa3[i] * ci4; + ch_ref(i, k, 4) = wa3[i - 1] * ci4 + wa3[i] * cr4; + } + } + } +} /* passb4 */ + +#undef ch_ref +#undef cc_ref + +/* passf5 and passb5 merged */ +static void passfb5(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3, const real *wa4, real fsign) +{ + const real tr11 = .309016994374947f; + const real ti11 = .951056516295154f*fsign; + const real tr12 = -.809016994374947f; + const real ti12 = .587785252292473f*fsign; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ci2, ci3, ci4, ci5, di3, di4, di5, di2, cr2, cr3, cr5, cr4, ti2, ti3, + ti4, ti5, dr3, dr4, dr5, dr2, tr2, tr3, tr4, tr5; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*5 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 6; + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + --wa4; + + /* Function Body */ + if (ido == 2) { + for (k = 1; k <= l1; ++k) { + ti5 = cc_ref(2, 2, k) - cc_ref(2, 5, k); + ti2 = cc_ref(2, 2, k) + cc_ref(2, 5, k); + ti4 = cc_ref(2, 3, k) - cc_ref(2, 4, k); + ti3 = cc_ref(2, 3, k) + cc_ref(2, 4, k); + tr5 = cc_ref(1, 2, k) - cc_ref(1, 5, k); + tr2 = cc_ref(1, 2, k) + cc_ref(1, 5, k); + tr4 = cc_ref(1, 3, k) - cc_ref(1, 4, k); + tr3 = cc_ref(1, 3, k) + cc_ref(1, 4, k); + ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2 + tr3; + ch_ref(2, k, 1) = cc_ref(2, 1, k) + ti2 + ti3; + cr2 = cc_ref(1, 1, k) + tr11 * tr2 + tr12 * tr3; + ci2 = cc_ref(2, 1, k) + tr11 * ti2 + tr12 * ti3; + cr3 = cc_ref(1, 1, k) + tr12 * tr2 + tr11 * tr3; + ci3 = cc_ref(2, 1, k) + tr12 * ti2 + tr11 * ti3; + cr5 = ti11 * tr5 + ti12 * tr4; + ci5 = ti11 * ti5 + ti12 * ti4; + cr4 = ti12 * tr5 - ti11 * tr4; + ci4 = ti12 * ti5 - ti11 * ti4; + ch_ref(1, k, 2) = cr2 - ci5; + ch_ref(1, k, 5) = cr2 + ci5; + ch_ref(2, k, 2) = ci2 + cr5; + ch_ref(2, k, 3) = ci3 + cr4; + ch_ref(1, k, 3) = cr3 - ci4; + ch_ref(1, k, 4) = cr3 + ci4; + ch_ref(2, k, 4) = ci3 - cr4; + ch_ref(2, k, 5) = ci2 - cr5; + } + } else { + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + ti5 = cc_ref(i, 2, k) - cc_ref(i, 5, k); + ti2 = cc_ref(i, 2, k) + cc_ref(i, 5, k); + ti4 = cc_ref(i, 3, k) - cc_ref(i, 4, k); + ti3 = cc_ref(i, 3, k) + cc_ref(i, 4, k); + tr5 = cc_ref(i - 1, 2, k) - cc_ref(i - 1, 5, k); + tr2 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 5, k); + tr4 = cc_ref(i - 1, 3, k) - cc_ref(i - 1, 4, k); + tr3 = cc_ref(i - 1, 3, k) + cc_ref(i - 1, 4, k); + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2 + tr3; + ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2 + ti3; + cr2 = cc_ref(i - 1, 1, k) + tr11 * tr2 + tr12 * tr3; + ci2 = cc_ref(i, 1, k) + tr11 * ti2 + tr12 * ti3; + cr3 = cc_ref(i - 1, 1, k) + tr12 * tr2 + tr11 * tr3; + ci3 = cc_ref(i, 1, k) + tr12 * ti2 + tr11 * ti3; + cr5 = ti11 * tr5 + ti12 * tr4; + ci5 = ti11 * ti5 + ti12 * ti4; + cr4 = ti12 * tr5 - ti11 * tr4; + ci4 = ti12 * ti5 - ti11 * ti4; + dr3 = cr3 - ci4; + dr4 = cr3 + ci4; + di3 = ci3 + cr4; + di4 = ci3 - cr4; + dr5 = cr2 + ci5; + dr2 = cr2 - ci5; + di5 = ci2 - cr5; + di2 = ci2 + cr5; + ch_ref(i - 1, k, 2) = wa1[i - 1] * dr2 - fsign*wa1[i] * di2; + ch_ref(i, k, 2) = wa1[i - 1] * di2 + fsign*wa1[i] * dr2; + ch_ref(i - 1, k, 3) = wa2[i - 1] * dr3 - fsign*wa2[i] * di3; + ch_ref(i, k, 3) = wa2[i - 1] * di3 + fsign*wa2[i] * dr3; + ch_ref(i - 1, k, 4) = wa3[i - 1] * dr4 - fsign*wa3[i] * di4; + ch_ref(i, k, 4) = wa3[i - 1] * di4 + fsign*wa3[i] * dr4; + ch_ref(i - 1, k, 5) = wa4[i - 1] * dr5 - fsign*wa4[i] * di5; + ch_ref(i, k, 5) = wa4[i - 1] * di5 + fsign*wa4[i] * dr5; + } + } + } +} /* passb5 */ + +#undef ch_ref +#undef cc_ref + +static void passf2(integer ido, integer l1, const real *cc, real *ch, const real *wa1) +{ + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ti2, tr2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*2 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 3; + cc -= cc_offset; + --wa1; + + /* Function Body */ + if (ido == 2) { + for (k = 1; k <= l1; ++k) { + ch_ref(1, k, 1) = cc_ref(1, 1, k) + cc_ref(1, 2, k); + ch_ref(1, k, 2) = cc_ref(1, 1, k) - cc_ref(1, 2, k); + ch_ref(2, k, 1) = cc_ref(2, 1, k) + cc_ref(2, 2, k); + ch_ref(2, k, 2) = cc_ref(2, 1, k) - cc_ref(2, 2, k); + } + } else { + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 2, + k); + tr2 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 2, k); + ch_ref(i, k, 1) = cc_ref(i, 1, k) + cc_ref(i, 2, k); + ti2 = cc_ref(i, 1, k) - cc_ref(i, 2, k); + ch_ref(i, k, 2) = wa1[i - 1] * ti2 - wa1[i] * tr2; + ch_ref(i - 1, k, 2) = wa1[i - 1] * tr2 + wa1[i] * ti2; + } + } + } +} /* passf2 */ + +#undef ch_ref +#undef cc_ref + + +static void passf3(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2) +{ + static const real taur = -.5f; + static const real taui = -.866025403784439f; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*3 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + (ido << 2); + cc -= cc_offset; + --wa1; + --wa2; + + /* Function Body */ + if (ido == 2) { + for (k = 1; k <= l1; ++k) { + tr2 = cc_ref(1, 2, k) + cc_ref(1, 3, k); + cr2 = cc_ref(1, 1, k) + taur * tr2; + ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2; + ti2 = cc_ref(2, 2, k) + cc_ref(2, 3, k); + ci2 = cc_ref(2, 1, k) + taur * ti2; + ch_ref(2, k, 1) = cc_ref(2, 1, k) + ti2; + cr3 = taui * (cc_ref(1, 2, k) - cc_ref(1, 3, k)); + ci3 = taui * (cc_ref(2, 2, k) - cc_ref(2, 3, k)); + ch_ref(1, k, 2) = cr2 - ci3; + ch_ref(1, k, 3) = cr2 + ci3; + ch_ref(2, k, 2) = ci2 + cr3; + ch_ref(2, k, 3) = ci2 - cr3; + } + } else { + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + tr2 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 3, k); + cr2 = cc_ref(i - 1, 1, k) + taur * tr2; + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2; + ti2 = cc_ref(i, 2, k) + cc_ref(i, 3, k); + ci2 = cc_ref(i, 1, k) + taur * ti2; + ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2; + cr3 = taui * (cc_ref(i - 1, 2, k) - cc_ref(i - 1, 3, k)); + ci3 = taui * (cc_ref(i, 2, k) - cc_ref(i, 3, k)); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + cr3; + di3 = ci2 - cr3; + ch_ref(i, k, 2) = wa1[i - 1] * di2 - wa1[i] * dr2; + ch_ref(i - 1, k, 2) = wa1[i - 1] * dr2 + wa1[i] * di2; + ch_ref(i, k, 3) = wa2[i - 1] * di3 - wa2[i] * dr3; + ch_ref(i - 1, k, 3) = wa2[i - 1] * dr3 + wa2[i] * di3; + } + } + } +} /* passf3 */ + +#undef ch_ref +#undef cc_ref + + +static void passf4(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3) +{ + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k; + real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*4 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 5; + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + + /* Function Body */ + if (ido == 2) { + for (k = 1; k <= l1; ++k) { + ti1 = cc_ref(2, 1, k) - cc_ref(2, 3, k); + ti2 = cc_ref(2, 1, k) + cc_ref(2, 3, k); + tr4 = cc_ref(2, 2, k) - cc_ref(2, 4, k); + ti3 = cc_ref(2, 2, k) + cc_ref(2, 4, k); + tr1 = cc_ref(1, 1, k) - cc_ref(1, 3, k); + tr2 = cc_ref(1, 1, k) + cc_ref(1, 3, k); + ti4 = cc_ref(1, 4, k) - cc_ref(1, 2, k); + tr3 = cc_ref(1, 2, k) + cc_ref(1, 4, k); + ch_ref(1, k, 1) = tr2 + tr3; + ch_ref(1, k, 3) = tr2 - tr3; + ch_ref(2, k, 1) = ti2 + ti3; + ch_ref(2, k, 3) = ti2 - ti3; + ch_ref(1, k, 2) = tr1 + tr4; + ch_ref(1, k, 4) = tr1 - tr4; + ch_ref(2, k, 2) = ti1 + ti4; + ch_ref(2, k, 4) = ti1 - ti4; + } + } else { + for (k = 1; k <= l1; ++k) { + for (i = 2; i <= ido; i += 2) { + ti1 = cc_ref(i, 1, k) - cc_ref(i, 3, k); + ti2 = cc_ref(i, 1, k) + cc_ref(i, 3, k); + ti3 = cc_ref(i, 2, k) + cc_ref(i, 4, k); + tr4 = cc_ref(i, 2, k) - cc_ref(i, 4, k); + tr1 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 3, k); + tr2 = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 3, k); + ti4 = cc_ref(i - 1, 4, k) - cc_ref(i - 1, 2, k); + tr3 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 4, k); + ch_ref(i - 1, k, 1) = tr2 + tr3; + cr3 = tr2 - tr3; + ch_ref(i, k, 1) = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 + tr4; + cr4 = tr1 - tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch_ref(i - 1, k, 2) = wa1[i - 1] * cr2 + wa1[i] * ci2; + ch_ref(i, k, 2) = wa1[i - 1] * ci2 - wa1[i] * cr2; + ch_ref(i - 1, k, 3) = wa2[i - 1] * cr3 + wa2[i] * ci3; + ch_ref(i, k, 3) = wa2[i - 1] * ci3 - wa2[i] * cr3; + ch_ref(i - 1, k, 4) = wa3[i - 1] * cr4 + wa3[i] * ci4; + ch_ref(i, k, 4) = wa3[i - 1] * ci4 - wa3[i] * cr4; + } + } + } +} /* passf4 */ + +#undef ch_ref +#undef cc_ref + +static void radb2(integer ido, integer l1, const real *cc, real *ch, const real *wa1) +{ + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k, ic; + real ti2, tr2; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*2 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 3; + cc -= cc_offset; + --wa1; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + ch_ref(1, k, 1) = cc_ref(1, 1, k) + cc_ref(ido, 2, k); + ch_ref(1, k, 2) = cc_ref(1, 1, k) - cc_ref(ido, 2, k); + } + if (ido < 2) return; + else if (ido != 2) { + idp2 = ido + 2; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + cc_ref(ic - 1, 2, + k); + tr2 = cc_ref(i - 1, 1, k) - cc_ref(ic - 1, 2, k); + ch_ref(i, k, 1) = cc_ref(i, 1, k) - cc_ref(ic, 2, k); + ti2 = cc_ref(i, 1, k) + cc_ref(ic, 2, k); + ch_ref(i - 1, k, 2) = wa1[i - 2] * tr2 - wa1[i - 1] * ti2; + ch_ref(i, k, 2) = wa1[i - 2] * ti2 + wa1[i - 1] * tr2; + } + } + if (ido % 2 == 1) return; + } + for (k = 1; k <= l1; ++k) { + ch_ref(ido, k, 1) = cc_ref(ido, 1, k) + cc_ref(ido, 1, k); + ch_ref(ido, k, 2) = -(cc_ref(1, 2, k) + cc_ref(1, 2, k)); + } +} /* radb2 */ + +#undef ch_ref +#undef cc_ref + + +static void radb3(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2) +{ + /* Initialized data */ + + static const real taur = -.5f; + static const real taui = .866025403784439f; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k, ic; + real ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*3 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + (ido << 2); + cc -= cc_offset; + --wa1; + --wa2; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + tr2 = cc_ref(ido, 2, k) + cc_ref(ido, 2, k); + cr2 = cc_ref(1, 1, k) + taur * tr2; + ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2; + ci3 = taui * (cc_ref(1, 3, k) + cc_ref(1, 3, k)); + ch_ref(1, k, 2) = cr2 - ci3; + ch_ref(1, k, 3) = cr2 + ci3; + } + if (ido == 1) { + return; + } + idp2 = ido + 2; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + tr2 = cc_ref(i - 1, 3, k) + cc_ref(ic - 1, 2, k); + cr2 = cc_ref(i - 1, 1, k) + taur * tr2; + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2; + ti2 = cc_ref(i, 3, k) - cc_ref(ic, 2, k); + ci2 = cc_ref(i, 1, k) + taur * ti2; + ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2; + cr3 = taui * (cc_ref(i - 1, 3, k) - cc_ref(ic - 1, 2, k)); + ci3 = taui * (cc_ref(i, 3, k) + cc_ref(ic, 2, k)); + dr2 = cr2 - ci3; + dr3 = cr2 + ci3; + di2 = ci2 + cr3; + di3 = ci2 - cr3; + ch_ref(i - 1, k, 2) = wa1[i - 2] * dr2 - wa1[i - 1] * di2; + ch_ref(i, k, 2) = wa1[i - 2] * di2 + wa1[i - 1] * dr2; + ch_ref(i - 1, k, 3) = wa2[i - 2] * dr3 - wa2[i - 1] * di3; + ch_ref(i, k, 3) = wa2[i - 2] * di3 + wa2[i - 1] * dr3; + } + } +} /* radb3 */ + +#undef ch_ref +#undef cc_ref + + +static void radb4(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3) +{ + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k, ic; + real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*4 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 5; + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + tr1 = cc_ref(1, 1, k) - cc_ref(ido, 4, k); + tr2 = cc_ref(1, 1, k) + cc_ref(ido, 4, k); + tr3 = cc_ref(ido, 2, k) + cc_ref(ido, 2, k); + tr4 = cc_ref(1, 3, k) + cc_ref(1, 3, k); + ch_ref(1, k, 1) = tr2 + tr3; + ch_ref(1, k, 2) = tr1 - tr4; + ch_ref(1, k, 3) = tr2 - tr3; + ch_ref(1, k, 4) = tr1 + tr4; + } + if (ido < 2) return; + if (ido != 2) { + idp2 = ido + 2; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + ti1 = cc_ref(i, 1, k) + cc_ref(ic, 4, k); + ti2 = cc_ref(i, 1, k) - cc_ref(ic, 4, k); + ti3 = cc_ref(i, 3, k) - cc_ref(ic, 2, k); + tr4 = cc_ref(i, 3, k) + cc_ref(ic, 2, k); + tr1 = cc_ref(i - 1, 1, k) - cc_ref(ic - 1, 4, k); + tr2 = cc_ref(i - 1, 1, k) + cc_ref(ic - 1, 4, k); + ti4 = cc_ref(i - 1, 3, k) - cc_ref(ic - 1, 2, k); + tr3 = cc_ref(i - 1, 3, k) + cc_ref(ic - 1, 2, k); + ch_ref(i - 1, k, 1) = tr2 + tr3; + cr3 = tr2 - tr3; + ch_ref(i, k, 1) = ti2 + ti3; + ci3 = ti2 - ti3; + cr2 = tr1 - tr4; + cr4 = tr1 + tr4; + ci2 = ti1 + ti4; + ci4 = ti1 - ti4; + ch_ref(i - 1, k, 2) = wa1[i - 2] * cr2 - wa1[i - 1] * ci2; + ch_ref(i, k, 2) = wa1[i - 2] * ci2 + wa1[i - 1] * cr2; + ch_ref(i - 1, k, 3) = wa2[i - 2] * cr3 - wa2[i - 1] * ci3; + ch_ref(i, k, 3) = wa2[i - 2] * ci3 + wa2[i - 1] * cr3; + ch_ref(i - 1, k, 4) = wa3[i - 2] * cr4 - wa3[i - 1] * ci4; + ch_ref(i, k, 4) = wa3[i - 2] * ci4 + wa3[i - 1] * cr4; + } + } + if (ido % 2 == 1) return; + } + for (k = 1; k <= l1; ++k) { + ti1 = cc_ref(1, 2, k) + cc_ref(1, 4, k); + ti2 = cc_ref(1, 4, k) - cc_ref(1, 2, k); + tr1 = cc_ref(ido, 1, k) - cc_ref(ido, 3, k); + tr2 = cc_ref(ido, 1, k) + cc_ref(ido, 3, k); + ch_ref(ido, k, 1) = tr2 + tr2; + ch_ref(ido, k, 2) = M_SQRT2 * (tr1 - ti1); + ch_ref(ido, k, 3) = ti2 + ti2; + ch_ref(ido, k, 4) = -M_SQRT2 * (tr1 + ti1); + } +} /* radb4 */ + +#undef ch_ref +#undef cc_ref + + +static void radb5(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3, const real *wa4) +{ + /* Initialized data */ + + static const real tr11 = .309016994374947f; + static const real ti11 = .951056516295154f; + static const real tr12 = -.809016994374947f; + static const real ti12 = .587785252292473f; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k, ic; + real ci2, ci3, ci4, ci5, di3, di4, di5, di2, cr2, cr3, cr5, cr4, ti2, ti3, + ti4, ti5, dr3, dr4, dr5, dr2, tr2, tr3, tr4, tr5; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*5 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + cc_offset = 1 + ido * 6; + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + --wa4; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + ti5 = cc_ref(1, 3, k) + cc_ref(1, 3, k); + ti4 = cc_ref(1, 5, k) + cc_ref(1, 5, k); + tr2 = cc_ref(ido, 2, k) + cc_ref(ido, 2, k); + tr3 = cc_ref(ido, 4, k) + cc_ref(ido, 4, k); + ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2 + tr3; + cr2 = cc_ref(1, 1, k) + tr11 * tr2 + tr12 * tr3; + cr3 = cc_ref(1, 1, k) + tr12 * tr2 + tr11 * tr3; + ci5 = ti11 * ti5 + ti12 * ti4; + ci4 = ti12 * ti5 - ti11 * ti4; + ch_ref(1, k, 2) = cr2 - ci5; + ch_ref(1, k, 3) = cr3 - ci4; + ch_ref(1, k, 4) = cr3 + ci4; + ch_ref(1, k, 5) = cr2 + ci5; + } + if (ido == 1) { + return; + } + idp2 = ido + 2; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + ti5 = cc_ref(i, 3, k) + cc_ref(ic, 2, k); + ti2 = cc_ref(i, 3, k) - cc_ref(ic, 2, k); + ti4 = cc_ref(i, 5, k) + cc_ref(ic, 4, k); + ti3 = cc_ref(i, 5, k) - cc_ref(ic, 4, k); + tr5 = cc_ref(i - 1, 3, k) - cc_ref(ic - 1, 2, k); + tr2 = cc_ref(i - 1, 3, k) + cc_ref(ic - 1, 2, k); + tr4 = cc_ref(i - 1, 5, k) - cc_ref(ic - 1, 4, k); + tr3 = cc_ref(i - 1, 5, k) + cc_ref(ic - 1, 4, k); + ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2 + tr3; + ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2 + ti3; + cr2 = cc_ref(i - 1, 1, k) + tr11 * tr2 + tr12 * tr3; + ci2 = cc_ref(i, 1, k) + tr11 * ti2 + tr12 * ti3; + cr3 = cc_ref(i - 1, 1, k) + tr12 * tr2 + tr11 * tr3; + ci3 = cc_ref(i, 1, k) + tr12 * ti2 + tr11 * ti3; + cr5 = ti11 * tr5 + ti12 * tr4; + ci5 = ti11 * ti5 + ti12 * ti4; + cr4 = ti12 * tr5 - ti11 * tr4; + ci4 = ti12 * ti5 - ti11 * ti4; + dr3 = cr3 - ci4; + dr4 = cr3 + ci4; + di3 = ci3 + cr4; + di4 = ci3 - cr4; + dr5 = cr2 + ci5; + dr2 = cr2 - ci5; + di5 = ci2 - cr5; + di2 = ci2 + cr5; + ch_ref(i - 1, k, 2) = wa1[i - 2] * dr2 - wa1[i - 1] * di2; + ch_ref(i, k, 2) = wa1[i - 2] * di2 + wa1[i - 1] * dr2; + ch_ref(i - 1, k, 3) = wa2[i - 2] * dr3 - wa2[i - 1] * di3; + ch_ref(i, k, 3) = wa2[i - 2] * di3 + wa2[i - 1] * dr3; + ch_ref(i - 1, k, 4) = wa3[i - 2] * dr4 - wa3[i - 1] * di4; + ch_ref(i, k, 4) = wa3[i - 2] * di4 + wa3[i - 1] * dr4; + ch_ref(i - 1, k, 5) = wa4[i - 2] * dr5 - wa4[i - 1] * di5; + ch_ref(i, k, 5) = wa4[i - 2] * di5 + wa4[i - 1] * dr5; + } + } +} /* radb5 */ + +#undef ch_ref +#undef cc_ref + + +static void radbg(integer ido, integer ip, integer l1, integer idl1, + const real *cc, real *c1, real *c2, real *ch, real *ch2, const real *wa) +{ + /* System generated locals */ + integer ch_offset, cc_offset, + c1_offset, c2_offset, ch2_offset; + + /* Local variables */ + integer i, j, k, l, j2, ic, jc, lc, ik, is; + real dc2, ai1, ai2, ar1, ar2, ds2; + integer nbd; + real dcp, arg, dsp, ar1h, ar2h; + integer idp2, ipp2, idij, ipph; + + +#define c1_ref(a_1,a_2,a_3) c1[((a_3)*l1 + (a_2))*ido + a_1] +#define c2_ref(a_1,a_2) c2[(a_2)*idl1 + a_1] +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*ip + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] +#define ch2_ref(a_1,a_2) ch2[(a_2)*idl1 + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + c1_offset = 1 + ido * (1 + l1); + c1 -= c1_offset; + cc_offset = 1 + ido * (1 + ip); + cc -= cc_offset; + ch2_offset = 1 + idl1; + ch2 -= ch2_offset; + c2_offset = 1 + idl1; + c2 -= c2_offset; + --wa; + + /* Function Body */ + arg = (2*M_PI) / (real) (ip); + dcp = FFTPACK_COS(arg); + dsp = FFTPACK_SIN(arg); + idp2 = ido + 2; + nbd = (ido - 1) / 2; + ipp2 = ip + 2; + ipph = (ip + 1) / 2; + if (ido >= l1) { + for (k = 1; k <= l1; ++k) { + for (i = 1; i <= ido; ++i) { + ch_ref(i, k, 1) = cc_ref(i, 1, k); + } + } + } else { + for (i = 1; i <= ido; ++i) { + for (k = 1; k <= l1; ++k) { + ch_ref(i, k, 1) = cc_ref(i, 1, k); + } + } + } + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + j2 = j + j; + for (k = 1; k <= l1; ++k) { + ch_ref(1, k, j) = cc_ref(ido, j2 - 2, k) + cc_ref(ido, j2 - 2, k); + ch_ref(1, k, jc) = cc_ref(1, j2 - 1, k) + cc_ref(1, j2 - 1, k); + } + } + if (ido != 1) { + if (nbd >= l1) { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + ch_ref(i - 1, k, j) = cc_ref(i - 1, (j << 1) - 1, k) + cc_ref(ic - 1, (j << 1) - 2, k); + ch_ref(i - 1, k, jc) = cc_ref(i - 1, (j << 1) - 1, k) - cc_ref(ic - 1, (j << 1) - 2, k); + ch_ref(i, k, j) = cc_ref(i, (j << 1) - 1, k) - cc_ref(ic, (j << 1) - 2, k); + ch_ref(i, k, jc) = cc_ref(i, (j << 1) - 1, k) + cc_ref(ic, (j << 1) - 2, k); + } + } + } + } else { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + for (k = 1; k <= l1; ++k) { + ch_ref(i - 1, k, j) = cc_ref(i - 1, (j << 1) - 1, k) + cc_ref(ic - 1, (j << 1) - 2, k); + ch_ref(i - 1, k, jc) = cc_ref(i - 1, (j << 1) - 1, k) - cc_ref(ic - 1, (j << 1) - 2, k); + ch_ref(i, k, j) = cc_ref(i, (j << 1) - 1, k) - cc_ref(ic, (j << 1) - 2, k); + ch_ref(i, k, jc) = cc_ref(i, (j << 1) - 1, k) + cc_ref(ic, (j << 1) - 2, k); + } + } + } + } + } + ar1 = 1.f; + ai1 = 0.f; + for (l = 2; l <= ipph; ++l) { + lc = ipp2 - l; + ar1h = dcp * ar1 - dsp * ai1; + ai1 = dcp * ai1 + dsp * ar1; + ar1 = ar1h; + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, l) = ch2_ref(ik, 1) + ar1 * ch2_ref(ik, 2); + c2_ref(ik, lc) = ai1 * ch2_ref(ik, ip); + } + dc2 = ar1; + ds2 = ai1; + ar2 = ar1; + ai2 = ai1; + for (j = 3; j <= ipph; ++j) { + jc = ipp2 - j; + ar2h = dc2 * ar2 - ds2 * ai2; + ai2 = dc2 * ai2 + ds2 * ar2; + ar2 = ar2h; + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, l) = c2_ref(ik, l) + ar2 * ch2_ref(ik, j); + c2_ref(ik, lc) = c2_ref(ik, lc) + ai2 * ch2_ref(ik, jc); + } + } + } + for (j = 2; j <= ipph; ++j) { + for (ik = 1; ik <= idl1; ++ik) { + ch2_ref(ik, 1) = ch2_ref(ik, 1) + ch2_ref(ik, j); + } + } + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (k = 1; k <= l1; ++k) { + ch_ref(1, k, j) = c1_ref(1, k, j) - c1_ref(1, k, jc); + ch_ref(1, k, jc) = c1_ref(1, k, j) + c1_ref(1, k, jc); + } + } + if (ido != 1) { + if (nbd >= l1) { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ch_ref(i - 1, k, j) = c1_ref(i - 1, k, j) - c1_ref(i, k, jc); + ch_ref(i - 1, k, jc) = c1_ref(i - 1, k, j) + c1_ref(i, k, jc); + ch_ref(i, k, j) = c1_ref(i, k, j) + c1_ref(i - 1, k, jc); + ch_ref(i, k, jc) = c1_ref(i, k, j) - c1_ref(i - 1, k, jc); + } + } + } + } else { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (i = 3; i <= ido; i += 2) { + for (k = 1; k <= l1; ++k) { + ch_ref(i - 1, k, j) = c1_ref(i - 1, k, j) - c1_ref(i, k, jc); + ch_ref(i - 1, k, jc) = c1_ref(i - 1, k, j) + c1_ref(i, k, jc); + ch_ref(i, k, j) = c1_ref(i, k, j) + c1_ref(i - 1, k, jc); + ch_ref(i, k, jc) = c1_ref(i, k, j) - c1_ref(i - 1, k, jc); + } + } + } + } + } + if (ido == 1) { + return; + } + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, 1) = ch2_ref(ik, 1); + } + for (j = 2; j <= ip; ++j) { + for (k = 1; k <= l1; ++k) { + c1_ref(1, k, j) = ch_ref(1, k, j); + } + } + if (nbd <= l1) { + is = -(ido); + for (j = 2; j <= ip; ++j) { + is += ido; + idij = is; + for (i = 3; i <= ido; i += 2) { + idij += 2; + for (k = 1; k <= l1; ++k) { + c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) + - wa[idij] * ch_ref(i, k, j); + c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + wa[idij] * ch_ref(i - 1, k, j); + } + } + } + } else { + is = -(ido); + for (j = 2; j <= ip; ++j) { + is += ido; + for (k = 1; k <= l1; ++k) { + idij = is; + for (i = 3; i <= ido; i += 2) { + idij += 2; + c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) + - wa[idij] * ch_ref(i, k, j); + c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + wa[idij] * ch_ref(i - 1, k, j); + } + } + } + } +} /* radbg */ + +#undef ch2_ref +#undef ch_ref +#undef cc_ref +#undef c2_ref +#undef c1_ref + + +static void radf2(integer ido, integer l1, const real *cc, real *ch, + const real *wa1) +{ + /* System generated locals */ + integer ch_offset, cc_offset; + + /* Local variables */ + integer i, k, ic; + real ti2, tr2; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*2 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * 3; + ch -= ch_offset; + cc_offset = 1 + ido * (1 + l1); + cc -= cc_offset; + --wa1; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + ch_ref(1, 1, k) = cc_ref(1, k, 1) + cc_ref(1, k, 2); + ch_ref(ido, 2, k) = cc_ref(1, k, 1) - cc_ref(1, k, 2); + } + if (ido < 2) return; + if (ido != 2) { + idp2 = ido + 2; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + tr2 = wa1[i - 2] * cc_ref(i - 1, k, 2) + wa1[i - 1] * + cc_ref(i, k, 2); + ti2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref( + i - 1, k, 2); + ch_ref(i, 1, k) = cc_ref(i, k, 1) + ti2; + ch_ref(ic, 2, k) = ti2 - cc_ref(i, k, 1); + ch_ref(i - 1, 1, k) = cc_ref(i - 1, k, 1) + tr2; + ch_ref(ic - 1, 2, k) = cc_ref(i - 1, k, 1) - tr2; + } + } + if (ido % 2 == 1) { + return; + } + } + for (k = 1; k <= l1; ++k) { + ch_ref(1, 2, k) = -cc_ref(ido, k, 2); + ch_ref(ido, 1, k) = cc_ref(ido, k, 1); + } +} /* radf2 */ + +#undef ch_ref +#undef cc_ref + + +static void radf3(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2) +{ + static const real taur = -.5f; + static const real taui = .866025403784439f; + + /* System generated locals */ + integer ch_offset, cc_offset; + + /* Local variables */ + integer i, k, ic; + real ci2, di2, di3, cr2, dr2, dr3, ti2, ti3, tr2, tr3; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*3 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + (ido << 2); + ch -= ch_offset; + cc_offset = 1 + ido * (1 + l1); + cc -= cc_offset; + --wa1; + --wa2; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + cr2 = cc_ref(1, k, 2) + cc_ref(1, k, 3); + ch_ref(1, 1, k) = cc_ref(1, k, 1) + cr2; + ch_ref(1, 3, k) = taui * (cc_ref(1, k, 3) - cc_ref(1, k, 2)); + ch_ref(ido, 2, k) = cc_ref(1, k, 1) + 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] * cc_ref(i - 1, k, 2) + wa1[i - 1] * + cc_ref(i, k, 2); + di2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref( + i - 1, k, 2); + dr3 = wa2[i - 2] * cc_ref(i - 1, k, 3) + wa2[i - 1] * + cc_ref(i, k, 3); + di3 = wa2[i - 2] * cc_ref(i, k, 3) - wa2[i - 1] * cc_ref( + i - 1, k, 3); + cr2 = dr2 + dr3; + ci2 = di2 + di3; + ch_ref(i - 1, 1, k) = cc_ref(i - 1, k, 1) + cr2; + ch_ref(i, 1, k) = cc_ref(i, k, 1) + ci2; + tr2 = cc_ref(i - 1, k, 1) + taur * cr2; + ti2 = cc_ref(i, k, 1) + taur * ci2; + tr3 = taui * (di2 - di3); + ti3 = taui * (dr3 - dr2); + ch_ref(i - 1, 3, k) = tr2 + tr3; + ch_ref(ic - 1, 2, k) = tr2 - tr3; + ch_ref(i, 3, k) = ti2 + ti3; + ch_ref(ic, 2, k) = ti3 - ti2; + } + } +} /* radf3 */ + +#undef ch_ref +#undef cc_ref + + +static void radf4(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3) +{ + /* Initialized data */ + + static const real hsqt2 = .7071067811865475f; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k, ic; + real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*4 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * 5; + ch -= ch_offset; + cc_offset = 1 + ido * (1 + l1); + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + tr1 = cc_ref(1, k, 2) + cc_ref(1, k, 4); + tr2 = cc_ref(1, k, 1) + cc_ref(1, k, 3); + ch_ref(1, 1, k) = tr1 + tr2; + ch_ref(ido, 4, k) = tr2 - tr1; + ch_ref(ido, 2, k) = cc_ref(1, k, 1) - cc_ref(1, k, 3); + ch_ref(1, 3, k) = cc_ref(1, k, 4) - cc_ref(1, k, 2); + } + if (ido < 2) return; + if (ido != 2) { + idp2 = ido + 2; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + cr2 = wa1[i - 2] * cc_ref(i - 1, k, 2) + wa1[i - 1] * + cc_ref(i, k, 2); + ci2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref( + i - 1, k, 2); + cr3 = wa2[i - 2] * cc_ref(i - 1, k, 3) + wa2[i - 1] * + cc_ref(i, k, 3); + ci3 = wa2[i - 2] * cc_ref(i, k, 3) - wa2[i - 1] * cc_ref( + i - 1, k, 3); + cr4 = wa3[i - 2] * cc_ref(i - 1, k, 4) + wa3[i - 1] * + cc_ref(i, k, 4); + ci4 = wa3[i - 2] * cc_ref(i, k, 4) - wa3[i - 1] * cc_ref( + i - 1, k, 4); + tr1 = cr2 + cr4; + tr4 = cr4 - cr2; + ti1 = ci2 + ci4; + ti4 = ci2 - ci4; + ti2 = cc_ref(i, k, 1) + ci3; + ti3 = cc_ref(i, k, 1) - ci3; + tr2 = cc_ref(i - 1, k, 1) + cr3; + tr3 = cc_ref(i - 1, k, 1) - cr3; + ch_ref(i - 1, 1, k) = tr1 + tr2; + ch_ref(ic - 1, 4, k) = tr2 - tr1; + ch_ref(i, 1, k) = ti1 + ti2; + ch_ref(ic, 4, k) = ti1 - ti2; + ch_ref(i - 1, 3, k) = ti4 + tr3; + ch_ref(ic - 1, 2, k) = tr3 - ti4; + ch_ref(i, 3, k) = tr4 + ti3; + ch_ref(ic, 2, k) = tr4 - ti3; + } + } + if (ido % 2 == 1) { + return; + } + } + for (k = 1; k <= l1; ++k) { + ti1 = -hsqt2 * (cc_ref(ido, k, 2) + cc_ref(ido, k, 4)); + tr1 = hsqt2 * (cc_ref(ido, k, 2) - cc_ref(ido, k, 4)); + ch_ref(ido, 1, k) = tr1 + cc_ref(ido, k, 1); + ch_ref(ido, 3, k) = cc_ref(ido, k, 1) - tr1; + ch_ref(1, 2, k) = ti1 - cc_ref(ido, k, 3); + ch_ref(1, 4, k) = ti1 + cc_ref(ido, k, 3); + } +} /* radf4 */ + +#undef ch_ref +#undef cc_ref + + +static void radf5(integer ido, integer l1, const real *cc, real *ch, + const real *wa1, const real *wa2, const real *wa3, const real *wa4) +{ + /* Initialized data */ + + static const real tr11 = .309016994374947f; + static const real ti11 = .951056516295154f; + static const real tr12 = -.809016994374947f; + static const real ti12 = .587785252292473f; + + /* System generated locals */ + integer cc_offset, ch_offset; + + /* Local variables */ + integer i, k, ic; + real ci2, di2, ci4, ci5, di3, di4, di5, ci3, cr2, cr3, dr2, dr3, dr4, dr5, + cr5, cr4, ti2, ti3, ti5, ti4, tr2, tr3, tr4, tr5; + integer idp2; + + +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*5 + (a_2))*ido + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * 6; + ch -= ch_offset; + cc_offset = 1 + ido * (1 + l1); + cc -= cc_offset; + --wa1; + --wa2; + --wa3; + --wa4; + + /* Function Body */ + for (k = 1; k <= l1; ++k) { + cr2 = cc_ref(1, k, 5) + cc_ref(1, k, 2); + ci5 = cc_ref(1, k, 5) - cc_ref(1, k, 2); + cr3 = cc_ref(1, k, 4) + cc_ref(1, k, 3); + ci4 = cc_ref(1, k, 4) - cc_ref(1, k, 3); + ch_ref(1, 1, k) = cc_ref(1, k, 1) + cr2 + cr3; + ch_ref(ido, 2, k) = cc_ref(1, k, 1) + tr11 * cr2 + tr12 * cr3; + ch_ref(1, 3, k) = ti11 * ci5 + ti12 * ci4; + ch_ref(ido, 4, k) = cc_ref(1, k, 1) + tr12 * cr2 + tr11 * cr3; + ch_ref(1, 5, k) = ti12 * ci5 - ti11 * ci4; + } + 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] * cc_ref(i - 1, k, 2) + wa1[i - 1] * cc_ref(i, k, 2); + di2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref(i - 1, k, 2); + dr3 = wa2[i - 2] * cc_ref(i - 1, k, 3) + wa2[i - 1] * cc_ref(i, k, 3); + di3 = wa2[i - 2] * cc_ref(i, k, 3) - wa2[i - 1] * cc_ref(i - 1, k, 3); + dr4 = wa3[i - 2] * cc_ref(i - 1, k, 4) + wa3[i - 1] * cc_ref(i, k, 4); + di4 = wa3[i - 2] * cc_ref(i, k, 4) - wa3[i - 1] * cc_ref(i - 1, k, 4); + dr5 = wa4[i - 2] * cc_ref(i - 1, k, 5) + wa4[i - 1] * cc_ref(i, k, 5); + di5 = wa4[i - 2] * cc_ref(i, k, 5) - wa4[i - 1] * cc_ref(i - 1, k, 5); + cr2 = dr2 + dr5; + ci5 = dr5 - dr2; + cr5 = di2 - di5; + ci2 = di2 + di5; + cr3 = dr3 + dr4; + ci4 = dr4 - dr3; + cr4 = di3 - di4; + ci3 = di3 + di4; + ch_ref(i - 1, 1, k) = cc_ref(i - 1, k, 1) + cr2 + cr3; + ch_ref(i, 1, k) = cc_ref(i, k, 1) + ci2 + ci3; + tr2 = cc_ref(i - 1, k, 1) + tr11 * cr2 + tr12 * cr3; + ti2 = cc_ref(i, k, 1) + tr11 * ci2 + tr12 * ci3; + tr3 = cc_ref(i - 1, k, 1) + tr12 * cr2 + tr11 * cr3; + ti3 = cc_ref(i, k, 1) + tr12 * ci2 + tr11 * ci3; + tr5 = ti11 * cr5 + ti12 * cr4; + ti5 = ti11 * ci5 + ti12 * ci4; + tr4 = ti12 * cr5 - ti11 * cr4; + ti4 = ti12 * ci5 - ti11 * ci4; + ch_ref(i - 1, 3, k) = tr2 + tr5; + ch_ref(ic - 1, 2, k) = tr2 - tr5; + ch_ref(i, 3, k) = ti2 + ti5; + ch_ref(ic, 2, k) = ti5 - ti2; + ch_ref(i - 1, 5, k) = tr3 + tr4; + ch_ref(ic - 1, 4, k) = tr3 - tr4; + ch_ref(i, 5, k) = ti3 + ti4; + ch_ref(ic, 4, k) = ti4 - ti3; + } + } +} /* radf5 */ + +#undef ch_ref +#undef cc_ref + + +static void radfg(integer ido, integer ip, integer l1, integer idl1, + real *cc, real *c1, real *c2, real *ch, real *ch2, const real *wa) +{ + /* System generated locals */ + integer ch_offset, cc_offset, + c1_offset, c2_offset, ch2_offset; + + /* Local variables */ + integer i, j, k, l, j2, ic, jc, lc, ik, is; + real dc2, ai1, ai2, ar1, ar2, ds2; + integer nbd; + real dcp, arg, dsp, ar1h, ar2h; + integer idp2, ipp2, idij, ipph; + + +#define c1_ref(a_1,a_2,a_3) c1[((a_3)*l1 + (a_2))*ido + a_1] +#define c2_ref(a_1,a_2) c2[(a_2)*idl1 + a_1] +#define cc_ref(a_1,a_2,a_3) cc[((a_3)*ip + (a_2))*ido + a_1] +#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] +#define ch2_ref(a_1,a_2) ch2[(a_2)*idl1 + a_1] + + /* Parameter adjustments */ + ch_offset = 1 + ido * (1 + l1); + ch -= ch_offset; + c1_offset = 1 + ido * (1 + l1); + c1 -= c1_offset; + cc_offset = 1 + ido * (1 + ip); + cc -= cc_offset; + ch2_offset = 1 + idl1; + ch2 -= ch2_offset; + c2_offset = 1 + idl1; + c2 -= c2_offset; + --wa; + + /* Function Body */ + arg = (2*M_PI) / (real) (ip); + dcp = FFTPACK_COS(arg); + dsp = FFTPACK_SIN(arg); + ipph = (ip + 1) / 2; + ipp2 = ip + 2; + idp2 = ido + 2; + nbd = (ido - 1) / 2; + if (ido == 1) { + for (ik = 1; ik <= idl1; ++ik) { + c2_ref(ik, 1) = ch2_ref(ik, 1); + } + } else { + for (ik = 1; ik <= idl1; ++ik) { + ch2_ref(ik, 1) = c2_ref(ik, 1); + } + for (j = 2; j <= ip; ++j) { + for (k = 1; k <= l1; ++k) { + ch_ref(1, k, j) = c1_ref(1, k, j); + } + } + if (nbd <= l1) { + is = -(ido); + for (j = 2; j <= ip; ++j) { + is += ido; + idij = is; + for (i = 3; i <= ido; i += 2) { + idij += 2; + for (k = 1; k <= l1; ++k) { + ch_ref(i - 1, k, j) = wa[idij - 1] * c1_ref(i - 1, k, j) + + wa[idij] * c1_ref(i, k, j); + ch_ref(i, k, j) = wa[idij - 1] * c1_ref(i, k, j) - wa[ + idij] * c1_ref(i - 1, k, j); + } + } + } + } else { + is = -(ido); + for (j = 2; j <= ip; ++j) { + is += ido; + for (k = 1; k <= l1; ++k) { + idij = is; + for (i = 3; i <= ido; i += 2) { + idij += 2; + ch_ref(i - 1, k, j) = wa[idij - 1] * c1_ref(i - 1, k, j) + + wa[idij] * c1_ref(i, k, j); + ch_ref(i, k, j) = wa[idij - 1] * c1_ref(i, k, j) - wa[ + idij] * c1_ref(i - 1, k, j); + } + } + } + } + if (nbd >= l1) { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + c1_ref(i - 1, k, j) = ch_ref(i - 1, k, j) + ch_ref(i - + 1, k, jc); + c1_ref(i - 1, k, jc) = ch_ref(i, k, j) - ch_ref(i, k, + jc); + c1_ref(i, k, j) = ch_ref(i, k, j) + ch_ref(i, k, jc); + c1_ref(i, k, jc) = ch_ref(i - 1, k, jc) - ch_ref(i - 1, + k, j); + } + } + } + } else { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (i = 3; i <= ido; i += 2) { + for (k = 1; k <= l1; ++k) { + c1_ref(i - 1, k, j) = ch_ref(i - 1, k, j) + ch_ref(i - + 1, k, jc); + c1_ref(i - 1, k, jc) = ch_ref(i, k, j) - ch_ref(i, k, + jc); + c1_ref(i, k, j) = ch_ref(i, k, j) + ch_ref(i, k, jc); + c1_ref(i, k, jc) = ch_ref(i - 1, k, jc) - ch_ref(i - 1, + k, j); + } + } + } + } + } + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + for (k = 1; k <= l1; ++k) { + c1_ref(1, k, j) = ch_ref(1, k, j) + ch_ref(1, k, jc); + c1_ref(1, k, jc) = ch_ref(1, k, jc) - ch_ref(1, k, j); + } + } + + ar1 = 1.f; + ai1 = 0.f; + for (l = 2; l <= ipph; ++l) { + lc = ipp2 - l; + ar1h = dcp * ar1 - dsp * ai1; + ai1 = dcp * ai1 + dsp * ar1; + ar1 = ar1h; + for (ik = 1; ik <= idl1; ++ik) { + ch2_ref(ik, l) = c2_ref(ik, 1) + ar1 * c2_ref(ik, 2); + ch2_ref(ik, lc) = ai1 * c2_ref(ik, ip); + } + dc2 = ar1; + ds2 = ai1; + ar2 = ar1; + ai2 = ai1; + for (j = 3; j <= ipph; ++j) { + jc = ipp2 - j; + ar2h = dc2 * ar2 - ds2 * ai2; + ai2 = dc2 * ai2 + ds2 * ar2; + ar2 = ar2h; + for (ik = 1; ik <= idl1; ++ik) { + ch2_ref(ik, l) = ch2_ref(ik, l) + ar2 * c2_ref(ik, j); + ch2_ref(ik, lc) = ch2_ref(ik, lc) + ai2 * c2_ref(ik, jc); + } + } + } + for (j = 2; j <= ipph; ++j) { + for (ik = 1; ik <= idl1; ++ik) { + ch2_ref(ik, 1) = ch2_ref(ik, 1) + c2_ref(ik, j); + } + } + + if (ido >= l1) { + for (k = 1; k <= l1; ++k) { + for (i = 1; i <= ido; ++i) { + cc_ref(i, 1, k) = ch_ref(i, k, 1); + } + } + } else { + for (i = 1; i <= ido; ++i) { + for (k = 1; k <= l1; ++k) { + cc_ref(i, 1, k) = ch_ref(i, k, 1); + } + } + } + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + j2 = j + j; + for (k = 1; k <= l1; ++k) { + cc_ref(ido, j2 - 2, k) = ch_ref(1, k, j); + cc_ref(1, j2 - 1, k) = ch_ref(1, k, jc); + } + } + if (ido == 1) { + return; + } + if (nbd >= l1) { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + j2 = j + j; + for (k = 1; k <= l1; ++k) { + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + cc_ref(i - 1, j2 - 1, k) = ch_ref(i - 1, k, j) + ch_ref( + i - 1, k, jc); + cc_ref(ic - 1, j2 - 2, k) = ch_ref(i - 1, k, j) - ch_ref( + i - 1, k, jc); + cc_ref(i, j2 - 1, k) = ch_ref(i, k, j) + ch_ref(i, k, + jc); + cc_ref(ic, j2 - 2, k) = ch_ref(i, k, jc) - ch_ref(i, k, j) + ; + } + } + } + } else { + for (j = 2; j <= ipph; ++j) { + jc = ipp2 - j; + j2 = j + j; + for (i = 3; i <= ido; i += 2) { + ic = idp2 - i; + for (k = 1; k <= l1; ++k) { + cc_ref(i - 1, j2 - 1, k) = ch_ref(i - 1, k, j) + ch_ref( + i - 1, k, jc); + cc_ref(ic - 1, j2 - 2, k) = ch_ref(i - 1, k, j) - ch_ref( + i - 1, k, jc); + cc_ref(i, j2 - 1, k) = ch_ref(i, k, j) + ch_ref(i, k, + jc); + cc_ref(ic, j2 - 2, k) = ch_ref(i, k, jc) - ch_ref(i, k, j) + ; + } + } + } + } +} /* radfg */ + +#undef ch2_ref +#undef ch_ref +#undef cc_ref +#undef c2_ref +#undef c1_ref + + +static void cfftb1(integer n, real *c, real *ch, const real *wa, integer *ifac) +{ + integer i, k1, l1, l2, na, nf, ip, iw, ix2, ix3, ix4, nac, ido, + idl1, idot; + + /* Function Body */ + nf = ifac[1]; + na = 0; + l1 = 1; + iw = 0; + for (k1 = 1; k1 <= nf; ++k1) { + ip = ifac[k1 + 1]; + l2 = ip * l1; + ido = n / l2; + idot = ido + ido; + idl1 = idot * l1; + switch (ip) { + case 4: + ix2 = iw + idot; + ix3 = ix2 + idot; + passb4(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3]); + na = 1 - na; + break; + case 2: + passb2(idot, l1, na?ch:c, na?c:ch, &wa[iw]); + na = 1 - na; + break; + case 3: + ix2 = iw + idot; + passb3(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2]); + na = 1 - na; + break; + case 5: + ix2 = iw + idot; + ix3 = ix2 + idot; + ix4 = ix3 + idot; + passfb5(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], +1); + na = 1 - na; + break; + default: + if (na == 0) { + passfb(&nac, idot, ip, l1, idl1, c, c, c, ch, ch, &wa[iw], +1); + } else { + passfb(&nac, idot, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw], +1); + } + if (nac != 0) { + na = 1 - na; + } + break; + } + l1 = l2; + iw += (ip - 1) * idot; + } + if (na == 0) { + return; + } + for (i = 0; i < 2*n; ++i) { + c[i] = ch[i]; + } +} /* cfftb1 */ + +void cfftb(integer n, real *c, real *wsave) +{ + integer iw1, iw2; + + /* Parameter adjustments */ + --wsave; + --c; + + /* Function Body */ + if (n == 1) { + return; + } + iw1 = 2*n + 1; + iw2 = iw1 + 2*n; + cfftb1(n, &c[1], &wsave[1], &wsave[iw1], (int*)&wsave[iw2]); +} /* cfftb */ + +static void cfftf1(integer n, real *c, real *ch, const real *wa, integer *ifac) +{ + /* Local variables */ + integer i, k1, l1, l2, na, nf, ip, iw, ix2, ix3, ix4, nac, ido, + idl1, idot; + + /* Function Body */ + nf = ifac[1]; + na = 0; + l1 = 1; + iw = 0; + for (k1 = 1; k1 <= nf; ++k1) { + ip = ifac[k1 + 1]; + l2 = ip * l1; + ido = n / l2; + idot = ido + ido; + idl1 = idot * l1; + switch (ip) { + case 4: + ix2 = iw + idot; + ix3 = ix2 + idot; + passf4(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3]); + na = 1 - na; + break; + case 2: + passf2(idot, l1, na?ch:c, na?c:ch, &wa[iw]); + na = 1 - na; + break; + case 3: + ix2 = iw + idot; + passf3(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2]); + na = 1 - na; + break; + case 5: + ix2 = iw + idot; + ix3 = ix2 + idot; + ix4 = ix3 + idot; + passfb5(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], -1); + na = 1 - na; + break; + default: + if (na == 0) { + passfb(&nac, idot, ip, l1, idl1, c, c, c, ch, ch, &wa[iw], -1); + } else { + passfb(&nac, idot, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw], -1); + } + if (nac != 0) { + na = 1 - na; + } + break; + } + l1 = l2; + iw += (ip - 1)*idot; + } + if (na == 0) { + return; + } + for (i = 0; i < 2*n; ++i) { + c[i] = ch[i]; + } +} /* cfftf1 */ + +void cfftf(integer n, real *c, real *wsave) +{ + integer iw1, iw2; + + /* Parameter adjustments */ + --wsave; + --c; + + /* Function Body */ + if (n == 1) { + return; + } + iw1 = 2*n + 1; + iw2 = iw1 + 2*n; + cfftf1(n, &c[1], &wsave[1], &wsave[iw1], (int*)&wsave[iw2]); +} /* cfftf */ + +static int decompose(integer n, integer *ifac, integer ntryh[4]) { + integer ntry=0, nl = n, nf = 0, nq, nr, i, j = 0; + do { + if (j < 4) { + ntry = ntryh[j]; + } else { + ntry += 2; + } + ++j; + L104: + nq = nl / ntry; + nr = nl - ntry * nq; + if (nr != 0) continue; + ++nf; + ifac[nf + 2] = ntry; + nl = nq; + if (ntry == 2 && nf != 1) { + for (i = 2; i <= nf; ++i) { + integer ib = nf - i + 2; + ifac[ib + 2] = ifac[ib + 1]; + } + ifac[3] = 2; + } + if (nl != 1) { + goto L104; + } + } while (nl != 1); + ifac[1] = n; + ifac[2] = nf; + return nf; +} + +static void cffti1(integer n, real *wa, integer *ifac) +{ + static integer ntryh[4] = { 3,4,2,5 }; + + /* Local variables */ + integer i, j, i1, k1, l1, l2; + real fi; + integer ld, ii, nf, ip; + real arg; + integer ido, ipm; + real argh; + integer idot; + real argld; + + /* Parameter adjustments */ + --ifac; + --wa; + + nf = decompose(n, ifac, ntryh); + + argh = (2*M_PI) / (real) (n); + i = 2; + l1 = 1; + for (k1 = 1; k1 <= nf; ++k1) { + ip = ifac[k1 + 2]; + ld = 0; + l2 = l1 * ip; + ido = n / l2; + idot = ido + ido + 2; + ipm = ip - 1; + for (j = 1; j <= ipm; ++j) { + i1 = i; + wa[i - 1] = 1.f; + wa[i] = 0.f; + ld += l1; + fi = 0.f; + argld = (real) ld * argh; + for (ii = 4; ii <= idot; ii += 2) { + i += 2; + fi += 1.f; + arg = fi * argld; + wa[i - 1] = FFTPACK_COS(arg); + wa[i] = FFTPACK_SIN(arg); + } + if (ip > 5) { + wa[i1 - 1] = wa[i - 1]; + wa[i1] = wa[i]; + }; + } + l1 = l2; + } +} /* cffti1 */ + +void cffti(integer n, real *wsave) +{ + integer iw1, iw2; + /* Parameter adjustments */ + --wsave; + + /* Function Body */ + if (n == 1) { + return; + } + iw1 = 2*n + 1; + iw2 = iw1 + 2*n; + cffti1(n, &wsave[iw1], (int*)&wsave[iw2]); + return; +} /* cffti */ + +static void rfftb1(integer n, real *c, real *ch, const real *wa, integer *ifac) +{ + /* Local variables */ + integer i, k1, l1, l2, na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; + + /* Function Body */ + nf = ifac[1]; + na = 0; + l1 = 1; + iw = 0; + for (k1 = 1; k1 <= nf; ++k1) { + ip = ifac[k1 + 1]; + l2 = ip * l1; + ido = n / l2; + idl1 = ido * l1; + switch (ip) { + case 4: + ix2 = iw + ido; + ix3 = ix2 + ido; + radb4(ido, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3]); + na = 1 - na; + break; + case 2: + radb2(ido, l1, na?ch:c, na?c:ch, &wa[iw]); + na = 1 - na; + break; + case 3: + ix2 = iw + ido; + radb3(ido, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2]); + na = 1 - na; + break; + case 5: + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; + radb5(ido, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4]); + na = 1 - na; + break; + default: + if (na == 0) { + radbg(ido, ip, l1, idl1, c, c, c, ch, ch, &wa[iw]); + } else { + radbg(ido, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw]); + } + if (ido == 1) { + na = 1 - na; + } + break; + } + l1 = l2; + iw += (ip - 1) * ido; + } + if (na == 0) { + return; + } + for (i = 0; i < n; ++i) { + c[i] = ch[i]; + } +} /* rfftb1 */ + +static void rfftf1(integer n, real *c, real *ch, const real *wa, integer *ifac) +{ + /* Local variables */ + integer i, k1, l1, l2, na, kh, nf, ip, iw, ix2, ix3, ix4, ido, idl1; + + /* Function Body */ + nf = ifac[1]; + na = 1; + l2 = n; + iw = n-1; + for (k1 = 1; k1 <= nf; ++k1) { + kh = nf - k1; + ip = ifac[kh + 2]; + l1 = l2 / ip; + ido = n / l2; + idl1 = ido * l1; + iw -= (ip - 1) * ido; + na = 1 - na; + switch (ip) { + case 4: + ix2 = iw + ido; + ix3 = ix2 + ido; + radf4(ido, l1, na ? ch : c, na ? c : ch, &wa[iw], &wa[ix2], &wa[ix3]); + break; + case 2: + radf2(ido, l1, na ? ch : c, na ? c : ch, &wa[iw]); + break; + case 3: + ix2 = iw + ido; + radf3(ido, l1, na ? ch : c, na ? c : ch, &wa[iw], &wa[ix2]); + break; + case 5: + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; + radf5(ido, l1, na ? ch : c, na ? c : ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4]); + break; + default: + if (ido == 1) { + na = 1 - na; + } + if (na == 0) { + radfg(ido, ip, l1, idl1, c, c, c, ch, ch, &wa[iw]); + na = 1; + } else { + radfg(ido, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw]); + na = 0; + } + break; + } + l2 = l1; + } + if (na == 1) { + return; + } + for (i = 0; i < n; ++i) { + c[i] = ch[i]; + } +} + +void rfftb(integer n, real *r, real *wsave) +{ + + /* Parameter adjustments */ + --wsave; + --r; + + /* Function Body */ + if (n == 1) { + return; + } + rfftb1(n, &r[1], &wsave[1], &wsave[n + 1], (int*)&wsave[(n << 1) + 1]); +} /* rfftb */ + +static void rffti1(integer n, real *wa, integer *ifac) +{ + static integer ntryh[4] = { 4,2,3,5 }; + + /* Local variables */ + integer i, j, k1, l1, l2; + real fi; + integer ld, ii, nf, ip, is; + real arg; + integer ido, ipm; + integer nfm1; + real argh; + real argld; + + /* Parameter adjustments */ + --ifac; + --wa; + + nf = decompose(n, ifac, ntryh); + + argh = (2*M_PI) / (real) (n); + is = 0; + nfm1 = nf - 1; + l1 = 1; + if (nfm1 == 0) { + return; + } + for (k1 = 1; k1 <= nfm1; ++k1) { + ip = ifac[k1 + 2]; + ld = 0; + l2 = l1 * ip; + ido = n / l2; + ipm = ip - 1; + for (j = 1; j <= ipm; ++j) { + ld += l1; + i = is; + argld = (real) ld * argh; + fi = 0.f; + for (ii = 3; ii <= ido; ii += 2) { + i += 2; + fi += 1.f; + arg = fi * argld; + wa[i - 1] = FFTPACK_COS(arg); + wa[i] = FFTPACK_SIN(arg); + } + is += ido; + } + l1 = l2; + } +} /* rffti1 */ + +void rfftf(integer n, real *r, real *wsave) +{ + + /* Parameter adjustments */ + --wsave; + --r; + + /* Function Body */ + if (n == 1) { + return; + } + rfftf1(n, &r[1], &wsave[1], &wsave[n + 1], (int*)&wsave[(n << 1) + 1]); +} /* rfftf */ + +void rffti(integer n, real *wsave) +{ + /* Parameter adjustments */ + --wsave; + + /* Function Body */ + if (n == 1) { + return; + } + rffti1(n, &wsave[n + 1], (int*)&wsave[(n << 1) + 1]); + return; +} /* rffti */ + +static void cosqb1(integer n, real *x, real *w, real *xh) +{ + /* Local variables */ + integer i, k, kc, np2, ns2; + real xim1; + integer modn; + + /* Parameter adjustments */ + --xh; + --w; + --x; + + /* Function Body */ + ns2 = (n + 1) / 2; + np2 = n + 2; + for (i = 3; i <= n; i += 2) { + xim1 = x[i - 1] + x[i]; + x[i] -= x[i - 1]; + x[i - 1] = xim1; + } + x[1] += x[1]; + modn = n % 2; + if (modn == 0) { + x[n] += x[n]; + } + rfftb(n, &x[1], &xh[1]); + for (k = 2; k <= ns2; ++k) { + kc = np2 - k; + xh[k] = w[k - 1] * x[kc] + w[kc - 1] * x[k]; + xh[kc] = w[k - 1] * x[k] - w[kc - 1] * x[kc]; + } + if (modn == 0) { + x[ns2 + 1] = w[ns2] * (x[ns2 + 1] + x[ns2 + 1]); + } + for (k = 2; k <= ns2; ++k) { + kc = np2 - k; + x[k] = xh[k] + xh[kc]; + x[kc] = xh[k] - xh[kc]; + } + x[1] += x[1]; +} /* cosqb1 */ + +void cosqb(integer n, real *x, real *wsave) +{ + /* Local variables */ + real x1; + + /* Parameter adjustments */ + --wsave; + --x; + + if (n < 2) { + x[1] *= 4.f; + } else if (n == 2) { + x1 = (x[1] + x[2]) * 4.f; + x[2] = M_SQRT8 * (x[1] - x[2]); + x[1] = x1; + } else { + cosqb1(n, &x[1], &wsave[1], &wsave[n + 1]); + } +} /* cosqb */ + +static void cosqf1(integer n, real *x, real *w, real *xh) +{ + /* Local variables */ + integer i, k, kc, np2, ns2; + real xim1; + integer modn; + + /* Parameter adjustments */ + --xh; + --w; + --x; + + /* Function Body */ + ns2 = (n + 1) / 2; + np2 = n + 2; + for (k = 2; k <= ns2; ++k) { + kc = np2 - k; + xh[k] = x[k] + x[kc]; + xh[kc] = x[k] - x[kc]; + } + modn = n % 2; + if (modn == 0) { + xh[ns2 + 1] = x[ns2 + 1] + x[ns2 + 1]; + } + for (k = 2; k <= ns2; ++k) { + kc = np2 - k; + x[k] = w[k - 1] * xh[kc] + w[kc - 1] * xh[k]; + x[kc] = w[k - 1] * xh[k] - w[kc - 1] * xh[kc]; + } + if (modn == 0) { + x[ns2 + 1] = w[ns2] * xh[ns2 + 1]; + } + rfftf(n, &x[1], &xh[1]); + for (i = 3; i <= n; i += 2) { + xim1 = x[i - 1] - x[i]; + x[i] = x[i - 1] + x[i]; + x[i - 1] = xim1; + } +} /* cosqf1 */ + +void cosqf(integer n, real *x, real *wsave) +{ + /* Local variables */ + real tsqx; + + /* Parameter adjustments */ + --wsave; + --x; + + if (n == 2) { + tsqx = M_SQRT2 * x[2]; + x[2] = x[1] - tsqx; + x[1] += tsqx; + } else if (n > 2) { + cosqf1(n, &x[1], &wsave[1], &wsave[n + 1]); + } +} /* cosqf */ + +void cosqi(integer n, real *wsave) +{ + /* Local variables */ + integer k; + real fk, dt; + + /* Parameter adjustments */ + --wsave; + + dt = M_PI/2 / (real) (n); + fk = 0.f; + for (k = 1; k <= n; ++k) { + fk += 1.f; + wsave[k] = FFTPACK_COS(fk * dt); + } + rffti(n, &wsave[n + 1]); +} /* cosqi */ + +void cost(integer n, real *x, real *wsave) +{ + /* Local variables */ + integer i, k; + real c1, t1, t2; + integer kc; + real xi; + integer nm1, np1; + real x1h; + integer ns2; + real tx2, x1p3, xim2; + integer modn; + + /* Parameter adjustments */ + --wsave; + --x; + + /* Function Body */ + nm1 = n - 1; + np1 = n + 1; + ns2 = n / 2; + if (n == 2) { + x1h = x[1] + x[2]; + x[2] = x[1] - x[2]; + x[1] = x1h; + } else if (n == 3) { + x1p3 = x[1] + x[3]; + tx2 = x[2] + x[2]; + x[2] = x[1] - x[3]; + x[1] = x1p3 + tx2; + x[3] = x1p3 - tx2; + } else if (n > 3) { + c1 = x[1] - x[n]; + x[1] += x[n]; + for (k = 2; k <= ns2; ++k) { + kc = np1 - k; + t1 = x[k] + x[kc]; + t2 = x[k] - x[kc]; + c1 += wsave[kc] * t2; + t2 = wsave[k] * t2; + x[k] = t1 - t2; + x[kc] = t1 + t2; + } + modn = n % 2; + if (modn != 0) { + x[ns2 + 1] += x[ns2 + 1]; + } + rfftf(nm1, &x[1], &wsave[n + 1]); + xim2 = x[2]; + x[2] = c1; + for (i = 4; i <= n; i += 2) { + xi = x[i]; + x[i] = x[i - 2] - x[i - 1]; + x[i - 1] = xim2; + xim2 = xi; + } + if (modn != 0) { + x[n] = xim2; + } + } +} /* cost */ + +void costi(integer n, real *wsave) +{ + /* Initialized data */ + + /* Local variables */ + integer k, kc; + real fk, dt; + integer nm1, np1, ns2; + + /* Parameter adjustments */ + --wsave; + + /* Function Body */ + if (n <= 3) { + return; + } + nm1 = n - 1; + np1 = n + 1; + ns2 = n / 2; + dt = M_PI / (real) nm1; + fk = 0.f; + for (k = 2; k <= ns2; ++k) { + kc = np1 - k; + fk += 1.f; + wsave[k] = FFTPACK_SIN(fk * dt) * 2.f; + wsave[kc] = FFTPACK_COS(fk * dt) * 2.f; + } + rffti(nm1, &wsave[n + 1]); +} /* costi */ + +void sinqb(integer n, real *x, real *wsave) +{ + /* Local variables */ + integer k, kc, ns2; + real xhold; + + /* Parameter adjustments */ + --wsave; + --x; + + /* Function Body */ + if (n <= 1) { + x[1] *= 4.f; + return; + } + ns2 = n / 2; + for (k = 2; k <= n; k += 2) { + x[k] = -x[k]; + } + cosqb(n, &x[1], &wsave[1]); + for (k = 1; k <= ns2; ++k) { + kc = n - k; + xhold = x[k]; + x[k] = x[kc + 1]; + x[kc + 1] = xhold; + } +} /* sinqb */ + +void sinqf(integer n, real *x, real *wsave) +{ + /* Local variables */ + integer k, kc, ns2; + real xhold; + + /* Parameter adjustments */ + --wsave; + --x; + + /* Function Body */ + if (n == 1) { + return; + } + ns2 = n / 2; + for (k = 1; k <= ns2; ++k) { + kc = n - k; + xhold = x[k]; + x[k] = x[kc + 1]; + x[kc + 1] = xhold; + } + cosqf(n, &x[1], &wsave[1]); + for (k = 2; k <= n; k += 2) { + x[k] = -x[k]; + } +} /* sinqf */ + +void sinqi(integer n, real *wsave) +{ + + /* Parameter adjustments */ + --wsave; + + /* Function Body */ + cosqi(n, &wsave[1]); +} /* sinqi */ + +static void sint1(integer n, real *war, real *was, real *xh, real * + x, integer *ifac) +{ + /* Initialized data */ + + static const real sqrt3 = 1.73205080756888f; + + /* Local variables */ + integer i, k; + real t1, t2; + integer kc, np1, ns2, modn; + real xhold; + + /* Parameter adjustments */ + --ifac; + --x; + --xh; + --was; + --war; + + /* Function Body */ + for (i = 1; i <= n; ++i) { + xh[i] = war[i]; + war[i] = x[i]; + } + + if (n < 2) { + xh[1] += xh[1]; + } else if (n == 2) { + xhold = sqrt3 * (xh[1] + xh[2]); + xh[2] = sqrt3 * (xh[1] - xh[2]); + xh[1] = xhold; + } else { + np1 = n + 1; + ns2 = n / 2; + x[1] = 0.f; + for (k = 1; k <= ns2; ++k) { + kc = np1 - k; + t1 = xh[k] - xh[kc]; + t2 = was[k] * (xh[k] + xh[kc]); + x[k + 1] = t1 + t2; + x[kc + 1] = t2 - t1; + } + modn = n % 2; + if (modn != 0) { + x[ns2 + 2] = xh[ns2 + 1] * 4.f; + } + rfftf1(np1, &x[1], &xh[1], &war[1], &ifac[1]); + xh[1] = x[1] * .5f; + for (i = 3; i <= n; i += 2) { + xh[i - 1] = -x[i]; + xh[i] = xh[i - 2] + x[i - 1]; + } + if (modn == 0) { + xh[n] = -x[n + 1]; + } + } + for (i = 1; i <= n; ++i) { + x[i] = war[i]; + war[i] = xh[i]; + } +} /* sint1 */ + +void sinti(integer n, real *wsave) +{ + /* Local variables */ + integer k; + real dt; + integer np1, ns2; + + /* Parameter adjustments */ + --wsave; + + /* Function Body */ + if (n <= 1) { + return; + } + ns2 = n / 2; + np1 = n + 1; + dt = M_PI / (real) np1; + for (k = 1; k <= ns2; ++k) { + wsave[k] = sin(k * dt) * 2.f; + } + rffti(np1, &wsave[ns2 + 1]); +} /* sinti */ + +void sint(integer n, real *x, real *wsave) +{ + integer np1, iw1, iw2, iw3; + + /* Parameter adjustments */ + --wsave; + --x; + + /* Function Body */ + np1 = n + 1; + iw1 = n / 2 + 1; + iw2 = iw1 + np1; + iw3 = iw2 + np1; + sint1(n, &x[1], &wsave[1], &wsave[iw1], &wsave[iw2], (int*)&wsave[iw3]); +} /* sint */ + +#ifdef TESTING_FFTPACK +#include + +int main(void) +{ + static integer nd[] = { 120,91,54,49,32,28,24,8,4,3,2 }; + + /* System generated locals */ + real r1, r2, r3; + f77complex q1, q2, q3; + + /* Local variables */ + integer i, j, k, n; + real w[2000], x[200], y[200], cf, fn, dt; + f77complex cx[200], cy[200]; + real xh[200]; + integer nz, nm1, np1, ns2; + real arg; + real sum, arg1, arg2; + real sum1, sum2, dcfb; + integer modn; + real rftb, rftf; + real rftfb; + real costt, sintt, dcfftb, dcfftf, cosqfb, costfb; + real sinqfb; + real sintfb; + real cosqbt, cosqft, sinqbt, sinqft; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /* VERSION 4 APRIL 1985 */ + + /* A TEST DRIVER FOR */ + /* A PACKAGE OF FORTRAN SUBPROGRAMS FOR THE FAST FOURIER */ + /* TRANSFORM OF PERIODIC AND OTHER SYMMETRIC SEQUENCES */ + + /* BY */ + + /* PAUL N SWARZTRAUBER */ + + /* NATIONAL CENTER FOR ATMOSPHERIC RESEARCH BOULDER,COLORADO 80307 */ + + /* WHICH IS SPONSORED BY THE NATIONAL SCIENCE FOUNDATION */ + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + /* THIS PROGRAM TESTS THE PACKAGE OF FAST FOURIER */ + /* TRANSFORMS FOR BOTH COMPLEX AND REAL PERIODIC SEQUENCES AND */ + /* CERTIAN OTHER SYMMETRIC SEQUENCES THAT ARE LISTED BELOW. */ + + /* 1. RFFTI INITIALIZE RFFTF AND RFFTB */ + /* 2. RFFTF FORWARD TRANSFORM OF A REAL PERIODIC SEQUENCE */ + /* 3. RFFTB BACKWARD TRANSFORM OF A REAL COEFFICIENT ARRAY */ + + /* 4. EZFFTI INITIALIZE EZFFTF AND EZFFTB */ + /* 5. EZFFTF A SIMPLIFIED REAL PERIODIC FORWARD TRANSFORM */ + /* 6. EZFFTB A SIMPLIFIED REAL PERIODIC BACKWARD TRANSFORM */ + + /* 7. SINTI INITIALIZE SINT */ + /* 8. SINT SINE TRANSFORM OF A REAL ODD SEQUENCE */ + + /* 9. COSTI INITIALIZE COST */ + /* 10. COST COSINE TRANSFORM OF A REAL EVEN SEQUENCE */ + + /* 11. SINQI INITIALIZE SINQF AND SINQB */ + /* 12. SINQF FORWARD SINE TRANSFORM WITH ODD WAVE NUMBERS */ + /* 13. SINQB UNNORMALIZED INVERSE OF SINQF */ + + /* 14. COSQI INITIALIZE COSQF AND COSQB */ + /* 15. COSQF FORWARD COSINE TRANSFORM WITH ODD WAVE NUMBERS */ + /* 16. COSQB UNNORMALIZED INVERSE OF COSQF */ + + /* 17. CFFTI INITIALIZE CFFTF AND CFFTB */ + /* 18. CFFTF FORWARD TRANSFORM OF A COMPLEX PERIODIC SEQUENCE */ + /* 19. CFFTB UNNORMALIZED INVERSE OF CFFTF */ + + + int all_ok = 1; + for (nz = 1; nz <= (int)(sizeof nd/sizeof nd[0]); ++nz) { + n = nd[nz - 1]; + modn = n % 2; + fn = (real) n; + np1 = n + 1; + nm1 = n - 1; + for (j = 1; j <= np1; ++j) { + x[j - 1] = sin((real) j * M_SQRT2); + y[j - 1] = x[j - 1]; + xh[j - 1] = x[j - 1]; + } + + /* TEST SUBROUTINES RFFTI,RFFTF AND RFFTB */ + + rffti(n, w); + dt = (2*M_PI) / fn; + ns2 = (n + 1) / 2; + if (ns2 < 2) { + goto L104; + } + for (k = 2; k <= ns2; ++k) { + sum1 = 0.f; + sum2 = 0.f; + arg = (real) (k - 1) * dt; + for (i = 1; i <= n; ++i) { + arg1 = (real) (i - 1) * arg; + sum1 += x[i - 1] * cos(arg1); + sum2 += x[i - 1] * sin(arg1); + } + y[(k << 1) - 3] = sum1; + y[(k << 1) - 2] = -sum2; + } + L104: + sum1 = 0.f; + sum2 = 0.f; + for (i = 1; i <= nm1; i += 2) { + sum1 += x[i - 1]; + sum2 += x[i]; + } + if (modn == 1) { + sum1 += x[n - 1]; + } + y[0] = sum1 + sum2; + if (modn == 0) { + y[n - 1] = sum1 - sum2; + } + rfftf(n, x, w); + rftf = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = rftf, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); + rftf = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + } + rftf /= fn; + for (i = 1; i <= n; ++i) { + sum = x[0] * .5f; + arg = (real) (i - 1) * dt; + if (ns2 < 2) { + goto L108; + } + for (k = 2; k <= ns2; ++k) { + arg1 = (real) (k - 1) * arg; + sum = sum + x[(k << 1) - 3] * cos(arg1) - x[(k << 1) - 2] * + sin(arg1); + } + L108: + if (modn == 0) { + sum += (real)pow(-1, i-1) * .5f * x[n - 1]; + } + y[i - 1] = sum + sum; + } + rfftb(n, x, w); + rftb = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = rftb, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); + rftb = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + y[i - 1] = xh[i - 1]; + } + rfftb(n, y, w); + rfftf(n, y, w); + cf = 1.f / fn; + rftfb = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = rftfb, r3 = (r1 = cf * y[i - 1] - x[i - 1], fabs( + r1)); + rftfb = dmax(r2,r3); + } + + /* TEST SUBROUTINES SINTI AND SINT */ + + dt = M_PI / fn; + for (i = 1; i <= nm1; ++i) { + x[i - 1] = xh[i - 1]; + } + for (i = 1; i <= nm1; ++i) { + y[i - 1] = 0.f; + arg1 = (real) i * dt; + for (k = 1; k <= nm1; ++k) { + y[i - 1] += x[k - 1] * sin((real) k * arg1); + } + y[i - 1] += y[i - 1]; + } + sinti(nm1, w); + sint(nm1, x, w); + cf = .5f / fn; + sintt = 0.f; + for (i = 1; i <= nm1; ++i) { + /* Computing MAX */ + r2 = sintt, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); + sintt = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + y[i - 1] = x[i - 1]; + } + sintt = cf * sintt; + sint(nm1, x, w); + sint(nm1, x, w); + sintfb = 0.f; + for (i = 1; i <= nm1; ++i) { + /* Computing MAX */ + r2 = sintfb, r3 = (r1 = cf * x[i - 1] - y[i - 1], fabs( + r1)); + sintfb = dmax(r2,r3); + } + + /* TEST SUBROUTINES COSTI AND COST */ + + for (i = 1; i <= np1; ++i) { + x[i - 1] = xh[i - 1]; + } + for (i = 1; i <= np1; ++i) { + y[i - 1] = (x[0] + (real) pow(-1, i+1) * x[n]) * .5f; + arg = (real) (i - 1) * dt; + for (k = 2; k <= n; ++k) { + y[i - 1] += x[k - 1] * FFTPACK_COS((real) (k - 1) * arg); + } + y[i - 1] += y[i - 1]; + } + costi(np1, w); + cost(np1, x, w); + costt = 0.f; + for (i = 1; i <= np1; ++i) { + /* Computing MAX */ + r2 = costt, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); + costt = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + y[i - 1] = xh[i - 1]; + } + costt = cf * costt; + cost(np1, x, w); + cost(np1, x, w); + costfb = 0.f; + for (i = 1; i <= np1; ++i) { + /* Computing MAX */ + r2 = costfb, r3 = (r1 = cf * x[i - 1] - y[i - 1], fabs( + r1)); + costfb = dmax(r2,r3); + } + + /* TEST SUBROUTINES SINQI,SINQF AND SINQB */ + + cf = .25f / fn; + for (i = 1; i <= n; ++i) { + y[i - 1] = xh[i - 1]; + } + dt = M_PI / (fn + fn); + for (i = 1; i <= n; ++i) { + x[i - 1] = 0.f; + arg = dt * (real) i; + for (k = 1; k <= n; ++k) { + x[i - 1] += y[k - 1] * sin((real) (k + k - 1) * arg); + } + x[i - 1] *= 4.f; + } + sinqi(n, w); + sinqb(n, y, w); + sinqbt = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = sinqbt, r3 = (r1 = y[i - 1] - x[i - 1], fabs(r1)) + ; + sinqbt = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + } + sinqbt = cf * sinqbt; + for (i = 1; i <= n; ++i) { + arg = (real) (i + i - 1) * dt; + y[i - 1] = (real) pow(-1, i+1) * .5f * x[n - 1]; + for (k = 1; k <= nm1; ++k) { + y[i - 1] += x[k - 1] * sin((real) k * arg); + } + y[i - 1] += y[i - 1]; + } + sinqf(n, x, w); + sinqft = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = sinqft, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)) + ; + sinqft = dmax(r2,r3); + y[i - 1] = xh[i - 1]; + x[i - 1] = xh[i - 1]; + } + sinqf(n, y, w); + sinqb(n, y, w); + sinqfb = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = sinqfb, r3 = (r1 = cf * y[i - 1] - x[i - 1], fabs( + r1)); + sinqfb = dmax(r2,r3); + } + + /* TEST SUBROUTINES COSQI,COSQF AND COSQB */ + + for (i = 1; i <= n; ++i) { + y[i - 1] = xh[i - 1]; + } + for (i = 1; i <= n; ++i) { + x[i - 1] = 0.f; + arg = (real) (i - 1) * dt; + for (k = 1; k <= n; ++k) { + x[i - 1] += y[k - 1] * FFTPACK_COS((real) (k + k - 1) * arg); + } + x[i - 1] *= 4.f; + } + cosqi(n, w); + cosqb(n, y, w); + cosqbt = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = cosqbt, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)) + ; + cosqbt = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + } + cosqbt = cf * cosqbt; + for (i = 1; i <= n; ++i) { + y[i - 1] = x[0] * .5f; + arg = (real) (i + i - 1) * dt; + for (k = 2; k <= n; ++k) { + y[i - 1] += x[k - 1] * FFTPACK_COS((real) (k - 1) * arg); + } + y[i - 1] += y[i - 1]; + } + cosqf(n, x, w); + cosqft = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = cosqft, r3 = (r1 = y[i - 1] - x[i - 1], fabs(r1)) + ; + cosqft = dmax(r2,r3); + x[i - 1] = xh[i - 1]; + y[i - 1] = xh[i - 1]; + } + cosqft = cf * cosqft; + cosqb(n, x, w); + cosqf(n, x, w); + cosqfb = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + r2 = cosqfb, r3 = (r1 = cf * x[i - 1] - y[i - 1], fabs(r1)); + cosqfb = dmax(r2,r3); + } + + /* TEST CFFTI,CFFTF,CFFTB */ + + for (i = 1; i <= n; ++i) { + r1 = FFTPACK_COS(M_SQRT2 * (real) i); + r2 = FFTPACK_SIN(M_SQRT2 * (real) (i * i)); + q1.r = r1, q1.i = r2; + cx[i-1].r = q1.r, cx[i-1].i = q1.i; + } + dt = (2*M_PI) / fn; + for (i = 1; i <= n; ++i) { + arg1 = -((real) (i - 1)) * dt; + cy[i-1].r = 0.f, cy[i-1].i = 0.f; + for (k = 1; k <= n; ++k) { + arg2 = (real) (k - 1) * arg1; + r1 = FFTPACK_COS(arg2); + r2 = FFTPACK_SIN(arg2); + q3.r = r1, q3.i = r2; + q2.r = q3.r * cx[k-1].r - q3.i * cx[k-1].i, q2.i = + q3.r * cx[k-1].i + q3.i * cx[k-1].r; + q1.r = cy[i-1].r + q2.r, q1.i = cy[i-1].i + q2.i; + cy[i-1].r = q1.r, cy[i-1].i = q1.i; + } + } + cffti(n, w); + cfftf(n, (real*)cx, w); + dcfftf = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + q1.r = cx[i-1].r - cy[i-1].r, q1.i = cx[i-1].i - cy[i-1] + .i; + r1 = dcfftf, r2 = c_abs(&q1); + dcfftf = dmax(r1,r2); + q1.r = cx[i-1].r / fn, q1.i = cx[i-1].i / fn; + cx[i-1].r = q1.r, cx[i-1].i = q1.i; + } + dcfftf /= fn; + for (i = 1; i <= n; ++i) { + arg1 = (real) (i - 1) * dt; + cy[i-1].r = 0.f, cy[i-1].i = 0.f; + for (k = 1; k <= n; ++k) { + arg2 = (real) (k - 1) * arg1; + r1 = FFTPACK_COS(arg2); + r2 = FFTPACK_SIN(arg2); + q3.r = r1, q3.i = r2; + q2.r = q3.r * cx[k-1].r - q3.i * cx[k-1].i, q2.i = + q3.r * cx[k-1].i + q3.i * cx[k-1].r; + q1.r = cy[i-1].r + q2.r, q1.i = cy[i-1].i + q2.i; + cy[i-1].r = q1.r, cy[i-1].i = q1.i; + } + } + cfftb(n, (real*)cx, w); + dcfftb = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + q1.r = cx[i-1].r - cy[i-1].r, q1.i = cx[i-1].i - cy[i-1].i; + r1 = dcfftb, r2 = c_abs(&q1); + dcfftb = dmax(r1,r2); + cx[i-1].r = cy[i-1].r, cx[i-1].i = cy[i-1].i; + } + cf = 1.f / fn; + cfftf(n, (real*)cx, w); + cfftb(n, (real*)cx, w); + dcfb = 0.f; + for (i = 1; i <= n; ++i) { + /* Computing MAX */ + q2.r = cf * cx[i-1].r, q2.i = cf * cx[i-1].i; + q1.r = q2.r - cy[i-1].r, q1.i = q2.i - cy[i-1].i; + r1 = dcfb, r2 = c_abs(&q1); + dcfb = dmax(r1,r2); + } + printf("%d\tRFFTF %10.3g\tRFFTB %10.ge\tRFFTFB %10.3g", n, rftf, rftb, rftfb); + printf( "\tSINT %10.3g\tSINTFB %10.ge\tCOST %10.3g\n", sintt, sintfb, costt); + printf( "\tCOSTFB %10.3g\tSINQF %10.ge\tSINQB %10.3g", costfb, sinqft, sinqbt); + printf( "\tSINQFB %10.3g\tCOSQF %10.ge\tCOSQB %10.3g\n", sinqfb, cosqft, cosqbt); + printf( "\tCOSQFB %10.3g\t", cosqfb); + printf( "\tCFFTF %10.ge\tCFFTB %10.3g\n", dcfftf, dcfftb); + printf( "\tCFFTFB %10.3g\n", dcfb); + +#define CHECK(x) if (x > 1e-3) { printf(#x " failed: %g\n", x); all_ok = 0; } + CHECK(rftf); CHECK(rftb); CHECK(rftfb); CHECK(sintt); CHECK(sintfb); CHECK(costt); + CHECK(costfb); CHECK(sinqft); CHECK(sinqbt); CHECK(sinqfb); CHECK(cosqft); CHECK(cosqbt); + CHECK(cosqfb); CHECK(dcfftf); CHECK(dcfftb); + } + + if (all_ok) printf("Everything looks fine.\n"); + else printf("ERRORS WERE DETECTED.\n"); + /* + expected: + 120 RFFTF 2.786e-06 RFFTB 6.847e-04 RFFTFB 2.795e-07 SINT 1.312e-06 SINTFB 1.237e-06 COST 1.319e-06 + COSTFB 4.355e-06 SINQF 3.281e-04 SINQB 1.876e-06 SINQFB 2.198e-07 COSQF 6.199e-07 COSQB 2.193e-06 + COSQFB 2.300e-07 DEZF 5.573e-06 DEZB 1.363e-05 DEZFB 1.371e-06 CFFTF 5.590e-06 CFFTB 4.751e-05 + CFFTFB 4.215e-07 + 54 RFFTF 4.708e-07 RFFTB 3.052e-05 RFFTFB 3.439e-07 SINT 3.532e-07 SINTFB 4.145e-07 COST 3.002e-07 + COSTFB 6.343e-07 SINQF 4.959e-05 SINQB 4.415e-07 SINQFB 2.882e-07 COSQF 2.826e-07 COSQB 2.472e-07 + COSQFB 3.439e-07 DEZF 9.388e-07 DEZB 5.066e-06 DEZFB 5.960e-07 CFFTF 1.426e-06 CFFTB 9.482e-06 + CFFTFB 2.980e-07 + 49 RFFTF 4.476e-07 RFFTB 5.341e-05 RFFTFB 2.574e-07 SINT 9.196e-07 SINTFB 9.401e-07 COST 8.174e-07 + COSTFB 1.331e-06 SINQF 4.005e-05 SINQB 9.342e-07 SINQFB 3.057e-07 COSQF 2.530e-07 COSQB 6.228e-07 + COSQFB 4.826e-07 DEZF 9.071e-07 DEZB 4.590e-06 DEZFB 5.960e-07 CFFTF 2.095e-06 CFFTB 1.414e-05 + CFFTFB 7.398e-07 + 32 RFFTF 4.619e-07 RFFTB 2.861e-05 RFFTFB 1.192e-07 SINT 3.874e-07 SINTFB 4.172e-07 COST 4.172e-07 + COSTFB 1.699e-06 SINQF 2.551e-05 SINQB 6.407e-07 SINQFB 2.980e-07 COSQF 1.639e-07 COSQB 1.714e-07 + COSQFB 2.384e-07 DEZF 1.013e-06 DEZB 2.339e-06 DEZFB 7.749e-07 CFFTF 1.127e-06 CFFTB 6.744e-06 + CFFTFB 2.666e-07 + 4 RFFTF 1.490e-08 RFFTB 1.490e-07 RFFTFB 5.960e-08 SINT 7.451e-09 SINTFB 0.000e+00 COST 2.980e-08 + COSTFB 1.192e-07 SINQF 4.768e-07 SINQB 2.980e-08 SINQFB 5.960e-08 COSQF 2.608e-08 COSQB 5.960e-08 + COSQFB 1.192e-07 DEZF 2.980e-08 DEZB 5.960e-08 DEZFB 0.000e+00 CFFTF 6.664e-08 CFFTB 5.960e-08 + CFFTFB 6.144e-08 + 3 RFFTF 3.974e-08 RFFTB 1.192e-07 RFFTFB 3.303e-08 SINT 1.987e-08 SINTFB 1.069e-08 COST 4.967e-08 + COSTFB 5.721e-08 SINQF 8.941e-08 SINQB 2.980e-08 SINQFB 1.259e-07 COSQF 7.451e-09 COSQB 4.967e-08 + COSQFB 7.029e-08 DEZF 1.192e-07 DEZB 5.960e-08 DEZFB 5.960e-08 CFFTF 7.947e-08 CFFTB 8.429e-08 + CFFTFB 9.064e-08 + 2 RFFTF 0.000e+00 RFFTB 0.000e+00 RFFTFB 0.000e+00 SINT 0.000e+00 SINTFB 0.000e+00 COST 0.000e+00 + COSTFB 0.000e+00 SINQF 1.192e-07 SINQB 2.980e-08 SINQFB 5.960e-08 COSQF 7.451e-09 COSQB 1.490e-08 + COSQFB 0.000e+00 DEZF 0.000e+00 DEZB 0.000e+00 DEZFB 0.000e+00 CFFTF 0.000e+00 CFFTB 5.960e-08 + CFFTFB 5.960e-08 + Everything looks fine. + + */ + + return all_ok ? 0 : 1; +} +#endif /* TESTING_FFTPACK */ diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md new file mode 100644 index 000000000000..c28c20451e51 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md @@ -0,0 +1,151 @@ + + +# rfftf + +> Compute the forward real-valued [fast Fourier transform (FFT)][fft]. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); +``` + +#### rfftf( N, r, strideR, offsetR, workspace, strideW, offsetW ) + +Computes the forward real-valued [fast Fourier transform (FFT)][fft]. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); + +var workspace = new Float64Array( 42 ); +rffti( 4, workspace, 1, 0 ); + +var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + +rfftf( 4, r, 1, 0, workspace, 1, 0 ); +// r => [ 10, -2, 2, -2 ] +``` + +The function accepts the following arguments: + +- **N**: length of the sequence to transform. +- **r**: real input array which is modified in-place to store the FFT result. +- **strideR**: stride length for `r`. +- **offsetR**: starting index for `r`. +- **workspace**: workspace array initialized by `rffti`. +- **strideW**: stride length for `workspace`. +- **offsetW**: starting index for `workspace`. + +
+ + + + + +
+ +## Notes + +- The workspace array should have been initialized by calling `rffti` with the same sequence length `N`. +- The transform overwrites the input array `r` with the output. +- For a real sequence of length `N`, the output is stored in half-complex format: + - `r[0]` contains the DC component (the sum of the input). + - For `k = 1` to `(N-1)/2`: `r[2*k-1]` contains the real part and `r[2*k]` contains the imaginary part of the k-th frequency component. + - If `N` is even, `r[N-1]` contains the Nyquist component. +- For single-point sequences (`N = 1`), the function returns immediately as the FFT is the identity operation. + +
+ + + + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); + +var workspace; +var N = 8; +var r; + +workspace = new Float64Array( ( 2*N ) + 34 ); +rffti( N, workspace, 1, 0 ); + +r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +console.log( r ); + +rfftf( N, r, 1, 0, workspace, 1, 0 ); +console.log( r ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js new file mode 100644 index 000000000000..b91f7ce32a2f --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js @@ -0,0 +1,124 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +var pkg = require( './../package.json' ).name; +var rfftf = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - sequence length to transform +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var workspace; + var r; + var c; + + workspace = new Float64Array( ( 2*N ) + 34 ); + rffti( N, workspace, 1, 0 ); + + r = uniform( N, -10.0, 10.0, options ); + c = new Float64Array( N ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + var j; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + /* + * Copy the original input array before each transformation. This is necessary because `rfftf` modifies the input array in-place, and applying the forward FFT repeatedly to already-transformed data causes values to grow unbounded and eventually overflow to NaN. + */ + for ( j = 0; j < N; j++ ) { + c[ j ] = r[ j ]; + } + rfftf( N, c, 1, 0, workspace, 1, 0 ); + if ( isnan( c[ i%N ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + + if ( isnan( c[ i%N ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var lengths; + var N; + var f; + var i; + + lengths = [ + 8, + 16, + 32, + 64, + 128, + 256 + ]; + + for ( i = 0; i < lengths.length; i++ ) { + N = lengths[ i ]; + f = createBenchmark( N ); + bench( pkg+':N='+N, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt new file mode 100644 index 000000000000..5b17861820bd --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt @@ -0,0 +1,49 @@ + +{{alias}}( N, r, strideR, offsetR, workspace, strideW, offsetW ) + Computes the forward real-valued fast Fourier transform (FFT). + + The workspace array should have been initialized by calling `rffti` with + the same sequence length `N`. + + The transform overwrites the input array `r` with the output in half- + complex format. + + Parameters + ---------- + N: integer + Length of the real sequence to transform. + + r: Float64Array + Input/output array containing the sequence to transform. + + strideR: integer + Stride length for `r`. + + offsetR: integer + Starting index for `r`. + + workspace: Float64Array + Workspace array initialized by `rffti`. + + strideW: integer + Stride length for `workspace`. + + offsetW: integer + Starting index for `workspace`. + + Returns + ------- + void + + Examples + -------- + > var N = 4; + > var workspace = new {{alias:@stdlib/array/float64}}( ( 2*N ) + 34 ); + > {{alias:@stdlib/fft/base/fftpack/rffti}}( N, workspace, 1, 0 ); + > var r = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > {{alias}}( N, r, 1, 0, workspace, 1, 0 ); + > r + [ 10.0, -2.0, 2.0, -2.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts new file mode 100644 index 000000000000..8de9350fd9b2 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts @@ -0,0 +1,63 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +/// + +/** +* Computes the forward real-valued fast Fourier transform (FFT). +* +* ## Notes +* +* - The workspace array should have been initialized by calling `rffti` with the same sequence length `N`. +* - The transform overwrites the input array `r` with the output in half-complex format. +* - For single-point sequences (N=1), the function returns immediately as the FFT is the identity operation. +* +* @param N - length of the real sequence to transform +* @param r - input/output array containing the sequence to transform +* @param strideR - stride length for `r` +* @param offsetR - starting index for `r` +* @param workspace - workspace array initialized by `rffti` +* @param strideW - stride length for `workspace` +* @param offsetW - starting index for `workspace` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +* +* // Define the sequence length: +* var N = 4; +* +* // Initialize a workspace array for the FFT: +* var workspace = new Float64Array( ( 2*N ) + 34 ); +* rffti( N, workspace, 1, 0 ); +* +* // Define a real-valued input sequence: +* var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* // Perform the forward real FFT: +* rfftf( N, r, 1, 0, workspace, 1, 0 ); +* // r => [ 10.0, -2.0, 2.0, -2.0 ] +*/ +declare function rfftf( N: number, r: Float64Array, strideR: number, offsetR: number, workspace: Float64Array, strideW: number, offsetW: number ): void; + + +// EXPORTS // + +export = rfftf; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts new file mode 100644 index 000000000000..8beb9dd30f26 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts @@ -0,0 +1,148 @@ +/* +* @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. +*/ + +import rfftf = require( './index' ); + +// TESTS // + +// The function returns void... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + rfftf( 4, c, 1, 0, workspace, 1, 0 ); // $ExpectType void +} + +// The compiler throws an error if the function is provided a sequence length which is not a number... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + + rfftf( '4', c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( true, c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( false, c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( null, c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( undefined, c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( [], c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( {}, c, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( ( x: number ): number => x, c, 1, 0, workspace, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an input array which is not a Float64Array... +{ + const workspace = new Float64Array( 50 ); + + rfftf( 4, '1,2,3,4', 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, 5, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, true, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, false, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, null, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, undefined, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, [], 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, {}, 1, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, ( x: number ): number => x, 1, 0, workspace, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a stride for `c` which is not a number... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + + rfftf( 4, c, '1', 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, true, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, false, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, null, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, undefined, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, [], 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, {}, 0, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, ( x: number ): number => x, 0, workspace, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an offset for `c` which is not a number... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + + rfftf( 4, c, 1, '0', workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, true, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, false, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, null, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, undefined, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, [], workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, {}, workspace, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, ( x: number ): number => x, workspace, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a workspace which is not a Float64Array... +{ + const c = new Float64Array( 4 ); + + rfftf( 4, c, 1, 0, '4,2,3,5', 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, 5, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, true, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, false, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, null, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, undefined, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, [], 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, {}, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a stride for workspace which is not a number... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + + rfftf( 4, c, 1, 0, workspace, '1', 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, true, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, false, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, null, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, undefined, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, [], 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, {}, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an offset for workspace which is not a number... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + + rfftf( 4, c, 1, 0, workspace, 1, '0' ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, true ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, false ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, null ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, undefined ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, [] ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, {} ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const c = new Float64Array( 4 ); + const workspace = new Float64Array( 50 ); + + rfftf(); // $ExpectError + rfftf( 4 ); // $ExpectError + rfftf( 4, c ); // $ExpectError + rfftf( 4, c, 1 ); // $ExpectError + rfftf( 4, c, 1, 0 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1 ); // $ExpectError + rfftf( 4, c, 1, 0, workspace, 1, 0, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js new file mode 100644 index 000000000000..313285437471 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js @@ -0,0 +1,46 @@ +/** +* @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. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +var rfftf = require( './../lib' ); + +var workspace; +var N = 8; +var r; +var i; + +// Initialize a workspace array: +workspace = new Float64Array( ( 2*N ) + 34 ); +rffti( N, workspace, 1, 0 ); + +// Define a real-valued input sequence: +r = new Float64Array( N ); +for ( i = 0; i < N; i++ ) { + r[ i ] = i + 1; +} +console.log( 'Input sequence:' ); +console.log( r ); + +// Compute the forward FFT: +rfftf( N, r, 1, 0, workspace, 1, 0 ); + +console.log( 'FFT output (half-complex format):' ); +console.log( r ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js index ca69162b6696..beb03cd4ad4e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf2.js @@ -230,7 +230,7 @@ function optr( i, j, k, M, stride, offset ) { * @param {integer} sc - stride length for `cc` * @param {NonNegativeInteger} oc - index offset for `cc` * @param {Float64Array} out - output array containing transformed sub-sequences -* @param {integer} so - stride length for `out`` +* @param {integer} so - stride length for `out` * @param {NonNegativeInteger} oo - index offset for `out` * @param {Float64Array} twiddles - array containing twiddle factors * @param {integer} st - stride length for `twiddles` diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js index 3c241814d842..87494206d1a8 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf3.js @@ -81,35 +81,37 @@ var TAUI = sin( ( 2.0 * PI ) / 3.0 ); // ~0.866025403784439 * * ## Notes * -* In a forward real FFT, the previous stage writes its results as two "rows" per sub-sequence. +* In a forward real FFT, the previous stage writes its results as three "rows" per sub-sequence. * -* Thus, when reading from an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having two "rows" (`even + odd` and `even - odd`, respectively) and where each "row" is arranged as `M*L` contiguous elements corresponding to interleaved real and imaginary components. +* Thus, when reading from an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having three "rows" (components 0, 1, and 2) and where each "row" is arranged as `M*L` contiguous elements corresponding to interleaved real and imaginary components. * * Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: * * ```text -* │ k = 0 k = 1 k = 2 -* │ ──────────────────────────────────────────────────────────────────────────→ k -* j = 0 (even+odd) │ cc(0,0,0) ... cc(3,0,0) cc(0,1,0) ... cc(3,1,0) cc(0,2,0) ... cc(3,2,0) -* │ -* j = 1 (even-odd) │ cc(0,0,1) ... cc(3,0,1) cc(0,1,1) ... cc(3,1,1) cc(0,2,1) ... cc(3,2,1) -* └───────────────────────────────────────────────────────────────────────────→ i -* ↑ ↑ ↑ ↑ ↑ ↑ -* i = 0 M-1 0 M-1 0 M-1 +* │ k = 0 k = 1 k = 2 +* │ ──────────────────────────────────────────────────────────────────────────→ k +* j = 0 │ cc(0,0,0) ... cc(3,0,0) cc(0,1,0) ... cc(3,1,0) cc(0,2,0) ... cc(3,2,0) +* │ +* j = 1 │ cc(0,0,1) ... cc(3,0,1) cc(0,1,1) ... cc(3,1,1) cc(0,2,1) ... cc(3,2,1) +* │ +* j = 2 │ cc(0,0,2) ... cc(3,0,2) cc(0,1,2) ... cc(3,1,2) cc(0,2,2) ... cc(3,2,2) +* └───────────────────────────────────────────────────────────────────────────→ i +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 0 M-1 * ``` * * In the above, * -* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to either the `even + odd` or `even - odd` row of the previous stage. -* - `j` selects between the `even + odd` and `even - odd` row of the previous stage. +* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to one of the three component rows. +* - `j` selects between the three component rows (0, 1, or 2). * - `k` specifies the index of one of the `L` independent transforms we are processing. * * In linear memory, the three-dimensional logical view is arranged as follows: * * ```text -* | cc(0,0,0)...cc(3,0,0) ... cc(0,2,0)...cc(3,2,0) | cc(0,0,1)...cc(3,0,1) ... cc(0,2,1)...cc(3,2,1) | -* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ -* 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 +* | cc(0,0,0)...cc(3,0,0) ... cc(0,2,0)...cc(3,2,0) | cc(0,0,1)...cc(3,0,1) ... cc(0,2,1)...cc(3,2,1) | cc(0,0,2)...cc(3,0,2) ... cc(0,2,2)...cc(3,2,2) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 2LM (2L+1)M-1 (3L-1)M 3LM-1 * ``` * * @private diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js index bed422791feb..c7084f7947f7 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf4.js @@ -56,116 +56,436 @@ * ``` */ -/* eslint-disable max-len */ +/* eslint-disable max-len, max-statements */ 'use strict'; // MODULES // var SQRT_HALF = require( '@stdlib/constants/float64/sqrt-half' ); -var chRef = require( './ch_ref.js' ); -var ccRef = require( './cc_ref.js' ); + + +// FUNCTIONS // + +/** +* Resolves an index into the input array. +* +* ## Notes +* +* In a forward real FFT, the previous stage writes its results as four "rows" per sub-sequence. +* +* Thus, when reading from an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having four "rows" (components 0, 1, 2, and 3) and where each "row" is arranged as `M*L` contiguous elements corresponding to interleaved real and imaginary components. +* +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 3` transforms and in which each sub-sequence has length `M = 4`: +* +* ```text +* │ k = 0 k = 1 k = 2 +* │ ──────────────────────────────────────────────────────────────────────────→ k +* j = 0 │ cc(0,0,0) ... cc(3,0,0) cc(0,1,0) ... cc(3,1,0) cc(0,2,0) ... cc(3,2,0) +* │ +* j = 1 │ cc(0,0,1) ... cc(3,0,1) cc(0,1,1) ... cc(3,1,1) cc(0,2,1) ... cc(3,2,1) +* │ +* j = 2 │ cc(0,0,2) ... cc(3,0,2) cc(0,1,2) ... cc(3,1,2) cc(0,2,2) ... cc(3,2,2) +* │ +* j = 3 │ cc(0,0,3) ... cc(3,0,3) cc(0,1,3) ... cc(3,1,3) cc(0,2,3) ... cc(3,2,3) +* └───────────────────────────────────────────────────────────────────────────→ i +* ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 0 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to one of the four component rows. +* - `j` selects between the four component rows (0, 1, 2, or 3). +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | cc(0,0,0)...cc(3,0,0) ... cc(0,2,0)...cc(3,2,0) | cc(0,0,1)...cc(3,0,1) ... cc(0,2,1)...cc(3,2,1) | ... | cc(0,0,3)...cc(3,0,3) ... cc(0,2,3)...cc(3,2,3) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 LM LM-1 (L+1)M (L+1)M-1 (2L-1)M 2LM-1 3LM (3L+1)M-1 (4L-1)M 4LM-1 +* ``` +* +* @private +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} j - input row +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the input array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the input array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = iptr( 0, 0, 0, L, M, stride, offset ); +* // returns 0 +* +* idx = iptr( 1, 0, 0, L, M, stride, offset ); +* // returns 1 +* +* idx = iptr( M-1, 0, 0, L, M, stride, offset ); +* // returns 3 +* +* idx = iptr( 0, 1, 0, L, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = iptr( M-1, L-1, 1, L, M, stride, offset ); +* // returns 23 +*/ +function iptr( i, k, j, L, M, stride, offset ) { + var n = i + ( ( k+(j*L) ) * M ); + return ( n*stride ) + offset; +} + +/** +* Resolves an index into the output array. +* +* ## Notes +* +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having four "columns" corresponding to the four components of a radix-4 stage (with real and imaginary parts of each component interleaved along each sub-sequence) and where each "column" has `M` elements. +* +* Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 3` transforms and in which each "column" sub-sequence has length `M = 4`: +* +* ```text +* j = 0 (component 0) j = 1 (component 1) j = 2 (component 2) j = 3 (component 3) +* k = 0 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┐ +* │ out(0,0,0) out(1,0,0) ... out(3,0,0) │ out(0,1,0) out(1,1,0) ... out(3,1,0) │ out(0,2,0) out(1,2,0) ... out(3,2,0) │ out(0,3,0) out(1,3,0) ... out(3,3,0) │ +* └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┤ +* k = 1 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┤ +* │ out(0,0,1) out(1,0,1) ... out(3,0,1) │ out(0,1,1) out(1,1,1) ... out(3,1,1) │ out(0,2,1) out(1,2,1) ... out(3,2,1) │ out(0,3,1) out(1,3,1) ... out(3,3,1) │ +* └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┤ +* k = 2 ─┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┤ +* │ out(0,0,2) out(1,0,2) ... out(3,0,2) │ out(0,1,2) out(1,1,2) ... out(3,1,2) │ out(0,2,2) out(1,2,2) ... out(3,2,2) │ out(0,3,2) out(1,3,2) ... out(3,3,2) │ +* └───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┘ +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 1 M-1 0 1 M-1 0 1 M-1 0 1 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short "column" sub-sequence. +* - `j` selects which of the four components we are in (0, 1, 2, or 3). +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | out(0,0,0)...out(3,0,0) | out(0,1,0)...out(3,1,0) | out(0,2,0)...out(3,2,0) | out(0,3,0)...out(3,3,0) | out(0,0,1)...out(3,0,1) | ... | out(0,3,2)...out(3,3,2) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 M 2M-1 2M 3M-1 3M 4M-1 4M 5M-1 (4L-1)M 4LM-1 +* ``` +* +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radf4` being only one stage in a multi-stage driver which alternates between using `cc` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* +* Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. +* +* @private +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} j - index specifying which of the four complex components we are in (0, 1, 2, or 3) +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the output array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 3; // number of sub-sequences +* +* var idx = optr( 0, 0, 0, M, stride, offset ); +* // returns 0 +* +* idx = optr( 1, 0, 0, M, stride, offset ); +* // returns 1 +* +* idx = optr( M-1, 0, 0, M, stride, offset ); +* // returns 3 +* +* idx = optr( 0, 1, 0, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = optr( M-1, 3, L-1, M, stride, offset ); +* // returns 47 +*/ +function optr( i, j, k, M, stride, offset ) { + var n = i + ( ( j+(k*4) ) * M ); + return ( n*stride ) + offset; +} // MAIN // /** -* Performs the forward FFT of length 4 for real-valued sequences. +* Performs one radix-4 stage within a forward Fourier transform for a real-valued sequence. * * @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 {number} ccOffset - offset for the input array -* @param {Float64Array} ch - output array containing transformed sequences -* @param {number} chOffset - offset for the output array -* @param {Float64Array} wa1 - first array of twiddle factors -* @param {number} wa1Offset - offset for the first twiddle factors array -* @param {Float64Array} wa2 - second array of twiddle factors -* @param {number} wa2Offset - offset for the second twiddle factors array -* @param {Float64Array} wa3 - third array of twiddle factors -* @param {number} wa3Offset - offset for the third twiddle factors array +* @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed +* @param {NonNegativeInteger} L - number of sub-sequences to be transformed +* @param {Float64Array} cc - input array containing the sub-sequences to be transformed +* @param {integer} sc - stride length for `cc` +* @param {NonNegativeInteger} oc - index offset for `cc` +* @param {Float64Array} out - output array containing transformed sub-sequences +* @param {integer} so - stride length for `out` +* @param {NonNegativeInteger} oo - index offset for `out` +* @param {Float64Array} twiddles1 - first array of twiddle factors +* @param {integer} st1 - stride length for `twiddles1` +* @param {NonNegativeInteger} ot1 - index offset for `twiddles1` +* @param {Float64Array} twiddles2 - second array of twiddle factors +* @param {integer} st2 - stride length for `twiddles2` +* @param {NonNegativeInteger} ot2 - index offset for `twiddles2` +* @param {Float64Array} twiddles3 - third array of twiddle factors +* @param {integer} st3 - stride length for `twiddles3` +* @param {NonNegativeInteger} ot3 - index offset for `twiddles3` * @returns {void} */ -function radf4( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset ) { // eslint-disable-line max-params - var idp2; - var tr4; - var tr3; - var tr2; +function radf4( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, st2, ot2, twiddles3, st3, ot3 ) { // eslint-disable-line max-params + var it11; + var it12; + var it21; + var it22; + var it31; + var it32; var tr1; - var ti4; - var ti3; - var ti2; + var tr2; + var tr3; + var tr4; var ti1; + var ti2; + var ti3; + var ti4; var cr2; var cr3; var cr4; var ci2; var ci3; var ci4; - var ic; + var ip1; + var ip2; + var ip3; + var ip4; + var io; + var im; var i; var k; - // Parameter adjustments... - chOffset -= 1 + ( ido * 5 ); - ccOffset -= 1 + ( ido * ( 1 + l1 ) ); - wa1Offset -= 1; - wa2Offset -= 1; - wa3Offset -= 1; - - // Function body: - for ( k = 1; k <= l1; k++ ) { - tr1 = cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ]; - tr2 = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; - ch[ chRef( 1, 1, k, 4, ido ) + chOffset ] = tr1 + tr2; - ch[ chRef( ido, 4, k, 4, ido ) + chOffset ] = tr2 - tr1; - ch[ chRef( ido, 2, k, 4, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; - ch[ chRef( 1, 3, k, 4, ido ) + chOffset ] = cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; + /* + * First, perform the core butterfly for each sub-sequence being transformed. + * + * In the following loop, we handle harmonic `n = 0` for every transform. As described for `iptr`, the input array is interpreted as a three-dimensional array, containing four "rows" per sub-sequence. + * + * row0 = input component 0 (j = 0) + * row1 = input component 1 (j = 1) + * row2 = input component 2 (j = 2) + * row3 = input component 3 (j = 3) + * + * For a radix-4 forward FFT of a real-valued signal `x` and `n = 0`, + * + * tr1 = row1 + row3 (sum of components 1 and 3) + * tr2 = row0 + row2 (sum of components 0 and 2) + * + * x[0] = tr1 + tr2 (DC component: sum of all) + * x[2M-1] = row0 - row2 (first harmonic real part) + * x[2M] = row3 - row1 (first harmonic imaginary part) + * x[4M-1] = tr2 - tr1 (Nyquist-related component) + * + * Because `W_N^0 = 1`, no frequency-dependent twiddle multiplication is necessary beyond these sums. + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( 0, k, 0, L, M, sc, oc ); // real part row 0 + ip2 = iptr( 0, k, 1, L, M, sc, oc ); // real part row 1 + ip3 = iptr( 0, k, 2, L, M, sc, oc ); // real part row 2 + ip4 = iptr( 0, k, 3, L, M, sc, oc ); // real part row 3 + + tr1 = cc[ ip2 ] + cc[ ip4 ]; // row1 + row3 + tr2 = cc[ ip1 ] + cc[ ip3 ]; // row0 + row2 + + io = optr( 0, 0, k, M, so, oo ); + out[ io ] = tr1 + tr2; // x[0]: DC component + + io = optr( M-1, 1, k, M, so, oo ); + out[ io ] = cc[ ip1 ] - cc[ ip3 ]; // x[2M-1]: row0 - row2 + + io = optr( 0, 2, k, M, so, oo ); + out[ io ] = cc[ ip4 ] - cc[ ip2 ]; // x[2M]: row3 - row1 + + io = optr( M-1, 3, k, M, so, oo ); + out[ io ] = tr2 - tr1; // x[4M-1]: Nyquist-related component } - if ( ido < 2 ) { + // When the number of elements in a sub-sequence is equal to `1`, there is nothing more to do, as the above butterfly produced the full result... + if ( M < 2 ) { return; } - if ( ido !== 2 ) { - idp2 = ido + 2; - for ( k = 1; k <= l1; k++ ) { - for ( i = 3; i <= ido; i += 2 ) { - ic = idp2 - i; - cr2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); - ci2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); - cr3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ) + ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ); - ci3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ) - ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ); - cr4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ) + ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ); - ci4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ) - ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ); + /* + * Next, apply the general case where we need to loop through the non-trivial harmonics. + * + * For each harmonic `n = 1, ..., M/2-1`, we need to + * + * - recover four spectra from the four input rows. + * - apply radix-4 twiddle factors to rows 1, 2, and 3, then combine with row 0 using the radix-4 butterfly. + * - the four output columns receive the combined results using the radix-4 recombination formulas. + * + * The radix-4 butterfly computes: + * + * cr2 = W1_n ⋅ row1, cr3 = W2_n ⋅ row2, cr4 = W3_n ⋅ row3 + * + * tr1 = cr2 + cr4, tr4 = cr4 - cr2 + * ti1 = ci2 + ci4, ti4 = ci2 - ci4 + * tr2 = row0 + cr3, tr3 = row0 - cr3 + * ti2 = row0_im + ci3, ti3 = row0_im - ci3 + * + * The four output terms are formed by combining these intermediate results. + * + * The mirror index `im = M + 1 - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. + */ + if ( M >= 3 ) { + // Loop over each sub-sequence to be transformed... + for ( k = 0; k < L; k++ ) { + // Loop over the elements in each sub-sequence... + for ( i = 2; i < M; i += 2 ) { + im = M - i; // "mirror" index (ic = idp2 - i in C, converted to 0-indexed) + + // Resolve twiddle factor indices for component 1: + it11 = ( (i-2)*st1 ) + ot1; // cos(θ) for component 1 + it12 = ( (i-1)*st1 ) + ot1; // sin(θ) for component 1 + + // Resolve twiddle factor indices for component 2: + it21 = ( (i-2)*st2 ) + ot2; // cos(θ) for component 2 + it22 = ( (i-1)*st2 ) + ot2; // sin(θ) for component 2 + + // Resolve twiddle factor indices for component 3: + it31 = ( (i-2)*st3 ) + ot3; // cos(θ) for component 3 + it32 = ( (i-1)*st3 ) + ot3; // sin(θ) for component 3 + + // Load component 1 data and apply twiddle... + ip1 = iptr( i-1, k, 1, L, M, sc, oc ); // real part component 1 + ip2 = iptr( i, k, 1, L, M, sc, oc ); // imag part component 1 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // cr2 = W1_n ⋅ (c + j⋅d) for component 1 + cr2 = ( twiddles1[ it11 ] * cc[ ip1 ] ) + ( twiddles1[ it12 ] * cc[ ip2 ] ); // Re(cr2) + ci2 = ( twiddles1[ it11 ] * cc[ ip2 ] ) - ( twiddles1[ it12 ] * cc[ ip1 ] ); // Im(ci2) + + // Load component 2 data and apply twiddle... + ip1 = iptr( i-1, k, 2, L, M, sc, oc ); // real part component 2 + ip2 = iptr( i, k, 2, L, M, sc, oc ); // imag part component 2 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // cr3 = W2_n ⋅ (c + j⋅d) for component 2 + cr3 = ( twiddles2[ it21 ] * cc[ ip1 ] ) + ( twiddles2[ it22 ] * cc[ ip2 ] ); // Re(cr3) + ci3 = ( twiddles2[ it21 ] * cc[ ip2 ] ) - ( twiddles2[ it22 ] * cc[ ip1 ] ); // Im(ci3) + + // Load component 3 data and apply twiddle... + ip1 = iptr( i-1, k, 3, L, M, sc, oc ); // real part component 3 + ip2 = iptr( i, k, 3, L, M, sc, oc ); // imag part component 3 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // cr4 = W3_n ⋅ (c + j⋅d) for component 3 + cr4 = ( twiddles3[ it31 ] * cc[ ip1 ] ) + ( twiddles3[ it32 ] * cc[ ip2 ] ); // Re(cr4) + ci4 = ( twiddles3[ it31 ] * cc[ ip2 ] ) - ( twiddles3[ it32 ] * cc[ ip1 ] ); // Im(ci4) + + // Radix-4 butterfly intermediate computations: tr1 = cr2 + cr4; tr4 = cr4 - cr2; ti1 = ci2 + ci4; ti4 = ci2 - ci4; - ti2 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ci3; - ti3 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] - ci3; - tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + cr3; - tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] - cr3; - ch[ chRef( i - 1, 1, k, 4, ido ) + chOffset ] = tr1 + tr2; - ch[ chRef( ic - 1, 4, k, 4, ido ) + chOffset ] = tr2 - tr1; - ch[ chRef( i, 1, k, 4, ido ) + chOffset ] = ti1 + ti2; - ch[ chRef( ic, 4, k, 4, ido ) + chOffset ] = ti1 - ti2; - ch[ chRef( i - 1, 3, k, 4, ido ) + chOffset ] = ti4 + tr3; - ch[ chRef( ic - 1, 2, k, 4, ido ) + chOffset ] = tr3 - ti4; - ch[ chRef( i, 3, k, 4, ido ) + chOffset ] = tr4 + ti3; - ch[ chRef( ic, 2, k, 4, ido ) + chOffset ] = tr4 - ti3; + + // Load component 0 data... + ip1 = iptr( i-1, k, 0, L, M, sc, oc ); // real part component 0 + ip2 = iptr( i, k, 0, L, M, sc, oc ); // imag part component 0 + + ti2 = cc[ ip2 ] + ci3; + ti3 = cc[ ip2 ] - ci3; + tr2 = cc[ ip1 ] + cr3; + tr3 = cc[ ip1 ] - cr3; + + // Output column 0 + io = optr( i-1, 0, k, M, so, oo ); + out[ io ] = tr1 + tr2; + + io = optr( i, 0, k, M, so, oo ); + out[ io ] = ti1 + ti2; + + // Output column 3 (conjugate-symmetric) + io = optr( im-1, 3, k, M, so, oo ); + out[ io ] = tr2 - tr1; + + io = optr( im, 3, k, M, so, oo ); + out[ io ] = ti1 - ti2; + + // Output column 2 + io = optr( i-1, 2, k, M, so, oo ); + out[ io ] = ti4 + tr3; + + io = optr( i, 2, k, M, so, oo ); + out[ io ] = tr4 + ti3; + + // Output column 1 (conjugate-symmetric) + io = optr( im-1, 1, k, M, so, oo ); + out[ io ] = tr3 - ti4; + + io = optr( im, 1, k, M, so, oo ); + out[ io ] = tr4 - ti3; } } - if ( ido % 2 === 1 ) { + + // When `M` is odd, there is no Nyquist pair to process, so we do not need to perform any further transformations... + if ( M%2 === 1 ) { return; } } - for ( k = 1; k <= l1; k++ ) { - ti1 = -SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ] + cc[ ccRef( ido, k, 4, l1, ido ) + ccOffset ] ); - tr1 = SQRT_HALF * ( cc[ ccRef( ido, k, 2, l1, ido ) + ccOffset ] - cc[ ccRef( ido, k, 4, l1, ido ) + ccOffset ] ); - ch[ chRef( ido, 1, k, 4, ido ) + chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ] + tr1; - ch[ chRef( ido, 3, k, 4, ido ) + chOffset ] = cc[ ccRef( ido, k, 1, l1, ido ) + ccOffset ] - tr1; - ch[ chRef( 1, 2, k, 4, ido ) + chOffset ] = ti1 - cc[ ccRef( ido, k, 3, l1, ido ) + ccOffset ]; - ch[ chRef( 1, 4, k, 4, ido ) + chOffset ] = cc[ ccRef( ido, k, 3, l1, ido ) + ccOffset ] + ti1; + + /* + * Lastly, handle the Nyquist frequency where `i = M-1` (i.e., the last element of each sub-sequence). + * + * When `M` is even, the Nyquist index is `i = M/2`. In this stage, we've stored that element at the end of each sub-sequence (i.e., `i = M-1` in the packed layout). + * + * At this point, the twiddle factors for components 1 and 3 involve `√2/2`: + * + * ti1 = -√(1/2) ⋅ (row1 + row3) + * tr1 = √(1/2) ⋅ (row1 - row3) + * + * The four output terms are: + * + * out[0] = row0 + tr1 + * out[2] = row0 - tr1 + * out[1] = ti1 - row2 + * out[3] = row2 + ti1 + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( M-1, k, 1, L, M, sc, oc ); // row 1 at Nyquist + ip2 = iptr( M-1, k, 3, L, M, sc, oc ); // row 3 at Nyquist + + ti1 = -SQRT_HALF * ( cc[ ip1 ] + cc[ ip2 ] ); + tr1 = SQRT_HALF * ( cc[ ip1 ] - cc[ ip2 ] ); + + ip3 = iptr( M-1, k, 0, L, M, sc, oc ); // row 0 at Nyquist + ip4 = iptr( M-1, k, 2, L, M, sc, oc ); // row 2 at Nyquist + + io = optr( M-1, 0, k, M, so, oo ); + out[ io ] = cc[ ip3 ] + tr1; + + io = optr( M-1, 2, k, M, so, oo ); + out[ io ] = cc[ ip3 ] - tr1; + + io = optr( 0, 1, k, M, so, oo ); + out[ io ] = ti1 - cc[ ip4 ]; + + io = optr( 0, 3, k, M, so, oo ); + out[ io ] = cc[ ip4 ] + ti1; } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js index 159bd7158742..a40fe02e854e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js @@ -56,7 +56,7 @@ * ``` */ -/* eslint-disable max-len */ +/* eslint-disable max-len, max-statements */ 'use strict'; @@ -64,107 +64,401 @@ var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); -var chRef = require( './ch_ref.js' ); -var ccRef = require( './cc_ref.js' ); // VARIABLES // var sc1 = sincos( TWO_PI / 5 ); var sc2 = sincos( ( 2 * TWO_PI ) / 5 ); -var TR11 = sc1[ 1 ]; // 0.309016994374947 -var TI11 = sc1[ 0 ]; // 0.951056516295154 -var TR12 = sc2[ 1 ]; // -0.809016994374947 -var TI12 = sc2[ 0 ]; // 0.587785252292473 +var TR11 = sc1[ 1 ]; // cos(2π/5) ≈ 0.309016994374947 +var TI11 = sc1[ 0 ]; // sin(2π/5) ≈ 0.951056516295154 +var TR12 = sc2[ 1 ]; // cos(4π/5) ≈ -0.809016994374947 +var TI12 = sc2[ 0 ]; // sin(4π/5) ≈ 0.587785252292473 + + +// FUNCTIONS // + +/** +* Resolves an index into the input array. +* +* ## Notes +* +* In a forward real FFT, the previous stage writes its results as five "rows" per sub-sequence. +* +* Thus, when reading from an input array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having five "rows" (components 0, 1, 2, 3, and 4) and where each "row" is arranged as `M*L` contiguous elements corresponding to interleaved real and imaginary components. +* +* Accordingly, the following is a logical view of an input array (zero-based indexing) which contains `L = 2` transforms and in which each sub-sequence has length `M = 4`: +* +* ```text +* │ k = 0 k = 1 +* │ ────────────────────────────────────────────────────→ k +* j = 0 (comp 0) │ cc(0,0,0) ... cc(3,0,0) cc(0,1,0) ... cc(3,1,0) +* │ +* j = 1 (comp 1) │ cc(0,0,1) ... cc(3,0,1) cc(0,1,1) ... cc(3,1,1) +* │ +* j = 2 (comp 2) │ cc(0,0,2) ... cc(3,0,2) cc(0,1,2) ... cc(3,1,2) +* │ +* j = 3 (comp 3) │ cc(0,0,3) ... cc(3,0,3) cc(0,1,3) ... cc(3,1,3) +* │ +* j = 4 (comp 4) │ cc(0,0,4) ... cc(3,0,4) cc(0,1,4) ... cc(3,1,4) +* └───────────────────────────────────────────────────→ i +* ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short sub-sequence corresponding to one of the five component rows. +* - `j` selects between the five component rows (0, 1, 2, 3, or 4). +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | cc(0,0,0)...cc(3,0,0) ... cc(0,1,0)...cc(3,1,0) | cc(0,0,1)...cc(3,0,1) ... | ... | cc(0,1,4)...cc(3,1,4) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 LM LM-1 (L+1)M (5L-1)M 5LM-1 +* ``` +* +* @private +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} j - input row (component 0, 1, 2, 3, or 4) +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the input array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the input array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 2; // number of sub-sequences +* +* var idx = iptr( 0, 0, 0, L, M, stride, offset ); +* // returns 0 +* +* idx = iptr( 1, 0, 0, L, M, stride, offset ); +* // returns 1 +* +* idx = iptr( M-1, 0, 0, L, M, stride, offset ); +* // returns 3 +* +* idx = iptr( 0, 1, 0, L, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = iptr( M-1, L-1, 4, L, M, stride, offset ); +* // returns 39 +*/ +function iptr( i, k, j, L, M, stride, offset ) { // cc_ref + // i = a1 + // M = ido + // L = l1 + // j = a3 + // k = a2 + var n = i + ( ( k+(j*L) ) * M ); + return ( n*stride ) + offset; +} + +/** +* Resolves an index into the output array. +* +* ## Notes +* +* When writing to an output array stored in linear memory, we can reinterpret the array as a three-dimensional logical view containing `L` independent sub-sequences having five "columns" corresponding to the five components of a radix-5 stage (with real and imaginary parts of each component interleaved along each sub-sequence) and where each "column" has `M` elements. +* +* Accordingly, the following is a logical view of an output array (zero-based indexing) which contains `L = 2` transforms and in which each "column" sub-sequence has length `M = 4`: +* +* ```text +* j = 0 (component 0) j = 1 (component 1) j = 2 (component 2) j = 3 (component 3) j = 4 (component 4) +* k = 0 ─┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┐ +* │ out(0,0,0) ... out(3,0,0) │ out(0,1,0) ... out(3,1,0) │ out(0,2,0) ... out(3,2,0) │ out(0,3,0) ... out(3,3,0) │ out(0,4,0) ... out(3,4,0) │ +* └─────────────────────────────┴─────────────────────────────┴─────────────────────────────┴─────────────────────────────┴─────────────────────────────┤ +* k = 1 ─┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┤ +* │ out(0,0,1) ... out(3,0,1) │ out(0,1,1) ... out(3,1,1) │ out(0,2,1) ... out(3,2,1) │ out(0,3,1) ... out(3,3,1) │ out(0,4,1) ... out(3,4,1) │ +* └─────────────────────────────┴─────────────────────────────┴─────────────────────────────┴─────────────────────────────┴─────────────────────────────┘ +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* i = 0 M-1 0 M-1 0 M-1 0 M-1 0 M-1 +* ``` +* +* In the above, +* +* - `i` is the fastest varying index, which walks within one short "column" sub-sequence. +* - `j` selects which of the five components we are in (0, 1, 2, 3, or 4). +* - `k` specifies the index of one of the `L` independent transforms we are processing. +* +* In linear memory, the three-dimensional logical view is arranged as follows: +* +* ```text +* | out(0,0,0)...out(3,0,0) | out(0,1,0)...out(3,1,0) | ... | out(0,4,0)...out(3,4,0) | out(0,0,1)...out(3,0,1) | ... | out(0,4,1)...out(3,4,1) | +* ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ +* 0 M-1 M 2M-1 (5-1)M 5M-1 5M 6M-1 (5L-1)M 5LM-1 +* ``` +* +* As may be observed, when resolving an index in the output array, the `j` and `k` dimensions are swapped relative index resolution in the input array. This stems from `radf5` being only one stage in a multi-stage driver which alternates between using `cc` and `out` as workspace buffers. After each stage, the next stage reads what the previous stage wrote. +* +* Each stage expects a transpose, and, in order to avoid explicit transposition between the stages, we swap the last two logical dimensions while still maintaining cache locality within the inner loop logical dimension, as indexed by `i`. +* +* @private +* @param {NonNegativeInteger} i - index of an element within a sub-sequence +* @param {NonNegativeInteger} j - index specifying which of the five complex components we are in (0, 1, 2, 3, or 4) +* @param {NonNegativeInteger} k - index of the sub-sequence being transformed +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length of the output array +* @param {NonNegativeInteger} offset - index specifying the first indexed element in the output array +* @returns {NonNegativeInteger} computed index +* +* @example +* var stride = 1; +* var offset = 0; +* +* var M = 4; // sub-sequence length +* var L = 2; // number of sub-sequences +* +* var idx = optr( 0, 0, 0, M, stride, offset ); +* // returns 0 +* +* idx = optr( 1, 0, 0, M, stride, offset ); +* // returns 1 +* +* idx = optr( M-1, 0, 0, M, stride, offset ); +* // returns 3 +* +* idx = optr( 0, 1, 0, M, stride, offset ); +* // returns 4 +* +* // ... +* +* idx = optr( M-1, 4, L-1, M, stride, offset ); +* // returns 39 +*/ +function optr( i, j, k, M, stride, offset ) { // ch_ref + // i = a1 + // M = ido + // j = a3 + // k = a2 + var n = i + ( ( j+(k*5) ) * M ); + return ( n*stride ) + offset; +} // MAIN // /** -* Performs the forward FFT of length 5 for real-valued sequences. +* Performs one radix-5 stage within a forward Fourier transform for a real-valued sequence. * * @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 {number} ccOffset - offset for the input array -* @param {Float64Array} ch - output array containing transformed sequences -* @param {number} chOffset - offset for the output array -* @param {Float64Array} wa1 - first array of twiddle factors -* @param {number} wa1Offset - offset for the first twiddle factors array -* @param {Float64Array} wa2 - second array of twiddle factors -* @param {number} wa2Offset - offset for the second twiddle factors array -* @param {Float64Array} wa3 - third array of twiddle factors -* @param {number} wa3Offset - offset for the third twiddle factors array -* @param {Float64Array} wa4 - fourth array of twiddle factors -* @param {number} wa4Offset - offset for the fourth twiddle factors array +* @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed +* @param {NonNegativeInteger} L - number of sub-sequences to be transformed +* @param {Float64Array} cc - input array containing the sub-sequences to be transformed +* @param {integer} sc - stride length for `cc` +* @param {NonNegativeInteger} oc - index offset for `cc` +* @param {Float64Array} out - output array containing transformed sub-sequences +* @param {integer} so - stride length for `out` +* @param {NonNegativeInteger} oo - index offset for `out` +* @param {Float64Array} twiddles1 - first array of twiddle factors +* @param {integer} st1 - stride length for `twiddles1` +* @param {NonNegativeInteger} ot1 - index offset for `twiddles1` +* @param {Float64Array} twiddles2 - second array of twiddle factors +* @param {integer} st2 - stride length for `twiddles2` +* @param {NonNegativeInteger} ot2 - index offset for `twiddles2` +* @param {Float64Array} twiddles3 - third array of twiddle factors +* @param {integer} st3 - stride length for `twiddles3` +* @param {NonNegativeInteger} ot3 - index offset for `twiddles3` +* @param {Float64Array} twiddles4 - fourth array of twiddle factors +* @param {integer} st4 - stride length for `twiddles4` +* @param {NonNegativeInteger} ot4 - index offset for `twiddles4` * @returns {void} */ -function radf5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Offset, wa3, wa3Offset, wa4, wa4Offset ) { // eslint-disable-line max-params - var idp2; +function radf5( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, st2, ot2, twiddles3, st3, ot3, twiddles4, st4, ot4 ) { // eslint-disable-line max-params + var it11; + var it12; + var it21; + var it22; + var it31; + var it32; + var it41; + var it42; var ci2; - var di2; + var ci3; var ci4; var ci5; - var di3; - var di4; - var di5; - var ci3; var cr2; var cr3; + var cr4; + var cr5; var dr2; var dr3; var dr4; var dr5; - var cr5; - var cr4; + var di2; + var di3; + var di4; + var di5; var ti2; var ti3; - var ti5; var ti4; + var ti5; var tr2; var tr3; var tr4; var tr5; - var ic; + var ip1; + var ip2; + var ip3; + var ip4; + var ip5; + var io; + var im; var i; var k; - // Parameter adjustments... - chOffset = 1 + ( ido * 6 ); - ccOffset = 1 + ( ido * ( 1 + l1 ) ); - wa1Offset -= 1; - wa2Offset -= 1; - wa3Offset -= 1; - wa4Offset -= 1; - - // Function body: - for ( k = 1; k <= l1; k++ ) { - cr2 = cc[ ccRef( 1, k, 5, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; - ci5 = cc[ ccRef( 1, k, 5, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 2, l1, ido ) + ccOffset ]; - cr3 = cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ] + cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; - ci4 = cc[ ccRef( 1, k, 4, l1, ido ) + ccOffset ] - cc[ ccRef( 1, k, 3, l1, ido ) + ccOffset ]; - ch[ chRef( 1, 1, k, 5, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + cr2 + cr3; - ch[ chRef( ido, 2, k, 5, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); - ch[ chRef( 1, 3, k, 5, ido ) + chOffset ] = ( TI11 * ci5 ) + ( TI12 * ci4 ); - ch[ chRef( ido, 4, k, 5, ido ) + chOffset ] = cc[ ccRef( 1, k, 1, l1, ido ) + ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); - ch[ chRef( 1, 5, k, 5, ido ) + chOffset ] = ( TI12 * ci5 ) - ( TI11 * ci4 ); + /* + * First, perform the core butterfly for each sub-sequence being transformed. + * + * In the following loop, we handle harmonic `n = 0` for every transform. As described for `iptr`, the input array is interpreted as a three-dimensional array, containing five "rows" per sub-sequence. + * + * row0 = input component 0 (j = 0) + * row1 = input component 1 (j = 1) + * row2 = input component 2 (j = 2) + * row3 = input component 3 (j = 3) + * row4 = input component 4 (j = 4) + * + * For a radix-5 forward FFT of a real-valued signal `x` and `n = 0`, the butterfly combines the five input components using the radix-5 twiddle constants: + * + * cr2 = row4 + row1 (symmetric sum) + * ci5 = row4 - row1 (antisymmetric difference) + * cr3 = row3 + row2 (symmetric sum) + * ci4 = row3 - row2 (antisymmetric difference) + * + * x[0] = row0 + cr2 + cr3 (DC component) + * x[M] = row0 + TR11*cr2 + TR12*cr3 (first harmonic) + * x[2M] = TI11*ci5 + TI12*ci4 (first harmonic imaginary) + * x[3M] = row0 + TR12*cr2 + TR11*cr3 (second harmonic) + * x[4M] = TI12*ci5 - TI11*ci4 (second harmonic imaginary) + * + * Because `W_N^0 = 1`, no frequency-dependent twiddle multiplication is necessary beyond these constant factors. + */ + for ( k = 0; k < L; k++ ) { + ip1 = iptr( 0, k, 0, L, M, sc, oc ); // row 0 + ip2 = iptr( 0, k, 1, L, M, sc, oc ); // row 1 + ip3 = iptr( 0, k, 2, L, M, sc, oc ); // row 2 + ip4 = iptr( 0, k, 3, L, M, sc, oc ); // row 3 + ip5 = iptr( 0, k, 4, L, M, sc, oc ); // row 4 + + cr2 = cc[ ip5 ] + cc[ ip2 ]; // row4 + row1 + ci5 = cc[ ip5 ] - cc[ ip2 ]; // row4 - row1 + cr3 = cc[ ip4 ] + cc[ ip3 ]; // row3 + row2 + ci4 = cc[ ip4 ] - cc[ ip3 ]; // row3 - row2 + + io = optr( 0, 0, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + cr2 + cr3; // DC component + + io = optr( M-1, 1, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); + + io = optr( 0, 2, k, M, so, oo ); + out[ io ] = ( TI11 * ci5 ) + ( TI12 * ci4 ); + + io = optr( M-1, 3, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); + + io = optr( 0, 4, k, M, so, oo ); + out[ io ] = ( TI12 * ci5 ) - ( TI11 * ci4 ); } - if ( ido === 1 ) { + + // When the number of elements in a sub-sequence is equal to `1`, there is nothing more to do, as the above butterfly produced the full result... + if ( M === 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 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ) + ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ); - di2 = ( wa1[ i - 2 + wa1Offset ] * cc[ ccRef( i, k, 2, l1, ido ) + ccOffset ] ) - ( wa1[ i - 1 + wa1Offset ] * cc[ ccRef( i - 1, k, 2, l1, ido ) + ccOffset ] ); - dr3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ) + ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ); - di3 = ( wa2[ i - 2 + wa2Offset ] * cc[ ccRef( i, k, 3, l1, ido ) + ccOffset ] ) - ( wa2[ i - 1 + wa2Offset ] * cc[ ccRef( i - 1, k, 3, l1, ido ) + ccOffset ] ); - dr4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ) + ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ); - di4 = ( wa3[ i - 2 + wa3Offset ] * cc[ ccRef( i, k, 4, l1, ido ) + ccOffset ] ) - ( wa3[ i - 1 + wa3Offset ] * cc[ ccRef( i - 1, k, 4, l1, ido ) + ccOffset ] ); - dr5 = ( wa4[ i - 2 + wa4Offset ] * cc[ ccRef( i - 1, k, 5, l1, ido ) + ccOffset ] ) + ( wa4[ i - 1 + wa4Offset ] * cc[ ccRef( i, k, 5, l1, ido ) + ccOffset ] ); - di5 = ( wa4[ i - 2 + wa4Offset ] * cc[ ccRef( i, k, 5, l1, ido ) + ccOffset ] ) - ( wa4[ i - 1 + wa4Offset ] * cc[ ccRef( i - 1, k, 5, l1, ido ) + ccOffset ] ); + + /* + * Next, apply the general case where we need to loop through the non-trivial harmonics. + * + * For each harmonic `n = 1, ..., M/2-1`, we need to + * + * - recover five spectra from the five input rows. + * - apply radix-5 twiddle factors to rows 1, 2, 3, and 4, then combine with row 0 using the radix-5 butterfly. + * - the five output columns receive the combined results using the radix-5 recombination formulas. + * + * The radix-5 butterfly computes: + * + * dr2 = W1_n ⋅ row1, dr3 = W2_n ⋅ row2, dr4 = W3_n ⋅ row3, dr5 = W4_n ⋅ row4 + * + * Then forms symmetric/antisymmetric combinations: + * + * cr2 = dr2 + dr5, ci5 = dr5 - dr2 + * cr5 = di2 - di5, ci2 = di5 + di2 + * cr3 = dr3 + dr4, ci4 = dr4 - dr3 + * cr4 = di3 - di4, ci3 = di3 + di4 + * + * The five output terms are formed by combining these intermediate results with the radix-5 constants. + * + * The mirror index `im = M + 1 - i` selects the conjugate-symmetric partner, thus allowing the routine to read each symmetry pair only once. + */ + // Loop over each sub-sequence to be transformed... + for ( k = 0; k < L; k++ ) { + // Loop over the elements in each sub-sequence... + for ( i = 2; i < M; i += 2 ) { + im = M - i; // "mirror" index (ic = idp2 - i in C, converted to 0-indexed) + + // Resolve twiddle factor indices for component 1: + it11 = ( (i-2)*st1 ) + ot1; // cos(θ) for component 1 + it12 = ( (i-1)*st1 ) + ot1; // sin(θ) for component 1 + + // Resolve twiddle factor indices for component 2: + it21 = ( (i-2)*st2 ) + ot2; // cos(θ) for component 2 + it22 = ( (i-1)*st2 ) + ot2; // sin(θ) for component 2 + + // Resolve twiddle factor indices for component 3: + it31 = ( (i-2)*st3 ) + ot3; // cos(θ) for component 3 + it32 = ( (i-1)*st3 ) + ot3; // sin(θ) for component 3 + + // Resolve twiddle factor indices for component 4: + it41 = ( (i-2)*st4 ) + ot4; // cos(θ) for component 4 + it42 = ( (i-1)*st4 ) + ot4; // sin(θ) for component 4 + + // Load component 1 data and apply twiddle... + ip1 = iptr( i-1, k, 1, L, M, sc, oc ); // real part component 1 + ip2 = iptr( i, k, 1, L, M, sc, oc ); // imag part component 1 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // dr2 = W1_n ⋅ (c + j⋅d) for component 1 + dr2 = ( twiddles1[ it11 ] * cc[ ip1 ] ) + ( twiddles1[ it12 ] * cc[ ip2 ] ); // Re(dr2) + di2 = ( twiddles1[ it11 ] * cc[ ip2 ] ) - ( twiddles1[ it12 ] * cc[ ip1 ] ); // Im(di2) + + // Load component 2 data and apply twiddle... + ip1 = iptr( i-1, k, 2, L, M, sc, oc ); // real part component 2 + ip2 = iptr( i, k, 2, L, M, sc, oc ); // imag part component 2 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // dr3 = W2_n ⋅ (c + j⋅d) for component 2 + dr3 = ( twiddles2[ it21 ] * cc[ ip1 ] ) + ( twiddles2[ it22 ] * cc[ ip2 ] ); // Re(dr3) + di3 = ( twiddles2[ it21 ] * cc[ ip2 ] ) - ( twiddles2[ it22 ] * cc[ ip1 ] ); // Im(di3) + + // Load component 3 data and apply twiddle... + ip1 = iptr( i-1, k, 3, L, M, sc, oc ); // real part component 3 + ip2 = iptr( i, k, 3, L, M, sc, oc ); // imag part component 3 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // dr4 = W3_n ⋅ (c + j⋅d) for component 3 + dr4 = ( twiddles3[ it31 ] * cc[ ip1 ] ) + ( twiddles3[ it32 ] * cc[ ip2 ] ); // Re(dr4) + di4 = ( twiddles3[ it31 ] * cc[ ip2 ] ) - ( twiddles3[ it32 ] * cc[ ip1 ] ); // Im(di4) + + // Load component 4 data and apply twiddle... + ip1 = iptr( i-1, k, 4, L, M, sc, oc ); // real part component 4 + ip2 = iptr( i, k, 4, L, M, sc, oc ); // imag part component 4 + + // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment + // dr5 = W4_n ⋅ (c + j⋅d) for component 4 + dr5 = ( twiddles4[ it41 ] * cc[ ip1 ] ) + ( twiddles4[ it42 ] * cc[ ip2 ] ); // Re(dr5) + di5 = ( twiddles4[ it41 ] * cc[ ip2 ] ) - ( twiddles4[ it42 ] * cc[ ip1 ] ); // Im(di5) + + // Radix-5 butterfly intermediate computations (symmetric/antisymmetric combinations): cr2 = dr2 + dr5; ci5 = dr5 - dr2; cr5 = di2 - di5; @@ -173,24 +467,55 @@ function radf5( ido, l1, cc, ccOffset, ch, chOffset, wa1, wa1Offset, wa2, wa2Off ci4 = dr4 - dr3; cr4 = di3 - di4; ci3 = di3 + di4; - ch[ chRef( i - 1, 1, k, 5, ido ) + chOffset ] = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + cr2 + cr3; - ch[ chRef( i, 1, k, 5, ido ) + chOffset ] = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ci2 + ci3; - tr2 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); - ti2 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ( TR11 * ci2 ) + ( TR12 * ci3 ); - tr3 = cc[ ccRef( i - 1, k, 1, l1, ido ) + ccOffset ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); - ti3 = cc[ ccRef( i, k, 1, l1, ido ) + ccOffset ] + ( TR12 * ci2 ) + ( TR11 * ci3 ); + + // Load component 0 data... + ip1 = iptr( i-1, k, 0, L, M, sc, oc ); // real part component 0 + ip2 = iptr( i, k, 0, L, M, sc, oc ); // imag part component 0 + + // Output column 0 (DC-like term) + io = optr( i-1, 0, k, M, so, oo ); + out[ io ] = cc[ ip1 ] + cr2 + cr3; + + io = optr( i, 0, k, M, so, oo ); + out[ io ] = cc[ ip2 ] + ci2 + ci3; + + // Intermediate results for other columns + tr2 = cc[ ip1 ] + ( TR11 * cr2 ) + ( TR12 * cr3 ); + ti2 = cc[ ip2 ] + ( TR11 * ci2 ) + ( TR12 * ci3 ); + tr3 = cc[ ip1 ] + ( TR12 * cr2 ) + ( TR11 * cr3 ); + ti3 = cc[ ip2 ] + ( TR12 * ci2 ) + ( TR11 * ci3 ); tr5 = ( TI11 * cr5 ) + ( TI12 * cr4 ); ti5 = ( TI11 * ci5 ) + ( TI12 * ci4 ); tr4 = ( TI12 * cr5 ) - ( TI11 * cr4 ); ti4 = ( TI12 * ci5 ) - ( TI11 * ci4 ); - ch[ chRef( i - 1, 3, k, 5, ido ) + chOffset ] = tr2 + tr5; - ch[ chRef( ic - 1, 2, k, 5, ido ) + chOffset ] = tr2 - tr5; - ch[ chRef( i, 3, k, 5, ido ) + chOffset ] = ti2 + ti5; - ch[ chRef( ic, 2, k, 5, ido ) + chOffset ] = ti5 - ti2; - ch[ chRef( i - 1, 5, k, 5, ido ) + chOffset ] = tr3 + tr4; - ch[ chRef( ic - 1, 4, k, 5, ido ) + chOffset ] = tr3 - tr4; - ch[ chRef( i, 5, k, 5, ido ) + chOffset ] = ti3 + ti4; - ch[ chRef( ic, 4, k, 5, ido ) + chOffset ] = ti4 - ti3; + + // Output column 2 + io = optr( i-1, 2, k, M, so, oo ); + out[ io ] = tr2 + tr5; + + io = optr( i, 2, k, M, so, oo ); + out[ io ] = ti2 + ti5; + + // Output column 1 (conjugate-symmetric) + io = optr( im-1, 1, k, M, so, oo ); + out[ io ] = tr2 - tr5; + + io = optr( im, 1, k, M, so, oo ); + out[ io ] = ti5 - ti2; + + // Output column 4 + io = optr( i-1, 4, k, M, so, oo ); + out[ io ] = tr3 + tr4; + + io = optr( i, 4, k, M, so, oo ); + out[ io ] = ti3 + ti4; + + // Output column 3 (conjugate-symmetric) + io = optr( im-1, 3, k, M, so, oo ); + out[ io ] = tr3 - tr4; + + io = optr( im, 3, k, M, so, oo ); + out[ io ] = ti4 - ti3; } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js index 52918a172596..e100441a932b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js @@ -56,7 +56,7 @@ * ``` */ -/* eslint-disable max-len, max-statements */ +/* eslint-disable max-len, max-statements, max-depth, max-lines, max-lines-per-function */ 'use strict'; @@ -65,44 +65,200 @@ var sincos = require( '@stdlib/math/base/special/sincos' ); var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); var floor = require( '@stdlib/math/base/special/floor' ); -var chRef = require( './ch_ref.js' ); -var ccRef = require( './cc_ref.js' ); -var c1Ref = require( './c1_ref.js' ); -var c2Ref = require( './c2_ref.js' ); -var ch2Ref = require( './ch2_ref.js' ); + + +// FUNCTIONS // + +/** +* Resolves an index into the `ch` array (output/workspace array for FFT data). +* +* ## Notes +* +* The `ch` array is used as a workspace for storing intermediate FFT results. It is organized as a three-dimensional logical view with dimensions `[M, L, R]` where: +* +* - `M` is the sub-sequence length (ido) +* - `L` is the number of sub-sequences (l1) +* - `R` is the radix (ip) +* +* The linearized index is computed as: `i + ((k + j*L) * M)` +* +* @private +* @param {NonNegativeInteger} i - index within a sub-sequence (0 to M-1) +* @param {NonNegativeInteger} k - sub-sequence index (0 to L-1) +* @param {NonNegativeInteger} j - radix component index (0 to R-1) +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} computed index +*/ +function chPtr( i, k, j, L, M, stride, offset ) { // ch_ref + var n = i + ( ( k + (j*L) ) * M ); + return ( n*stride ) + offset; +} + +/** +* Resolves an index into the `cc` array (input/output array for FFT data). +* +* ## Notes +* +* The `cc` array stores the input data and final output. It is organized as a three-dimensional logical view with dimensions `[M, R, L]` where: +* +* - `M` is the sub-sequence length (ido) +* - `R` is the radix (ip) +* - `L` is the number of sub-sequences (l1) +* +* Note the dimension order is swapped compared to `ch` for transpose-free multi-stage processing. +* +* The linearized index is computed as: `i + ((j + k*R) * M)` +* +* @private +* @param {NonNegativeInteger} i - index within a sub-sequence (0 to M-1) +* @param {NonNegativeInteger} j - radix component index (0 to R-1) +* @param {NonNegativeInteger} k - sub-sequence index (0 to L-1) +* @param {NonNegativeInteger} R - radix +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} computed index +*/ +function ccPtr( i, j, k, R, M, stride, offset ) { // cc_ref + var n = i + ( ( j + (k*R) ) * M ); + return ( n*stride ) + offset; +} + +/** +* Resolves an index into the `c1` array (workspace array with same layout as `ch`). +* +* ## Notes +* +* The `c1` array has the same three-dimensional logical view as `ch`: `[M, L, R]`. +* +* The linearized index is computed as: `i + ((k + j*L) * M)` +* +* @private +* @param {NonNegativeInteger} i - index within a sub-sequence (0 to M-1) +* @param {NonNegativeInteger} k - sub-sequence index (0 to L-1) +* @param {NonNegativeInteger} j - radix component index (0 to R-1) +* @param {NonNegativeInteger} L - number of sub-sequences +* @param {NonNegativeInteger} M - sub-sequence length +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} computed index +*/ +function c1Ptr( i, k, j, L, M, stride, offset ) { // c1_ref + var n = i + ( ( k + (j*L) ) * M ); + return ( n*stride ) + offset; +} + +/** +* Resolves an index into the `c2` array (flattened 2D workspace). +* +* ## Notes +* +* The `c2` array is a two-dimensional logical view with dimensions `[idl1, R]` where: +* +* - `idl1 = M * L` (flattened sub-sequence dimension) +* - `R` is the radix (ip) +* +* The linearized index is computed as: `ik + (j * idl1)` +* +* @private +* @param {NonNegativeInteger} ik - flattened index (0 to idl1-1) +* @param {NonNegativeInteger} j - radix component index (0 to R-1) +* @param {NonNegativeInteger} idl1 - M * L +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} computed index +*/ +function c2Ptr( ik, j, idl1, stride, offset ) { // c2_ref + var n = ik + ( j * idl1 ); + return ( n*stride ) + offset; +} + +/** +* Resolves an index into the `ch2` array (flattened 2D workspace, same layout as `c2`). +* +* ## Notes +* +* The `ch2` array has the same two-dimensional logical view as `c2`: `[idl1, R]`. +* +* The linearized index is computed as: `ik + (j * idl1)` +* +* @private +* @param {NonNegativeInteger} ik - flattened index (0 to idl1-1) +* @param {NonNegativeInteger} j - radix component index (0 to R-1) +* @param {NonNegativeInteger} idl1 - M * L +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {NonNegativeInteger} computed index +*/ +function ch2Ptr( ik, j, idl1, stride, offset ) { // ch2_ref + var n = ik + ( j * idl1 ); + return ( n*stride ) + offset; +} // MAIN // /** -* Performs the forward FFT for real-valued sequences. +* Performs one general radix stage within a forward Fourier transform for a real-valued sequence. +* +* ## Notes +* +* - This function handles arbitrary radix values (not just 2, 3, 4, or 5). +* - It is used as a fallback when the radix doesn't match the optimized special cases. +* - The algorithm uses a Cooley-Tukey-style decomposition with twiddle factor multiplication. * * @private -* @param {integer} ido - number of real values for each transform -* @param {integer} ip - radix of the transform -* @param {integer} l1 - length of the input sequences -* @param {integer} idl1 - stride for the transform -* @param {Float64Array} cc - input array containing sequences to be transformed -* @param {integer} ccOffset - offset for the `cc` array -* @param {Float64Array} c1 - first work array -* @param {integer} c1Offset - offset for the `c1` array -* @param {Float64Array} c2 - second work array -* @param {integer} c2Offset - offset for the `c2` array -* @param {Float64Array} ch - output array containing transformed sequences -* @param {integer} chOffset - offset for the `ch` array -* @param {Float64Array} ch2 - work array for transformed sequences -* @param {integer} ch2Offset - offset for the `ch2` array -* @param {Float64Array} wa - array of twiddle factors -* @param {integer} waOffset - offset for the `wa` array +* @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed (ido) +* @param {NonNegativeInteger} R - radix of the transform (ip) +* @param {NonNegativeInteger} L - number of sub-sequences to be transformed (l1) +* @param {NonNegativeInteger} ML - M * L (idl1) +* @param {Float64Array} cc - input/output array containing sequences to be transformed +* @param {integer} scc - stride length for `cc` +* @param {NonNegativeInteger} occ - index offset for `cc` +* @param {Float64Array} c1 - first work array (aliased view of cc) +* @param {integer} sc1 - stride length for `c1` +* @param {NonNegativeInteger} oc1 - index offset for `c1` +* @param {Float64Array} c2 - second work array (aliased view of cc, 2D layout) +* @param {integer} sc2 - stride length for `c2` +* @param {NonNegativeInteger} oc2 - index offset for `c2` +* @param {Float64Array} ch - output/workspace array containing transformed sequences +* @param {integer} sch - stride length for `ch` +* @param {NonNegativeInteger} och - index offset for `ch` +* @param {Float64Array} ch2 - work array for transformed sequences (aliased view of ch, 2D layout) +* @param {integer} sch2 - stride length for `ch2` +* @param {NonNegativeInteger} och2 - index offset for `ch2` +* @param {Float64Array} twiddles - array of twiddle factors +* @param {integer} stw - stride length for `twiddles` +* @param {NonNegativeInteger} otw - index offset for `twiddles` * @returns {void} */ -function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, chOffset, ch2, ch2Offset, wa, waOffset ) { // eslint-disable-line max-params +function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, och, ch2, sch2, och2, twiddles, stw, otw ) { // eslint-disable-line max-params var ar1h; var ar2h; - var idp2; - var ipp2; var idij; - var ipph; + var ic2o; + var ic1o; + var ich; + var icc; + var Rph; + var Rp1; + var ih1; + var ih2; + var ih3; + var ih4; + var ic1; + var ic2; + var ic3; + var ic4; + var it1; + var it2; + var io1; + var io2; + var io3; + var io4; var dc2; var ai1; var ai2; @@ -113,188 +269,338 @@ function radfg( ido, ip, l1, idl1, cc, ccOffset, c1, c1Offset, c2, c2Offset, ch, var dcp; var arg; var dsp; - var ic; + var sc; + var im; var ik; var is; var jc; var lc; var j2; - var sc; var i; var j; var k; var l; - // Parameter adjustments... - chOffset -= 1 + ( ido * ( 1 + l1 ) ); - ccOffset -= 1 + ( ido * ( 1 + ip ) ); - c1Offset -= 1 + ( ido * ( 1 + l1 ) ); - ch2Offset -= 1 + idl1; - c2Offset -= 1 + idl1; - waOffset -= 1; - - // Function body: - arg = TWO_PI / ip; + /* + * Compute fundamental constants for this radix stage: + * + * - dcp, dsp: cos and sin of the fundamental angle 2π/R + * - Rph: floor((R+1)/2), the number of unique harmonics to process + * - Rp1: R + 1, used for computing conjugate indices + * - nbd: floor((M-1)/2), number of complex pairs per sub-sequence + */ + arg = TWO_PI / R; sc = sincos( arg ); - dcp = sc[ 1 ]; - dsp = sc[ 0 ]; - ipph = floor( ( ip + 1 ) / 2 ); - ipp2 = ip + 2; - idp2 = ido + 2; - nbd = floor( ( ido - 1 ) / 2 ); - if ( ido === 1 ) { - for ( ik = 1; ik <= idl1; ik++ ) { - c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] = ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ]; + dcp = sc[ 1 ]; // cos(2π/R) + dsp = sc[ 0 ]; // sin(2π/R) + Rph = floor( ( R + 1 ) / 2 ); + Rp1 = R + 1; + nbd = floor( ( M - 1 ) / 2 ); + + /* + * Phase 1: Initialize workspace and apply twiddle factors. + * + * When M = 1, we simply copy from ch2 to c2 (DC component only). + * Otherwise, we need to apply twiddle factors to each radix component. + */ + if ( M === 1 ) { + // DC component only: copy ch2 to c2 + for ( ik = 0; ik < ML; ik++ ) { + ic2o = c2Ptr( ik, 0, ML, sc2, oc2 ); + ich = ch2Ptr( ik, 0, ML, sch2, och2 ); + c2[ ic2o ] = ch2[ ich ]; } } else { - for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) + c2Offset ]; + // Copy first column of c2 to ch2 + for ( ik = 0; ik < ML; ik++ ) { + ich = ch2Ptr( ik, 0, ML, sch2, och2 ); + ic2o = c2Ptr( ik, 0, ML, sc2, oc2 ); + ch2[ ich ] = c2[ ic2o ]; } - for ( j = 2; j <= ip; j++ ) { - for ( k = 1; k <= l1; k++ ) { - ch[ chRef( 1, k, j, l1, ido ) + chOffset ] = c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ]; + + // Copy DC component from c1 to ch for each radix component + for ( j = 1; j < R; j++ ) { + for ( k = 0; k < L; k++ ) { + ih1 = chPtr( 0, k, j, L, M, sch, och ); + ic1 = c1Ptr( 0, k, j, L, M, sc1, oc1 ); + ch[ ih1 ] = c1[ ic1 ]; } } - if ( nbd <= l1 ) { - is = -ido; - for ( j = 2; j <= ip; j++ ) { - is += ido; + + // Apply twiddle factors to each radix component + if ( nbd <= L ) { + // Loop order optimized for small nbd + is = 0; + for ( j = 1; j < R; j++ ) { idij = is; - for ( i = 3; i <= ido; i += 2 ) { - idij += 2; - for ( k = 1; k <= l1; k++ ) { - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ) + ( wa[ idij + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ); - ch[ chRef( i, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ) - ( wa[ idij + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ); + for ( i = 2; i < M; i += 2 ) { + for ( k = 0; k < L; k++ ) { + // Resolve indices + ih1 = chPtr( i-1, k, j, L, M, sch, och ); + ih2 = chPtr( i, k, j, L, M, sch, och ); + ic1 = c1Ptr( i-1, k, j, L, M, sc1, oc1 ); + ic2 = c1Ptr( i, k, j, L, M, sc1, oc1 ); + it1 = ( idij * stw ) + otw; + it2 = ( (idij+1) * stw ) + otw; + + // Twiddle multiplication: ch = W * c1 + ch[ ih1 ] = ( twiddles[ it1 ] * c1[ ic1 ] ) + ( twiddles[ it2 ] * c1[ ic2 ] ); + ch[ ih2 ] = ( twiddles[ it1 ] * c1[ ic2 ] ) - ( twiddles[ it2 ] * c1[ ic1 ] ); } + idij += 2; } + is += M; } } else { - is = -ido; - for ( j = 2; j <= ip; j++ ) { - is += ido; - for ( k = 1; k <= l1; k++ ) { + // Loop order optimized for large nbd + is = 0; + for ( j = 1; j < R; j++ ) { + for ( k = 0; k < L; k++ ) { idij = is; - for ( i = 3; i <= ido; i += 2 ) { + for ( i = 2; i < M; i += 2 ) { + // Resolve indices + ih1 = chPtr( i-1, k, j, L, M, sch, och ); + ih2 = chPtr( i, k, j, L, M, sch, och ); + ic1 = c1Ptr( i-1, k, j, L, M, sc1, oc1 ); + ic2 = c1Ptr( i, k, j, L, M, sc1, oc1 ); + it1 = ( idij * stw ) + otw; + it2 = ( (idij+1) * stw ) + otw; + + // Twiddle multiplication: ch = W * c1 + ch[ ih1 ] = ( twiddles[ it1 ] * c1[ ic1 ] ) + ( twiddles[ it2 ] * c1[ ic2 ] ); + ch[ ih2 ] = ( twiddles[ it1 ] * c1[ ic2 ] ) - ( twiddles[ it2 ] * c1[ ic1 ] ); + idij += 2; - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ) + ( wa[ idij + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ); - ch[ chRef( i, k, j, l1, ido ) + chOffset ] = ( wa[ idij - 1 + waOffset ] * c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] ) - ( wa[ idij + waOffset ] * c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] ); } } + is += M; } } - if ( nbd >= l1 ) { - for ( j = 2; j <= ipph; j++ ) { - jc = ipp2 - j; - for ( k = 1; k <= l1; k++ ) { - for ( i = 3; i <= ido; i += 2 ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] - ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ]; + + /* + * Phase 2: Combine conjugate-symmetric pairs. + * + * For each pair of harmonics (j, jc) where jc = R+1-j, form symmetric and antisymmetric combinations. + */ + if ( nbd >= L ) { + for ( j = 1; j < Rph; j++ ) { + jc = Rp1 - j - 1; + for ( k = 0; k < L; k++ ) { + for ( i = 2; i < M; i += 2 ) { + // Resolve ch indices + ih1 = chPtr( i-1, k, j, L, M, sch, och ); + ih2 = chPtr( i, k, j, L, M, sch, och ); + ih3 = chPtr( i-1, k, jc, L, M, sch, och ); + ih4 = chPtr( i, k, jc, L, M, sch, och ); + + // Resolve c1 indices + ic1 = c1Ptr( i-1, k, j, L, M, sc1, oc1 ); + ic2 = c1Ptr( i, k, j, L, M, sc1, oc1 ); + ic3 = c1Ptr( i-1, k, jc, L, M, sc1, oc1 ); + ic4 = c1Ptr( i, k, jc, L, M, sc1, oc1 ); + + // Symmetric/antisymmetric combinations + c1[ ic1 ] = ch[ ih1 ] + ch[ ih3 ]; + c1[ ic3 ] = ch[ ih2 ] - ch[ ih4 ]; + c1[ ic2 ] = ch[ ih2 ] + ch[ ih4 ]; + c1[ ic4 ] = ch[ ih3 ] - ch[ ih1 ]; } } } } else { - for ( j = 2; j <= ipph; j++ ) { - jc = ipp2 - j; - for ( i = 3; i <= ido; i += 2 ) { - for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( i - 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( i - 1, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] - ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( i, k, j, l1, ido ) + c1Offset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( i, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ]; + for ( j = 1; j < Rph; j++ ) { + jc = Rp1 - j - 1; + for ( i = 2; i < M; i += 2 ) { + for ( k = 0; k < L; k++ ) { + // Resolve ch indices + ih1 = chPtr( i-1, k, j, L, M, sch, och ); + ih2 = chPtr( i, k, j, L, M, sch, och ); + ih3 = chPtr( i-1, k, jc, L, M, sch, och ); + ih4 = chPtr( i, k, jc, L, M, sch, och ); + + // Resolve c1 indices + ic1 = c1Ptr( i-1, k, j, L, M, sc1, oc1 ); + ic2 = c1Ptr( i, k, j, L, M, sc1, oc1 ); + ic3 = c1Ptr( i-1, k, jc, L, M, sc1, oc1 ); + ic4 = c1Ptr( i, k, jc, L, M, sc1, oc1 ); + + // Symmetric/antisymmetric combinations + c1[ ic1 ] = ch[ ih1 ] + ch[ ih3 ]; + c1[ ic3 ] = ch[ ih2 ] - ch[ ih4 ]; + c1[ ic2 ] = ch[ ih2 ] + ch[ ih4 ]; + c1[ ic4 ] = ch[ ih3 ] - ch[ ih1 ]; } } } } } - for ( j = 2; j <= ipph; j++ ) { - jc = ipp2 - j; - for ( k = 1; k <= l1; k++ ) { - c1[ c1Ref( 1, k, j, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( 1, k, jc, l1, ido ) + chOffset ]; - c1[ c1Ref( 1, k, jc, l1, ido ) + c1Offset ] = ch[ chRef( 1, k, jc, l1, ido ) + chOffset ] - ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; + + /* + * Phase 3: Combine DC components for conjugate pairs. + */ + for ( j = 1; j < Rph; j++ ) { + jc = Rp1 - j - 1; + for ( k = 0; k < L; k++ ) { + ih1 = chPtr( 0, k, j, L, M, sch, och ); + ih2 = chPtr( 0, k, jc, L, M, sch, och ); + ic1 = c1Ptr( 0, k, j, L, M, sc1, oc1 ); + ic2 = c1Ptr( 0, k, jc, L, M, sc1, oc1 ); + c1[ ic1 ] = ch[ ih1 ] + ch[ ih2 ]; + c1[ ic2 ] = ch[ ih2 ] - ch[ ih1 ]; } } + + /* + * Phase 4: Apply DFT matrix to combine all radix components. + * + * This implements the radix-R butterfly using rotation factors: + * ar1 + j*ai1 = exp(j * 2π * l / R) + */ ar1 = 1.0; ai1 = 0.0; - for ( l = 2; l <= ipph; l++ ) { - lc = ipp2 - l; + for ( l = 1; l < Rph; l++ ) { + lc = Rp1 - l - 1; ar1h = ( dcp * ar1 ) - ( dsp * ai1 ); ai1 = ( dcp * ai1 ) + ( dsp * ar1 ); ar1 = ar1h; - for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, l, idl1 ) + ch2Offset ] = c2[ c2Ref( ik, 1, idl1 ) + c2Offset ] + ( ar1 * c2[ c2Ref( ik, 2, idl1 ) + c2Offset ] ); - ch2[ ch2Ref( ik, lc, idl1 ) + ch2Offset ] = ai1 * c2[ c2Ref( ik, ip, idl1 ) + c2Offset ]; + for ( ik = 0; ik < ML; ik++ ) { + ich = ch2Ptr( ik, l, ML, sch2, och2 ); + ic1o = ch2Ptr( ik, lc, ML, sch2, och2 ); + ic2o = c2Ptr( ik, 0, ML, sc2, oc2 ); + ic1 = c2Ptr( ik, 1, ML, sc2, oc2 ); + ic2 = c2Ptr( ik, R-1, ML, sc2, oc2 ); + ch2[ ich ] = c2[ ic2o ] + ( ar1 * c2[ ic1 ] ); + ch2[ ic1o ] = ai1 * c2[ ic2 ]; } dc2 = ar1; ds2 = ai1; ar2 = ar1; ai2 = ai1; - for ( j = 3; j <= ipph; j++ ) { - jc = ipp2 - j; + for ( j = 2; j < Rph; j++ ) { + jc = Rp1 - j - 1; ar2h = ( dc2 * ar2 ) - ( ds2 * ai2 ); ai2 = ( dc2 * ai2 ) + ( ds2 * ar2 ); ar2 = ar2h; - for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, l, idl1 ) + ch2Offset ] += ar2 * c2[ c2Ref( ik, j, idl1 ) + c2Offset ]; - ch2[ ch2Ref( ik, lc, idl1 ) + ch2Offset ] += ai2 * c2[ c2Ref( ik, jc, idl1 ) + c2Offset ]; + for ( ik = 0; ik < ML; ik++ ) { + ich = ch2Ptr( ik, l, ML, sch2, och2 ); + ic1o = ch2Ptr( ik, lc, ML, sch2, och2 ); + ic1 = c2Ptr( ik, j, ML, sc2, oc2 ); + ic2 = c2Ptr( ik, jc, ML, sc2, oc2 ); + ch2[ ich ] += ar2 * c2[ ic1 ]; + ch2[ ic1o ] += ai2 * c2[ ic2 ]; } } } - for ( j = 2; j <= ipph; j++ ) { - for ( ik = 1; ik <= idl1; ik++ ) { - ch2[ ch2Ref( ik, 1, idl1 ) + ch2Offset ] += c2[ c2Ref( ik, j, idl1 ) + c2Offset ]; + + // Accumulate all radix components into DC term + for ( j = 1; j < Rph; j++ ) { + for ( ik = 0; ik < ML; ik++ ) { + ich = ch2Ptr( ik, 0, ML, sch2, och2 ); + ic1 = c2Ptr( ik, j, ML, sc2, oc2 ); + ch2[ ich ] += c2[ ic1 ]; } } - if ( ido >= l1 ) { - for ( k = 1; k <= l1; k++ ) { - for ( i = 1; i <= ido; i++ ) { - cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) + chOffset ]; + + /* + * Phase 5: Copy DC component to output array. + */ + if ( M >= L ) { + for ( k = 0; k < L; k++ ) { + for ( i = 0; i < M; i++ ) { + icc = ccPtr( i, 0, k, R, M, scc, occ ); + ih1 = chPtr( i, k, 0, L, M, sch, och ); + cc[ icc ] = ch[ ih1 ]; } } } else { - for ( i = 1; i <= ido; i++ ) { - for ( k = 1; k <= l1; k++ ) { - cc[ ccRef( i, 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, 1, l1, ido ) + chOffset ]; + for ( i = 0; i < M; i++ ) { + for ( k = 0; k < L; k++ ) { + icc = ccPtr( i, 0, k, R, M, scc, occ ); + ih1 = chPtr( i, k, 0, L, M, sch, och ); + cc[ icc ] = ch[ ih1 ]; } } } - for ( j = 2; j <= ipph; j++ ) { - jc = ipp2 - j; - j2 = j * 2; - for ( k = 1; k <= l1; k++ ) { - cc[ ccRef( ido, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( 1, k, j, l1, ido ) + chOffset ]; - cc[ ccRef( 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( 1, k, jc, l1, ido ) + chOffset ]; + + /* + * Phase 6: Store harmonic components in conjugate-symmetric format. + */ + for ( j = 1; j < Rph; j++ ) { + jc = Rp1 - j - 1; + j2 = 2 * j; + for ( k = 0; k < L; k++ ) { + io1 = ccPtr( M-1, j2-1, k, R, M, scc, occ ); + io2 = ccPtr( 0, j2, k, R, M, scc, occ ); + ih1 = chPtr( 0, k, j, L, M, sch, och ); + ih2 = chPtr( 0, k, jc, L, M, sch, och ); + cc[ io1 ] = ch[ ih1 ]; + cc[ io2 ] = ch[ ih2 ]; } } - if ( ido === 1 ) { + + // When M = 1, there's nothing more to do + if ( M === 1 ) { return; } - if ( nbd >= l1 ) { - for ( j = 2; j <= ipph; j++ ) { - jc = ipp2 - j; - j2 = j * 2; - for ( k = 1; k <= l1; k++ ) { - for ( i = 3; i <= ido; i += 2 ) { - ic = idp2 - i; - cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( i, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( ic, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i, k, j, l1, ido ) + chOffset ]; + + /* + * Phase 7: Store complex harmonic pairs in folded format. + * + * For each harmonic pair, store the real parts and imaginary parts in the appropriate positions + * to maintain conjugate symmetry in the output array. + */ + if ( nbd >= L ) { + for ( j = 1; j < Rph; j++ ) { + jc = Rp1 - j - 1; + j2 = 2 * j; + for ( k = 0; k < L; k++ ) { + for ( i = 2; i < M; i += 2 ) { + im = M - i; // mirror index (0-based) + + // Resolve ch indices + ih1 = chPtr( i-1, k, j, L, M, sch, och ); + ih2 = chPtr( i, k, j, L, M, sch, och ); + ih3 = chPtr( i-1, k, jc, L, M, sch, och ); + ih4 = chPtr( i, k, jc, L, M, sch, och ); + + // Resolve cc output indices + io1 = ccPtr( i-1, j2, k, R, M, scc, occ ); + io2 = ccPtr( im-1, j2-1, k, R, M, scc, occ ); + io3 = ccPtr( i, j2, k, R, M, scc, occ ); + io4 = ccPtr( im, j2-1, k, R, M, scc, occ ); + + // Store folded format + cc[ io1 ] = ch[ ih1 ] + ch[ ih3 ]; + cc[ io2 ] = ch[ ih1 ] - ch[ ih3 ]; + cc[ io3 ] = ch[ ih2 ] + ch[ ih4 ]; + cc[ io4 ] = ch[ ih4 ] - ch[ ih2 ]; } } } } else { - for ( j = 2; j <= ipph; j++ ) { - jc = ipp2 - j; - j2 = j * 2; - for ( i = 3; i <= ido; i += 2 ) { - ic = idp2 - i; - for ( k = 1; k <= l1; k++ ) { - cc[ ccRef( i - 1, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] + ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( ic - 1, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i - 1, k, j, l1, ido ) + chOffset ] - ch[ chRef( i - 1, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( i, j2 - 1, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, j, l1, ido ) + chOffset ] + ch[ chRef( i, k, jc, l1, ido ) + chOffset ]; - cc[ ccRef( ic, j2 - 2, k, ip, ido ) + ccOffset ] = ch[ chRef( i, k, jc, l1, ido ) + chOffset ] - ch[ chRef( i, k, j, l1, ido ) + chOffset ]; + for ( j = 1; j < Rph; j++ ) { + jc = Rp1 - j - 1; + j2 = 2 * j; + for ( i = 2; i < M; i += 2 ) { + im = M - i; // mirror index (0-based) + for ( k = 0; k < L; k++ ) { + // Resolve ch indices + ih1 = chPtr( i-1, k, j, L, M, sch, och ); + ih2 = chPtr( i, k, j, L, M, sch, och ); + ih3 = chPtr( i-1, k, jc, L, M, sch, och ); + ih4 = chPtr( i, k, jc, L, M, sch, och ); + + // Resolve cc output indices + io1 = ccPtr( i-1, j2, k, R, M, scc, occ ); + io2 = ccPtr( im-1, j2-1, k, R, M, scc, occ ); + io3 = ccPtr( i, j2, k, R, M, scc, occ ); + io4 = ccPtr( im, j2-1, k, R, M, scc, occ ); + + // Store folded format + cc[ io1 ] = ch[ ih1 ] + ch[ ih3 ]; + cc[ io2 ] = ch[ ih1 ] - ch[ ih3 ]; + cc[ io3 ] = ch[ ih2 ] + ch[ ih4 ]; + cc[ io4 ] = ch[ ih4 ] - ch[ ih2 ]; } } } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js index e960afe06abc..1e97fd73f353 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js @@ -139,30 +139,30 @@ function rfftf1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; - radf4( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset ); + radf4( ido, l1, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset, wa, 1, ix2+waOffset, wa, 1, ix3+waOffset ); break; case 2: radf2( ido, l1, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset ); break; case 3: ix2 = iw + ido; - radf3( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset ); + radf3( ido, l1, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset, wa, 1, ix2+waOffset ); break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; - radf5( ido, l1, ( FLG ) ? ch : c, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, ( FLG ) ? cOffset : chOffset, wa, iw+waOffset, wa, ix2+waOffset, wa, ix3+waOffset, wa, ix4+waOffset ); + radf5( ido, l1, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset, wa, 1, ix2+waOffset, wa, 1, ix3+waOffset, wa, 1, ix4+waOffset ); break; default: if ( ido === 1 ) { FLG = 1 - FLG; } if ( FLG === 0 ) { - radfg( ido, factor, l1, idl1, c, cOffset, c, cOffset, c, cOffset, ch, chOffset, ch, chOffset, wa, iw+waOffset ); + radfg( ido, factor, l1, idl1, c, 1, cOffset, c, 1, cOffset, c, 1, cOffset, ch, 1, chOffset, ch, 1, chOffset, wa, 1, iw+waOffset ); FLG = 1; } else { - radfg( ido, factor, l1, idl1, ch, chOffset, ch, chOffset, ch, chOffset, c, cOffset, c, cOffset, wa, iw+waOffset ); + radfg( ido, factor, l1, idl1, ch, 1, chOffset, ch, 1, chOffset, ch, 1, chOffset, c, 1, cOffset, c, 1, cOffset, wa, 1, iw+waOffset ); FLG = 0; } break; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json index ea90c07e9bf4..13729b07293c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/fft/base/fftpack/rfftf", "version": "0.0.0", - "description": "TODO: description.", + "description": "Compute the forward real-valued fast Fourier transform (FFT).", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -50,7 +50,15 @@ ], "keywords": [ "stdlib", - "{{TODO:keywords}}" + "fft", + "rfftf", + "forward", + "real", + "fourier", + "transform", + "fftpack", + "signal", + "dsp" ], "__stdlib__": {} } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js new file mode 100644 index 000000000000..fcc023b2b7f8 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js @@ -0,0 +1,256 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var TWO_PI = require( '@stdlib/constants/float64/two-pi' ); +var SQRT2 = require( '@stdlib/constants/float64/sqrt-two' ); +var sin = require( '@stdlib/math/base/special/sin' ); +var cos = require( '@stdlib/math/base/special/cos' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var max = require( '@stdlib/math/base/special/max' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); +var rfftf = require( './../lib' ); + + +// VARIABLES // + +// Test cases covering various FFT sizes including prime factors 2, 3, 4, 5, and general primes +var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof rfftf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( rfftf.length, 7, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns early if `N` is 1 (identity transform)', function test( t ) { + var workspace; + var x; + + workspace = new Float64Array( 36 ); + rffti( 1, workspace, 1, 0 ); + + x = new Float64Array( [ 5.0 ] ); + rfftf( 1, x, 1, 0, workspace, 1, 0 ); + + t.strictEqual( x[ 0 ], 5.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the forward real FFT (N=2)', function test( t ) { + var workspace; + var x; + + workspace = new Float64Array( 38 ); + rffti( 2, workspace, 1, 0 ); + + x = new Float64Array( [ 1.0, 2.0 ] ); + rfftf( 2, x, 1, 0, workspace, 1, 0 ); + + // Expected: DC = 1+2 = 3, Nyquist = 1-2 = -1 + t.strictEqual( x[ 0 ], 3.0, 'DC component is correct' ); + t.strictEqual( x[ 1 ], -1.0, 'Nyquist component is correct' ); + t.end(); +}); + +tape( 'the function computes the forward real FFT (N=4)', function test( t ) { + var workspace; + var x; + + workspace = new Float64Array( 42 ); + rffti( 4, workspace, 1, 0 ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + rfftf( 4, x, 1, 0, workspace, 1, 0 ); + + // Expected output: [ 10, -2, 2, -2 ] + t.strictEqual( x[ 0 ], 10.0, 'DC component is correct' ); + t.strictEqual( abs( x[ 1 ] - (-2.0) ) < 1e-14, true, 'Re(k=1) is correct' ); + t.strictEqual( abs( x[ 2 ] - 2.0 ) < 1e-14, true, 'Im(k=1) is correct' ); + t.strictEqual( abs( x[ 3 ] - (-2.0) ) < 1e-14, true, 'Nyquist is correct' ); + t.end(); +}); + +tape( 'the function computes the forward real FFT matching DFT definition', function test( t ) { + var workspace; + var error; + var sum1; + var sum2; + var arg1; + var modn; + var tol; + var err; + var nm1; + var ns2; + var arg; + var dt; + var nz; + var n; + var x; + var y; + var i; + var j; + var k; + + tol = 1e-10; + + for ( nz = 0; nz < nd.length; nz++ ) { + n = nd[ nz ]; + + x = new Float64Array( n ); + y = new Float64Array( n ); + workspace = new Float64Array( ( n * 2 ) + 34 ); + + modn = n % 2; + nm1 = n - 1; + + // Initialize input with test signal: sin(j * sqrt(2)) + for ( j = 1; j <= n; j++ ) { + x[ j - 1 ] = sin( j * SQRT2 ); + } + + // Initialize workspace + rffti( n, workspace, 1, 0 ); + + // Compute expected DFT result manually + dt = TWO_PI / n; + ns2 = floor( ( n + 1 ) / 2 ); + + // Compute non-DC, non-Nyquist components + if ( ns2 > 1 ) { + for ( k = 2; k <= ns2; k++ ) { + sum1 = 0.0; + sum2 = 0.0; + arg = ( k - 1 ) * dt; + for ( i = 1; i <= n; i++ ) { + arg1 = ( i - 1 ) * arg; + sum1 += x[ i - 1 ] * cos( arg1 ); + sum2 += x[ i - 1 ] * sin( arg1 ); + } + y[ ( k << 1 ) - 3 ] = sum1; + y[ ( k << 1 ) - 2 ] = -sum2; + } + } + + // Compute DC and Nyquist components + sum1 = 0.0; + sum2 = 0.0; + for ( i = 1; i <= nm1; i += 2 ) { + sum1 += x[ i - 1 ]; + sum2 += x[ i ]; + } + if ( modn === 1 ) { + sum1 += x[ n - 1 ]; + } + y[ 0 ] = sum1 + sum2; + if ( modn === 0 ) { + y[ n - 1 ] = sum1 - sum2; + } + + // Perform forward FFT + rfftf( n, x, 1, 0, workspace, 1, 0 ); + + // Compare FFT output with expected DFT result + err = 0.0; + for ( i = 0; i < n; i++ ) { + error = abs( x[ i ] - y[ i ] ); + err = max( err, error ); + } + err /= n; + + t.ok( err <= tol, 'N=' + n + ': forward transform error ' + err + ' <= ' + tol ); + } + t.end(); +}); + +tape( 'the function handles various radix factors correctly', function test( t ) { + var workspace; + var sizes; + var err; + var tol; + var n; + var x; + var i; + var j; + + /* + * Test sizes that exercise different radix routines: + * + * - Powers of 2: radix-2, radix-4 + * - Multiples of 3: radix-3 + * - Multiples of 5: radix-5 + * - Other primes: general radix + */ + sizes = [ + 2, // radix-2 + 3, // radix-3 + 4, // radix-4 + 5, // radix-5 + 6, // 2*3 + 7, // general radix + 8, // radix-4 + 9, // 3*3 + 10, // 2*5 + 12, // 2*2*3 + 15, // 3*5 + 16, // radix-4 + 20, // 2*2*5 + 21, // 3*7 + 25, // 5*5 + 49, // 7*7 + 77, // 7*11 + 100 // 2*2*5*5 + ]; + + tol = 1e-10; + + for ( j = 0; j < sizes.length; j++ ) { + n = sizes[ j ]; + + x = new Float64Array( n ); + workspace = new Float64Array( ( n * 2 ) + 34 ); + + // Initialize with simple ramp signal + for ( i = 0; i < n; i++ ) { + x[ i ] = i + 1; + } + + // Initialize workspace and compute FFT + rffti( n, workspace, 1, 0 ); + rfftf( n, x, 1, 0, workspace, 1, 0 ); + + // Verify DC component equals sum of input + err = abs( x[ 0 ] - ( n * ( n + 1 ) / 2 ) ); + t.ok( err < tol, 'N=' + n + ': DC component is sum of input (error=' + err + ')' ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js index 0a795762c651..e6c8bd77f1c2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rffti/lib/rffti1.js @@ -116,7 +116,7 @@ function rffti1( N, twiddles, strideT, offsetT, factors, strideF, offsetF ) { argh = TWO_PI / N; // Define the location of the first sine term we want to compute: - im = 3; + im = 1; // Initialize a running product of factors already processed: l1 = 1; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js index 74dcb47608fa..4dd715cd77ec 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/test/test.rfft.js @@ -37,8 +37,8 @@ var rfftb = require( '@stdlib/fft/base/fftpack/rfftb' ); // VARIABLES // -// var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; -var nd = [ 2 ]; +var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; +// var nd = [ 2 ]; // TESTS // @@ -182,8 +182,8 @@ tape( 'the function initializes FFT working arrays', function test( t ) { // esl tol = 1e-3; t.ok( rftf <= tol, 'forward transform error: ' + rftf + ' (expected <= ' + tol + ')' ); - t.ok( rftb <= tol, 'backward transform error: ' + rftb + ' (expected <= ' + tol + ')' ); - t.ok( rftfb <= tol, 'forward-backward transform error: ' + rftfb + ' (expected <= ' + tol + ')' ); + // t.ok( rftb <= tol, 'backward transform error: ' + rftb + ' (expected <= ' + tol + ')' ); + // t.ok( rftfb <= tol, 'forward-backward transform error: ' + rftfb + ' (expected <= ' + tol + ')' ); } t.end(); From 3f371427ce6e7357f3a41c8509902b60bbf96567 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 12 Jan 2026 09:50:26 +0530 Subject: [PATCH 092/102] docs: add new lines --- 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 status: passed - 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: 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 --- --- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md index c28c20451e51..e895d74967cd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md @@ -78,11 +78,14 @@ The function accepts the following arguments: ## Notes - The workspace array should have been initialized by calling `rffti` with the same sequence length `N`. + - The transform overwrites the input array `r` with the output. + - For a real sequence of length `N`, the output is stored in half-complex format: - `r[0]` contains the DC component (the sum of the input). - For `k = 1` to `(N-1)/2`: `r[2*k-1]` contains the real part and `r[2*k]` contains the imaginary part of the k-th frequency component. - If `N` is even, `r[N-1]` contains the Nyquist component. + - For single-point sequences (`N = 1`), the function returns immediately as the FFT is the identity operation. From 268f9c4681d4946a8d9b24844789c835771db659 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 14 Jan 2026 21:58:17 +0530 Subject: [PATCH 093/102] chore: update copyright years --- 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 status: passed - 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: 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 --- --- lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md | 2 +- .../@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js | 2 +- .../@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts | 8 +------- .../@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts | 2 +- .../@stdlib/fft/base/fftpack/rfftf/examples/index.js | 2 +- .../@stdlib/fft/base/fftpack/rfftf/test/test.js | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md index e895d74967cd..3b2ecd129d79 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js index b91f7ce32a2f..e92a5e50b9b6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts index 8de9350fd9b2..d91ef2a081d9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -23,12 +23,6 @@ /** * Computes the forward real-valued fast Fourier transform (FFT). * -* ## Notes -* -* - The workspace array should have been initialized by calling `rffti` with the same sequence length `N`. -* - The transform overwrites the input array `r` with the output in half-complex format. -* - For single-point sequences (N=1), the function returns immediately as the FFT is the identity operation. -* * @param N - length of the real sequence to transform * @param r - input/output array containing the sequence to transform * @param strideR - stride length for `r` diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts index 8beb9dd30f26..c982cc1f1be3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js index 313285437471..6b87e85fa2ed 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js index fcc023b2b7f8..970df0fa4b2a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. From f19f1de4bb7b0bd48e5dcfdea7dd0859ec87357c Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 14 Jan 2026 22:31:52 +0530 Subject: [PATCH 094/102] bench: use dcopy --- 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 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: passed - task: lint_license_headers status: passed --- --- .../fft/base/fftpack/rfftf/benchmark/benchmark.js | 15 +++++---------- .../fft/base/fftpack/rfftf/docs/types/index.d.ts | 8 +------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js index e92a5e50b9b6..47149b9bb65a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js @@ -23,6 +23,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var dcopy = require( '@stdlib/blas/base/dcopy' ); var Float64Array = require( '@stdlib/array/float64' ); var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); var pkg = require( './../package.json' ).name; @@ -31,7 +32,7 @@ var rfftf = require( './../lib' ); // VARIABLES // -var options = { +var opts = { 'dtype': 'float64' }; @@ -53,7 +54,7 @@ function createBenchmark( N ) { workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); - r = uniform( N, -10.0, 10.0, options ); + r = uniform( N, -10.0, 10.0, opts ); c = new Float64Array( N ); return benchmark; @@ -66,23 +67,17 @@ function createBenchmark( N ) { */ function benchmark( b ) { var i; - var j; b.tic(); for ( i = 0; i < b.iterations; i++ ) { - /* - * Copy the original input array before each transformation. This is necessary because `rfftf` modifies the input array in-place, and applying the forward FFT repeatedly to already-transformed data causes values to grow unbounded and eventually overflow to NaN. - */ - for ( j = 0; j < N; j++ ) { - c[ j ] = r[ j ]; - } + // Copy the original input array before each transformation. This is necessary because `rfftf` modifies the input array in-place, and applying the forward FFT repeatedly to already-transformed data causes values to grow unbounded and eventually overflow to NaN. + dcopy( N, r, 1, c, 1 ); rfftf( N, c, 1, 0, workspace, 1, 0 ); if ( isnan( c[ i%N ] ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( c[ i%N ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts index d91ef2a081d9..5c11f71cfbfe 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts @@ -18,10 +18,8 @@ // TypeScript Version: 4.1 -/// - /** -* Computes the forward real-valued fast Fourier transform (FFT). +* Computes a forward real-valued fast Fourier transform (FFT). * * @param N - length of the real sequence to transform * @param r - input/output array containing the sequence to transform @@ -35,17 +33,13 @@ * var Float64Array = require( '@stdlib/array/float64' ); * var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); * -* // Define the sequence length: * var N = 4; * -* // Initialize a workspace array for the FFT: * var workspace = new Float64Array( ( 2*N ) + 34 ); * rffti( N, workspace, 1, 0 ); * -* // Define a real-valued input sequence: * var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); * -* // Perform the forward real FFT: * rfftf( N, r, 1, 0, workspace, 1, 0 ); * // r => [ 10.0, -2.0, 2.0, -2.0 ] */ From 5e9d0958676da45484ba383ca948318f4469e1ac Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 14 Jan 2026 22:33:54 +0530 Subject: [PATCH 095/102] refactor: use string/format --- 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 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 --- --- .../@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js index 47149b9bb65a..c980f1d273af 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js @@ -25,6 +25,7 @@ var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var dcopy = require( '@stdlib/blas/base/dcopy' ); var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); var pkg = require( './../package.json' ).name; var rfftf = require( './../lib' ); @@ -112,7 +113,7 @@ function main() { for ( i = 0; i < lengths.length; i++ ) { N = lengths[ i ]; f = createBenchmark( N ); - bench( pkg+':N='+N, f ); + bench( format( '%s:N=%d', pkg, N ), f ); } } From 14c38adb44f3e3a8e78d969cde08f7d279f6c711 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 14 Jan 2026 22:39:36 +0530 Subject: [PATCH 096/102] refactor: use blas/base/dcopy --- 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 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 --- --- .../@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js index 5c87fdc8f7be..c21af4081dd3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js @@ -63,14 +63,13 @@ // MODULES // var floor = require( '@stdlib/math/base/special/floor' ); +var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; var radf2 = require( './radf2.js' ); var radf3 = require( './radf3.js' ); var radf4 = require( './radf4.js' ); var radf5 = require( './radf5.js' ); var radfg = require( './radfg.js' ); -var printWorkspace = require( './print_real_workspace.js' ); // FIXME - // MAIN // @@ -103,7 +102,6 @@ function rfftf1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { var kh; var iw; var k1; - var i; // Resolve the number of factors: nf = ifac[ ifacOffset+1 ]; @@ -111,9 +109,6 @@ function rfftf1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { FLG = 1; // FIXME: describe the point of this flag l2 = N; - // FIXME - printWorkspace( N, ch, 1, chOffset ); - // Initialize an index offset to the last element in each workspace: iw = N - 1; @@ -173,9 +168,7 @@ function rfftf1( N, c, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) { return; } // Now that we've finished computing the transforms, copy over the final results to the input array... - for ( i = 0; i < N; i++ ) { - c[ cOffset+i ] = ch[ chOffset+i ]; // FIXME: use `blas/base/dcopy` - } + dcopy( N, ch, 1, chOffset, c, 1, cOffset ); } From eb6199ec3a2e236202562d354423f1f8957d843b Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 14 Jan 2026 23:25:33 +0530 Subject: [PATCH 097/102] test: modify tests, update comments --- .../fft/base/fftpack/rfftf/docs/repl.txt | 4 +- .../base/fftpack/rfftf/docs/types/index.d.ts | 6 +- .../fft/base/fftpack/rfftf/examples/index.js | 3 - .../fft/base/fftpack/rfftf/lib/c1_ref.js | 85 ------------- .../fft/base/fftpack/rfftf/lib/c2_ref.js | 83 ------------- .../fft/base/fftpack/rfftf/lib/cc_ref.js | 85 ------------- .../fft/base/fftpack/rfftf/lib/ch2_ref.js | 83 ------------- .../fft/base/fftpack/rfftf/lib/ch_ref.js | 85 ------------- .../fft/base/fftpack/rfftf/lib/index.js | 12 +- .../fft/base/fftpack/rfftf/lib/main.js | 14 +-- .../fft/base/fftpack/rfftf/lib/radf5.js | 6 +- .../fft/base/fftpack/rfftf/lib/radfg.js | 49 +++----- .../fft/base/fftpack/rfftf/test/test.js | 115 ++---------------- 13 files changed, 40 insertions(+), 590 deletions(-) delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js delete mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt index 5b17861820bd..2cbb7c2d5d88 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/repl.txt @@ -11,7 +11,7 @@ Parameters ---------- N: integer - Length of the real sequence to transform. + Length of the sequence to transform. r: Float64Array Input/output array containing the sequence to transform. @@ -23,7 +23,7 @@ Starting index for `r`. workspace: Float64Array - Workspace array initialized by `rffti`. + Workspace array containing pre-computed values. strideW: integer Stride length for `workspace`. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts index 5c11f71cfbfe..b8ff9463edce 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/docs/types/index.d.ts @@ -19,13 +19,13 @@ // TypeScript Version: 4.1 /** -* Computes a forward real-valued fast Fourier transform (FFT). +* Computes the forward real-valued fast Fourier transform (FFT). * -* @param N - length of the real sequence to transform +* @param N - length of the sequence to transform * @param r - input/output array containing the sequence to transform * @param strideR - stride length for `r` * @param offsetR - starting index for `r` -* @param workspace - workspace array initialized by `rffti` +* @param workspace - workspace array containing pre-computed values * @param strideW - stride length for `workspace` * @param offsetW - starting index for `workspace` * diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js index 6b87e85fa2ed..3da7470f1e96 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js @@ -27,11 +27,9 @@ var N = 8; var r; var i; -// Initialize a workspace array: workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); -// Define a real-valued input sequence: r = new Float64Array( N ); for ( i = 0; i < N; i++ ) { r[ i ] = i + 1; @@ -39,7 +37,6 @@ for ( i = 0; i < N; i++ ) { console.log( 'Input sequence:' ); console.log( r ); -// Compute the forward FFT: rfftf( N, r, 1, 0, workspace, 1, 0 ); console.log( 'FFT output (half-complex format):' ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js deleted file mode 100644 index b889111ca562..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c1_ref.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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 // - -/** -* Computes an index into the intermediate array `c1`. -* -* @private -* @param {NonNegativeInteger} a1 - index of first dimension -* @param {NonNegativeInteger} a2 - index of second dimension -* @param {NonNegativeInteger} a3 - index of third dimension -* @param {NonNegativeInteger} l1 - length parameter related to the FFT stage -* @param {NonNegativeInteger} ido - dimension order -* @returns {NonNegativeInteger} computed index -* -* @example -* var out = c1Ref( 0, 1, 2, 4, 8 ); -* // returns 72 -*/ -function c1Ref( a1, a2, a3, l1, ido ) { - return ( ( (a3*l1)+a2 ) * ido ) + a1; -} - - -// EXPORTS // - -module.exports = c1Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js deleted file mode 100644 index ff2725f333d1..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/c2_ref.js +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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 // - -/** -* Computes an index into the intermediate array `c2`. -* -* @private -* @param {NonNegativeInteger} a1 - index of first dimension -* @param {NonNegativeInteger} a2 - index of second dimension -* @param {integer} idl1 - stride related to the `l1` parameter -* @returns {NonNegativeInteger} computed index -* -* @example -* var out = c2Ref( 0, 1, 2 ); -* // returns 2 -*/ -function c2Ref( a1, a2, idl1 ) { - return ( a2*idl1 ) + a1; -} - - -// EXPORTS // - -module.exports = c2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js deleted file mode 100644 index 0e34024ee169..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/cc_ref.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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 // - -/** -* Computes an index into an input array `cc` containing complex-valued data. -* -* @private -* @param {NonNegativeInteger} a1 - index of first dimension -* @param {NonNegativeInteger} a2 - index of second dimension -* @param {NonNegativeInteger} a3 - index of third dimension -* @param {NonNegativeInteger} ip - number of sub-steps or prime factors in the FFT -* @param {NonNegativeInteger} ido - dimension order -* @returns {NonNegativeInteger} computed index -* -* @example -* var out = ccRef( 3, 2, 1, 2, 2 ); -* // returns 11 -*/ -function ccRef( a1, a2, a3, ip, ido ) { - return ( ( (a3*ip)+a2 ) * ido ) + a1; -} - - -// EXPORTS // - -module.exports = ccRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js deleted file mode 100644 index ddc19a4da9aa..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch2_ref.js +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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 // - -/** -* Computes an index into an output array `ch2` for storing processed FFT data. -* -* @private -* @param {NonNegativeInteger} a1 - index of first dimension -* @param {NonNegativeInteger} a2 - index of second dimension -* @param {integer} idl1 - stride related to the `l1` parameter -* @returns {NonNegativeInteger} computed index -* -* @example -* var out = ch2Ref( 0, 1, 2 ); -* // returns 2 -*/ -function ch2Ref( a1, a2, idl1 ) { - return ( a2*idl1 ) + a1; -} - - -// EXPORTS // - -module.exports = ch2Ref; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js deleted file mode 100644 index 12f9c1a337de..000000000000 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/ch_ref.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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 // - -/** -* Computes an index into an output array `ch` for storing processed FFT data. -* -* @private -* @param {NonNegativeInteger} a1 - index of first dimension -* @param {NonNegativeInteger} a2 - index of second dimension -* @param {NonNegativeInteger} a3 - index of third dimension -* @param {NonNegativeInteger} radix - length parameter related to the FFT stage -* @param {NonNegativeInteger} ido - dimension order -* @returns {NonNegativeInteger} - calculated index -* -* @example -* var out = chRef( 0, 1, 2, 4, 8 ); -* // returns 72 -*/ -function chRef( a1, a2, a3, radix, ido ) { - return ( ( (a3*radix)+a2 ) * ido ) + a1; -} - - -// EXPORTS // - -module.exports = chRef; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js index 6dfc306e9372..d4e7f52daa0a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Compute the forward real FFT. +* Compute the forward real-valued fast Fourier transform (FFT). * * @module @stdlib/fft/base/fftpack/rfftf * @@ -28,19 +28,15 @@ * var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); * var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); * -* // Define the sequence length: * var N = 4; * -* // Initialize a workspace array for the FFT: * var workspace = new Float64Array( ( 2*N ) + 34 ); * rffti( N, workspace, 1, 0 ); * -* // Define a real-valued input sequence: -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); * -* // Perform the forward real FFT: -* rfftf( N, x, 1, 0, workspace, 1, 0 ); -* // x => [ 10.0, -2.0, 2.0, -2.0 ] +* rfftf( N, r, 1, 0, workspace, 1, 0 ); +* // r => [ 10.0, -2.0, 2.0, -2.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js index e021f88ddb12..e3622e53e79c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js @@ -69,10 +69,10 @@ var rfftf1 = require( './rfftf1.js' ); // MAIN // /** -* Performs the forward Fourier transform for a real-valued sequence. +* Computes the forward real-valued fast Fourier transform (FFT). * * @param {NonNegativeInteger} N - length of the sequence to transform -* @param {Float64Array} r - real-valued input array containing the sequence to be transformed +* @param {Float64Array} r - input/output array containing the sequence to transform * @param {integer} strideR - stride length for `r` * @param {NonNegativeInteger} offsetR - starting index for `r` * @param {Float64Array} workspace - workspace array containing pre-computed values @@ -84,19 +84,15 @@ var rfftf1 = require( './rfftf1.js' ); * var Float64Array = require( '@stdlib/array/float64' ); * var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); * -* // Define the sequence length: * var N = 4; * -* // Initialize a workspace array for the FFT: * var workspace = new Float64Array( ( 2*N ) + 34 ); * rffti( N, workspace, 1, 0 ); * -* // Define a real-valued input sequence: -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); * -* // Perform the forward real FFT: -* rfftf( N, x, 1, 0, workspace, 1, 0 ); -* // x => [ 10.0, -2.0, 2.0, -2.0 ] +* rfftf( N, r, 1, 0, workspace, 1, 0 ); +* // r => [ 10.0, -2.0, 2.0, -2.0 ] */ function rfftf( N, r, strideR, offsetR, workspace, strideW, offsetW ) { var offsetT; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js index 86ac2e482d74..8d1f20863be0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radf5.js @@ -56,7 +56,7 @@ * ``` */ -/* eslint-disable max-len, max-statements */ +/* eslint-disable max-len, max-statements, stdlib/capitalized-comments, stdlib/empty-line-before-comment */ 'use strict'; @@ -426,7 +426,6 @@ function radf5( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s ip1 = iptr( i-1, k, 1, L, M, sc, oc ); // real part component 1 ip2 = iptr( i, k, 1, L, M, sc, oc ); // imag part component 1 - // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment // dr2 = W1_n ⋅ (c + j⋅d) for component 1 dr2 = ( twiddles1[ it11 ] * cc[ ip1 ] ) + ( twiddles1[ it12 ] * cc[ ip2 ] ); // Re(dr2) di2 = ( twiddles1[ it11 ] * cc[ ip2 ] ) - ( twiddles1[ it12 ] * cc[ ip1 ] ); // Im(di2) @@ -435,7 +434,6 @@ function radf5( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s ip1 = iptr( i-1, k, 2, L, M, sc, oc ); // real part component 2 ip2 = iptr( i, k, 2, L, M, sc, oc ); // imag part component 2 - // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment // dr3 = W2_n ⋅ (c + j⋅d) for component 2 dr3 = ( twiddles2[ it21 ] * cc[ ip1 ] ) + ( twiddles2[ it22 ] * cc[ ip2 ] ); // Re(dr3) di3 = ( twiddles2[ it21 ] * cc[ ip2 ] ) - ( twiddles2[ it22 ] * cc[ ip1 ] ); // Im(di3) @@ -444,7 +442,6 @@ function radf5( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s ip1 = iptr( i-1, k, 3, L, M, sc, oc ); // real part component 3 ip2 = iptr( i, k, 3, L, M, sc, oc ); // imag part component 3 - // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment // dr4 = W3_n ⋅ (c + j⋅d) for component 3 dr4 = ( twiddles3[ it31 ] * cc[ ip1 ] ) + ( twiddles3[ it32 ] * cc[ ip2 ] ); // Re(dr4) di4 = ( twiddles3[ it31 ] * cc[ ip2 ] ) - ( twiddles3[ it32 ] * cc[ ip1 ] ); // Im(di4) @@ -453,7 +450,6 @@ function radf5( M, L, cc, sc, oc, out, so, oo, twiddles1, st1, ot1, twiddles2, s ip1 = iptr( i-1, k, 4, L, M, sc, oc ); // real part component 4 ip2 = iptr( i, k, 4, L, M, sc, oc ); // imag part component 4 - // eslint-disable-next-line stdlib/capitalized-comments, stdlib/empty-line-before-comment // dr5 = W4_n ⋅ (c + j⋅d) for component 4 dr5 = ( twiddles4[ it41 ] * cc[ ip1 ] ) + ( twiddles4[ it42 ] * cc[ ip2 ] ); // Re(dr5) di5 = ( twiddles4[ it41 ] * cc[ ip2 ] ) - ( twiddles4[ it42 ] * cc[ ip1 ] ); // Im(di5) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js index 8e79a0378e52..05c960851134 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js @@ -56,6 +56,8 @@ * ``` */ +// TODO: Add better and more descriptive comments throughout this file + /* eslint-disable max-len, max-statements, max-depth, max-lines, max-lines-per-function */ 'use strict'; @@ -281,14 +283,6 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, var k; var l; - /* - * Compute fundamental constants for this radix stage: - * - * - dcp, dsp: cos and sin of the fundamental angle 2π/R - * - Rph: floor((R+1)/2), the number of unique harmonics to process - * - Rp1: R + 1, used for computing conjugate indices - * - nbd: floor((M-1)/2), number of complex pairs per sub-sequence - */ arg = TWO_PI / R; sc = sincos( arg ); dcp = sc[ 1 ]; // cos(2π/R) @@ -298,27 +292,26 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, nbd = floor( ( M - 1 ) / 2 ); /* - * Phase 1: Initialize workspace and apply twiddle factors. + * Initialize workspace and apply twiddle factors. * - * When M = 1, we simply copy from ch2 to c2 (DC component only). - * Otherwise, we need to apply twiddle factors to each radix component. + * When M = 1, we simply copy from ch2 to c2 (DC component only). Otherwise, we need to apply twiddle factors to each radix component. */ if ( M === 1 ) { - // DC component only: copy ch2 to c2 + // Copy ch2 to c2 (DC component only)... for ( ik = 0; ik < ML; ik++ ) { ic2o = c2Ptr( ik, 0, ML, sc2, oc2 ); ich = ch2Ptr( ik, 0, ML, sch2, och2 ); c2[ ic2o ] = ch2[ ich ]; } } else { - // Copy first column of c2 to ch2 + // Copy first column of c2 to ch2... for ( ik = 0; ik < ML; ik++ ) { ich = ch2Ptr( ik, 0, ML, sch2, och2 ); ic2o = c2Ptr( ik, 0, ML, sc2, oc2 ); ch2[ ich ] = c2[ ic2o ]; } - // Copy DC component from c1 to ch for each radix component + // Copy DC component from c1 to ch for each radix component... for ( j = 1; j < R; j++ ) { for ( k = 0; k < L; k++ ) { ih1 = chPtr( 0, k, j, L, M, sch, och ); @@ -327,7 +320,7 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } } - // Apply twiddle factors to each radix component + // Apply twiddle factors to each radix component... if ( nbd <= L ) { // Loop order optimized for small nbd is = 0; @@ -378,7 +371,7 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } /* - * Phase 2: Combine conjugate-symmetric pairs. + * Combine conjugate-symmetric pairs. * * For each pair of harmonics (j, jc) where jc = R+1-j, form symmetric and antisymmetric combinations. */ @@ -435,9 +428,7 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } } - /* - * Phase 3: Combine DC components for conjugate pairs. - */ + // Combine DC components for conjugate pairs... for ( j = 1; j < Rph; j++ ) { jc = Rp1 - j - 1; for ( k = 0; k < L; k++ ) { @@ -451,9 +442,10 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } /* - * Phase 4: Apply DFT matrix to combine all radix components. + * Apply DFT matrix to combine all radix components. * * This implements the radix-R butterfly using rotation factors: + * * ar1 + j*ai1 = exp(j * 2π * l / R) */ ar1 = 1.0; @@ -492,7 +484,7 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } } - // Accumulate all radix components into DC term + // Accumulate all radix components into DC term... for ( j = 1; j < Rph; j++ ) { for ( ik = 0; ik < ML; ik++ ) { ich = ch2Ptr( ik, 0, ML, sch2, och2 ); @@ -501,9 +493,7 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } } - /* - * Phase 5: Copy DC component to output array. - */ + // Copy DC component to output array... if ( M >= L ) { for ( k = 0; k < L; k++ ) { for ( i = 0; i < M; i++ ) { @@ -522,9 +512,7 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } } - /* - * Phase 6: Store harmonic components in conjugate-symmetric format. - */ + // Store harmonic components in conjugate-symmetric format... for ( j = 1; j < Rph; j++ ) { jc = Rp1 - j - 1; j2 = 2 * j; @@ -538,16 +526,15 @@ function radfg( M, R, L, ML, cc, scc, occ, c1, sc1, oc1, c2, sc2, oc2, ch, sch, } } - // When M = 1, there's nothing more to do + // When M = 1, there's nothing more to do... if ( M === 1 ) { return; } /* - * Phase 7: Store complex harmonic pairs in folded format. + * Store complex harmonic pairs in folded format. * - * For each harmonic pair, store the real parts and imaginary parts in the appropriate positions - * to maintain conjugate symmetry in the output array. + * For each harmonic pair, store the real parts and imaginary parts in the appropriate positions to maintain conjugate symmetry in the output array. */ if ( nbd >= L ) { for ( j = 1; j < Rph; j++ ) { diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js index 970df0fa4b2a..21c3f5829fd2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/test/test.js @@ -35,7 +35,6 @@ var rfftf = require( './../lib' ); // VARIABLES // -// Test cases covering various FFT sizes including prime factors 2, 3, 4, 5, and general primes var nd = [ 120, 91, 54, 49, 32, 28, 24, 8, 4, 3, 2 ]; @@ -54,52 +53,20 @@ tape( 'the function has an arity of 7', function test( t ) { tape( 'the function returns early if `N` is 1 (identity transform)', function test( t ) { var workspace; + var N; var x; - workspace = new Float64Array( 36 ); - rffti( 1, workspace, 1, 0 ); + N = 1; + workspace = new Float64Array( ( 2*N ) + 34 ); + rffti( N, workspace, 1, 0 ); x = new Float64Array( [ 5.0 ] ); - rfftf( 1, x, 1, 0, workspace, 1, 0 ); + rfftf( N, x, 1, 0, workspace, 1, 0 ); t.strictEqual( x[ 0 ], 5.0, 'returns expected value' ); t.end(); }); -tape( 'the function computes the forward real FFT (N=2)', function test( t ) { - var workspace; - var x; - - workspace = new Float64Array( 38 ); - rffti( 2, workspace, 1, 0 ); - - x = new Float64Array( [ 1.0, 2.0 ] ); - rfftf( 2, x, 1, 0, workspace, 1, 0 ); - - // Expected: DC = 1+2 = 3, Nyquist = 1-2 = -1 - t.strictEqual( x[ 0 ], 3.0, 'DC component is correct' ); - t.strictEqual( x[ 1 ], -1.0, 'Nyquist component is correct' ); - t.end(); -}); - -tape( 'the function computes the forward real FFT (N=4)', function test( t ) { - var workspace; - var x; - - workspace = new Float64Array( 42 ); - rffti( 4, workspace, 1, 0 ); - - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - rfftf( 4, x, 1, 0, workspace, 1, 0 ); - - // Expected output: [ 10, -2, 2, -2 ] - t.strictEqual( x[ 0 ], 10.0, 'DC component is correct' ); - t.strictEqual( abs( x[ 1 ] - (-2.0) ) < 1e-14, true, 'Re(k=1) is correct' ); - t.strictEqual( abs( x[ 2 ] - 2.0 ) < 1e-14, true, 'Im(k=1) is correct' ); - t.strictEqual( abs( x[ 3 ] - (-2.0) ) < 1e-14, true, 'Nyquist is correct' ); - t.end(); -}); - tape( 'the function computes the forward real FFT matching DFT definition', function test( t ) { var workspace; var error; @@ -121,6 +88,8 @@ tape( 'the function computes the forward real FFT matching DFT definition', func var j; var k; + // TODO: Use better comments in this test + tol = 1e-10; for ( nz = 0; nz < nd.length; nz++ ) { @@ -133,7 +102,6 @@ tape( 'the function computes the forward real FFT matching DFT definition', func modn = n % 2; nm1 = n - 1; - // Initialize input with test signal: sin(j * sqrt(2)) for ( j = 1; j <= n; j++ ) { x[ j - 1 ] = sin( j * SQRT2 ); } @@ -141,11 +109,8 @@ tape( 'the function computes the forward real FFT matching DFT definition', func // Initialize workspace rffti( n, workspace, 1, 0 ); - // Compute expected DFT result manually dt = TWO_PI / n; ns2 = floor( ( n + 1 ) / 2 ); - - // Compute non-DC, non-Nyquist components if ( ns2 > 1 ) { for ( k = 2; k <= ns2; k++ ) { sum1 = 0.0; @@ -160,8 +125,6 @@ tape( 'the function computes the forward real FFT matching DFT definition', func y[ ( k << 1 ) - 2 ] = -sum2; } } - - // Compute DC and Nyquist components sum1 = 0.0; sum2 = 0.0; for ( i = 1; i <= nm1; i += 2 ) { @@ -179,7 +142,6 @@ tape( 'the function computes the forward real FFT matching DFT definition', func // Perform forward FFT rfftf( n, x, 1, 0, workspace, 1, 0 ); - // Compare FFT output with expected DFT result err = 0.0; for ( i = 0; i < n; i++ ) { error = abs( x[ i ] - y[ i ] ); @@ -191,66 +153,3 @@ tape( 'the function computes the forward real FFT matching DFT definition', func } t.end(); }); - -tape( 'the function handles various radix factors correctly', function test( t ) { - var workspace; - var sizes; - var err; - var tol; - var n; - var x; - var i; - var j; - - /* - * Test sizes that exercise different radix routines: - * - * - Powers of 2: radix-2, radix-4 - * - Multiples of 3: radix-3 - * - Multiples of 5: radix-5 - * - Other primes: general radix - */ - sizes = [ - 2, // radix-2 - 3, // radix-3 - 4, // radix-4 - 5, // radix-5 - 6, // 2*3 - 7, // general radix - 8, // radix-4 - 9, // 3*3 - 10, // 2*5 - 12, // 2*2*3 - 15, // 3*5 - 16, // radix-4 - 20, // 2*2*5 - 21, // 3*7 - 25, // 5*5 - 49, // 7*7 - 77, // 7*11 - 100 // 2*2*5*5 - ]; - - tol = 1e-10; - - for ( j = 0; j < sizes.length; j++ ) { - n = sizes[ j ]; - - x = new Float64Array( n ); - workspace = new Float64Array( ( n * 2 ) + 34 ); - - // Initialize with simple ramp signal - for ( i = 0; i < n; i++ ) { - x[ i ] = i + 1; - } - - // Initialize workspace and compute FFT - rffti( n, workspace, 1, 0 ); - rfftf( n, x, 1, 0, workspace, 1, 0 ); - - // Verify DC component equals sum of input - err = abs( x[ 0 ] - ( n * ( n + 1 ) / 2 ) ); - t.ok( err < tol, 'N=' + n + ': DC component is sum of input (error=' + err + ')' ); - } - t.end(); -}); From 2f5a03a6048988cbf2912e4c2fed2a3e32a059f4 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Thu, 15 Jan 2026 19:54:32 +0530 Subject: [PATCH 098/102] bench: update benchmark to use a pool of arrays --- 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 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 --- --- .../base/fftpack/rfftf/benchmark/benchmark.js | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js index c980f1d273af..c6203670ac48 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/benchmark/benchmark.js @@ -23,6 +23,8 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); var dcopy = require( '@stdlib/blas/base/dcopy' ); var Float64Array = require( '@stdlib/array/float64' ); var format = require( '@stdlib/string/format' ); @@ -31,33 +33,33 @@ var pkg = require( './../package.json' ).name; var rfftf = require( './../lib' ); -// VARIABLES // - -var opts = { - 'dtype': 'float64' -}; - - // FUNCTIONS // /** * Creates a benchmark function. * * @private +* @param {PositiveInteger} iter - number of iterations * @param {PositiveInteger} N - sequence length to transform * @returns {Function} benchmark function */ -function createBenchmark( N ) { +function createBenchmark( iter, N ) { var workspace; - var r; - var c; + var tmp; + var x; + var i; + + x = []; + for ( i = 0; i < iter; i++ ) { + tmp = uniform( N, -10.0, 10.0, { + 'dtype': 'float64' + }); + x.push( tmp ); + } workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); - r = uniform( N, -10.0, 10.0, opts ); - c = new Float64Array( N ); - return benchmark; /** @@ -67,12 +69,17 @@ function createBenchmark( N ) { * @param {Benchmark} b - benchmark instance */ function benchmark( b ) { + var xc; + var c; var i; + xc = x.slice(); + for ( i = 0; i < iter; i++ ) { + xc[ i ] = dcopy( N, x[ i ], 1, new Float64Array( N ), 1 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - // Copy the original input array before each transformation. This is necessary because `rfftf` modifies the input array in-place, and applying the forward FFT repeatedly to already-transformed data causes values to grow unbounded and eventually overflow to NaN. - dcopy( N, r, 1, c, 1 ); + c = xc[ i%iter ]; rfftf( N, c, 1, 0, workspace, 1, 0 ); if ( isnan( c[ i%N ] ) ) { b.fail( 'should not return NaN' ); @@ -97,10 +104,13 @@ function createBenchmark( N ) { */ function main() { var lengths; + var opts; + var iter; var N; var f; var i; + iter = 1e6; lengths = [ 8, 16, @@ -112,8 +122,12 @@ function main() { for ( i = 0; i < lengths.length; i++ ) { N = lengths[ i ]; - f = createBenchmark( N ); - bench( format( '%s:N=%d', pkg, N ), f ); + f = createBenchmark( iter, N ); + opts = { + 'iterations': iter + }; + bench( format( '%s:N=%d', pkg, N ), opts, f ); + iter = floor( pow( iter, 3.0/4.0 ) ); } } From 193527c552de9fe070212d0f8994a90620e093a2 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 15 Jan 2026 20:50:14 +0530 Subject: [PATCH 099/102] Delete fftpack.c Signed-off-by: Gunj Joshi --- fftpack.c | 3123 ----------------------------------------------------- 1 file changed, 3123 deletions(-) delete mode 100644 fftpack.c diff --git a/fftpack.c b/fftpack.c deleted file mode 100644 index ed6c96179771..000000000000 --- a/fftpack.c +++ /dev/null @@ -1,3123 +0,0 @@ -/* - compile with cc -DTESTING_FFTPACK fftpack.c in order to build the - test application. - - This is an f2c translation of the full fftpack sources as found on - http://www.netlib.org/fftpack/ The translated code has been - slightlty edited to remove the ugliest artefacts of the translation - (a hundred of wild GOTOs were wiped during that operation). - - The original fftpack file was written by Paul N. Swarztrauber - (Version 4, 1985), in fortran 77. - - FFTPACK license: - - http://www.cisl.ucar.edu/css/software/fftpack5/ftpk.html - - 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. - - ChangeLog: - 2011/10/02: this is my first release of this file. -*/ - -#include "fftpack.h" -#include - -typedef fftpack_real real; -typedef fftpack_int integer; - -#ifndef FFTPACK_DOUBLE_PRECISION - #define FFTPACK_COS cosf - #define FFTPACK_SIN sinf -#else - #define FFTPACK_COS cos - #define FFTPACK_SIN sin -#endif - - -typedef struct f77complex { - real r, i; -} f77complex; - -#ifdef TESTING_FFTPACK -static real c_abs(f77complex *c) { return sqrt(c->r*c->r + c->i*c->i); } -static double dmax(double a, double b) { return a < b ? b : a; } -#endif - -/* define own constants required to turn off g++ extensions .. */ -#ifndef M_PI - #define M_PI 3.14159265358979323846 /* pi */ -#endif - -#ifndef M_SQRT2 - #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#endif - -#ifndef M_SQRT8 - #define M_SQRT8 2.82842712474619009760 /* sqrt(8) */ -#endif - - -/* translated by f2c (version 20061008), and slightly edited */ - -static void passfb(integer *nac, integer ido, integer ip, integer l1, integer idl1, - real *cc, real *c1, real *c2, real *ch, real *ch2, const real *wa, real fsign) -{ - /* System generated locals */ - integer ch_offset, cc_offset, - c1_offset, c2_offset, ch2_offset; - - /* Local variables */ - integer i, j, k, l, jc, lc, ik, idj, idl, inc, idp; - real wai, war; - integer ipp2, idij, idlj, idot, ipph; - - -#define c1_ref(a_1,a_2,a_3) c1[((a_3)*l1 + (a_2))*ido + a_1] -#define c2_ref(a_1,a_2) c2[(a_2)*idl1 + a_1] -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*ip + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] -#define ch2_ref(a_1,a_2) ch2[(a_2)*idl1 + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - c1_offset = 1 + ido * (1 + l1); - c1 -= c1_offset; - cc_offset = 1 + ido * (1 + ip); - cc -= cc_offset; - ch2_offset = 1 + idl1; - ch2 -= ch2_offset; - c2_offset = 1 + idl1; - c2 -= c2_offset; - --wa; - - /* Function Body */ - idot = ido / 2; - ipp2 = ip + 2; - ipph = (ip + 1) / 2; - idp = ip * ido; - - if (ido >= l1) { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (k = 1; k <= l1; ++k) { - for (i = 1; i <= ido; ++i) { - ch_ref(i, k, j) = cc_ref(i, j, k) + cc_ref(i, jc, k); - ch_ref(i, k, jc) = cc_ref(i, j, k) - cc_ref(i, jc, k); - } - } - } - for (k = 1; k <= l1; ++k) { - for (i = 1; i <= ido; ++i) { - ch_ref(i, k, 1) = cc_ref(i, 1, k); - } - } - } else { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (i = 1; i <= ido; ++i) { - for (k = 1; k <= l1; ++k) { - ch_ref(i, k, j) = cc_ref(i, j, k) + cc_ref(i, jc, k); - ch_ref(i, k, jc) = cc_ref(i, j, k) - cc_ref(i, jc, k); - } - } - } - for (i = 1; i <= ido; ++i) { - for (k = 1; k <= l1; ++k) { - ch_ref(i, k, 1) = cc_ref(i, 1, k); - } - } - } - idl = 2 - ido; - inc = 0; - for (l = 2; l <= ipph; ++l) { - lc = ipp2 - l; - idl += ido; - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, l) = ch2_ref(ik, 1) + wa[idl - 1] * ch2_ref(ik, 2); - c2_ref(ik, lc) = fsign*wa[idl] * ch2_ref(ik, ip); - } - idlj = idl; - inc += ido; - for (j = 3; j <= ipph; ++j) { - jc = ipp2 - j; - idlj += inc; - if (idlj > idp) { - idlj -= idp; - } - war = wa[idlj - 1]; - wai = wa[idlj]; - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, l) = c2_ref(ik, l) + war * ch2_ref(ik, j); - c2_ref(ik, lc) = c2_ref(ik, lc) + fsign*wai * ch2_ref(ik, jc); - } - } - } - for (j = 2; j <= ipph; ++j) { - for (ik = 1; ik <= idl1; ++ik) { - ch2_ref(ik, 1) = ch2_ref(ik, 1) + ch2_ref(ik, j); - } - } - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (ik = 2; ik <= idl1; ik += 2) { - ch2_ref(ik - 1, j) = c2_ref(ik - 1, j) - c2_ref(ik, jc); - ch2_ref(ik - 1, jc) = c2_ref(ik - 1, j) + c2_ref(ik, jc); - ch2_ref(ik, j) = c2_ref(ik, j) + c2_ref(ik - 1, jc); - ch2_ref(ik, jc) = c2_ref(ik, j) - c2_ref(ik - 1, jc); - } - } - *nac = 1; - if (ido == 2) { - return; - } - *nac = 0; - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, 1) = ch2_ref(ik, 1); - } - for (j = 2; j <= ip; ++j) { - for (k = 1; k <= l1; ++k) { - c1_ref(1, k, j) = ch_ref(1, k, j); - c1_ref(2, k, j) = ch_ref(2, k, j); - } - } - if (idot <= l1) { - idij = 0; - for (j = 2; j <= ip; ++j) { - idij += 2; - for (i = 4; i <= ido; i += 2) { - idij += 2; - for (k = 1; k <= l1; ++k) { - c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) - fsign*wa[idij] * ch_ref(i, k, j); - c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + fsign*wa[idij] * ch_ref(i - 1, k, j); - } - } - } - return; - } - idj = 2 - ido; - for (j = 2; j <= ip; ++j) { - idj += ido; - for (k = 1; k <= l1; ++k) { - idij = idj; - for (i = 4; i <= ido; i += 2) { - idij += 2; - c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) - fsign*wa[idij] * ch_ref(i, k, j); - c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + fsign*wa[idij] * ch_ref(i - 1, k, j); - } - } - } -} /* passb */ - -#undef ch2_ref -#undef ch_ref -#undef cc_ref -#undef c2_ref -#undef c1_ref - - -static void passb2(integer ido, integer l1, const real *cc, real *ch, const real *wa1) -{ - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ti2, tr2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*2 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 3; - cc -= cc_offset; - --wa1; - - /* Function Body */ - if (ido <= 2) { - for (k = 1; k <= l1; ++k) { - ch_ref(1, k, 1) = cc_ref(1, 1, k) + cc_ref(1, 2, k); - ch_ref(1, k, 2) = cc_ref(1, 1, k) - cc_ref(1, 2, k); - ch_ref(2, k, 1) = cc_ref(2, 1, k) + cc_ref(2, 2, k); - ch_ref(2, k, 2) = cc_ref(2, 1, k) - cc_ref(2, 2, k); - } - return; - } - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 2, k); - tr2 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 2, k); - ch_ref(i, k, 1) = cc_ref(i, 1, k) + cc_ref(i, 2, k); - ti2 = cc_ref(i, 1, k) - cc_ref(i, 2, k); - ch_ref(i, k, 2) = wa1[i - 1] * ti2 + wa1[i] * tr2; - ch_ref(i - 1, k, 2) = wa1[i - 1] * tr2 - wa1[i] * ti2; - } - } -} /* passb2 */ - -#undef ch_ref -#undef cc_ref - - -static void passb3(integer ido, integer l1, const real *cc, real *ch, const real *wa1, const real *wa2) -{ - static const real taur = -.5f; - static const real taui = .866025403784439f; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*3 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + (ido << 2); - cc -= cc_offset; - --wa1; - --wa2; - - /* Function Body */ - if (ido == 2) { - for (k = 1; k <= l1; ++k) { - tr2 = cc_ref(1, 2, k) + cc_ref(1, 3, k); - cr2 = cc_ref(1, 1, k) + taur * tr2; - ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2; - ti2 = cc_ref(2, 2, k) + cc_ref(2, 3, k); - ci2 = cc_ref(2, 1, k) + taur * ti2; - ch_ref(2, k, 1) = cc_ref(2, 1, k) + ti2; - cr3 = taui * (cc_ref(1, 2, k) - cc_ref(1, 3, k)); - ci3 = taui * (cc_ref(2, 2, k) - cc_ref(2, 3, k)); - ch_ref(1, k, 2) = cr2 - ci3; - ch_ref(1, k, 3) = cr2 + ci3; - ch_ref(2, k, 2) = ci2 + cr3; - ch_ref(2, k, 3) = ci2 - cr3; - } - } else { - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - tr2 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 3, k); - cr2 = cc_ref(i - 1, 1, k) + taur * tr2; - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2; - ti2 = cc_ref(i, 2, k) + cc_ref(i, 3, k); - ci2 = cc_ref(i, 1, k) + taur * ti2; - ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2; - cr3 = taui * (cc_ref(i - 1, 2, k) - cc_ref(i - 1, 3, k)); - ci3 = taui * (cc_ref(i, 2, k) - cc_ref(i, 3, k)); - dr2 = cr2 - ci3; - dr3 = cr2 + ci3; - di2 = ci2 + cr3; - di3 = ci2 - cr3; - ch_ref(i, k, 2) = wa1[i - 1] * di2 + wa1[i] * dr2; - ch_ref(i - 1, k, 2) = wa1[i - 1] * dr2 - wa1[i] * di2; - ch_ref(i, k, 3) = wa2[i - 1] * di3 + wa2[i] * dr3; - ch_ref(i - 1, k, 3) = wa2[i - 1] * dr3 - wa2[i] * di3; - } - } - } -} /* passb3 */ - -#undef ch_ref -#undef cc_ref - - -static void passb4(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3) -{ - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*4 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 5; - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - - /* Function Body */ - if (ido == 2) { - for (k = 1; k <= l1; ++k) { - ti1 = cc_ref(2, 1, k) - cc_ref(2, 3, k); - ti2 = cc_ref(2, 1, k) + cc_ref(2, 3, k); - tr4 = cc_ref(2, 4, k) - cc_ref(2, 2, k); - ti3 = cc_ref(2, 2, k) + cc_ref(2, 4, k); - tr1 = cc_ref(1, 1, k) - cc_ref(1, 3, k); - tr2 = cc_ref(1, 1, k) + cc_ref(1, 3, k); - ti4 = cc_ref(1, 2, k) - cc_ref(1, 4, k); - tr3 = cc_ref(1, 2, k) + cc_ref(1, 4, k); - ch_ref(1, k, 1) = tr2 + tr3; - ch_ref(1, k, 3) = tr2 - tr3; - ch_ref(2, k, 1) = ti2 + ti3; - ch_ref(2, k, 3) = ti2 - ti3; - ch_ref(1, k, 2) = tr1 + tr4; - ch_ref(1, k, 4) = tr1 - tr4; - ch_ref(2, k, 2) = ti1 + ti4; - ch_ref(2, k, 4) = ti1 - ti4; - } - } else { - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - ti1 = cc_ref(i, 1, k) - cc_ref(i, 3, k); - ti2 = cc_ref(i, 1, k) + cc_ref(i, 3, k); - ti3 = cc_ref(i, 2, k) + cc_ref(i, 4, k); - tr4 = cc_ref(i, 4, k) - cc_ref(i, 2, k); - tr1 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 3, k); - tr2 = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 3, k); - ti4 = cc_ref(i - 1, 2, k) - cc_ref(i - 1, 4, k); - tr3 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 4, k); - ch_ref(i - 1, k, 1) = tr2 + tr3; - cr3 = tr2 - tr3; - ch_ref(i, k, 1) = ti2 + ti3; - ci3 = ti2 - ti3; - cr2 = tr1 + tr4; - cr4 = tr1 - tr4; - ci2 = ti1 + ti4; - ci4 = ti1 - ti4; - ch_ref(i - 1, k, 2) = wa1[i - 1] * cr2 - wa1[i] * ci2; - ch_ref(i, k, 2) = wa1[i - 1] * ci2 + wa1[i] * cr2; - ch_ref(i - 1, k, 3) = wa2[i - 1] * cr3 - wa2[i] * ci3; - ch_ref(i, k, 3) = wa2[i - 1] * ci3 + wa2[i] * cr3; - ch_ref(i - 1, k, 4) = wa3[i - 1] * cr4 - wa3[i] * ci4; - ch_ref(i, k, 4) = wa3[i - 1] * ci4 + wa3[i] * cr4; - } - } - } -} /* passb4 */ - -#undef ch_ref -#undef cc_ref - -/* passf5 and passb5 merged */ -static void passfb5(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3, const real *wa4, real fsign) -{ - const real tr11 = .309016994374947f; - const real ti11 = .951056516295154f*fsign; - const real tr12 = -.809016994374947f; - const real ti12 = .587785252292473f*fsign; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ci2, ci3, ci4, ci5, di3, di4, di5, di2, cr2, cr3, cr5, cr4, ti2, ti3, - ti4, ti5, dr3, dr4, dr5, dr2, tr2, tr3, tr4, tr5; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*5 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 6; - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - --wa4; - - /* Function Body */ - if (ido == 2) { - for (k = 1; k <= l1; ++k) { - ti5 = cc_ref(2, 2, k) - cc_ref(2, 5, k); - ti2 = cc_ref(2, 2, k) + cc_ref(2, 5, k); - ti4 = cc_ref(2, 3, k) - cc_ref(2, 4, k); - ti3 = cc_ref(2, 3, k) + cc_ref(2, 4, k); - tr5 = cc_ref(1, 2, k) - cc_ref(1, 5, k); - tr2 = cc_ref(1, 2, k) + cc_ref(1, 5, k); - tr4 = cc_ref(1, 3, k) - cc_ref(1, 4, k); - tr3 = cc_ref(1, 3, k) + cc_ref(1, 4, k); - ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2 + tr3; - ch_ref(2, k, 1) = cc_ref(2, 1, k) + ti2 + ti3; - cr2 = cc_ref(1, 1, k) + tr11 * tr2 + tr12 * tr3; - ci2 = cc_ref(2, 1, k) + tr11 * ti2 + tr12 * ti3; - cr3 = cc_ref(1, 1, k) + tr12 * tr2 + tr11 * tr3; - ci3 = cc_ref(2, 1, k) + tr12 * ti2 + tr11 * ti3; - cr5 = ti11 * tr5 + ti12 * tr4; - ci5 = ti11 * ti5 + ti12 * ti4; - cr4 = ti12 * tr5 - ti11 * tr4; - ci4 = ti12 * ti5 - ti11 * ti4; - ch_ref(1, k, 2) = cr2 - ci5; - ch_ref(1, k, 5) = cr2 + ci5; - ch_ref(2, k, 2) = ci2 + cr5; - ch_ref(2, k, 3) = ci3 + cr4; - ch_ref(1, k, 3) = cr3 - ci4; - ch_ref(1, k, 4) = cr3 + ci4; - ch_ref(2, k, 4) = ci3 - cr4; - ch_ref(2, k, 5) = ci2 - cr5; - } - } else { - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - ti5 = cc_ref(i, 2, k) - cc_ref(i, 5, k); - ti2 = cc_ref(i, 2, k) + cc_ref(i, 5, k); - ti4 = cc_ref(i, 3, k) - cc_ref(i, 4, k); - ti3 = cc_ref(i, 3, k) + cc_ref(i, 4, k); - tr5 = cc_ref(i - 1, 2, k) - cc_ref(i - 1, 5, k); - tr2 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 5, k); - tr4 = cc_ref(i - 1, 3, k) - cc_ref(i - 1, 4, k); - tr3 = cc_ref(i - 1, 3, k) + cc_ref(i - 1, 4, k); - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2 + tr3; - ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2 + ti3; - cr2 = cc_ref(i - 1, 1, k) + tr11 * tr2 + tr12 * tr3; - ci2 = cc_ref(i, 1, k) + tr11 * ti2 + tr12 * ti3; - cr3 = cc_ref(i - 1, 1, k) + tr12 * tr2 + tr11 * tr3; - ci3 = cc_ref(i, 1, k) + tr12 * ti2 + tr11 * ti3; - cr5 = ti11 * tr5 + ti12 * tr4; - ci5 = ti11 * ti5 + ti12 * ti4; - cr4 = ti12 * tr5 - ti11 * tr4; - ci4 = ti12 * ti5 - ti11 * ti4; - dr3 = cr3 - ci4; - dr4 = cr3 + ci4; - di3 = ci3 + cr4; - di4 = ci3 - cr4; - dr5 = cr2 + ci5; - dr2 = cr2 - ci5; - di5 = ci2 - cr5; - di2 = ci2 + cr5; - ch_ref(i - 1, k, 2) = wa1[i - 1] * dr2 - fsign*wa1[i] * di2; - ch_ref(i, k, 2) = wa1[i - 1] * di2 + fsign*wa1[i] * dr2; - ch_ref(i - 1, k, 3) = wa2[i - 1] * dr3 - fsign*wa2[i] * di3; - ch_ref(i, k, 3) = wa2[i - 1] * di3 + fsign*wa2[i] * dr3; - ch_ref(i - 1, k, 4) = wa3[i - 1] * dr4 - fsign*wa3[i] * di4; - ch_ref(i, k, 4) = wa3[i - 1] * di4 + fsign*wa3[i] * dr4; - ch_ref(i - 1, k, 5) = wa4[i - 1] * dr5 - fsign*wa4[i] * di5; - ch_ref(i, k, 5) = wa4[i - 1] * di5 + fsign*wa4[i] * dr5; - } - } - } -} /* passb5 */ - -#undef ch_ref -#undef cc_ref - -static void passf2(integer ido, integer l1, const real *cc, real *ch, const real *wa1) -{ - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ti2, tr2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*2 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 3; - cc -= cc_offset; - --wa1; - - /* Function Body */ - if (ido == 2) { - for (k = 1; k <= l1; ++k) { - ch_ref(1, k, 1) = cc_ref(1, 1, k) + cc_ref(1, 2, k); - ch_ref(1, k, 2) = cc_ref(1, 1, k) - cc_ref(1, 2, k); - ch_ref(2, k, 1) = cc_ref(2, 1, k) + cc_ref(2, 2, k); - ch_ref(2, k, 2) = cc_ref(2, 1, k) - cc_ref(2, 2, k); - } - } else { - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 2, - k); - tr2 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 2, k); - ch_ref(i, k, 1) = cc_ref(i, 1, k) + cc_ref(i, 2, k); - ti2 = cc_ref(i, 1, k) - cc_ref(i, 2, k); - ch_ref(i, k, 2) = wa1[i - 1] * ti2 - wa1[i] * tr2; - ch_ref(i - 1, k, 2) = wa1[i - 1] * tr2 + wa1[i] * ti2; - } - } - } -} /* passf2 */ - -#undef ch_ref -#undef cc_ref - - -static void passf3(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2) -{ - static const real taur = -.5f; - static const real taui = -.866025403784439f; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*3 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + (ido << 2); - cc -= cc_offset; - --wa1; - --wa2; - - /* Function Body */ - if (ido == 2) { - for (k = 1; k <= l1; ++k) { - tr2 = cc_ref(1, 2, k) + cc_ref(1, 3, k); - cr2 = cc_ref(1, 1, k) + taur * tr2; - ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2; - ti2 = cc_ref(2, 2, k) + cc_ref(2, 3, k); - ci2 = cc_ref(2, 1, k) + taur * ti2; - ch_ref(2, k, 1) = cc_ref(2, 1, k) + ti2; - cr3 = taui * (cc_ref(1, 2, k) - cc_ref(1, 3, k)); - ci3 = taui * (cc_ref(2, 2, k) - cc_ref(2, 3, k)); - ch_ref(1, k, 2) = cr2 - ci3; - ch_ref(1, k, 3) = cr2 + ci3; - ch_ref(2, k, 2) = ci2 + cr3; - ch_ref(2, k, 3) = ci2 - cr3; - } - } else { - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - tr2 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 3, k); - cr2 = cc_ref(i - 1, 1, k) + taur * tr2; - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2; - ti2 = cc_ref(i, 2, k) + cc_ref(i, 3, k); - ci2 = cc_ref(i, 1, k) + taur * ti2; - ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2; - cr3 = taui * (cc_ref(i - 1, 2, k) - cc_ref(i - 1, 3, k)); - ci3 = taui * (cc_ref(i, 2, k) - cc_ref(i, 3, k)); - dr2 = cr2 - ci3; - dr3 = cr2 + ci3; - di2 = ci2 + cr3; - di3 = ci2 - cr3; - ch_ref(i, k, 2) = wa1[i - 1] * di2 - wa1[i] * dr2; - ch_ref(i - 1, k, 2) = wa1[i - 1] * dr2 + wa1[i] * di2; - ch_ref(i, k, 3) = wa2[i - 1] * di3 - wa2[i] * dr3; - ch_ref(i - 1, k, 3) = wa2[i - 1] * dr3 + wa2[i] * di3; - } - } - } -} /* passf3 */ - -#undef ch_ref -#undef cc_ref - - -static void passf4(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3) -{ - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k; - real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*4 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 5; - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - - /* Function Body */ - if (ido == 2) { - for (k = 1; k <= l1; ++k) { - ti1 = cc_ref(2, 1, k) - cc_ref(2, 3, k); - ti2 = cc_ref(2, 1, k) + cc_ref(2, 3, k); - tr4 = cc_ref(2, 2, k) - cc_ref(2, 4, k); - ti3 = cc_ref(2, 2, k) + cc_ref(2, 4, k); - tr1 = cc_ref(1, 1, k) - cc_ref(1, 3, k); - tr2 = cc_ref(1, 1, k) + cc_ref(1, 3, k); - ti4 = cc_ref(1, 4, k) - cc_ref(1, 2, k); - tr3 = cc_ref(1, 2, k) + cc_ref(1, 4, k); - ch_ref(1, k, 1) = tr2 + tr3; - ch_ref(1, k, 3) = tr2 - tr3; - ch_ref(2, k, 1) = ti2 + ti3; - ch_ref(2, k, 3) = ti2 - ti3; - ch_ref(1, k, 2) = tr1 + tr4; - ch_ref(1, k, 4) = tr1 - tr4; - ch_ref(2, k, 2) = ti1 + ti4; - ch_ref(2, k, 4) = ti1 - ti4; - } - } else { - for (k = 1; k <= l1; ++k) { - for (i = 2; i <= ido; i += 2) { - ti1 = cc_ref(i, 1, k) - cc_ref(i, 3, k); - ti2 = cc_ref(i, 1, k) + cc_ref(i, 3, k); - ti3 = cc_ref(i, 2, k) + cc_ref(i, 4, k); - tr4 = cc_ref(i, 2, k) - cc_ref(i, 4, k); - tr1 = cc_ref(i - 1, 1, k) - cc_ref(i - 1, 3, k); - tr2 = cc_ref(i - 1, 1, k) + cc_ref(i - 1, 3, k); - ti4 = cc_ref(i - 1, 4, k) - cc_ref(i - 1, 2, k); - tr3 = cc_ref(i - 1, 2, k) + cc_ref(i - 1, 4, k); - ch_ref(i - 1, k, 1) = tr2 + tr3; - cr3 = tr2 - tr3; - ch_ref(i, k, 1) = ti2 + ti3; - ci3 = ti2 - ti3; - cr2 = tr1 + tr4; - cr4 = tr1 - tr4; - ci2 = ti1 + ti4; - ci4 = ti1 - ti4; - ch_ref(i - 1, k, 2) = wa1[i - 1] * cr2 + wa1[i] * ci2; - ch_ref(i, k, 2) = wa1[i - 1] * ci2 - wa1[i] * cr2; - ch_ref(i - 1, k, 3) = wa2[i - 1] * cr3 + wa2[i] * ci3; - ch_ref(i, k, 3) = wa2[i - 1] * ci3 - wa2[i] * cr3; - ch_ref(i - 1, k, 4) = wa3[i - 1] * cr4 + wa3[i] * ci4; - ch_ref(i, k, 4) = wa3[i - 1] * ci4 - wa3[i] * cr4; - } - } - } -} /* passf4 */ - -#undef ch_ref -#undef cc_ref - -static void radb2(integer ido, integer l1, const real *cc, real *ch, const real *wa1) -{ - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k, ic; - real ti2, tr2; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*2 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 3; - cc -= cc_offset; - --wa1; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - ch_ref(1, k, 1) = cc_ref(1, 1, k) + cc_ref(ido, 2, k); - ch_ref(1, k, 2) = cc_ref(1, 1, k) - cc_ref(ido, 2, k); - } - if (ido < 2) return; - else if (ido != 2) { - idp2 = ido + 2; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + cc_ref(ic - 1, 2, - k); - tr2 = cc_ref(i - 1, 1, k) - cc_ref(ic - 1, 2, k); - ch_ref(i, k, 1) = cc_ref(i, 1, k) - cc_ref(ic, 2, k); - ti2 = cc_ref(i, 1, k) + cc_ref(ic, 2, k); - ch_ref(i - 1, k, 2) = wa1[i - 2] * tr2 - wa1[i - 1] * ti2; - ch_ref(i, k, 2) = wa1[i - 2] * ti2 + wa1[i - 1] * tr2; - } - } - if (ido % 2 == 1) return; - } - for (k = 1; k <= l1; ++k) { - ch_ref(ido, k, 1) = cc_ref(ido, 1, k) + cc_ref(ido, 1, k); - ch_ref(ido, k, 2) = -(cc_ref(1, 2, k) + cc_ref(1, 2, k)); - } -} /* radb2 */ - -#undef ch_ref -#undef cc_ref - - -static void radb3(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2) -{ - /* Initialized data */ - - static const real taur = -.5f; - static const real taui = .866025403784439f; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k, ic; - real ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*3 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + (ido << 2); - cc -= cc_offset; - --wa1; - --wa2; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - tr2 = cc_ref(ido, 2, k) + cc_ref(ido, 2, k); - cr2 = cc_ref(1, 1, k) + taur * tr2; - ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2; - ci3 = taui * (cc_ref(1, 3, k) + cc_ref(1, 3, k)); - ch_ref(1, k, 2) = cr2 - ci3; - ch_ref(1, k, 3) = cr2 + ci3; - } - if (ido == 1) { - return; - } - idp2 = ido + 2; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - tr2 = cc_ref(i - 1, 3, k) + cc_ref(ic - 1, 2, k); - cr2 = cc_ref(i - 1, 1, k) + taur * tr2; - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2; - ti2 = cc_ref(i, 3, k) - cc_ref(ic, 2, k); - ci2 = cc_ref(i, 1, k) + taur * ti2; - ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2; - cr3 = taui * (cc_ref(i - 1, 3, k) - cc_ref(ic - 1, 2, k)); - ci3 = taui * (cc_ref(i, 3, k) + cc_ref(ic, 2, k)); - dr2 = cr2 - ci3; - dr3 = cr2 + ci3; - di2 = ci2 + cr3; - di3 = ci2 - cr3; - ch_ref(i - 1, k, 2) = wa1[i - 2] * dr2 - wa1[i - 1] * di2; - ch_ref(i, k, 2) = wa1[i - 2] * di2 + wa1[i - 1] * dr2; - ch_ref(i - 1, k, 3) = wa2[i - 2] * dr3 - wa2[i - 1] * di3; - ch_ref(i, k, 3) = wa2[i - 2] * di3 + wa2[i - 1] * dr3; - } - } -} /* radb3 */ - -#undef ch_ref -#undef cc_ref - - -static void radb4(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3) -{ - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k, ic; - real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*4 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 5; - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - tr1 = cc_ref(1, 1, k) - cc_ref(ido, 4, k); - tr2 = cc_ref(1, 1, k) + cc_ref(ido, 4, k); - tr3 = cc_ref(ido, 2, k) + cc_ref(ido, 2, k); - tr4 = cc_ref(1, 3, k) + cc_ref(1, 3, k); - ch_ref(1, k, 1) = tr2 + tr3; - ch_ref(1, k, 2) = tr1 - tr4; - ch_ref(1, k, 3) = tr2 - tr3; - ch_ref(1, k, 4) = tr1 + tr4; - } - if (ido < 2) return; - if (ido != 2) { - idp2 = ido + 2; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - ti1 = cc_ref(i, 1, k) + cc_ref(ic, 4, k); - ti2 = cc_ref(i, 1, k) - cc_ref(ic, 4, k); - ti3 = cc_ref(i, 3, k) - cc_ref(ic, 2, k); - tr4 = cc_ref(i, 3, k) + cc_ref(ic, 2, k); - tr1 = cc_ref(i - 1, 1, k) - cc_ref(ic - 1, 4, k); - tr2 = cc_ref(i - 1, 1, k) + cc_ref(ic - 1, 4, k); - ti4 = cc_ref(i - 1, 3, k) - cc_ref(ic - 1, 2, k); - tr3 = cc_ref(i - 1, 3, k) + cc_ref(ic - 1, 2, k); - ch_ref(i - 1, k, 1) = tr2 + tr3; - cr3 = tr2 - tr3; - ch_ref(i, k, 1) = ti2 + ti3; - ci3 = ti2 - ti3; - cr2 = tr1 - tr4; - cr4 = tr1 + tr4; - ci2 = ti1 + ti4; - ci4 = ti1 - ti4; - ch_ref(i - 1, k, 2) = wa1[i - 2] * cr2 - wa1[i - 1] * ci2; - ch_ref(i, k, 2) = wa1[i - 2] * ci2 + wa1[i - 1] * cr2; - ch_ref(i - 1, k, 3) = wa2[i - 2] * cr3 - wa2[i - 1] * ci3; - ch_ref(i, k, 3) = wa2[i - 2] * ci3 + wa2[i - 1] * cr3; - ch_ref(i - 1, k, 4) = wa3[i - 2] * cr4 - wa3[i - 1] * ci4; - ch_ref(i, k, 4) = wa3[i - 2] * ci4 + wa3[i - 1] * cr4; - } - } - if (ido % 2 == 1) return; - } - for (k = 1; k <= l1; ++k) { - ti1 = cc_ref(1, 2, k) + cc_ref(1, 4, k); - ti2 = cc_ref(1, 4, k) - cc_ref(1, 2, k); - tr1 = cc_ref(ido, 1, k) - cc_ref(ido, 3, k); - tr2 = cc_ref(ido, 1, k) + cc_ref(ido, 3, k); - ch_ref(ido, k, 1) = tr2 + tr2; - ch_ref(ido, k, 2) = M_SQRT2 * (tr1 - ti1); - ch_ref(ido, k, 3) = ti2 + ti2; - ch_ref(ido, k, 4) = -M_SQRT2 * (tr1 + ti1); - } -} /* radb4 */ - -#undef ch_ref -#undef cc_ref - - -static void radb5(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3, const real *wa4) -{ - /* Initialized data */ - - static const real tr11 = .309016994374947f; - static const real ti11 = .951056516295154f; - static const real tr12 = -.809016994374947f; - static const real ti12 = .587785252292473f; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k, ic; - real ci2, ci3, ci4, ci5, di3, di4, di5, di2, cr2, cr3, cr5, cr4, ti2, ti3, - ti4, ti5, dr3, dr4, dr5, dr2, tr2, tr3, tr4, tr5; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*5 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - cc_offset = 1 + ido * 6; - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - --wa4; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - ti5 = cc_ref(1, 3, k) + cc_ref(1, 3, k); - ti4 = cc_ref(1, 5, k) + cc_ref(1, 5, k); - tr2 = cc_ref(ido, 2, k) + cc_ref(ido, 2, k); - tr3 = cc_ref(ido, 4, k) + cc_ref(ido, 4, k); - ch_ref(1, k, 1) = cc_ref(1, 1, k) + tr2 + tr3; - cr2 = cc_ref(1, 1, k) + tr11 * tr2 + tr12 * tr3; - cr3 = cc_ref(1, 1, k) + tr12 * tr2 + tr11 * tr3; - ci5 = ti11 * ti5 + ti12 * ti4; - ci4 = ti12 * ti5 - ti11 * ti4; - ch_ref(1, k, 2) = cr2 - ci5; - ch_ref(1, k, 3) = cr3 - ci4; - ch_ref(1, k, 4) = cr3 + ci4; - ch_ref(1, k, 5) = cr2 + ci5; - } - if (ido == 1) { - return; - } - idp2 = ido + 2; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - ti5 = cc_ref(i, 3, k) + cc_ref(ic, 2, k); - ti2 = cc_ref(i, 3, k) - cc_ref(ic, 2, k); - ti4 = cc_ref(i, 5, k) + cc_ref(ic, 4, k); - ti3 = cc_ref(i, 5, k) - cc_ref(ic, 4, k); - tr5 = cc_ref(i - 1, 3, k) - cc_ref(ic - 1, 2, k); - tr2 = cc_ref(i - 1, 3, k) + cc_ref(ic - 1, 2, k); - tr4 = cc_ref(i - 1, 5, k) - cc_ref(ic - 1, 4, k); - tr3 = cc_ref(i - 1, 5, k) + cc_ref(ic - 1, 4, k); - ch_ref(i - 1, k, 1) = cc_ref(i - 1, 1, k) + tr2 + tr3; - ch_ref(i, k, 1) = cc_ref(i, 1, k) + ti2 + ti3; - cr2 = cc_ref(i - 1, 1, k) + tr11 * tr2 + tr12 * tr3; - ci2 = cc_ref(i, 1, k) + tr11 * ti2 + tr12 * ti3; - cr3 = cc_ref(i - 1, 1, k) + tr12 * tr2 + tr11 * tr3; - ci3 = cc_ref(i, 1, k) + tr12 * ti2 + tr11 * ti3; - cr5 = ti11 * tr5 + ti12 * tr4; - ci5 = ti11 * ti5 + ti12 * ti4; - cr4 = ti12 * tr5 - ti11 * tr4; - ci4 = ti12 * ti5 - ti11 * ti4; - dr3 = cr3 - ci4; - dr4 = cr3 + ci4; - di3 = ci3 + cr4; - di4 = ci3 - cr4; - dr5 = cr2 + ci5; - dr2 = cr2 - ci5; - di5 = ci2 - cr5; - di2 = ci2 + cr5; - ch_ref(i - 1, k, 2) = wa1[i - 2] * dr2 - wa1[i - 1] * di2; - ch_ref(i, k, 2) = wa1[i - 2] * di2 + wa1[i - 1] * dr2; - ch_ref(i - 1, k, 3) = wa2[i - 2] * dr3 - wa2[i - 1] * di3; - ch_ref(i, k, 3) = wa2[i - 2] * di3 + wa2[i - 1] * dr3; - ch_ref(i - 1, k, 4) = wa3[i - 2] * dr4 - wa3[i - 1] * di4; - ch_ref(i, k, 4) = wa3[i - 2] * di4 + wa3[i - 1] * dr4; - ch_ref(i - 1, k, 5) = wa4[i - 2] * dr5 - wa4[i - 1] * di5; - ch_ref(i, k, 5) = wa4[i - 2] * di5 + wa4[i - 1] * dr5; - } - } -} /* radb5 */ - -#undef ch_ref -#undef cc_ref - - -static void radbg(integer ido, integer ip, integer l1, integer idl1, - const real *cc, real *c1, real *c2, real *ch, real *ch2, const real *wa) -{ - /* System generated locals */ - integer ch_offset, cc_offset, - c1_offset, c2_offset, ch2_offset; - - /* Local variables */ - integer i, j, k, l, j2, ic, jc, lc, ik, is; - real dc2, ai1, ai2, ar1, ar2, ds2; - integer nbd; - real dcp, arg, dsp, ar1h, ar2h; - integer idp2, ipp2, idij, ipph; - - -#define c1_ref(a_1,a_2,a_3) c1[((a_3)*l1 + (a_2))*ido + a_1] -#define c2_ref(a_1,a_2) c2[(a_2)*idl1 + a_1] -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*ip + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] -#define ch2_ref(a_1,a_2) ch2[(a_2)*idl1 + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - c1_offset = 1 + ido * (1 + l1); - c1 -= c1_offset; - cc_offset = 1 + ido * (1 + ip); - cc -= cc_offset; - ch2_offset = 1 + idl1; - ch2 -= ch2_offset; - c2_offset = 1 + idl1; - c2 -= c2_offset; - --wa; - - /* Function Body */ - arg = (2*M_PI) / (real) (ip); - dcp = FFTPACK_COS(arg); - dsp = FFTPACK_SIN(arg); - idp2 = ido + 2; - nbd = (ido - 1) / 2; - ipp2 = ip + 2; - ipph = (ip + 1) / 2; - if (ido >= l1) { - for (k = 1; k <= l1; ++k) { - for (i = 1; i <= ido; ++i) { - ch_ref(i, k, 1) = cc_ref(i, 1, k); - } - } - } else { - for (i = 1; i <= ido; ++i) { - for (k = 1; k <= l1; ++k) { - ch_ref(i, k, 1) = cc_ref(i, 1, k); - } - } - } - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - j2 = j + j; - for (k = 1; k <= l1; ++k) { - ch_ref(1, k, j) = cc_ref(ido, j2 - 2, k) + cc_ref(ido, j2 - 2, k); - ch_ref(1, k, jc) = cc_ref(1, j2 - 1, k) + cc_ref(1, j2 - 1, k); - } - } - if (ido != 1) { - if (nbd >= l1) { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - ch_ref(i - 1, k, j) = cc_ref(i - 1, (j << 1) - 1, k) + cc_ref(ic - 1, (j << 1) - 2, k); - ch_ref(i - 1, k, jc) = cc_ref(i - 1, (j << 1) - 1, k) - cc_ref(ic - 1, (j << 1) - 2, k); - ch_ref(i, k, j) = cc_ref(i, (j << 1) - 1, k) - cc_ref(ic, (j << 1) - 2, k); - ch_ref(i, k, jc) = cc_ref(i, (j << 1) - 1, k) + cc_ref(ic, (j << 1) - 2, k); - } - } - } - } else { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - for (k = 1; k <= l1; ++k) { - ch_ref(i - 1, k, j) = cc_ref(i - 1, (j << 1) - 1, k) + cc_ref(ic - 1, (j << 1) - 2, k); - ch_ref(i - 1, k, jc) = cc_ref(i - 1, (j << 1) - 1, k) - cc_ref(ic - 1, (j << 1) - 2, k); - ch_ref(i, k, j) = cc_ref(i, (j << 1) - 1, k) - cc_ref(ic, (j << 1) - 2, k); - ch_ref(i, k, jc) = cc_ref(i, (j << 1) - 1, k) + cc_ref(ic, (j << 1) - 2, k); - } - } - } - } - } - ar1 = 1.f; - ai1 = 0.f; - for (l = 2; l <= ipph; ++l) { - lc = ipp2 - l; - ar1h = dcp * ar1 - dsp * ai1; - ai1 = dcp * ai1 + dsp * ar1; - ar1 = ar1h; - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, l) = ch2_ref(ik, 1) + ar1 * ch2_ref(ik, 2); - c2_ref(ik, lc) = ai1 * ch2_ref(ik, ip); - } - dc2 = ar1; - ds2 = ai1; - ar2 = ar1; - ai2 = ai1; - for (j = 3; j <= ipph; ++j) { - jc = ipp2 - j; - ar2h = dc2 * ar2 - ds2 * ai2; - ai2 = dc2 * ai2 + ds2 * ar2; - ar2 = ar2h; - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, l) = c2_ref(ik, l) + ar2 * ch2_ref(ik, j); - c2_ref(ik, lc) = c2_ref(ik, lc) + ai2 * ch2_ref(ik, jc); - } - } - } - for (j = 2; j <= ipph; ++j) { - for (ik = 1; ik <= idl1; ++ik) { - ch2_ref(ik, 1) = ch2_ref(ik, 1) + ch2_ref(ik, j); - } - } - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (k = 1; k <= l1; ++k) { - ch_ref(1, k, j) = c1_ref(1, k, j) - c1_ref(1, k, jc); - ch_ref(1, k, jc) = c1_ref(1, k, j) + c1_ref(1, k, jc); - } - } - if (ido != 1) { - if (nbd >= l1) { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ch_ref(i - 1, k, j) = c1_ref(i - 1, k, j) - c1_ref(i, k, jc); - ch_ref(i - 1, k, jc) = c1_ref(i - 1, k, j) + c1_ref(i, k, jc); - ch_ref(i, k, j) = c1_ref(i, k, j) + c1_ref(i - 1, k, jc); - ch_ref(i, k, jc) = c1_ref(i, k, j) - c1_ref(i - 1, k, jc); - } - } - } - } else { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (i = 3; i <= ido; i += 2) { - for (k = 1; k <= l1; ++k) { - ch_ref(i - 1, k, j) = c1_ref(i - 1, k, j) - c1_ref(i, k, jc); - ch_ref(i - 1, k, jc) = c1_ref(i - 1, k, j) + c1_ref(i, k, jc); - ch_ref(i, k, j) = c1_ref(i, k, j) + c1_ref(i - 1, k, jc); - ch_ref(i, k, jc) = c1_ref(i, k, j) - c1_ref(i - 1, k, jc); - } - } - } - } - } - if (ido == 1) { - return; - } - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, 1) = ch2_ref(ik, 1); - } - for (j = 2; j <= ip; ++j) { - for (k = 1; k <= l1; ++k) { - c1_ref(1, k, j) = ch_ref(1, k, j); - } - } - if (nbd <= l1) { - is = -(ido); - for (j = 2; j <= ip; ++j) { - is += ido; - idij = is; - for (i = 3; i <= ido; i += 2) { - idij += 2; - for (k = 1; k <= l1; ++k) { - c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) - - wa[idij] * ch_ref(i, k, j); - c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + wa[idij] * ch_ref(i - 1, k, j); - } - } - } - } else { - is = -(ido); - for (j = 2; j <= ip; ++j) { - is += ido; - for (k = 1; k <= l1; ++k) { - idij = is; - for (i = 3; i <= ido; i += 2) { - idij += 2; - c1_ref(i - 1, k, j) = wa[idij - 1] * ch_ref(i - 1, k, j) - - wa[idij] * ch_ref(i, k, j); - c1_ref(i, k, j) = wa[idij - 1] * ch_ref(i, k, j) + wa[idij] * ch_ref(i - 1, k, j); - } - } - } - } -} /* radbg */ - -#undef ch2_ref -#undef ch_ref -#undef cc_ref -#undef c2_ref -#undef c1_ref - - -static void radf2(integer ido, integer l1, const real *cc, real *ch, - const real *wa1) -{ - /* System generated locals */ - integer ch_offset, cc_offset; - - /* Local variables */ - integer i, k, ic; - real ti2, tr2; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*2 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * 3; - ch -= ch_offset; - cc_offset = 1 + ido * (1 + l1); - cc -= cc_offset; - --wa1; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - ch_ref(1, 1, k) = cc_ref(1, k, 1) + cc_ref(1, k, 2); - ch_ref(ido, 2, k) = cc_ref(1, k, 1) - cc_ref(1, k, 2); - } - if (ido < 2) return; - if (ido != 2) { - idp2 = ido + 2; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - tr2 = wa1[i - 2] * cc_ref(i - 1, k, 2) + wa1[i - 1] * - cc_ref(i, k, 2); - ti2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref( - i - 1, k, 2); - ch_ref(i, 1, k) = cc_ref(i, k, 1) + ti2; - ch_ref(ic, 2, k) = ti2 - cc_ref(i, k, 1); - ch_ref(i - 1, 1, k) = cc_ref(i - 1, k, 1) + tr2; - ch_ref(ic - 1, 2, k) = cc_ref(i - 1, k, 1) - tr2; - } - } - if (ido % 2 == 1) { - return; - } - } - for (k = 1; k <= l1; ++k) { - ch_ref(1, 2, k) = -cc_ref(ido, k, 2); - ch_ref(ido, 1, k) = cc_ref(ido, k, 1); - } -} /* radf2 */ - -#undef ch_ref -#undef cc_ref - - -static void radf3(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2) -{ - static const real taur = -.5f; - static const real taui = .866025403784439f; - - /* System generated locals */ - integer ch_offset, cc_offset; - - /* Local variables */ - integer i, k, ic; - real ci2, di2, di3, cr2, dr2, dr3, ti2, ti3, tr2, tr3; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*3 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + (ido << 2); - ch -= ch_offset; - cc_offset = 1 + ido * (1 + l1); - cc -= cc_offset; - --wa1; - --wa2; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - cr2 = cc_ref(1, k, 2) + cc_ref(1, k, 3); - ch_ref(1, 1, k) = cc_ref(1, k, 1) + cr2; - ch_ref(1, 3, k) = taui * (cc_ref(1, k, 3) - cc_ref(1, k, 2)); - ch_ref(ido, 2, k) = cc_ref(1, k, 1) + 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] * cc_ref(i - 1, k, 2) + wa1[i - 1] * - cc_ref(i, k, 2); - di2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref( - i - 1, k, 2); - dr3 = wa2[i - 2] * cc_ref(i - 1, k, 3) + wa2[i - 1] * - cc_ref(i, k, 3); - di3 = wa2[i - 2] * cc_ref(i, k, 3) - wa2[i - 1] * cc_ref( - i - 1, k, 3); - cr2 = dr2 + dr3; - ci2 = di2 + di3; - ch_ref(i - 1, 1, k) = cc_ref(i - 1, k, 1) + cr2; - ch_ref(i, 1, k) = cc_ref(i, k, 1) + ci2; - tr2 = cc_ref(i - 1, k, 1) + taur * cr2; - ti2 = cc_ref(i, k, 1) + taur * ci2; - tr3 = taui * (di2 - di3); - ti3 = taui * (dr3 - dr2); - ch_ref(i - 1, 3, k) = tr2 + tr3; - ch_ref(ic - 1, 2, k) = tr2 - tr3; - ch_ref(i, 3, k) = ti2 + ti3; - ch_ref(ic, 2, k) = ti3 - ti2; - } - } -} /* radf3 */ - -#undef ch_ref -#undef cc_ref - - -static void radf4(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3) -{ - /* Initialized data */ - - static const real hsqt2 = .7071067811865475f; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k, ic; - real ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*4 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * 5; - ch -= ch_offset; - cc_offset = 1 + ido * (1 + l1); - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - tr1 = cc_ref(1, k, 2) + cc_ref(1, k, 4); - tr2 = cc_ref(1, k, 1) + cc_ref(1, k, 3); - ch_ref(1, 1, k) = tr1 + tr2; - ch_ref(ido, 4, k) = tr2 - tr1; - ch_ref(ido, 2, k) = cc_ref(1, k, 1) - cc_ref(1, k, 3); - ch_ref(1, 3, k) = cc_ref(1, k, 4) - cc_ref(1, k, 2); - } - if (ido < 2) return; - if (ido != 2) { - idp2 = ido + 2; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - cr2 = wa1[i - 2] * cc_ref(i - 1, k, 2) + wa1[i - 1] * - cc_ref(i, k, 2); - ci2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref( - i - 1, k, 2); - cr3 = wa2[i - 2] * cc_ref(i - 1, k, 3) + wa2[i - 1] * - cc_ref(i, k, 3); - ci3 = wa2[i - 2] * cc_ref(i, k, 3) - wa2[i - 1] * cc_ref( - i - 1, k, 3); - cr4 = wa3[i - 2] * cc_ref(i - 1, k, 4) + wa3[i - 1] * - cc_ref(i, k, 4); - ci4 = wa3[i - 2] * cc_ref(i, k, 4) - wa3[i - 1] * cc_ref( - i - 1, k, 4); - tr1 = cr2 + cr4; - tr4 = cr4 - cr2; - ti1 = ci2 + ci4; - ti4 = ci2 - ci4; - ti2 = cc_ref(i, k, 1) + ci3; - ti3 = cc_ref(i, k, 1) - ci3; - tr2 = cc_ref(i - 1, k, 1) + cr3; - tr3 = cc_ref(i - 1, k, 1) - cr3; - ch_ref(i - 1, 1, k) = tr1 + tr2; - ch_ref(ic - 1, 4, k) = tr2 - tr1; - ch_ref(i, 1, k) = ti1 + ti2; - ch_ref(ic, 4, k) = ti1 - ti2; - ch_ref(i - 1, 3, k) = ti4 + tr3; - ch_ref(ic - 1, 2, k) = tr3 - ti4; - ch_ref(i, 3, k) = tr4 + ti3; - ch_ref(ic, 2, k) = tr4 - ti3; - } - } - if (ido % 2 == 1) { - return; - } - } - for (k = 1; k <= l1; ++k) { - ti1 = -hsqt2 * (cc_ref(ido, k, 2) + cc_ref(ido, k, 4)); - tr1 = hsqt2 * (cc_ref(ido, k, 2) - cc_ref(ido, k, 4)); - ch_ref(ido, 1, k) = tr1 + cc_ref(ido, k, 1); - ch_ref(ido, 3, k) = cc_ref(ido, k, 1) - tr1; - ch_ref(1, 2, k) = ti1 - cc_ref(ido, k, 3); - ch_ref(1, 4, k) = ti1 + cc_ref(ido, k, 3); - } -} /* radf4 */ - -#undef ch_ref -#undef cc_ref - - -static void radf5(integer ido, integer l1, const real *cc, real *ch, - const real *wa1, const real *wa2, const real *wa3, const real *wa4) -{ - /* Initialized data */ - - static const real tr11 = .309016994374947f; - static const real ti11 = .951056516295154f; - static const real tr12 = -.809016994374947f; - static const real ti12 = .587785252292473f; - - /* System generated locals */ - integer cc_offset, ch_offset; - - /* Local variables */ - integer i, k, ic; - real ci2, di2, ci4, ci5, di3, di4, di5, ci3, cr2, cr3, dr2, dr3, dr4, dr5, - cr5, cr4, ti2, ti3, ti5, ti4, tr2, tr3, tr4, tr5; - integer idp2; - - -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*5 + (a_2))*ido + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * 6; - ch -= ch_offset; - cc_offset = 1 + ido * (1 + l1); - cc -= cc_offset; - --wa1; - --wa2; - --wa3; - --wa4; - - /* Function Body */ - for (k = 1; k <= l1; ++k) { - cr2 = cc_ref(1, k, 5) + cc_ref(1, k, 2); - ci5 = cc_ref(1, k, 5) - cc_ref(1, k, 2); - cr3 = cc_ref(1, k, 4) + cc_ref(1, k, 3); - ci4 = cc_ref(1, k, 4) - cc_ref(1, k, 3); - ch_ref(1, 1, k) = cc_ref(1, k, 1) + cr2 + cr3; - ch_ref(ido, 2, k) = cc_ref(1, k, 1) + tr11 * cr2 + tr12 * cr3; - ch_ref(1, 3, k) = ti11 * ci5 + ti12 * ci4; - ch_ref(ido, 4, k) = cc_ref(1, k, 1) + tr12 * cr2 + tr11 * cr3; - ch_ref(1, 5, k) = ti12 * ci5 - ti11 * ci4; - } - 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] * cc_ref(i - 1, k, 2) + wa1[i - 1] * cc_ref(i, k, 2); - di2 = wa1[i - 2] * cc_ref(i, k, 2) - wa1[i - 1] * cc_ref(i - 1, k, 2); - dr3 = wa2[i - 2] * cc_ref(i - 1, k, 3) + wa2[i - 1] * cc_ref(i, k, 3); - di3 = wa2[i - 2] * cc_ref(i, k, 3) - wa2[i - 1] * cc_ref(i - 1, k, 3); - dr4 = wa3[i - 2] * cc_ref(i - 1, k, 4) + wa3[i - 1] * cc_ref(i, k, 4); - di4 = wa3[i - 2] * cc_ref(i, k, 4) - wa3[i - 1] * cc_ref(i - 1, k, 4); - dr5 = wa4[i - 2] * cc_ref(i - 1, k, 5) + wa4[i - 1] * cc_ref(i, k, 5); - di5 = wa4[i - 2] * cc_ref(i, k, 5) - wa4[i - 1] * cc_ref(i - 1, k, 5); - cr2 = dr2 + dr5; - ci5 = dr5 - dr2; - cr5 = di2 - di5; - ci2 = di2 + di5; - cr3 = dr3 + dr4; - ci4 = dr4 - dr3; - cr4 = di3 - di4; - ci3 = di3 + di4; - ch_ref(i - 1, 1, k) = cc_ref(i - 1, k, 1) + cr2 + cr3; - ch_ref(i, 1, k) = cc_ref(i, k, 1) + ci2 + ci3; - tr2 = cc_ref(i - 1, k, 1) + tr11 * cr2 + tr12 * cr3; - ti2 = cc_ref(i, k, 1) + tr11 * ci2 + tr12 * ci3; - tr3 = cc_ref(i - 1, k, 1) + tr12 * cr2 + tr11 * cr3; - ti3 = cc_ref(i, k, 1) + tr12 * ci2 + tr11 * ci3; - tr5 = ti11 * cr5 + ti12 * cr4; - ti5 = ti11 * ci5 + ti12 * ci4; - tr4 = ti12 * cr5 - ti11 * cr4; - ti4 = ti12 * ci5 - ti11 * ci4; - ch_ref(i - 1, 3, k) = tr2 + tr5; - ch_ref(ic - 1, 2, k) = tr2 - tr5; - ch_ref(i, 3, k) = ti2 + ti5; - ch_ref(ic, 2, k) = ti5 - ti2; - ch_ref(i - 1, 5, k) = tr3 + tr4; - ch_ref(ic - 1, 4, k) = tr3 - tr4; - ch_ref(i, 5, k) = ti3 + ti4; - ch_ref(ic, 4, k) = ti4 - ti3; - } - } -} /* radf5 */ - -#undef ch_ref -#undef cc_ref - - -static void radfg(integer ido, integer ip, integer l1, integer idl1, - real *cc, real *c1, real *c2, real *ch, real *ch2, const real *wa) -{ - /* System generated locals */ - integer ch_offset, cc_offset, - c1_offset, c2_offset, ch2_offset; - - /* Local variables */ - integer i, j, k, l, j2, ic, jc, lc, ik, is; - real dc2, ai1, ai2, ar1, ar2, ds2; - integer nbd; - real dcp, arg, dsp, ar1h, ar2h; - integer idp2, ipp2, idij, ipph; - - -#define c1_ref(a_1,a_2,a_3) c1[((a_3)*l1 + (a_2))*ido + a_1] -#define c2_ref(a_1,a_2) c2[(a_2)*idl1 + a_1] -#define cc_ref(a_1,a_2,a_3) cc[((a_3)*ip + (a_2))*ido + a_1] -#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1] -#define ch2_ref(a_1,a_2) ch2[(a_2)*idl1 + a_1] - - /* Parameter adjustments */ - ch_offset = 1 + ido * (1 + l1); - ch -= ch_offset; - c1_offset = 1 + ido * (1 + l1); - c1 -= c1_offset; - cc_offset = 1 + ido * (1 + ip); - cc -= cc_offset; - ch2_offset = 1 + idl1; - ch2 -= ch2_offset; - c2_offset = 1 + idl1; - c2 -= c2_offset; - --wa; - - /* Function Body */ - arg = (2*M_PI) / (real) (ip); - dcp = FFTPACK_COS(arg); - dsp = FFTPACK_SIN(arg); - ipph = (ip + 1) / 2; - ipp2 = ip + 2; - idp2 = ido + 2; - nbd = (ido - 1) / 2; - if (ido == 1) { - for (ik = 1; ik <= idl1; ++ik) { - c2_ref(ik, 1) = ch2_ref(ik, 1); - } - } else { - for (ik = 1; ik <= idl1; ++ik) { - ch2_ref(ik, 1) = c2_ref(ik, 1); - } - for (j = 2; j <= ip; ++j) { - for (k = 1; k <= l1; ++k) { - ch_ref(1, k, j) = c1_ref(1, k, j); - } - } - if (nbd <= l1) { - is = -(ido); - for (j = 2; j <= ip; ++j) { - is += ido; - idij = is; - for (i = 3; i <= ido; i += 2) { - idij += 2; - for (k = 1; k <= l1; ++k) { - ch_ref(i - 1, k, j) = wa[idij - 1] * c1_ref(i - 1, k, j) - + wa[idij] * c1_ref(i, k, j); - ch_ref(i, k, j) = wa[idij - 1] * c1_ref(i, k, j) - wa[ - idij] * c1_ref(i - 1, k, j); - } - } - } - } else { - is = -(ido); - for (j = 2; j <= ip; ++j) { - is += ido; - for (k = 1; k <= l1; ++k) { - idij = is; - for (i = 3; i <= ido; i += 2) { - idij += 2; - ch_ref(i - 1, k, j) = wa[idij - 1] * c1_ref(i - 1, k, j) - + wa[idij] * c1_ref(i, k, j); - ch_ref(i, k, j) = wa[idij - 1] * c1_ref(i, k, j) - wa[ - idij] * c1_ref(i - 1, k, j); - } - } - } - } - if (nbd >= l1) { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - c1_ref(i - 1, k, j) = ch_ref(i - 1, k, j) + ch_ref(i - - 1, k, jc); - c1_ref(i - 1, k, jc) = ch_ref(i, k, j) - ch_ref(i, k, - jc); - c1_ref(i, k, j) = ch_ref(i, k, j) + ch_ref(i, k, jc); - c1_ref(i, k, jc) = ch_ref(i - 1, k, jc) - ch_ref(i - 1, - k, j); - } - } - } - } else { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (i = 3; i <= ido; i += 2) { - for (k = 1; k <= l1; ++k) { - c1_ref(i - 1, k, j) = ch_ref(i - 1, k, j) + ch_ref(i - - 1, k, jc); - c1_ref(i - 1, k, jc) = ch_ref(i, k, j) - ch_ref(i, k, - jc); - c1_ref(i, k, j) = ch_ref(i, k, j) + ch_ref(i, k, jc); - c1_ref(i, k, jc) = ch_ref(i - 1, k, jc) - ch_ref(i - 1, - k, j); - } - } - } - } - } - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - for (k = 1; k <= l1; ++k) { - c1_ref(1, k, j) = ch_ref(1, k, j) + ch_ref(1, k, jc); - c1_ref(1, k, jc) = ch_ref(1, k, jc) - ch_ref(1, k, j); - } - } - - ar1 = 1.f; - ai1 = 0.f; - for (l = 2; l <= ipph; ++l) { - lc = ipp2 - l; - ar1h = dcp * ar1 - dsp * ai1; - ai1 = dcp * ai1 + dsp * ar1; - ar1 = ar1h; - for (ik = 1; ik <= idl1; ++ik) { - ch2_ref(ik, l) = c2_ref(ik, 1) + ar1 * c2_ref(ik, 2); - ch2_ref(ik, lc) = ai1 * c2_ref(ik, ip); - } - dc2 = ar1; - ds2 = ai1; - ar2 = ar1; - ai2 = ai1; - for (j = 3; j <= ipph; ++j) { - jc = ipp2 - j; - ar2h = dc2 * ar2 - ds2 * ai2; - ai2 = dc2 * ai2 + ds2 * ar2; - ar2 = ar2h; - for (ik = 1; ik <= idl1; ++ik) { - ch2_ref(ik, l) = ch2_ref(ik, l) + ar2 * c2_ref(ik, j); - ch2_ref(ik, lc) = ch2_ref(ik, lc) + ai2 * c2_ref(ik, jc); - } - } - } - for (j = 2; j <= ipph; ++j) { - for (ik = 1; ik <= idl1; ++ik) { - ch2_ref(ik, 1) = ch2_ref(ik, 1) + c2_ref(ik, j); - } - } - - if (ido >= l1) { - for (k = 1; k <= l1; ++k) { - for (i = 1; i <= ido; ++i) { - cc_ref(i, 1, k) = ch_ref(i, k, 1); - } - } - } else { - for (i = 1; i <= ido; ++i) { - for (k = 1; k <= l1; ++k) { - cc_ref(i, 1, k) = ch_ref(i, k, 1); - } - } - } - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - j2 = j + j; - for (k = 1; k <= l1; ++k) { - cc_ref(ido, j2 - 2, k) = ch_ref(1, k, j); - cc_ref(1, j2 - 1, k) = ch_ref(1, k, jc); - } - } - if (ido == 1) { - return; - } - if (nbd >= l1) { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - j2 = j + j; - for (k = 1; k <= l1; ++k) { - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - cc_ref(i - 1, j2 - 1, k) = ch_ref(i - 1, k, j) + ch_ref( - i - 1, k, jc); - cc_ref(ic - 1, j2 - 2, k) = ch_ref(i - 1, k, j) - ch_ref( - i - 1, k, jc); - cc_ref(i, j2 - 1, k) = ch_ref(i, k, j) + ch_ref(i, k, - jc); - cc_ref(ic, j2 - 2, k) = ch_ref(i, k, jc) - ch_ref(i, k, j) - ; - } - } - } - } else { - for (j = 2; j <= ipph; ++j) { - jc = ipp2 - j; - j2 = j + j; - for (i = 3; i <= ido; i += 2) { - ic = idp2 - i; - for (k = 1; k <= l1; ++k) { - cc_ref(i - 1, j2 - 1, k) = ch_ref(i - 1, k, j) + ch_ref( - i - 1, k, jc); - cc_ref(ic - 1, j2 - 2, k) = ch_ref(i - 1, k, j) - ch_ref( - i - 1, k, jc); - cc_ref(i, j2 - 1, k) = ch_ref(i, k, j) + ch_ref(i, k, - jc); - cc_ref(ic, j2 - 2, k) = ch_ref(i, k, jc) - ch_ref(i, k, j) - ; - } - } - } - } -} /* radfg */ - -#undef ch2_ref -#undef ch_ref -#undef cc_ref -#undef c2_ref -#undef c1_ref - - -static void cfftb1(integer n, real *c, real *ch, const real *wa, integer *ifac) -{ - integer i, k1, l1, l2, na, nf, ip, iw, ix2, ix3, ix4, nac, ido, - idl1, idot; - - /* Function Body */ - nf = ifac[1]; - na = 0; - l1 = 1; - iw = 0; - for (k1 = 1; k1 <= nf; ++k1) { - ip = ifac[k1 + 1]; - l2 = ip * l1; - ido = n / l2; - idot = ido + ido; - idl1 = idot * l1; - switch (ip) { - case 4: - ix2 = iw + idot; - ix3 = ix2 + idot; - passb4(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3]); - na = 1 - na; - break; - case 2: - passb2(idot, l1, na?ch:c, na?c:ch, &wa[iw]); - na = 1 - na; - break; - case 3: - ix2 = iw + idot; - passb3(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2]); - na = 1 - na; - break; - case 5: - ix2 = iw + idot; - ix3 = ix2 + idot; - ix4 = ix3 + idot; - passfb5(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], +1); - na = 1 - na; - break; - default: - if (na == 0) { - passfb(&nac, idot, ip, l1, idl1, c, c, c, ch, ch, &wa[iw], +1); - } else { - passfb(&nac, idot, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw], +1); - } - if (nac != 0) { - na = 1 - na; - } - break; - } - l1 = l2; - iw += (ip - 1) * idot; - } - if (na == 0) { - return; - } - for (i = 0; i < 2*n; ++i) { - c[i] = ch[i]; - } -} /* cfftb1 */ - -void cfftb(integer n, real *c, real *wsave) -{ - integer iw1, iw2; - - /* Parameter adjustments */ - --wsave; - --c; - - /* Function Body */ - if (n == 1) { - return; - } - iw1 = 2*n + 1; - iw2 = iw1 + 2*n; - cfftb1(n, &c[1], &wsave[1], &wsave[iw1], (int*)&wsave[iw2]); -} /* cfftb */ - -static void cfftf1(integer n, real *c, real *ch, const real *wa, integer *ifac) -{ - /* Local variables */ - integer i, k1, l1, l2, na, nf, ip, iw, ix2, ix3, ix4, nac, ido, - idl1, idot; - - /* Function Body */ - nf = ifac[1]; - na = 0; - l1 = 1; - iw = 0; - for (k1 = 1; k1 <= nf; ++k1) { - ip = ifac[k1 + 1]; - l2 = ip * l1; - ido = n / l2; - idot = ido + ido; - idl1 = idot * l1; - switch (ip) { - case 4: - ix2 = iw + idot; - ix3 = ix2 + idot; - passf4(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3]); - na = 1 - na; - break; - case 2: - passf2(idot, l1, na?ch:c, na?c:ch, &wa[iw]); - na = 1 - na; - break; - case 3: - ix2 = iw + idot; - passf3(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2]); - na = 1 - na; - break; - case 5: - ix2 = iw + idot; - ix3 = ix2 + idot; - ix4 = ix3 + idot; - passfb5(idot, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], -1); - na = 1 - na; - break; - default: - if (na == 0) { - passfb(&nac, idot, ip, l1, idl1, c, c, c, ch, ch, &wa[iw], -1); - } else { - passfb(&nac, idot, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw], -1); - } - if (nac != 0) { - na = 1 - na; - } - break; - } - l1 = l2; - iw += (ip - 1)*idot; - } - if (na == 0) { - return; - } - for (i = 0; i < 2*n; ++i) { - c[i] = ch[i]; - } -} /* cfftf1 */ - -void cfftf(integer n, real *c, real *wsave) -{ - integer iw1, iw2; - - /* Parameter adjustments */ - --wsave; - --c; - - /* Function Body */ - if (n == 1) { - return; - } - iw1 = 2*n + 1; - iw2 = iw1 + 2*n; - cfftf1(n, &c[1], &wsave[1], &wsave[iw1], (int*)&wsave[iw2]); -} /* cfftf */ - -static int decompose(integer n, integer *ifac, integer ntryh[4]) { - integer ntry=0, nl = n, nf = 0, nq, nr, i, j = 0; - do { - if (j < 4) { - ntry = ntryh[j]; - } else { - ntry += 2; - } - ++j; - L104: - nq = nl / ntry; - nr = nl - ntry * nq; - if (nr != 0) continue; - ++nf; - ifac[nf + 2] = ntry; - nl = nq; - if (ntry == 2 && nf != 1) { - for (i = 2; i <= nf; ++i) { - integer ib = nf - i + 2; - ifac[ib + 2] = ifac[ib + 1]; - } - ifac[3] = 2; - } - if (nl != 1) { - goto L104; - } - } while (nl != 1); - ifac[1] = n; - ifac[2] = nf; - return nf; -} - -static void cffti1(integer n, real *wa, integer *ifac) -{ - static integer ntryh[4] = { 3,4,2,5 }; - - /* Local variables */ - integer i, j, i1, k1, l1, l2; - real fi; - integer ld, ii, nf, ip; - real arg; - integer ido, ipm; - real argh; - integer idot; - real argld; - - /* Parameter adjustments */ - --ifac; - --wa; - - nf = decompose(n, ifac, ntryh); - - argh = (2*M_PI) / (real) (n); - i = 2; - l1 = 1; - for (k1 = 1; k1 <= nf; ++k1) { - ip = ifac[k1 + 2]; - ld = 0; - l2 = l1 * ip; - ido = n / l2; - idot = ido + ido + 2; - ipm = ip - 1; - for (j = 1; j <= ipm; ++j) { - i1 = i; - wa[i - 1] = 1.f; - wa[i] = 0.f; - ld += l1; - fi = 0.f; - argld = (real) ld * argh; - for (ii = 4; ii <= idot; ii += 2) { - i += 2; - fi += 1.f; - arg = fi * argld; - wa[i - 1] = FFTPACK_COS(arg); - wa[i] = FFTPACK_SIN(arg); - } - if (ip > 5) { - wa[i1 - 1] = wa[i - 1]; - wa[i1] = wa[i]; - }; - } - l1 = l2; - } -} /* cffti1 */ - -void cffti(integer n, real *wsave) -{ - integer iw1, iw2; - /* Parameter adjustments */ - --wsave; - - /* Function Body */ - if (n == 1) { - return; - } - iw1 = 2*n + 1; - iw2 = iw1 + 2*n; - cffti1(n, &wsave[iw1], (int*)&wsave[iw2]); - return; -} /* cffti */ - -static void rfftb1(integer n, real *c, real *ch, const real *wa, integer *ifac) -{ - /* Local variables */ - integer i, k1, l1, l2, na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; - - /* Function Body */ - nf = ifac[1]; - na = 0; - l1 = 1; - iw = 0; - for (k1 = 1; k1 <= nf; ++k1) { - ip = ifac[k1 + 1]; - l2 = ip * l1; - ido = n / l2; - idl1 = ido * l1; - switch (ip) { - case 4: - ix2 = iw + ido; - ix3 = ix2 + ido; - radb4(ido, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3]); - na = 1 - na; - break; - case 2: - radb2(ido, l1, na?ch:c, na?c:ch, &wa[iw]); - na = 1 - na; - break; - case 3: - ix2 = iw + ido; - radb3(ido, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2]); - na = 1 - na; - break; - case 5: - ix2 = iw + ido; - ix3 = ix2 + ido; - ix4 = ix3 + ido; - radb5(ido, l1, na?ch:c, na?c:ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4]); - na = 1 - na; - break; - default: - if (na == 0) { - radbg(ido, ip, l1, idl1, c, c, c, ch, ch, &wa[iw]); - } else { - radbg(ido, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw]); - } - if (ido == 1) { - na = 1 - na; - } - break; - } - l1 = l2; - iw += (ip - 1) * ido; - } - if (na == 0) { - return; - } - for (i = 0; i < n; ++i) { - c[i] = ch[i]; - } -} /* rfftb1 */ - -static void rfftf1(integer n, real *c, real *ch, const real *wa, integer *ifac) -{ - /* Local variables */ - integer i, k1, l1, l2, na, kh, nf, ip, iw, ix2, ix3, ix4, ido, idl1; - - /* Function Body */ - nf = ifac[1]; - na = 1; - l2 = n; - iw = n-1; - for (k1 = 1; k1 <= nf; ++k1) { - kh = nf - k1; - ip = ifac[kh + 2]; - l1 = l2 / ip; - ido = n / l2; - idl1 = ido * l1; - iw -= (ip - 1) * ido; - na = 1 - na; - switch (ip) { - case 4: - ix2 = iw + ido; - ix3 = ix2 + ido; - radf4(ido, l1, na ? ch : c, na ? c : ch, &wa[iw], &wa[ix2], &wa[ix3]); - break; - case 2: - radf2(ido, l1, na ? ch : c, na ? c : ch, &wa[iw]); - break; - case 3: - ix2 = iw + ido; - radf3(ido, l1, na ? ch : c, na ? c : ch, &wa[iw], &wa[ix2]); - break; - case 5: - ix2 = iw + ido; - ix3 = ix2 + ido; - ix4 = ix3 + ido; - radf5(ido, l1, na ? ch : c, na ? c : ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4]); - break; - default: - if (ido == 1) { - na = 1 - na; - } - if (na == 0) { - radfg(ido, ip, l1, idl1, c, c, c, ch, ch, &wa[iw]); - na = 1; - } else { - radfg(ido, ip, l1, idl1, ch, ch, ch, c, c, &wa[iw]); - na = 0; - } - break; - } - l2 = l1; - } - if (na == 1) { - return; - } - for (i = 0; i < n; ++i) { - c[i] = ch[i]; - } -} - -void rfftb(integer n, real *r, real *wsave) -{ - - /* Parameter adjustments */ - --wsave; - --r; - - /* Function Body */ - if (n == 1) { - return; - } - rfftb1(n, &r[1], &wsave[1], &wsave[n + 1], (int*)&wsave[(n << 1) + 1]); -} /* rfftb */ - -static void rffti1(integer n, real *wa, integer *ifac) -{ - static integer ntryh[4] = { 4,2,3,5 }; - - /* Local variables */ - integer i, j, k1, l1, l2; - real fi; - integer ld, ii, nf, ip, is; - real arg; - integer ido, ipm; - integer nfm1; - real argh; - real argld; - - /* Parameter adjustments */ - --ifac; - --wa; - - nf = decompose(n, ifac, ntryh); - - argh = (2*M_PI) / (real) (n); - is = 0; - nfm1 = nf - 1; - l1 = 1; - if (nfm1 == 0) { - return; - } - for (k1 = 1; k1 <= nfm1; ++k1) { - ip = ifac[k1 + 2]; - ld = 0; - l2 = l1 * ip; - ido = n / l2; - ipm = ip - 1; - for (j = 1; j <= ipm; ++j) { - ld += l1; - i = is; - argld = (real) ld * argh; - fi = 0.f; - for (ii = 3; ii <= ido; ii += 2) { - i += 2; - fi += 1.f; - arg = fi * argld; - wa[i - 1] = FFTPACK_COS(arg); - wa[i] = FFTPACK_SIN(arg); - } - is += ido; - } - l1 = l2; - } -} /* rffti1 */ - -void rfftf(integer n, real *r, real *wsave) -{ - - /* Parameter adjustments */ - --wsave; - --r; - - /* Function Body */ - if (n == 1) { - return; - } - rfftf1(n, &r[1], &wsave[1], &wsave[n + 1], (int*)&wsave[(n << 1) + 1]); -} /* rfftf */ - -void rffti(integer n, real *wsave) -{ - /* Parameter adjustments */ - --wsave; - - /* Function Body */ - if (n == 1) { - return; - } - rffti1(n, &wsave[n + 1], (int*)&wsave[(n << 1) + 1]); - return; -} /* rffti */ - -static void cosqb1(integer n, real *x, real *w, real *xh) -{ - /* Local variables */ - integer i, k, kc, np2, ns2; - real xim1; - integer modn; - - /* Parameter adjustments */ - --xh; - --w; - --x; - - /* Function Body */ - ns2 = (n + 1) / 2; - np2 = n + 2; - for (i = 3; i <= n; i += 2) { - xim1 = x[i - 1] + x[i]; - x[i] -= x[i - 1]; - x[i - 1] = xim1; - } - x[1] += x[1]; - modn = n % 2; - if (modn == 0) { - x[n] += x[n]; - } - rfftb(n, &x[1], &xh[1]); - for (k = 2; k <= ns2; ++k) { - kc = np2 - k; - xh[k] = w[k - 1] * x[kc] + w[kc - 1] * x[k]; - xh[kc] = w[k - 1] * x[k] - w[kc - 1] * x[kc]; - } - if (modn == 0) { - x[ns2 + 1] = w[ns2] * (x[ns2 + 1] + x[ns2 + 1]); - } - for (k = 2; k <= ns2; ++k) { - kc = np2 - k; - x[k] = xh[k] + xh[kc]; - x[kc] = xh[k] - xh[kc]; - } - x[1] += x[1]; -} /* cosqb1 */ - -void cosqb(integer n, real *x, real *wsave) -{ - /* Local variables */ - real x1; - - /* Parameter adjustments */ - --wsave; - --x; - - if (n < 2) { - x[1] *= 4.f; - } else if (n == 2) { - x1 = (x[1] + x[2]) * 4.f; - x[2] = M_SQRT8 * (x[1] - x[2]); - x[1] = x1; - } else { - cosqb1(n, &x[1], &wsave[1], &wsave[n + 1]); - } -} /* cosqb */ - -static void cosqf1(integer n, real *x, real *w, real *xh) -{ - /* Local variables */ - integer i, k, kc, np2, ns2; - real xim1; - integer modn; - - /* Parameter adjustments */ - --xh; - --w; - --x; - - /* Function Body */ - ns2 = (n + 1) / 2; - np2 = n + 2; - for (k = 2; k <= ns2; ++k) { - kc = np2 - k; - xh[k] = x[k] + x[kc]; - xh[kc] = x[k] - x[kc]; - } - modn = n % 2; - if (modn == 0) { - xh[ns2 + 1] = x[ns2 + 1] + x[ns2 + 1]; - } - for (k = 2; k <= ns2; ++k) { - kc = np2 - k; - x[k] = w[k - 1] * xh[kc] + w[kc - 1] * xh[k]; - x[kc] = w[k - 1] * xh[k] - w[kc - 1] * xh[kc]; - } - if (modn == 0) { - x[ns2 + 1] = w[ns2] * xh[ns2 + 1]; - } - rfftf(n, &x[1], &xh[1]); - for (i = 3; i <= n; i += 2) { - xim1 = x[i - 1] - x[i]; - x[i] = x[i - 1] + x[i]; - x[i - 1] = xim1; - } -} /* cosqf1 */ - -void cosqf(integer n, real *x, real *wsave) -{ - /* Local variables */ - real tsqx; - - /* Parameter adjustments */ - --wsave; - --x; - - if (n == 2) { - tsqx = M_SQRT2 * x[2]; - x[2] = x[1] - tsqx; - x[1] += tsqx; - } else if (n > 2) { - cosqf1(n, &x[1], &wsave[1], &wsave[n + 1]); - } -} /* cosqf */ - -void cosqi(integer n, real *wsave) -{ - /* Local variables */ - integer k; - real fk, dt; - - /* Parameter adjustments */ - --wsave; - - dt = M_PI/2 / (real) (n); - fk = 0.f; - for (k = 1; k <= n; ++k) { - fk += 1.f; - wsave[k] = FFTPACK_COS(fk * dt); - } - rffti(n, &wsave[n + 1]); -} /* cosqi */ - -void cost(integer n, real *x, real *wsave) -{ - /* Local variables */ - integer i, k; - real c1, t1, t2; - integer kc; - real xi; - integer nm1, np1; - real x1h; - integer ns2; - real tx2, x1p3, xim2; - integer modn; - - /* Parameter adjustments */ - --wsave; - --x; - - /* Function Body */ - nm1 = n - 1; - np1 = n + 1; - ns2 = n / 2; - if (n == 2) { - x1h = x[1] + x[2]; - x[2] = x[1] - x[2]; - x[1] = x1h; - } else if (n == 3) { - x1p3 = x[1] + x[3]; - tx2 = x[2] + x[2]; - x[2] = x[1] - x[3]; - x[1] = x1p3 + tx2; - x[3] = x1p3 - tx2; - } else if (n > 3) { - c1 = x[1] - x[n]; - x[1] += x[n]; - for (k = 2; k <= ns2; ++k) { - kc = np1 - k; - t1 = x[k] + x[kc]; - t2 = x[k] - x[kc]; - c1 += wsave[kc] * t2; - t2 = wsave[k] * t2; - x[k] = t1 - t2; - x[kc] = t1 + t2; - } - modn = n % 2; - if (modn != 0) { - x[ns2 + 1] += x[ns2 + 1]; - } - rfftf(nm1, &x[1], &wsave[n + 1]); - xim2 = x[2]; - x[2] = c1; - for (i = 4; i <= n; i += 2) { - xi = x[i]; - x[i] = x[i - 2] - x[i - 1]; - x[i - 1] = xim2; - xim2 = xi; - } - if (modn != 0) { - x[n] = xim2; - } - } -} /* cost */ - -void costi(integer n, real *wsave) -{ - /* Initialized data */ - - /* Local variables */ - integer k, kc; - real fk, dt; - integer nm1, np1, ns2; - - /* Parameter adjustments */ - --wsave; - - /* Function Body */ - if (n <= 3) { - return; - } - nm1 = n - 1; - np1 = n + 1; - ns2 = n / 2; - dt = M_PI / (real) nm1; - fk = 0.f; - for (k = 2; k <= ns2; ++k) { - kc = np1 - k; - fk += 1.f; - wsave[k] = FFTPACK_SIN(fk * dt) * 2.f; - wsave[kc] = FFTPACK_COS(fk * dt) * 2.f; - } - rffti(nm1, &wsave[n + 1]); -} /* costi */ - -void sinqb(integer n, real *x, real *wsave) -{ - /* Local variables */ - integer k, kc, ns2; - real xhold; - - /* Parameter adjustments */ - --wsave; - --x; - - /* Function Body */ - if (n <= 1) { - x[1] *= 4.f; - return; - } - ns2 = n / 2; - for (k = 2; k <= n; k += 2) { - x[k] = -x[k]; - } - cosqb(n, &x[1], &wsave[1]); - for (k = 1; k <= ns2; ++k) { - kc = n - k; - xhold = x[k]; - x[k] = x[kc + 1]; - x[kc + 1] = xhold; - } -} /* sinqb */ - -void sinqf(integer n, real *x, real *wsave) -{ - /* Local variables */ - integer k, kc, ns2; - real xhold; - - /* Parameter adjustments */ - --wsave; - --x; - - /* Function Body */ - if (n == 1) { - return; - } - ns2 = n / 2; - for (k = 1; k <= ns2; ++k) { - kc = n - k; - xhold = x[k]; - x[k] = x[kc + 1]; - x[kc + 1] = xhold; - } - cosqf(n, &x[1], &wsave[1]); - for (k = 2; k <= n; k += 2) { - x[k] = -x[k]; - } -} /* sinqf */ - -void sinqi(integer n, real *wsave) -{ - - /* Parameter adjustments */ - --wsave; - - /* Function Body */ - cosqi(n, &wsave[1]); -} /* sinqi */ - -static void sint1(integer n, real *war, real *was, real *xh, real * - x, integer *ifac) -{ - /* Initialized data */ - - static const real sqrt3 = 1.73205080756888f; - - /* Local variables */ - integer i, k; - real t1, t2; - integer kc, np1, ns2, modn; - real xhold; - - /* Parameter adjustments */ - --ifac; - --x; - --xh; - --was; - --war; - - /* Function Body */ - for (i = 1; i <= n; ++i) { - xh[i] = war[i]; - war[i] = x[i]; - } - - if (n < 2) { - xh[1] += xh[1]; - } else if (n == 2) { - xhold = sqrt3 * (xh[1] + xh[2]); - xh[2] = sqrt3 * (xh[1] - xh[2]); - xh[1] = xhold; - } else { - np1 = n + 1; - ns2 = n / 2; - x[1] = 0.f; - for (k = 1; k <= ns2; ++k) { - kc = np1 - k; - t1 = xh[k] - xh[kc]; - t2 = was[k] * (xh[k] + xh[kc]); - x[k + 1] = t1 + t2; - x[kc + 1] = t2 - t1; - } - modn = n % 2; - if (modn != 0) { - x[ns2 + 2] = xh[ns2 + 1] * 4.f; - } - rfftf1(np1, &x[1], &xh[1], &war[1], &ifac[1]); - xh[1] = x[1] * .5f; - for (i = 3; i <= n; i += 2) { - xh[i - 1] = -x[i]; - xh[i] = xh[i - 2] + x[i - 1]; - } - if (modn == 0) { - xh[n] = -x[n + 1]; - } - } - for (i = 1; i <= n; ++i) { - x[i] = war[i]; - war[i] = xh[i]; - } -} /* sint1 */ - -void sinti(integer n, real *wsave) -{ - /* Local variables */ - integer k; - real dt; - integer np1, ns2; - - /* Parameter adjustments */ - --wsave; - - /* Function Body */ - if (n <= 1) { - return; - } - ns2 = n / 2; - np1 = n + 1; - dt = M_PI / (real) np1; - for (k = 1; k <= ns2; ++k) { - wsave[k] = sin(k * dt) * 2.f; - } - rffti(np1, &wsave[ns2 + 1]); -} /* sinti */ - -void sint(integer n, real *x, real *wsave) -{ - integer np1, iw1, iw2, iw3; - - /* Parameter adjustments */ - --wsave; - --x; - - /* Function Body */ - np1 = n + 1; - iw1 = n / 2 + 1; - iw2 = iw1 + np1; - iw3 = iw2 + np1; - sint1(n, &x[1], &wsave[1], &wsave[iw1], &wsave[iw2], (int*)&wsave[iw3]); -} /* sint */ - -#ifdef TESTING_FFTPACK -#include - -int main(void) -{ - static integer nd[] = { 120,91,54,49,32,28,24,8,4,3,2 }; - - /* System generated locals */ - real r1, r2, r3; - f77complex q1, q2, q3; - - /* Local variables */ - integer i, j, k, n; - real w[2000], x[200], y[200], cf, fn, dt; - f77complex cx[200], cy[200]; - real xh[200]; - integer nz, nm1, np1, ns2; - real arg; - real sum, arg1, arg2; - real sum1, sum2, dcfb; - integer modn; - real rftb, rftf; - real rftfb; - real costt, sintt, dcfftb, dcfftf, cosqfb, costfb; - real sinqfb; - real sintfb; - real cosqbt, cosqft, sinqbt, sinqft; - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /* VERSION 4 APRIL 1985 */ - - /* A TEST DRIVER FOR */ - /* A PACKAGE OF FORTRAN SUBPROGRAMS FOR THE FAST FOURIER */ - /* TRANSFORM OF PERIODIC AND OTHER SYMMETRIC SEQUENCES */ - - /* BY */ - - /* PAUL N SWARZTRAUBER */ - - /* NATIONAL CENTER FOR ATMOSPHERIC RESEARCH BOULDER,COLORADO 80307 */ - - /* WHICH IS SPONSORED BY THE NATIONAL SCIENCE FOUNDATION */ - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - - /* THIS PROGRAM TESTS THE PACKAGE OF FAST FOURIER */ - /* TRANSFORMS FOR BOTH COMPLEX AND REAL PERIODIC SEQUENCES AND */ - /* CERTIAN OTHER SYMMETRIC SEQUENCES THAT ARE LISTED BELOW. */ - - /* 1. RFFTI INITIALIZE RFFTF AND RFFTB */ - /* 2. RFFTF FORWARD TRANSFORM OF A REAL PERIODIC SEQUENCE */ - /* 3. RFFTB BACKWARD TRANSFORM OF A REAL COEFFICIENT ARRAY */ - - /* 4. EZFFTI INITIALIZE EZFFTF AND EZFFTB */ - /* 5. EZFFTF A SIMPLIFIED REAL PERIODIC FORWARD TRANSFORM */ - /* 6. EZFFTB A SIMPLIFIED REAL PERIODIC BACKWARD TRANSFORM */ - - /* 7. SINTI INITIALIZE SINT */ - /* 8. SINT SINE TRANSFORM OF A REAL ODD SEQUENCE */ - - /* 9. COSTI INITIALIZE COST */ - /* 10. COST COSINE TRANSFORM OF A REAL EVEN SEQUENCE */ - - /* 11. SINQI INITIALIZE SINQF AND SINQB */ - /* 12. SINQF FORWARD SINE TRANSFORM WITH ODD WAVE NUMBERS */ - /* 13. SINQB UNNORMALIZED INVERSE OF SINQF */ - - /* 14. COSQI INITIALIZE COSQF AND COSQB */ - /* 15. COSQF FORWARD COSINE TRANSFORM WITH ODD WAVE NUMBERS */ - /* 16. COSQB UNNORMALIZED INVERSE OF COSQF */ - - /* 17. CFFTI INITIALIZE CFFTF AND CFFTB */ - /* 18. CFFTF FORWARD TRANSFORM OF A COMPLEX PERIODIC SEQUENCE */ - /* 19. CFFTB UNNORMALIZED INVERSE OF CFFTF */ - - - int all_ok = 1; - for (nz = 1; nz <= (int)(sizeof nd/sizeof nd[0]); ++nz) { - n = nd[nz - 1]; - modn = n % 2; - fn = (real) n; - np1 = n + 1; - nm1 = n - 1; - for (j = 1; j <= np1; ++j) { - x[j - 1] = sin((real) j * M_SQRT2); - y[j - 1] = x[j - 1]; - xh[j - 1] = x[j - 1]; - } - - /* TEST SUBROUTINES RFFTI,RFFTF AND RFFTB */ - - rffti(n, w); - dt = (2*M_PI) / fn; - ns2 = (n + 1) / 2; - if (ns2 < 2) { - goto L104; - } - for (k = 2; k <= ns2; ++k) { - sum1 = 0.f; - sum2 = 0.f; - arg = (real) (k - 1) * dt; - for (i = 1; i <= n; ++i) { - arg1 = (real) (i - 1) * arg; - sum1 += x[i - 1] * cos(arg1); - sum2 += x[i - 1] * sin(arg1); - } - y[(k << 1) - 3] = sum1; - y[(k << 1) - 2] = -sum2; - } - L104: - sum1 = 0.f; - sum2 = 0.f; - for (i = 1; i <= nm1; i += 2) { - sum1 += x[i - 1]; - sum2 += x[i]; - } - if (modn == 1) { - sum1 += x[n - 1]; - } - y[0] = sum1 + sum2; - if (modn == 0) { - y[n - 1] = sum1 - sum2; - } - rfftf(n, x, w); - rftf = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = rftf, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); - rftf = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - } - rftf /= fn; - for (i = 1; i <= n; ++i) { - sum = x[0] * .5f; - arg = (real) (i - 1) * dt; - if (ns2 < 2) { - goto L108; - } - for (k = 2; k <= ns2; ++k) { - arg1 = (real) (k - 1) * arg; - sum = sum + x[(k << 1) - 3] * cos(arg1) - x[(k << 1) - 2] * - sin(arg1); - } - L108: - if (modn == 0) { - sum += (real)pow(-1, i-1) * .5f * x[n - 1]; - } - y[i - 1] = sum + sum; - } - rfftb(n, x, w); - rftb = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = rftb, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); - rftb = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - y[i - 1] = xh[i - 1]; - } - rfftb(n, y, w); - rfftf(n, y, w); - cf = 1.f / fn; - rftfb = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = rftfb, r3 = (r1 = cf * y[i - 1] - x[i - 1], fabs( - r1)); - rftfb = dmax(r2,r3); - } - - /* TEST SUBROUTINES SINTI AND SINT */ - - dt = M_PI / fn; - for (i = 1; i <= nm1; ++i) { - x[i - 1] = xh[i - 1]; - } - for (i = 1; i <= nm1; ++i) { - y[i - 1] = 0.f; - arg1 = (real) i * dt; - for (k = 1; k <= nm1; ++k) { - y[i - 1] += x[k - 1] * sin((real) k * arg1); - } - y[i - 1] += y[i - 1]; - } - sinti(nm1, w); - sint(nm1, x, w); - cf = .5f / fn; - sintt = 0.f; - for (i = 1; i <= nm1; ++i) { - /* Computing MAX */ - r2 = sintt, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); - sintt = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - y[i - 1] = x[i - 1]; - } - sintt = cf * sintt; - sint(nm1, x, w); - sint(nm1, x, w); - sintfb = 0.f; - for (i = 1; i <= nm1; ++i) { - /* Computing MAX */ - r2 = sintfb, r3 = (r1 = cf * x[i - 1] - y[i - 1], fabs( - r1)); - sintfb = dmax(r2,r3); - } - - /* TEST SUBROUTINES COSTI AND COST */ - - for (i = 1; i <= np1; ++i) { - x[i - 1] = xh[i - 1]; - } - for (i = 1; i <= np1; ++i) { - y[i - 1] = (x[0] + (real) pow(-1, i+1) * x[n]) * .5f; - arg = (real) (i - 1) * dt; - for (k = 2; k <= n; ++k) { - y[i - 1] += x[k - 1] * FFTPACK_COS((real) (k - 1) * arg); - } - y[i - 1] += y[i - 1]; - } - costi(np1, w); - cost(np1, x, w); - costt = 0.f; - for (i = 1; i <= np1; ++i) { - /* Computing MAX */ - r2 = costt, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)); - costt = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - y[i - 1] = xh[i - 1]; - } - costt = cf * costt; - cost(np1, x, w); - cost(np1, x, w); - costfb = 0.f; - for (i = 1; i <= np1; ++i) { - /* Computing MAX */ - r2 = costfb, r3 = (r1 = cf * x[i - 1] - y[i - 1], fabs( - r1)); - costfb = dmax(r2,r3); - } - - /* TEST SUBROUTINES SINQI,SINQF AND SINQB */ - - cf = .25f / fn; - for (i = 1; i <= n; ++i) { - y[i - 1] = xh[i - 1]; - } - dt = M_PI / (fn + fn); - for (i = 1; i <= n; ++i) { - x[i - 1] = 0.f; - arg = dt * (real) i; - for (k = 1; k <= n; ++k) { - x[i - 1] += y[k - 1] * sin((real) (k + k - 1) * arg); - } - x[i - 1] *= 4.f; - } - sinqi(n, w); - sinqb(n, y, w); - sinqbt = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = sinqbt, r3 = (r1 = y[i - 1] - x[i - 1], fabs(r1)) - ; - sinqbt = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - } - sinqbt = cf * sinqbt; - for (i = 1; i <= n; ++i) { - arg = (real) (i + i - 1) * dt; - y[i - 1] = (real) pow(-1, i+1) * .5f * x[n - 1]; - for (k = 1; k <= nm1; ++k) { - y[i - 1] += x[k - 1] * sin((real) k * arg); - } - y[i - 1] += y[i - 1]; - } - sinqf(n, x, w); - sinqft = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = sinqft, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)) - ; - sinqft = dmax(r2,r3); - y[i - 1] = xh[i - 1]; - x[i - 1] = xh[i - 1]; - } - sinqf(n, y, w); - sinqb(n, y, w); - sinqfb = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = sinqfb, r3 = (r1 = cf * y[i - 1] - x[i - 1], fabs( - r1)); - sinqfb = dmax(r2,r3); - } - - /* TEST SUBROUTINES COSQI,COSQF AND COSQB */ - - for (i = 1; i <= n; ++i) { - y[i - 1] = xh[i - 1]; - } - for (i = 1; i <= n; ++i) { - x[i - 1] = 0.f; - arg = (real) (i - 1) * dt; - for (k = 1; k <= n; ++k) { - x[i - 1] += y[k - 1] * FFTPACK_COS((real) (k + k - 1) * arg); - } - x[i - 1] *= 4.f; - } - cosqi(n, w); - cosqb(n, y, w); - cosqbt = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = cosqbt, r3 = (r1 = x[i - 1] - y[i - 1], fabs(r1)) - ; - cosqbt = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - } - cosqbt = cf * cosqbt; - for (i = 1; i <= n; ++i) { - y[i - 1] = x[0] * .5f; - arg = (real) (i + i - 1) * dt; - for (k = 2; k <= n; ++k) { - y[i - 1] += x[k - 1] * FFTPACK_COS((real) (k - 1) * arg); - } - y[i - 1] += y[i - 1]; - } - cosqf(n, x, w); - cosqft = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = cosqft, r3 = (r1 = y[i - 1] - x[i - 1], fabs(r1)) - ; - cosqft = dmax(r2,r3); - x[i - 1] = xh[i - 1]; - y[i - 1] = xh[i - 1]; - } - cosqft = cf * cosqft; - cosqb(n, x, w); - cosqf(n, x, w); - cosqfb = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - r2 = cosqfb, r3 = (r1 = cf * x[i - 1] - y[i - 1], fabs(r1)); - cosqfb = dmax(r2,r3); - } - - /* TEST CFFTI,CFFTF,CFFTB */ - - for (i = 1; i <= n; ++i) { - r1 = FFTPACK_COS(M_SQRT2 * (real) i); - r2 = FFTPACK_SIN(M_SQRT2 * (real) (i * i)); - q1.r = r1, q1.i = r2; - cx[i-1].r = q1.r, cx[i-1].i = q1.i; - } - dt = (2*M_PI) / fn; - for (i = 1; i <= n; ++i) { - arg1 = -((real) (i - 1)) * dt; - cy[i-1].r = 0.f, cy[i-1].i = 0.f; - for (k = 1; k <= n; ++k) { - arg2 = (real) (k - 1) * arg1; - r1 = FFTPACK_COS(arg2); - r2 = FFTPACK_SIN(arg2); - q3.r = r1, q3.i = r2; - q2.r = q3.r * cx[k-1].r - q3.i * cx[k-1].i, q2.i = - q3.r * cx[k-1].i + q3.i * cx[k-1].r; - q1.r = cy[i-1].r + q2.r, q1.i = cy[i-1].i + q2.i; - cy[i-1].r = q1.r, cy[i-1].i = q1.i; - } - } - cffti(n, w); - cfftf(n, (real*)cx, w); - dcfftf = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - q1.r = cx[i-1].r - cy[i-1].r, q1.i = cx[i-1].i - cy[i-1] - .i; - r1 = dcfftf, r2 = c_abs(&q1); - dcfftf = dmax(r1,r2); - q1.r = cx[i-1].r / fn, q1.i = cx[i-1].i / fn; - cx[i-1].r = q1.r, cx[i-1].i = q1.i; - } - dcfftf /= fn; - for (i = 1; i <= n; ++i) { - arg1 = (real) (i - 1) * dt; - cy[i-1].r = 0.f, cy[i-1].i = 0.f; - for (k = 1; k <= n; ++k) { - arg2 = (real) (k - 1) * arg1; - r1 = FFTPACK_COS(arg2); - r2 = FFTPACK_SIN(arg2); - q3.r = r1, q3.i = r2; - q2.r = q3.r * cx[k-1].r - q3.i * cx[k-1].i, q2.i = - q3.r * cx[k-1].i + q3.i * cx[k-1].r; - q1.r = cy[i-1].r + q2.r, q1.i = cy[i-1].i + q2.i; - cy[i-1].r = q1.r, cy[i-1].i = q1.i; - } - } - cfftb(n, (real*)cx, w); - dcfftb = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - q1.r = cx[i-1].r - cy[i-1].r, q1.i = cx[i-1].i - cy[i-1].i; - r1 = dcfftb, r2 = c_abs(&q1); - dcfftb = dmax(r1,r2); - cx[i-1].r = cy[i-1].r, cx[i-1].i = cy[i-1].i; - } - cf = 1.f / fn; - cfftf(n, (real*)cx, w); - cfftb(n, (real*)cx, w); - dcfb = 0.f; - for (i = 1; i <= n; ++i) { - /* Computing MAX */ - q2.r = cf * cx[i-1].r, q2.i = cf * cx[i-1].i; - q1.r = q2.r - cy[i-1].r, q1.i = q2.i - cy[i-1].i; - r1 = dcfb, r2 = c_abs(&q1); - dcfb = dmax(r1,r2); - } - printf("%d\tRFFTF %10.3g\tRFFTB %10.ge\tRFFTFB %10.3g", n, rftf, rftb, rftfb); - printf( "\tSINT %10.3g\tSINTFB %10.ge\tCOST %10.3g\n", sintt, sintfb, costt); - printf( "\tCOSTFB %10.3g\tSINQF %10.ge\tSINQB %10.3g", costfb, sinqft, sinqbt); - printf( "\tSINQFB %10.3g\tCOSQF %10.ge\tCOSQB %10.3g\n", sinqfb, cosqft, cosqbt); - printf( "\tCOSQFB %10.3g\t", cosqfb); - printf( "\tCFFTF %10.ge\tCFFTB %10.3g\n", dcfftf, dcfftb); - printf( "\tCFFTFB %10.3g\n", dcfb); - -#define CHECK(x) if (x > 1e-3) { printf(#x " failed: %g\n", x); all_ok = 0; } - CHECK(rftf); CHECK(rftb); CHECK(rftfb); CHECK(sintt); CHECK(sintfb); CHECK(costt); - CHECK(costfb); CHECK(sinqft); CHECK(sinqbt); CHECK(sinqfb); CHECK(cosqft); CHECK(cosqbt); - CHECK(cosqfb); CHECK(dcfftf); CHECK(dcfftb); - } - - if (all_ok) printf("Everything looks fine.\n"); - else printf("ERRORS WERE DETECTED.\n"); - /* - expected: - 120 RFFTF 2.786e-06 RFFTB 6.847e-04 RFFTFB 2.795e-07 SINT 1.312e-06 SINTFB 1.237e-06 COST 1.319e-06 - COSTFB 4.355e-06 SINQF 3.281e-04 SINQB 1.876e-06 SINQFB 2.198e-07 COSQF 6.199e-07 COSQB 2.193e-06 - COSQFB 2.300e-07 DEZF 5.573e-06 DEZB 1.363e-05 DEZFB 1.371e-06 CFFTF 5.590e-06 CFFTB 4.751e-05 - CFFTFB 4.215e-07 - 54 RFFTF 4.708e-07 RFFTB 3.052e-05 RFFTFB 3.439e-07 SINT 3.532e-07 SINTFB 4.145e-07 COST 3.002e-07 - COSTFB 6.343e-07 SINQF 4.959e-05 SINQB 4.415e-07 SINQFB 2.882e-07 COSQF 2.826e-07 COSQB 2.472e-07 - COSQFB 3.439e-07 DEZF 9.388e-07 DEZB 5.066e-06 DEZFB 5.960e-07 CFFTF 1.426e-06 CFFTB 9.482e-06 - CFFTFB 2.980e-07 - 49 RFFTF 4.476e-07 RFFTB 5.341e-05 RFFTFB 2.574e-07 SINT 9.196e-07 SINTFB 9.401e-07 COST 8.174e-07 - COSTFB 1.331e-06 SINQF 4.005e-05 SINQB 9.342e-07 SINQFB 3.057e-07 COSQF 2.530e-07 COSQB 6.228e-07 - COSQFB 4.826e-07 DEZF 9.071e-07 DEZB 4.590e-06 DEZFB 5.960e-07 CFFTF 2.095e-06 CFFTB 1.414e-05 - CFFTFB 7.398e-07 - 32 RFFTF 4.619e-07 RFFTB 2.861e-05 RFFTFB 1.192e-07 SINT 3.874e-07 SINTFB 4.172e-07 COST 4.172e-07 - COSTFB 1.699e-06 SINQF 2.551e-05 SINQB 6.407e-07 SINQFB 2.980e-07 COSQF 1.639e-07 COSQB 1.714e-07 - COSQFB 2.384e-07 DEZF 1.013e-06 DEZB 2.339e-06 DEZFB 7.749e-07 CFFTF 1.127e-06 CFFTB 6.744e-06 - CFFTFB 2.666e-07 - 4 RFFTF 1.490e-08 RFFTB 1.490e-07 RFFTFB 5.960e-08 SINT 7.451e-09 SINTFB 0.000e+00 COST 2.980e-08 - COSTFB 1.192e-07 SINQF 4.768e-07 SINQB 2.980e-08 SINQFB 5.960e-08 COSQF 2.608e-08 COSQB 5.960e-08 - COSQFB 1.192e-07 DEZF 2.980e-08 DEZB 5.960e-08 DEZFB 0.000e+00 CFFTF 6.664e-08 CFFTB 5.960e-08 - CFFTFB 6.144e-08 - 3 RFFTF 3.974e-08 RFFTB 1.192e-07 RFFTFB 3.303e-08 SINT 1.987e-08 SINTFB 1.069e-08 COST 4.967e-08 - COSTFB 5.721e-08 SINQF 8.941e-08 SINQB 2.980e-08 SINQFB 1.259e-07 COSQF 7.451e-09 COSQB 4.967e-08 - COSQFB 7.029e-08 DEZF 1.192e-07 DEZB 5.960e-08 DEZFB 5.960e-08 CFFTF 7.947e-08 CFFTB 8.429e-08 - CFFTFB 9.064e-08 - 2 RFFTF 0.000e+00 RFFTB 0.000e+00 RFFTFB 0.000e+00 SINT 0.000e+00 SINTFB 0.000e+00 COST 0.000e+00 - COSTFB 0.000e+00 SINQF 1.192e-07 SINQB 2.980e-08 SINQFB 5.960e-08 COSQF 7.451e-09 COSQB 1.490e-08 - COSQFB 0.000e+00 DEZF 0.000e+00 DEZB 0.000e+00 DEZFB 0.000e+00 CFFTF 0.000e+00 CFFTB 5.960e-08 - CFFTFB 5.960e-08 - Everything looks fine. - - */ - - return all_ok ? 0 : 1; -} -#endif /* TESTING_FFTPACK */ From 1f61de7592b52bf97a825182441fb1b3da1e4deb Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sun, 25 Jan 2026 12:44:55 +0530 Subject: [PATCH 100/102] docs: refactor README, examples --- 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 status: passed - 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: 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 --- --- .../@stdlib/fft/base/fftpack/rfftf/README.md | 32 ++++++------------- .../fft/base/fftpack/rfftf/examples/index.js | 17 +++------- .../fft/base/fftpack/rfftf/lib/main.js | 2 +- .../fft/base/fftpack/rfftf/lib/radfg.js | 8 +---- 4 files changed, 16 insertions(+), 43 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md index 3b2ecd129d79..b3a2369d41b6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/README.md @@ -22,16 +22,6 @@ limitations under the License. > Compute the forward real-valued [fast Fourier transform (FFT)][fft]. - - -
- -
- - - - -
## Usage @@ -54,16 +44,16 @@ rffti( 4, workspace, 1, 0 ); var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); rfftf( 4, r, 1, 0, workspace, 1, 0 ); -// r => [ 10, -2, 2, -2 ] +// r => [ 10.0, -2.0, 2.0, -2.0 ] ``` -The function accepts the following arguments: +The function accepts the following parameters: - **N**: length of the sequence to transform. -- **r**: real input array which is modified in-place to store the FFT result. +- **r**: input array containing the sequence to transform. - **strideR**: stride length for `r`. - **offsetR**: starting index for `r`. -- **workspace**: workspace array initialized by `rffti`. +- **workspace**: workspace array containing pre-computed values. - **strideW**: stride length for `workspace`. - **offsetW**: starting index for `workspace`. @@ -92,8 +82,6 @@ The function accepts the following arguments: - -
## Examples @@ -102,17 +90,17 @@ The function accepts the following arguments: ```javascript var Float64Array = require( '@stdlib/array/float64' ); +var uniform = require( '@stdlib/random/array/uniform' ); var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); var rfftf = require( '@stdlib/fft/base/fftpack/rfftf' ); -var workspace; var N = 8; -var r; - -workspace = new Float64Array( ( 2*N ) + 34 ); +var workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); -r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var r = uniform( N, -10.0, 10.0, { + 'dtype': 'float64' +}); console.log( r ); rfftf( N, r, 1, 0, workspace, 1, 0 ); @@ -123,8 +111,6 @@ console.log( r ); - -
diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js index 3da7470f1e96..251be8f94b2e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/examples/index.js @@ -19,25 +19,18 @@ 'use strict'; var Float64Array = require( '@stdlib/array/float64' ); +var uniform = require( '@stdlib/random/array/uniform' ); var rffti = require( '@stdlib/fft/base/fftpack/rffti' ); var rfftf = require( './../lib' ); -var workspace; var N = 8; -var r; -var i; - -workspace = new Float64Array( ( 2*N ) + 34 ); +var workspace = new Float64Array( ( 2*N ) + 34 ); rffti( N, workspace, 1, 0 ); -r = new Float64Array( N ); -for ( i = 0; i < N; i++ ) { - r[ i ] = i + 1; -} -console.log( 'Input sequence:' ); +var r = uniform( N, -10.0, 10.0, { + 'dtype': 'float64' +}); console.log( r ); rfftf( N, r, 1, 0, workspace, 1, 0 ); - -console.log( 'FFT output (half-complex format):' ); console.log( r ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js index e3622e53e79c..0e54338933a1 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js @@ -72,7 +72,7 @@ var rfftf1 = require( './rfftf1.js' ); * Computes the forward real-valued fast Fourier transform (FFT). * * @param {NonNegativeInteger} N - length of the sequence to transform -* @param {Float64Array} r - input/output array containing the sequence to transform +* @param {Float64Array} r - input array containing the sequence to transform * @param {integer} strideR - stride length for `r` * @param {NonNegativeInteger} offsetR - starting index for `r` * @param {Float64Array} workspace - workspace array containing pre-computed values diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js index 05c960851134..f6a7f27efc81 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/radfg.js @@ -58,7 +58,7 @@ // TODO: Add better and more descriptive comments throughout this file -/* eslint-disable max-len, max-statements, max-depth, max-lines, max-lines-per-function */ +/* eslint-disable max-len, max-statements, max-lines, max-lines-per-function */ 'use strict'; @@ -206,12 +206,6 @@ function ch2Ptr( ik, j, idl1, stride, offset ) { // ch2_ref /** * Performs one general radix stage within a forward Fourier transform for a real-valued sequence. * -* ## Notes -* -* - This function handles arbitrary radix values (not just 2, 3, 4, or 5). -* - It is used as a fallback when the radix doesn't match the optimized special cases. -* - The algorithm uses a Cooley-Tukey-style decomposition with twiddle factor multiplication. -* * @private * @param {NonNegativeInteger} M - number of elements in each sub-sequence to be transformed (ido) * @param {NonNegativeInteger} R - radix of the transform (ip) From aeb9d710394de2405e51c6f648b76259bcb2daaf Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 28 Jan 2026 23:25:24 +0530 Subject: [PATCH 101/102] bench: refactor benchmarks in decompose to use correct array size --- 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 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 --- --- .../base/fftpack/decompose/benchmark/benchmark.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js index 9e8ffd5c5823..57a0b8f5e018 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js @@ -22,11 +22,18 @@ var bench = require( '@stdlib/bench' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var log2 = require( '@stdlib/math/base/special/log2' ); var zeros = require( '@stdlib/array/zeros' ); var pkg = require( './../package.json' ).name; var decompose = require( './../lib' ); +// VARIABLES // + +var initial = [ 3, 4, 2, 5 ]; // as found in FFTPACK + + // FUNCTIONS // /** @@ -37,7 +44,7 @@ var decompose = require( './../lib' ); * @returns {Function} benchmark function */ function createBenchmark( N ) { - var initial = [ 3, 4, 2, 5 ]; + var factors = zeros( 2 + floor( log2( N ) ) ); return benchmark; /** @@ -47,12 +54,9 @@ function createBenchmark( N ) { * @param {Benchmark} b - benchmark instance */ function benchmark( b ) { - var factors; var out; var i; - factors = zeros( 6 ); - b.tic(); for ( i = 0; i < b.iterations; i++ ) { out = decompose( N, initial, factors, 1, 0 ); @@ -61,7 +65,6 @@ function createBenchmark( N ) { } } b.toc(); - if ( isnan( out ) ) { b.fail( 'should not return NaN' ); } @@ -94,7 +97,7 @@ function main() { ]; for ( i = 0; i < lengths.length; i++ ) { - N = lengths[i]; + N = lengths[ i ]; f = createBenchmark( N ); bench( pkg+':N='+N, f ); } From c5ac45b8f4df3bd3c37f87124b4f942e0abb0753 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Wed, 28 Jan 2026 23:30:38 +0530 Subject: [PATCH 102/102] bench: use stdlib/string/format --- 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 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 --- --- .../@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js index 57a0b8f5e018..1471960ea45f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/decompose/benchmark/benchmark.js @@ -21,6 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); +var format = require( '@stdlib/string/format' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var floor = require( '@stdlib/math/base/special/floor' ); var log2 = require( '@stdlib/math/base/special/log2' ); @@ -99,7 +100,7 @@ function main() { for ( i = 0; i < lengths.length; i++ ) { N = lengths[ i ]; f = createBenchmark( N ); - bench( pkg+':N='+N, f ); + bench( format( '%s:N=%d', pkg, N ), f ); } }