From 030a34ab25db2d8d976e2a9f88780fb4da031d77 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sat, 18 Jul 2026 07:16:08 +0530 Subject: [PATCH 01/14] feat: add initial implementation --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- .../base/fftpack/ndarray/rffti/lib/main.js | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js new file mode 100644 index 000000000000..48ccc00789fe --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js @@ -0,0 +1,85 @@ +/** +* @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'; + +// MODULES // + +var getStride = require( '@stdlib/ndarray/base/stride' ); +var getOffset = require( '@stdlib/ndarray/base/offset' ); +var getData = require( '@stdlib/ndarray/base/data-buffer' ); +var strided = require( '@stdlib/fft/base/fftpack/rffti' ); +var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); + + +// MAIN // + +/** +* Initializes a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a zero-dimensional ndarray containing the length of the sequence to transform. +* - a one-dimensional input ndarray. +* +* @param {ArrayLikeObject} arrays - array-like object containing ndarrays +* @returns {ndarrayLike} output ndarray +* +* @example +* var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* +* var N = 8; +* var len = scalar2ndarray( N, { +* 'dtype': 'int32' +* }); +* +* var workspace = new Float64Vector( ( 2*N ) + 34 ); +* +* var out = rffti( [ len, workspace ] ); +* // returns +* +* var bool = ( out === workspace ); +* // returns true +* +* var workspaceArr = ndarray2array( workspace ); +* // returns +* +* var twiddleFactors = workspaceArr.slice( N, 2*N ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] +* +* var factors = workspaceArr.slice( 2*N, ( 2*N ) + 4 ); +* // returns [ 8, 2, 2, 4 ] +*/ +function rffti( arrays ) { + var workspace; + var N; + + N = ndarraylike2scalar( arrays[ 0 ] ); + workspace = arrays[ 1 ]; + strided( N, getData( workspace ), getStride( workspace, 0 ), getOffset( workspace ) ); // eslint-disable-line max-len + return workspace; +} + + +// EXPORTS // + +module.exports = rffti; From 60f690c5755a14b278818a533d680d93ce9e3251 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sat, 18 Jul 2026 07:55:54 +0530 Subject: [PATCH 02/14] refactor: use ndarray/slice --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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/ndarray/rffti/lib/main.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js index 48ccc00789fe..43a4aabdc8a4 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js @@ -45,7 +45,8 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * @example * var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); * var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* var Slice = require( '@stdlib/slice/ctor' ); +* var slice = require( '@stdlib/ndarray/slice' ); * * var N = 8; * var len = scalar2ndarray( N, { @@ -60,14 +61,11 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * var bool = ( out === workspace ); * // returns true * -* var workspaceArr = ndarray2array( workspace ); -* // returns +* var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] * -* var twiddleFactors = workspaceArr.slice( N, 2*N ); -* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] -* -* var factors = workspaceArr.slice( 2*N, ( 2*N ) + 4 ); -* // returns [ 8, 2, 2, 4 ] +* var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +* // returns [ 8, 2, 2, 4 ] */ function rffti( arrays ) { var workspace; From a56e1f1da7afdf83c38e63a35e49459311d6c797 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 21 Jul 2026 02:14:48 +0530 Subject: [PATCH 03/14] feat: add fft/base/fftpack/ndarray/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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - 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: passed - task: lint_license_headers status: passed --- --- .../fft/base/fftpack/ndarray/rffti/README.md | 135 +++++++++ .../ndarray/rffti/benchmark/benchmark.js | 112 ++++++++ .../base/fftpack/ndarray/rffti/docs/repl.txt | 39 +++ .../ndarray/rffti/docs/types/index.d.ts | 68 +++++ .../fftpack/ndarray/rffti/docs/types/test.ts | 63 +++++ .../fftpack/ndarray/rffti/examples/index.js | 38 +++ .../base/fftpack/ndarray/rffti/lib/index.js | 60 ++++ .../base/fftpack/ndarray/rffti/package.json | 65 +++++ .../base/fftpack/ndarray/rffti/test/test.js | 256 ++++++++++++++++++ 9 files changed, 836 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md new file mode 100644 index 000000000000..7394e894e078 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md @@ -0,0 +1,135 @@ + + +# rffti + +> Initialize a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray. + +
+ +
+ + + +
+ +## Usage + +```javascript +var rffti = require( '@stdlib/fft/base/fftpack/ndarray/rffti' ); +``` + +#### rffti( arrays ) + +Initializes a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray. + +```javascript +var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var Slice = require( '@stdlib/slice/ctor' ); +var slice = require( '@stdlib/ndarray/slice' ); + +var N = 8; +var len = scalar2ndarray( N, { + 'dtype': 'int32' +}); + +var workspace = new Float64Vector( ( 2*N ) + 34 ); + +var out = rffti( [ len, workspace ] ); +// returns + +var bool = ( out === workspace ); +// returns true + +var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +// returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] + +var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +// returns [ 8, 2, 2, 4 ] +``` + +The function has the following parameters: + +- **arrays**: array-like object containing the following ndarrays: + + - a zero-dimensional ndarray containing the length of the sequence to transform. + - a one-dimensional input ndarray. + +
+ + + +
+ +## Notes + +- If provided an empty one-dimensional input ndarray, the function returns the output ndarray unchanged. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var rffti = require( '@stdlib/fft/base/fftpack/ndarray/rffti' ); + +var opts = { + 'dtype': 'int32' +}; + +var N = 8; + +var workspace = new Float64Vector( ( 2*N ) + 34 ); +console.log( ndarray2array( workspace ) ); + +var len = scalar2ndarray( N, opts ); + +var out = rffti( [ len, workspace ] ); +console.log( ndarray2array( out ) ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js new file mode 100644 index 000000000000..189ebcffa1e5 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js @@ -0,0 +1,112 @@ +/** +* @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'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var rffti = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - sequence length +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var workspace = new Float64Vector( ( 2*N ) + 34 ); + var len = scalar2ndarray( N, options ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = rffti( [ len, workspace ] ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( isnan( v.get( 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, + 512, + 1024 + ]; + + for ( i = 0; i < lengths.length; i++ ) { + N = lengths[ i ]; + f = createBenchmark( N ); + bench( format( '%s:N=%d', pkg, N ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt new file mode 100644 index 000000000000..dccdff0f39cd --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt @@ -0,0 +1,39 @@ + +{{alias}}( arrays ) + Initializes a workspace array for performing a real-valued Fourier + transform on a one-dimensional ndarray. + + If provided an empty input ndarray, the function returns the output ndarray + unchanged. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing the following ndarrays: + + - a zero-dimensional ndarray containing the length of the sequence to + transform. + - a one-dimensional input ndarray. + + Returns + ------- + out: ndarray + Output ndarray. + + Examples + -------- + > var N = 8; + > var workspace = new {{alias:@stdlib/ndarray/vector/float64}}( ( 2*N ) + 34 ); + > var len = {{alias:@stdlib/ndarray/from-scalar}}( N, { 'dtype': 'int32' }); + > var out = {{alias}}( [ len, workspace ] ) + + > var bool = ( out === workspace ) + true + > var twiddleFactors = {{alias:@stdlib/ndarray/slice}}( workspace, new {{alias:@stdlib/slice/ctor}}( N, 2*N ) ) + [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] + > var factors = {{alias:@stdlib/ndarray/slice}}( workspace, new {{alias:@stdlib/slice/ctor}}( 2*N, ( 2*N ) + 4 ) ) + [ 8, 2, 2, 4 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts new file mode 100644 index 000000000000..6b827dfea080 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts @@ -0,0 +1,68 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +/// + +import { ndarray, float64ndarray } from '@stdlib/types/ndarray'; + +/** +* Initializes a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a zero-dimensional ndarray containing the length of the sequence to transform. +* - a one-dimensional input ndarray. +* +* @param arrays - array-like object containing ndarrays +* @returns output ndarray +* +* @example +* var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +* var Slice = require( '@stdlib/slice/ctor' ); +* var slice = require( '@stdlib/ndarray/slice' ); +* +* var N = 8; +* var len = scalar2ndarray( N, { +* 'dtype': 'int32' +* }); +* +* var workspace = new Float64Vector( ( 2*N ) + 34 ); +* +* var out = rffti( [ len, workspace ] ); +* // returns +* +* var bool = ( out === workspace ); +* // returns true +* +* var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] +* +* var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +* // returns [ 8, 2, 2, 4 ] +*/ +declare function rffti( arrays: [ ndarray, float64ndarray ] ): float64ndarray; + + +// EXPORTS // + +export = rffti; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts new file mode 100644 index 000000000000..cb5cba80f1b3 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts @@ -0,0 +1,63 @@ +/* +* @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. +*/ + +/* eslint-disable space-in-parens */ + +import zeros = require( '@stdlib/ndarray/zeros' ); +import rffti = require( './index' ); + + +// TESTS // + +// The function returns an ndarray... +{ + const workspace = zeros( [ 10 ], { + 'dtype': 'float64' + }); + const N = zeros( [], { + 'dtype': 'int32' + }); + + rffti( [ N, workspace ] ); // $ExpectType float64ndarray +} + +// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... +{ + rffti( '10' ); // $ExpectError + rffti( 10 ); // $ExpectError + rffti( true ); // $ExpectError + rffti( false ); // $ExpectError + rffti( null ); // $ExpectError + rffti( undefined ); // $ExpectError + rffti( [] ); // $ExpectError + rffti( {} ); // $ExpectError + rffti( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const workspace = zeros( [ 10 ], { + 'dtype': 'float64' + }); + const N = zeros( [], { + 'dtype': 'int32' + }); + + rffti(); // $ExpectError + rffti( [ N, workspace ], {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js new file mode 100644 index 000000000000..04270542fb5f --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js @@ -0,0 +1,38 @@ +/** +* @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'; + +var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var rffti = require( './../lib' ); + +var opts = { + 'dtype': 'int32' +}; + +var N = 8; + +var workspace = new Float64Vector( ( 2*N ) + 34 ); +console.log( ndarray2array( workspace ) ); + +var len = scalar2ndarray( N, opts ); + +var out = rffti( [ len, workspace ] ); +console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js new file mode 100644 index 000000000000..a211755d6c5c --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js @@ -0,0 +1,60 @@ +/** +* @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'; + +/** +* Initialize a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray. +* +* @module @stdlib/fft/base/fftpack/ndarray/rffti +* +* @example +* var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +* var Slice = require( '@stdlib/slice/ctor' ); +* var slice = require( '@stdlib/ndarray/slice' ); +* var rffti = require( '@stdlib/fft/base/fftpack/ndarray/rffti' ); +* +* var N = 8; +* var len = scalar2ndarray( N, { +* 'dtype': 'int32' +* }); +* +* var workspace = new Float64Vector( ( 2*N ) + 34 ); +* +* var out = rffti( [ len, workspace ] ); +* // returns +* +* var bool = ( out === workspace ); +* // returns true +* +* var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] +* +* var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +* // 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/ndarray/rffti/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/package.json new file mode 100644 index 000000000000..4a473186e063 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/fft/base/fftpack/ndarray/rffti", + "version": "0.0.0", + "description": "Initialize a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray.", + "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", + "fft", + "fftpack", + "rffti", + "fourier", + "transform", + "twiddle", + "workspace", + "initialization", + "real", + "ndarray" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js new file mode 100644 index 000000000000..0a743d847968 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -0,0 +1,256 @@ +/** +* @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. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); +var Float64Array = require( '@stdlib/array/float64' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var getData = require( '@stdlib/ndarray/data-buffer' ); +var rffti = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns a one-dimensional ndarray. +* +* @private +* @param {Collection} buffer - underlying data buffer +* @param {NonNegativeInteger} length - number of indexed elements +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {ndarray} one-dimensional ndarray +*/ +function vector( buffer, length, stride, offset ) { + return new ndarray( 'float64', buffer, [ length ], [ stride ], offset, 'row-major' ); +} + + +// 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 has an arity of 1', function test( t ) { + t.strictEqual( rffti.length, 1, 'has expected arity' ); + t.end(); +}); + +tape( 'the function correctly initializes twiddle and integer factors in a one-dimensional ndarray `workspace`', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var workspaceBuf; + var workspace; + var ulps; + var len; + var N; + var v; + var i; + var y; + var e; + + N = 8; + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + workspaceBuf = new Float64Array( ( 2 * N ) + 34 ); + workspace = vector( workspaceBuf, ( 2 * N ) + 34, 1, 0 ); + v = rffti( [ len, workspace ] ); + t.strictEqual( v, workspace, 'returns expected workspace reference' ); + + expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); + + ulps = 1; + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = workspaceBuf[ N + i ]; + e = expectedTwiddles[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedFactors.length; i++ ) { + y = workspaceBuf[ ( 2 * N ) + i ]; + e = expectedFactors[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + t.end(); +}); + +tape( 'if provided an empty ndarray, the function returns the output ndarray unchanged', function test( t ) { + var workspaceBuf; + var workspace; + var expected; + var len; + var N; + var v; + + N = 4; + workspaceBuf = new Float64Array( [] ); + workspace = vector( workspaceBuf, 0, 1, 0 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = rffti( [ len, workspace ] ); + + expected = new Float64Array( [] ); + t.strictEqual( v, workspace, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( getData( v ), expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a one-dimensional ndarray having a non-unit stride', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var workspaceBuf; + var workspace; + var ulps; + var len; + var y; + var e; + var i; + var N; + var v; + + N = 8; + workspaceBuf = new Float64Array( ( 4 * N ) + 68 ); + workspace = vector( workspaceBuf, ( 2 * N ) + 34, 2, 0 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = rffti( [ len, workspace ] ); + + expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); + + t.strictEqual( v, workspace, 'returns expected value' ); + + ulps = 1; + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = workspaceBuf[ ( 2 * N ) + ( 2 * i ) ]; + e = expectedTwiddles[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedFactors.length; i++ ) { + y = workspaceBuf[ ( 4 * N ) + ( 2 * i ) ]; + e = expectedFactors[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + t.end(); +}); + +tape( 'the function supports a one-dimensional ndarray having a negative stride', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var workspaceBuf; + var workspace; + var ulps; + var len; + var v; + var y; + var e; + var i; + var N; + + N = 8; + workspaceBuf = new Float64Array( ( 2 * N ) + 34 ); + workspace = vector( workspaceBuf, ( 2 * N ) + 34, -1, ( 2 * N ) + 33 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = rffti( [ len, workspace ] ); + t.strictEqual( v, workspace, 'returns expected value' ); + + expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expectedFactors = new Float64Array( [ 8.0, 2.0, 2.0, 4.0 ] ); + + ulps = 1; + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = workspaceBuf[ N + 33 - i ]; + e = expectedTwiddles[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedFactors.length; i++ ) { + y = workspaceBuf[ 33 - i ]; + e = expectedFactors[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + t.end(); +}); + +tape( 'the function supports a one-dimensional ndarray having a non-zero offset', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var workspaceBuf; + var workspace; + var ulps; + var len; + var v; + var y; + var e; + var i; + var N; + + N = 8; + workspaceBuf = new Float64Array( ( 2 * N ) + 34 + 2 ); + workspace = vector( workspaceBuf, ( 2 * N ) + 34, 1, 2 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = rffti( [ len, workspace ] ); + + t.strictEqual( v, workspace, 'returns expected value' ); + + expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expectedFactors = new Float64Array( [ 8.0, 2.0, 2.0, 4.0 ] ); + + ulps = 1; + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = workspaceBuf[ N + i + 2 ]; + e = expectedTwiddles[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedFactors.length; i++ ) { + y = workspaceBuf[ ( 2 * N ) + i + 2 ]; + e = expectedFactors[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + t.end(); +}); From 77183d917a7fc3a01da2b76a4a5dc4cede73019e Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 21 Jul 2026 02:39:18 +0530 Subject: [PATCH 04/14] bench: use int32 --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- .../fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js index 189ebcffa1e5..de088b0d6d40 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js @@ -32,7 +32,7 @@ var rffti = require( './../lib' ); // VARIABLES // var options = { - 'dtype': 'float64' + 'dtype': 'int32' }; From 974b5b740b079f2120a1e20ab08c38f9bbf34ce0 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 26 Jul 2026 07:09:48 +0530 Subject: [PATCH 05/14] refactor: keep workspace first, len next --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/fft/base/fftpack/ndarray/rffti/README.md | 4 ++-- .../base/fftpack/ndarray/rffti/benchmark/benchmark.js | 2 +- .../fft/base/fftpack/ndarray/rffti/docs/repl.txt | 4 ++-- .../base/fftpack/ndarray/rffti/docs/types/index.d.ts | 4 ++-- .../fft/base/fftpack/ndarray/rffti/docs/types/test.ts | 4 ++-- .../fft/base/fftpack/ndarray/rffti/examples/index.js | 2 +- .../fft/base/fftpack/ndarray/rffti/lib/index.js | 2 +- .../@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js | 8 ++++---- .../fft/base/fftpack/ndarray/rffti/test/test.js | 10 +++++----- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md index 7394e894e078..9909b4bcbd9d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md @@ -53,7 +53,7 @@ var len = scalar2ndarray( N, { var workspace = new Float64Vector( ( 2*N ) + 34 ); -var out = rffti( [ len, workspace ] ); +var out = rffti( [ workspace, len ] ); // returns var bool = ( out === workspace ); @@ -110,7 +110,7 @@ console.log( ndarray2array( workspace ) ); var len = scalar2ndarray( N, opts ); -var out = rffti( [ len, workspace ] ); +var out = rffti( [ workspace, len ] ); console.log( ndarray2array( out ) ); ``` diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js index de088b0d6d40..f473cdd6d81f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js @@ -63,7 +63,7 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - v = rffti( [ len, workspace ] ); + v = rffti( [ workspace, len ] ); if ( typeof v !== 'object' ) { b.fail( 'should return an ndarray' ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt index dccdff0f39cd..dd932a85b6f2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt @@ -11,9 +11,9 @@ arrays: ArrayLikeObject Array-like object containing the following ndarrays: + - a one-dimensional input ndarray. - a zero-dimensional ndarray containing the length of the sequence to transform. - - a one-dimensional input ndarray. Returns ------- @@ -25,7 +25,7 @@ > var N = 8; > var workspace = new {{alias:@stdlib/ndarray/vector/float64}}( ( 2*N ) + 34 ); > var len = {{alias:@stdlib/ndarray/from-scalar}}( N, { 'dtype': 'int32' }); - > var out = {{alias}}( [ len, workspace ] ) + > var out = {{alias}}( [ workspace, len ] ) > var bool = ( out === workspace ) true diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts index 6b827dfea080..fcfe4d0afad3 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts @@ -29,8 +29,8 @@ import { ndarray, float64ndarray } from '@stdlib/types/ndarray'; * * - The function expects the following ndarrays: * -* - a zero-dimensional ndarray containing the length of the sequence to transform. * - a one-dimensional input ndarray. +* - a zero-dimensional ndarray containing the length of the sequence to transform. * * @param arrays - array-like object containing ndarrays * @returns output ndarray @@ -48,7 +48,7 @@ import { ndarray, float64ndarray } from '@stdlib/types/ndarray'; * * var workspace = new Float64Vector( ( 2*N ) + 34 ); * -* var out = rffti( [ len, workspace ] ); +* var out = rffti( [ workspace, len ] ); * // returns * * var bool = ( out === workspace ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts index cb5cba80f1b3..905a3cc395db 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts @@ -33,7 +33,7 @@ import rffti = require( './index' ); 'dtype': 'int32' }); - rffti( [ N, workspace ] ); // $ExpectType float64ndarray + rffti( [ workspace, N ] ); // $ExpectType float64ndarray } // The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... @@ -59,5 +59,5 @@ import rffti = require( './index' ); }); rffti(); // $ExpectError - rffti( [ N, workspace ], {} ); // $ExpectError + rffti( [ workspace, N ], {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js index 04270542fb5f..ce4e76ac003b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js @@ -34,5 +34,5 @@ console.log( ndarray2array( workspace ) ); var len = scalar2ndarray( N, opts ); -var out = rffti( [ len, workspace ] ); +var out = rffti( [ workspace, len ] ); console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js index a211755d6c5c..cc56d4f4c47a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js @@ -37,7 +37,7 @@ * * var workspace = new Float64Vector( ( 2*N ) + 34 ); * -* var out = rffti( [ len, workspace ] ); +* var out = rffti( [ workspace, len ] ); * // returns * * var bool = ( out === workspace ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js index 43a4aabdc8a4..a8761431c450 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js @@ -36,8 +36,8 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * * - The function expects the following ndarrays: * -* - a zero-dimensional ndarray containing the length of the sequence to transform. * - a one-dimensional input ndarray. +* - a zero-dimensional ndarray containing the length of the sequence to transform. * * @param {ArrayLikeObject} arrays - array-like object containing ndarrays * @returns {ndarrayLike} output ndarray @@ -55,7 +55,7 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * * var workspace = new Float64Vector( ( 2*N ) + 34 ); * -* var out = rffti( [ len, workspace ] ); +* var out = rffti( [ workspace, len ] ); * // returns * * var bool = ( out === workspace ); @@ -71,8 +71,8 @@ function rffti( arrays ) { var workspace; var N; - N = ndarraylike2scalar( arrays[ 0 ] ); - workspace = arrays[ 1 ]; + workspace = arrays[ 0 ]; + N = ndarraylike2scalar( arrays[ 1 ] ); strided( N, getData( workspace ), getStride( workspace, 0 ), getOffset( workspace ) ); // eslint-disable-line max-len return workspace; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js index 0a743d847968..a9559a963593 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -81,7 +81,7 @@ tape( 'the function correctly initializes twiddle and integer factors in a one-d }); workspaceBuf = new Float64Array( ( 2 * N ) + 34 ); workspace = vector( workspaceBuf, ( 2 * N ) + 34, 1, 0 ); - v = rffti( [ len, workspace ] ); + v = rffti( [ workspace, len ] ); t.strictEqual( v, workspace, 'returns expected workspace reference' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -118,7 +118,7 @@ tape( 'if provided an empty ndarray, the function returns the output ndarray unc 'dtype': 'int32' }); - v = rffti( [ len, workspace ] ); + v = rffti( [ workspace, len ] ); expected = new Float64Array( [] ); t.strictEqual( v, workspace, 'returns expected value' ); @@ -147,7 +147,7 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' 'dtype': 'int32' }); - v = rffti( [ len, workspace ] ); + v = rffti( [ workspace, len ] ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); @@ -190,7 +190,7 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' 'dtype': 'int32' }); - v = rffti( [ len, workspace ] ); + v = rffti( [ workspace, len ] ); t.strictEqual( v, workspace, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -232,7 +232,7 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' 'dtype': 'int32' }); - v = rffti( [ len, workspace ] ); + v = rffti( [ workspace, len ] ); t.strictEqual( v, workspace, 'returns expected value' ); From 2e597478478e375a20e08ab602075f4524fbcd3c Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 26 Jul 2026 07:36:53 +0530 Subject: [PATCH 06/14] test: add checks to ensure scratch region and spaces between strides are zero --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- .../base/fftpack/ndarray/rffti/test/test.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js index a9559a963593..82f98a09fb03 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -100,6 +100,12 @@ tape( 'the function correctly initializes twiddle and integer factors in a one-d t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } + for ( i = 0; i < N; i++ ) { + y = workspaceBuf[ i ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + } + t.end(); }); @@ -167,6 +173,15 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } + for ( i = 0; i < N; i++ ) { + y = workspaceBuf[ 2*i ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + + y = workspaceBuf[ ( 2*N ) + ( 2*i ) + 1 ]; + t.strictEqual( y, e, 'returns expected value' ); + } + t.end(); }); @@ -209,6 +224,12 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } + for ( i = 0; i < N; i++ ) { + y = workspaceBuf[ ( 2*N ) + 33 - i ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + } + t.end(); }); @@ -252,5 +273,11 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } + for ( i = 0; i < N; i++ ) { + y = workspaceBuf[ i+2 ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + } + t.end(); }); From cc5821c6d0c3f4b6a2129815ed6f690353eb3442 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 26 Jul 2026 07:44:33 +0530 Subject: [PATCH 07/14] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Gunj Joshi --- .../fftpack/ndarray/rffti/benchmark/benchmark.js | 12 +++--------- .../fft/base/fftpack/ndarray/rffti/docs/repl.txt | 6 ++++-- .../base/fftpack/ndarray/rffti/docs/types/index.d.ts | 9 +++++++-- .../fft/base/fftpack/ndarray/rffti/examples/index.js | 8 +++----- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js index f473cdd6d81f..2a715c88cb0c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js @@ -29,13 +29,6 @@ var pkg = require( './../package.json' ).name; var rffti = require( './../lib' ); -// VARIABLES // - -var options = { - 'dtype': 'int32' -}; - - // FUNCTIONS // /** @@ -47,8 +40,9 @@ var options = { */ function createBenchmark( N ) { var workspace = new Float64Vector( ( 2*N ) + 34 ); - var len = scalar2ndarray( N, options ); - + var len = scalar2ndarray( N, { + 'dtype': 'int32' + }); return benchmark; /** diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt index dd932a85b6f2..e8a582eca877 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt @@ -29,9 +29,11 @@ > var bool = ( out === workspace ) true - > var twiddleFactors = {{alias:@stdlib/ndarray/slice}}( workspace, new {{alias:@stdlib/slice/ctor}}( N, 2*N ) ) + > var s = new {{alias:@stdlib/slice/ctor}}( N, 2*N ); + > var twiddleFactors = {{alias:@stdlib/ndarray/slice}}( workspace, s ) [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] - > var factors = {{alias:@stdlib/ndarray/slice}}( workspace, new {{alias:@stdlib/slice/ctor}}( 2*N, ( 2*N ) + 4 ) ) + > s = new {{alias:@stdlib/slice/ctor}}( 2*N, ( 2*N ) + 4 ); + > var factors = {{alias:@stdlib/ndarray/slice}}( workspace, s ) [ 8, 2, 2, 4 ] See Also diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts index fcfe4d0afad3..075eaff4264b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts @@ -20,7 +20,12 @@ /// -import { ndarray, float64ndarray } from '@stdlib/types/ndarray'; +import { typedndarray, floatndarray, genericndarray } from '@stdlib/types/ndarray'; + +/** +* Input array. +*/ +type InputArray = floatndarray | genericndarray; /** * Initializes a workspace array for performing a real-valued Fourier transform on a one-dimensional ndarray. @@ -60,7 +65,7 @@ import { ndarray, float64ndarray } from '@stdlib/types/ndarray'; * var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); * // returns [ 8, 2, 2, 4 ] */ -declare function rffti( arrays: [ ndarray, float64ndarray ] ): float64ndarray; +declare function rffti( arrays: [ T, typedndarray ] ): T; // EXPORTS // diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js index ce4e76ac003b..1ea7f95b212c 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js @@ -23,16 +23,14 @@ var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); var rffti = require( './../lib' ); -var opts = { - 'dtype': 'int32' -}; - var N = 8; var workspace = new Float64Vector( ( 2*N ) + 34 ); console.log( ndarray2array( workspace ) ); -var len = scalar2ndarray( N, opts ); +var len = scalar2ndarray( N, { + 'dtype': 'int32' +}); var out = rffti( [ workspace, len ] ); console.log( ndarray2array( out ) ); From d39a78cbe838eeaccf53740b002f8dc78d023c63 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 26 Jul 2026 07:46:19 +0530 Subject: [PATCH 08/14] docs: update README example --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - 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: 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/ndarray/rffti/README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md index 9909b4bcbd9d..73015133f181 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md @@ -99,16 +99,14 @@ var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); var rffti = require( '@stdlib/fft/base/fftpack/ndarray/rffti' ); -var opts = { - 'dtype': 'int32' -}; - var N = 8; var workspace = new Float64Vector( ( 2*N ) + 34 ); console.log( ndarray2array( workspace ) ); -var len = scalar2ndarray( N, opts ); +var len = scalar2ndarray( N, { + 'dtype': 'int32' +}); var out = rffti( [ workspace, len ] ); console.log( ndarray2array( out ) ); From dac4cdd410a8a35d08632a4d3ba7f07c64ce20b7 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 26 Jul 2026 13:15:35 +0530 Subject: [PATCH 09/14] docs: use correct parameter order in README Signed-off-by: Gunj Joshi --- .../@stdlib/fft/base/fftpack/ndarray/rffti/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md index 73015133f181..29334c684337 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md @@ -70,8 +70,8 @@ The function has the following parameters: - **arrays**: array-like object containing the following ndarrays: - - a zero-dimensional ndarray containing the length of the sequence to transform. - a one-dimensional input ndarray. + - a zero-dimensional ndarray containing the length of the sequence to transform. From 89394659d091cb4f9d315348ba003d21ac48e76b Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Wed, 29 Jul 2026 23:08:41 +0530 Subject: [PATCH 10/14] docs: rename workspace to w --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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: passed - task: lint_license_headers status: passed --- --- .../fft/base/fftpack/ndarray/rffti/README.md | 16 ++-- .../ndarray/rffti/benchmark/benchmark.js | 4 +- .../base/fftpack/ndarray/rffti/docs/repl.txt | 10 +-- .../ndarray/rffti/docs/types/index.d.ts | 10 +-- .../fftpack/ndarray/rffti/docs/types/test.ts | 8 +- .../fftpack/ndarray/rffti/examples/index.js | 6 +- .../base/fftpack/ndarray/rffti/lib/index.js | 10 +-- .../base/fftpack/ndarray/rffti/lib/main.js | 18 ++-- .../base/fftpack/ndarray/rffti/test/test.js | 88 +++++++++---------- 9 files changed, 85 insertions(+), 85 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md index 29334c684337..11af16e1dd60 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/README.md @@ -51,18 +51,18 @@ var len = scalar2ndarray( N, { 'dtype': 'int32' }); -var workspace = new Float64Vector( ( 2*N ) + 34 ); +var w = new Float64Vector( ( 2*N ) + 34 ); -var out = rffti( [ workspace, len ] ); +var out = rffti( [ w, len ] ); // returns -var bool = ( out === workspace ); +var bool = ( out === w ); // returns true -var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +var twiddleFactors = slice( w, new Slice( N, 2*N ) ); // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] -var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +var factors = slice( w, new Slice( 2*N, ( 2*N ) + 4 ) ); // returns [ 8, 2, 2, 4 ] ``` @@ -101,14 +101,14 @@ var rffti = require( '@stdlib/fft/base/fftpack/ndarray/rffti' ); var N = 8; -var workspace = new Float64Vector( ( 2*N ) + 34 ); -console.log( ndarray2array( workspace ) ); +var w = new Float64Vector( ( 2*N ) + 34 ); +console.log( ndarray2array( w ) ); var len = scalar2ndarray( N, { 'dtype': 'int32' }); -var out = rffti( [ workspace, len ] ); +var out = rffti( [ w, len ] ); console.log( ndarray2array( out ) ); ``` diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js index 2a715c88cb0c..fb6e8b58a164 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js @@ -39,10 +39,10 @@ var rffti = require( './../lib' ); * @returns {Function} benchmark function */ function createBenchmark( N ) { - var workspace = new Float64Vector( ( 2*N ) + 34 ); var len = scalar2ndarray( N, { 'dtype': 'int32' }); + var w = new Float64Vector( ( 2*N ) + 34 ); return benchmark; /** @@ -57,7 +57,7 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - v = rffti( [ workspace, len ] ); + v = rffti( [ w, len ] ); if ( typeof v !== 'object' ) { b.fail( 'should return an ndarray' ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt index e8a582eca877..acb1be166c4d 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/repl.txt @@ -23,17 +23,17 @@ Examples -------- > var N = 8; - > var workspace = new {{alias:@stdlib/ndarray/vector/float64}}( ( 2*N ) + 34 ); + > var w = new {{alias:@stdlib/ndarray/vector/float64}}( ( 2*N ) + 34 ); > var len = {{alias:@stdlib/ndarray/from-scalar}}( N, { 'dtype': 'int32' }); - > var out = {{alias}}( [ workspace, len ] ) + > var out = {{alias}}( [ w, len ] ) - > var bool = ( out === workspace ) + > var bool = ( out === w ) true > var s = new {{alias:@stdlib/slice/ctor}}( N, 2*N ); - > var twiddleFactors = {{alias:@stdlib/ndarray/slice}}( workspace, s ) + > var twiddleFactors = {{alias:@stdlib/ndarray/slice}}( w, s ) [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] > s = new {{alias:@stdlib/slice/ctor}}( 2*N, ( 2*N ) + 4 ); - > var factors = {{alias:@stdlib/ndarray/slice}}( workspace, s ) + > var factors = {{alias:@stdlib/ndarray/slice}}( w, s ) [ 8, 2, 2, 4 ] See Also diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts index 075eaff4264b..4f576a246f3e 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/index.d.ts @@ -51,18 +51,18 @@ type InputArray = floatndarray | genericndarray; * 'dtype': 'int32' * }); * -* var workspace = new Float64Vector( ( 2*N ) + 34 ); +* var w = new Float64Vector( ( 2*N ) + 34 ); * -* var out = rffti( [ workspace, len ] ); +* var out = rffti( [ w, len ] ); * // returns * -* var bool = ( out === workspace ); +* var bool = ( out === w ); * // returns true * -* var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +* var twiddleFactors = slice( w, new Slice( N, 2*N ) ); * // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] * -* var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +* var factors = slice( w, new Slice( 2*N, ( 2*N ) + 4 ) ); * // returns [ 8, 2, 2, 4 ] */ declare function rffti( arrays: [ T, typedndarray ] ): T; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts index 905a3cc395db..97187a6bf704 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/docs/types/test.ts @@ -26,14 +26,14 @@ import rffti = require( './index' ); // The function returns an ndarray... { - const workspace = zeros( [ 10 ], { + const w = zeros( [ 10 ], { 'dtype': 'float64' }); const N = zeros( [], { 'dtype': 'int32' }); - rffti( [ workspace, N ] ); // $ExpectType float64ndarray + rffti( [ w, N ] ); // $ExpectType float64ndarray } // The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... @@ -51,7 +51,7 @@ import rffti = require( './index' ); // The compiler throws an error if the function is provided an unsupported number of arguments... { - const workspace = zeros( [ 10 ], { + const w = zeros( [ 10 ], { 'dtype': 'float64' }); const N = zeros( [], { @@ -59,5 +59,5 @@ import rffti = require( './index' ); }); rffti(); // $ExpectError - rffti( [ workspace, N ], {} ); // $ExpectError + rffti( [ w, N ], {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js index 1ea7f95b212c..4b802e6c1c12 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/examples/index.js @@ -25,12 +25,12 @@ var rffti = require( './../lib' ); var N = 8; -var workspace = new Float64Vector( ( 2*N ) + 34 ); -console.log( ndarray2array( workspace ) ); +var w = new Float64Vector( ( 2*N ) + 34 ); +console.log( ndarray2array( w ) ); var len = scalar2ndarray( N, { 'dtype': 'int32' }); -var out = rffti( [ workspace, len ] ); +var out = rffti( [ w, len ] ); console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js index cc56d4f4c47a..d6b1fe501bc0 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/index.js @@ -35,18 +35,18 @@ * 'dtype': 'int32' * }); * -* var workspace = new Float64Vector( ( 2*N ) + 34 ); +* var w = new Float64Vector( ( 2*N ) + 34 ); * -* var out = rffti( [ workspace, len ] ); +* var out = rffti( [ w, len ] ); * // returns * -* var bool = ( out === workspace ); +* var bool = ( out === w ); * // returns true * -* var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +* var twiddleFactors = slice( w, new Slice( N, 2*N ) ); * // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] * -* var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +* var factors = slice( w, new Slice( 2*N, ( 2*N ) + 4 ) ); * // returns [ 8, 2, 2, 4 ] */ diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js index a8761431c450..445523f4734f 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/lib/main.js @@ -53,28 +53,28 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * 'dtype': 'int32' * }); * -* var workspace = new Float64Vector( ( 2*N ) + 34 ); +* var w = new Float64Vector( ( 2*N ) + 34 ); * -* var out = rffti( [ workspace, len ] ); +* var out = rffti( [ w, len ] ); * // returns * -* var bool = ( out === workspace ); +* var bool = ( out === w ); * // returns true * -* var twiddleFactors = slice( workspace, new Slice( N, 2*N ) ); +* var twiddleFactors = slice( w, new Slice( N, 2*N ) ); * // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] * -* var factors = slice( workspace, new Slice( 2*N, ( 2*N ) + 4 ) ); +* var factors = slice( w, new Slice( 2*N, ( 2*N ) + 4 ) ); * // returns [ 8, 2, 2, 4 ] */ function rffti( arrays ) { - var workspace; + var w; var N; - workspace = arrays[ 0 ]; + w = arrays[ 0 ]; N = ndarraylike2scalar( arrays[ 1 ] ); - strided( N, getData( workspace ), getStride( workspace, 0 ), getOffset( workspace ) ); // eslint-disable-line max-len - return workspace; + strided( N, getData( w ), getStride( w, 0 ), getOffset( w ) ); + return w; } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js index 82f98a09fb03..53944cf204d6 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -62,14 +62,14 @@ tape( 'the function has an arity of 1', function test( t ) { t.end(); }); -tape( 'the function correctly initializes twiddle and integer factors in a one-dimensional ndarray `workspace`', function test( t ) { +tape( 'the function correctly initializes twiddle and integer factors in a one-dimensional ndarray `w`', function test( t ) { var expectedTwiddles; var expectedFactors; - var workspaceBuf; - var workspace; + var wBuf; var ulps; var len; var N; + var w; var v; var i; var y; @@ -79,29 +79,29 @@ tape( 'the function correctly initializes twiddle and integer factors in a one-d len = scalar2ndarray( N, { 'dtype': 'int32' }); - workspaceBuf = new Float64Array( ( 2 * N ) + 34 ); - workspace = vector( workspaceBuf, ( 2 * N ) + 34, 1, 0 ); - v = rffti( [ workspace, len ] ); - t.strictEqual( v, workspace, 'returns expected workspace reference' ); + wBuf = new Float64Array( ( 2 * N ) + 34 ); + w = vector( wBuf, ( 2 * N ) + 34, 1, 0 ); + v = rffti( [ w, len ] ); + t.strictEqual( v, w, 'returns expected workspace reference' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = workspaceBuf[ N + i ]; + y = wBuf[ N + i ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = workspaceBuf[ ( 2 * N ) + i ]; + y = wBuf[ ( 2 * N ) + i ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < N; i++ ) { - y = workspaceBuf[ i ]; + y = wBuf[ i ]; e = 0.0; t.strictEqual( y, e, 'returns expected value' ); } @@ -110,24 +110,24 @@ tape( 'the function correctly initializes twiddle and integer factors in a one-d }); tape( 'if provided an empty ndarray, the function returns the output ndarray unchanged', function test( t ) { - var workspaceBuf; - var workspace; var expected; + var wBuf; var len; + var w; var N; var v; N = 4; - workspaceBuf = new Float64Array( [] ); - workspace = vector( workspaceBuf, 0, 1, 0 ); + wBuf = new Float64Array( [] ); + w = vector( wBuf, 0, 1, 0 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); - v = rffti( [ workspace, len ] ); + v = rffti( [ w, len ] ); expected = new Float64Array( [] ); - t.strictEqual( v, workspace, 'returns expected value' ); + t.strictEqual( v, w, 'returns expected value' ); t.strictEqual( isSameFloat64Array( getData( v ), expected ), true, 'returns expected value' ); t.end(); @@ -136,10 +136,10 @@ tape( 'if provided an empty ndarray, the function returns the output ndarray unc tape( 'the function supports a one-dimensional ndarray having a non-unit stride', function test( t ) { var expectedTwiddles; var expectedFactors; - var workspaceBuf; - var workspace; + var wBuf; var ulps; var len; + var w; var y; var e; var i; @@ -147,38 +147,38 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' var v; N = 8; - workspaceBuf = new Float64Array( ( 4 * N ) + 68 ); - workspace = vector( workspaceBuf, ( 2 * N ) + 34, 2, 0 ); + wBuf = new Float64Array( ( 4 * N ) + 68 ); + w = vector( wBuf, ( 2 * N ) + 34, 2, 0 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); - v = rffti( [ workspace, len ] ); + v = rffti( [ w, len ] ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); - t.strictEqual( v, workspace, 'returns expected value' ); + t.strictEqual( v, w, 'returns expected value' ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = workspaceBuf[ ( 2 * N ) + ( 2 * i ) ]; + y = wBuf[ ( 2 * N ) + ( 2 * i ) ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = workspaceBuf[ ( 4 * N ) + ( 2 * i ) ]; + y = wBuf[ ( 4 * N ) + ( 2 * i ) ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < N; i++ ) { - y = workspaceBuf[ 2*i ]; + y = wBuf[ 2*i ]; e = 0.0; t.strictEqual( y, e, 'returns expected value' ); - y = workspaceBuf[ ( 2*N ) + ( 2*i ) + 1 ]; + y = wBuf[ ( 2*N ) + ( 2*i ) + 1 ]; t.strictEqual( y, e, 'returns expected value' ); } @@ -188,10 +188,10 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' tape( 'the function supports a one-dimensional ndarray having a negative stride', function test( t ) { var expectedTwiddles; var expectedFactors; - var workspaceBuf; - var workspace; + var wBuf; var ulps; var len; + var w; var v; var y; var e; @@ -199,33 +199,33 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' var N; N = 8; - workspaceBuf = new Float64Array( ( 2 * N ) + 34 ); - workspace = vector( workspaceBuf, ( 2 * N ) + 34, -1, ( 2 * N ) + 33 ); + wBuf = new Float64Array( ( 2 * N ) + 34 ); + w = vector( wBuf, ( 2 * N ) + 34, -1, ( 2 * N ) + 33 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); - v = rffti( [ workspace, len ] ); - t.strictEqual( v, workspace, 'returns expected value' ); + v = rffti( [ w, len ] ); + t.strictEqual( v, w, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); expectedFactors = new Float64Array( [ 8.0, 2.0, 2.0, 4.0 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = workspaceBuf[ N + 33 - i ]; + y = wBuf[ N + 33 - i ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = workspaceBuf[ 33 - i ]; + y = wBuf[ 33 - i ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < N; i++ ) { - y = workspaceBuf[ ( 2*N ) + 33 - i ]; + y = wBuf[ ( 2*N ) + 33 - i ]; e = 0.0; t.strictEqual( y, e, 'returns expected value' ); } @@ -236,10 +236,10 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' tape( 'the function supports a one-dimensional ndarray having a non-zero offset', function test( t ) { var expectedTwiddles; var expectedFactors; - var workspaceBuf; - var workspace; + var wBuf; var ulps; var len; + var w; var v; var y; var e; @@ -247,34 +247,34 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' var N; N = 8; - workspaceBuf = new Float64Array( ( 2 * N ) + 34 + 2 ); - workspace = vector( workspaceBuf, ( 2 * N ) + 34, 1, 2 ); + wBuf = new Float64Array( ( 2 * N ) + 34 + 2 ); + w = vector( wBuf, ( 2 * N ) + 34, 1, 2 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); - v = rffti( [ workspace, len ] ); + v = rffti( [ w, len ] ); - t.strictEqual( v, workspace, 'returns expected value' ); + t.strictEqual( v, w, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); expectedFactors = new Float64Array( [ 8.0, 2.0, 2.0, 4.0 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = workspaceBuf[ N + i + 2 ]; + y = wBuf[ N + i + 2 ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = workspaceBuf[ ( 2 * N ) + i + 2 ]; + y = wBuf[ ( 2 * N ) + i + 2 ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < N; i++ ) { - y = workspaceBuf[ i+2 ]; + y = wBuf[ i+2 ]; e = 0.0; t.strictEqual( y, e, 'returns expected value' ); } From a737efb2a5570c8edfc1031c1d5e380e3c57ecc1 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 4 Aug 2026 23:14:32 +0530 Subject: [PATCH 11/14] bench: use generic dtype in 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- .../ndarray/rffti/benchmark/benchmark.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js index fb6e8b58a164..a82fbe499d96 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +var zeros = require( '@stdlib/ndarray/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var format = require( '@stdlib/string/format' ); @@ -29,6 +29,13 @@ var pkg = require( './../package.json' ).name; var rffti = require( './../lib' ); +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + // FUNCTIONS // /** @@ -39,10 +46,12 @@ var rffti = require( './../lib' ); * @returns {Function} benchmark function */ function createBenchmark( N ) { - var len = scalar2ndarray( N, { - 'dtype': 'int32' - }); - var w = new Float64Vector( ( 2*N ) + 34 ); + var len; + var w; + + len = scalar2ndarray( N, options ); + w = zeros( [ ( 2*N ) + 34 ], options ); + return benchmark; /** From 59bdb2332c70e6f53464e361c7b48b84c4ad28d2 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 9 Aug 2026 14:01:39 +0530 Subject: [PATCH 12/14] docs: fix spacing Signed-off-by: Gunj Joshi --- .../base/fftpack/ndarray/rffti/test/test.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js index 53944cf204d6..16a2f43a1b16 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -79,8 +79,8 @@ tape( 'the function correctly initializes twiddle and integer factors in a one-d len = scalar2ndarray( N, { 'dtype': 'int32' }); - wBuf = new Float64Array( ( 2 * N ) + 34 ); - w = vector( wBuf, ( 2 * N ) + 34, 1, 0 ); + wBuf = new Float64Array( ( 2*N ) + 34 ); + w = vector( wBuf, ( 2*N ) + 34, 1, 0 ); v = rffti( [ w, len ] ); t.strictEqual( v, w, 'returns expected workspace reference' ); @@ -89,13 +89,13 @@ tape( 'the function correctly initializes twiddle and integer factors in a one-d ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = wBuf[ N + i ]; + y = wBuf[ N+i ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = wBuf[ ( 2 * N ) + i ]; + y = wBuf[ ( 2*N ) + i ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } @@ -147,8 +147,8 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' var v; N = 8; - wBuf = new Float64Array( ( 4 * N ) + 68 ); - w = vector( wBuf, ( 2 * N ) + 34, 2, 0 ); + wBuf = new Float64Array( ( 4*N ) + 68 ); + w = vector( wBuf, ( 2*N ) + 34, 2, 0 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); @@ -162,13 +162,13 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = wBuf[ ( 2 * N ) + ( 2 * i ) ]; + y = wBuf[ ( 2*N ) + ( 2*i ) ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = wBuf[ ( 4 * N ) + ( 2 * i ) ]; + y = wBuf[ ( 4*N ) + ( 2*i ) ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } @@ -199,8 +199,8 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' var N; N = 8; - wBuf = new Float64Array( ( 2 * N ) + 34 ); - w = vector( wBuf, ( 2 * N ) + 34, -1, ( 2 * N ) + 33 ); + wBuf = new Float64Array( ( 2*N ) + 34 ); + w = vector( wBuf, ( 2*N ) + 34, -1, ( 2*N ) + 33 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); @@ -213,13 +213,13 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = wBuf[ N + 33 - i ]; + y = wBuf[ N +33-i ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = wBuf[ 33 - i ]; + y = wBuf[ 33-i ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } @@ -247,8 +247,8 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' var N; N = 8; - wBuf = new Float64Array( ( 2 * N ) + 34 + 2 ); - w = vector( wBuf, ( 2 * N ) + 34, 1, 2 ); + wBuf = new Float64Array( ( 2*N ) + 34 + 2 ); + w = vector( wBuf, ( 2*N ) + 34, 1, 2 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); @@ -262,13 +262,13 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { - y = wBuf[ N + i + 2 ]; + y = wBuf[ N+i+2 ]; e = expectedTwiddles[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } for ( i = 0; i < expectedFactors.length; i++ ) { - y = wBuf[ ( 2 * N ) + i + 2 ]; + y = wBuf[ ( 2*N ) + i + 2 ]; e = expectedFactors[ i ]; t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); } From 849bbc4ae864d2ad498ce7e3e4ae3e312026f47b Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 11 Aug 2026 08:43:46 +0530 Subject: [PATCH 13/14] test: use integers Signed-off-by: Gunj Joshi --- .../@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js index 16a2f43a1b16..3ac6bee78ce9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -209,7 +209,7 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' t.strictEqual( v, w, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - expectedFactors = new Float64Array( [ 8.0, 2.0, 2.0, 4.0 ] ); + expectedFactors = new Float32Array( [ 8, 2, 2, 4 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { @@ -258,7 +258,7 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' t.strictEqual( v, w, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - expectedFactors = new Float64Array( [ 8.0, 2.0, 2.0, 4.0 ] ); + expectedFactors = new Float32Array( [ 8, 2, 2, 4 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { From 17c95ca436c3aeddaa74ecc76db0cb1649c2404c Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 11 Aug 2026 09:04:50 +0530 Subject: [PATCH 14/14] test: use Float64Array Signed-off-by: Gunj Joshi --- .../@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js index 3ac6bee78ce9..53f396630a75 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/rffti/test/test.js @@ -209,7 +209,7 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' t.strictEqual( v, w, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - expectedFactors = new Float32Array( [ 8, 2, 2, 4 ] ); + expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) { @@ -258,7 +258,7 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' t.strictEqual( v, w, 'returns expected value' ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - expectedFactors = new Float32Array( [ 8, 2, 2, 4 ] ); + expectedFactors = new Float64Array( [ 8, 2, 2, 4 ] ); ulps = 1; for ( i = 0; i < expectedTwiddles.length; i++ ) {