Skip to content

Commit 7479095

Browse files
committed
feat: add passb2
1 parent b6c3ed7 commit 7479095

File tree

9 files changed

+239
-6
lines changed

9 files changed

+239
-6
lines changed

lib/node_modules/@stdlib/fft/base/fftpack/lib/c1Ref.js renamed to lib/node_modules/@stdlib/fft/base/fftpack/lib/c1_ref.js

File renamed without changes.

lib/node_modules/@stdlib/fft/base/fftpack/lib/c2Ref.js renamed to lib/node_modules/@stdlib/fft/base/fftpack/lib/c2_ref.js

File renamed without changes.

lib/node_modules/@stdlib/fft/base/fftpack/lib/ccRef.js renamed to lib/node_modules/@stdlib/fft/base/fftpack/lib/cc_ref.js

File renamed without changes.

lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2Ref.js renamed to lib/node_modules/@stdlib/fft/base/fftpack/lib/ch2_ref.js

File renamed without changes.

lib/node_modules/@stdlib/fft/base/fftpack/lib/chRef.js renamed to lib/node_modules/@stdlib/fft/base/fftpack/lib/ch_ref.js

File renamed without changes.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*
19+
* ## Notice
20+
*
21+
* 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.
22+
*
23+
* ```text
24+
* Copyright (c) 2004 the University Corporation for Atmospheric
25+
* Research ("UCAR"). All rights reserved. Developed by NCAR's
26+
* Computational and Information Systems Laboratory, UCAR,
27+
* www.cisl.ucar.edu.
28+
*
29+
* Redistribution and use of the Software in source and binary forms,
30+
* with or without modification, is permitted provided that the
31+
* following conditions are met:
32+
*
33+
* - Neither the names of NCAR's Computational and Information Systems
34+
* Laboratory, the University Corporation for Atmospheric Research,
35+
* nor the names of its sponsors or contributors may be used to
36+
* endorse or promote products derived from this Software without
37+
* specific prior written permission.
38+
*
39+
* - Redistributions of source code must retain the above copyright
40+
* notices, this list of conditions, and the disclaimer below.
41+
*
42+
* - Redistributions in binary form must reproduce the above copyright
43+
* notice, this list of conditions, and the disclaimer below in the
44+
* documentation and/or other materials provided with the
45+
* distribution.
46+
*
47+
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48+
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
49+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50+
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
51+
* HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
52+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
53+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
54+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
55+
* SOFTWARE.
56+
* ```
57+
*/
58+
59+
'use strict';
60+
61+
// MODULES //
62+
63+
var chRef = require( './ch_ref.js' );
64+
var ccRef = require( './cc_ref.js' );
65+
66+
67+
// MAIN //
68+
69+
/**
70+
* Performs a pass of length 2 of the FFT algorithm.
71+
*
72+
* @private
73+
* @param {number} ido - Number of real values for each transform
74+
* @param {number} l1 - Length of the input sequences
75+
* @param {Float64Array} cc - Input array containing sequences to be transformed
76+
* @param {Float64Array} ch - Output array containing transformed sequences
77+
* @param {Float64Array} wa1 - Array of twiddle factors
78+
* @returns {void}
79+
*/
80+
function passb2( ido, l1, cc, ch, wa1 ) {
81+
var ch_offset;
82+
var cc_offset;
83+
var ti2;
84+
var tr2;
85+
var i;
86+
var k;
87+
88+
// Parameter adjustments...
89+
ch_offset = 1 + ( ido * ( 1 + l1 ) );
90+
cc_offset = 1 + ( ido * 3 );
91+
92+
// Function body:
93+
if ( ido <= 2 ) {
94+
for ( k = 1; k <= l1; ++k ) {
95+
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 ];
96+
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 ];
97+
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 ];
98+
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 ];
99+
}
100+
return;
101+
}
102+
for ( k = 1; k <= l1; ++k ) {
103+
for ( i = 2; i <= ido; i += 2 ) {
104+
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 ];
105+
tr2 = cc[ ccRef( i - 1, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i - 1, 2, k, 2, ido ) - cc_offset ];
106+
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 ];
107+
ti2 = cc[ ccRef( i, 1, k, 2, ido ) - cc_offset ] - cc[ ccRef( i, 2, k, 2, ido ) - cc_offset ];
108+
ch[ chRef( i, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * ti2 ) - ( wa1[ i - 1 ] * tr2 );
109+
ch[ chRef( i - 1, k, 2, l1, ido ) - ch_offset ] = ( wa1[ i - 1 - 1 ] * tr2 ) - ( wa1[ i - 1 ] * ti2 );
110+
}
111+
}
112+
}
113+
114+
115+
// EXPORTS //
116+
117+
module.exports = passb2;
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*
19+
* ## Notice
20+
*
21+
* 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.
22+
*
23+
* ```text
24+
* Copyright (c) 2004 the University Corporation for Atmospheric
25+
* Research ("UCAR"). All rights reserved. Developed by NCAR's
26+
* Computational and Information Systems Laboratory, UCAR,
27+
* www.cisl.ucar.edu.
28+
*
29+
* Redistribution and use of the Software in source and binary forms,
30+
* with or without modification, is permitted provided that the
31+
* following conditions are met:
32+
*
33+
* - Neither the names of NCAR's Computational and Information Systems
34+
* Laboratory, the University Corporation for Atmospheric Research,
35+
* nor the names of its sponsors or contributors may be used to
36+
* endorse or promote products derived from this Software without
37+
* specific prior written permission.
38+
*
39+
* - Redistributions of source code must retain the above copyright
40+
* notices, this list of conditions, and the disclaimer below.
41+
*
42+
* - Redistributions in binary form must reproduce the above copyright
43+
* notice, this list of conditions, and the disclaimer below in the
44+
* documentation and/or other materials provided with the
45+
* distribution.
46+
*
47+
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48+
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
49+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50+
* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
51+
* HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
52+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
53+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
54+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
55+
* SOFTWARE.
56+
* ```
57+
*/
58+
59+
'use strict';
60+
61+
// MODULES //
62+
63+
var chRef = require( './ch_ref.js' );
64+
var ccRef = require( './cc_ref.js' );
65+
66+
67+
// VARIABLES //
68+
69+
var taur = 0.5;
70+
var taui = 0.866025403784439;
71+
72+
73+
// MAIN //
74+
75+
/**
76+
* Performs a pass of length 3 of the FFT algorithm.
77+
*
78+
* @private
79+
* @param {number} ido - Number of real values for each transform
80+
* @param {number} l1 - Length of the input sequences
81+
* @param {Float64Array} cc - Input array containing sequences to be transformed
82+
* @param {Float64Array} ch - Output array containing transformed sequences
83+
* @param {Float64Array} wa1 - First array of twiddle factors
84+
* @param {Float64Array} wa2 - Second array of twiddle factors
85+
* @returns {void}
86+
*/
87+
function passb3( ido, l1, cc, ch, wa1, wa2 ) {
88+
var ch_offset;
89+
var cc_offset;
90+
var ci2;
91+
var ci3;
92+
var di2;
93+
var di3;
94+
var cr2;
95+
var cr3;
96+
var dr2;
97+
var dr3;
98+
var ti2;
99+
var tr2;
100+
var i;
101+
var k;
102+
103+
// Parameter adjustments...
104+
ch_offset = 1 + ( ido * ( 1 + l1 ) );
105+
cc_offset = 1 + ( ido << 2 );
106+
107+
// Function body:
108+
if ( ido == 2 ) {
109+
110+
}
111+
}
112+
113+
114+
// EXPORTS //
115+
116+
module.exports = passb3;

lib/node_modules/@stdlib/fft/base/fftpack/lib/passfb.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060

6161
// MODULES //
6262

63-
var c1Ref = require( './c1Ref.js' );
64-
var c2Ref = require( './c2Ref.js' );
65-
var chRef = require( './chRef.js' );
66-
var ch2Ref = require( './ch2Ref.js' );
67-
var ccRef = require( './ccRef.js' );
63+
var c1Ref = require( './c1_ref.js' );
64+
var c2Ref = require( './c2_ref.js' );
65+
var chRef = require( './ch_ref.js' );
66+
var ch2Ref = require( './ch2_ref.js' );
67+
var ccRef = require( './cc_ref.js' );
6868

6969

7070
// MAIN //

lib/node_modules/@stdlib/math/base/special/log1p/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ double stdlib_base_log1p( const double x ) {
311311
}
312312
// Apply a bit mask (0 00000000000 11111111111111111111) to remove the exponent:
313313
hu &= 0x000fffff; // max value => 0x000fffff => 1048575
314-
314+
315315
// 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.
316316

317317
// Check if u significand is less than sqrt(2) significand => 0x6a09e => 01101010000010011110

0 commit comments

Comments
 (0)