Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 4x 4x 2x 1x 1x 1x 1x 1x | /**
* @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 floor = require( '@stdlib/math/base/special/floor' );
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' );
var printWorkspace = require( './print_real_workspace.js' ); // FIXME
// 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 {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, cOffset, ch, chOffset, wa, waOffset, ifac, ifacOffset ) {
var idl1;
var ido;
var ix4;
var ix3;
var ix2;
var FLG;
var nf;
var l2;
var l1;
var iw;
var ip;
var k1;
var i;
// 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++ ) {
// Resolve the next factor:
ip = ifac[ ifacOffset+k1+1 ];
l2 = ip * l1;
ido = floor( N / l2 );
idl1 = ido * l1;
switch ( ip ) {
case 4:
ix2 = iw + ido;
ix3 = ix2 + ido;
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, ( FLG ) ? ch : c, 1, ( FLG ) ? chOffset : cOffset, ( FLG ) ? c : ch, 1, ( FLG ) ? cOffset : chOffset, wa, 1, iw+waOffset );
FLG = 1 - FLG;
break;
case 3:
ix2 = iw + ido;
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, ( 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 ( 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 );
}
if ( ido === 1 ) {
FLG = 1 - FLG;
}
break;
}
l1 = l2;
iw += ( ip - 1 ) * ido;
}
if ( FLG === 0 ) {
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[ i+cOffset ] = ch[ i+chOffset ]; // FIXME: use `blas/base/dcopy`
}
}
// EXPORTS //
module.exports = rfftb1;
|