Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @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.
*/

'use strict';

/**
* Compute the forward real-valued fast Fourier transform (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' );
*
* var N = 4;
*
* var workspace = new Float64Array( ( 2*N ) + 34 );
* rffti( N, workspace, 1, 0 );
*
* var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
*
* rfftf( N, r, 1, 0, workspace, 1, 0 );
* // r => <Float64Array>[ 10.0, -2.0, 2.0, -2.0 ]
*/

// MODULES //

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


// EXPORTS //

module.exports = main;
124 changes: 124 additions & 0 deletions lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/**
* @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';

// 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' );

Check failure on line 66 in lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

cannot resolve module: "/home/runner/work/stdlib/stdlib/lib/node_modules/@stdlib/fft/base/fftpack/rfftf/lib/rfftf1.js"


// MAIN //

/**
* Computes the forward real-valued fast Fourier transform (FFT).
*
* @param {NonNegativeInteger} N - length of 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
* @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' );
*
* var N = 4;
*
* var workspace = new Float64Array( ( 2*N ) + 34 );
* rffti( N, workspace, 1, 0 );
*
* var r = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
*
* rfftf( N, r, 1, 0, workspace, 1, 0 );
* // r => <Float64Array>[ 10.0, -2.0, 2.0, -2.0 ]
*/
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 * 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
}


// EXPORTS //

module.exports = rfftf;
Loading
Loading