From 63a07339c6b62200624f801148ced238171eedea Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sat, 15 Aug 2026 16:17:56 +0530 Subject: [PATCH 1/3] feat: add fft/base/fftpack/ndarray/dsinqi --- 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/dsinqi/README.md | 136 ++++++++ .../ndarray/dsinqi/benchmark/benchmark.js | 110 ++++++ .../base/fftpack/ndarray/dsinqi/docs/repl.txt | 43 +++ .../ndarray/dsinqi/docs/types/index.d.ts | 71 ++++ .../fftpack/ndarray/dsinqi/docs/types/test.ts | 63 ++++ .../fftpack/ndarray/dsinqi/examples/index.js | 36 ++ .../base/fftpack/ndarray/dsinqi/lib/index.js | 63 ++++ .../base/fftpack/ndarray/dsinqi/lib/main.js | 86 +++++ .../base/fftpack/ndarray/dsinqi/package.json | 66 ++++ .../base/fftpack/ndarray/dsinqi/test/test.js | 315 ++++++++++++++++++ 10 files changed, 989 insertions(+) create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/main.js create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json create mode 100644 lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md new file mode 100644 index 000000000000..012c31c5013d --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md @@ -0,0 +1,136 @@ + + +# dsinqi + +> Initialize a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. + +
+ +
+ + + +
+ +## Usage + +```javascript +var dsinqi = require( '@stdlib/fft/base/fftpack/ndarray/dsinqi' ); +``` + +#### dsinqi( arrays ) + +Initializes a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point 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 w = new Float64Vector( ( 3*N ) + 34 ); + +var out = dsinqi( [ w, len ] ); +// returns + +var bool = ( out === w ); +// returns true + +var cosineTable = slice( w, new Slice( 0, N ) ); +// returns [ ~0.98, ~0.92, ~0.83, ~0.7, ~0.56, ~0.38, ~0.2, ~0.0 ] + +var twiddleFactors = slice( w, new Slice( 2*N, 3*N ) ); +// returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] + +var factors = slice( w, new Slice( 3*N, ( 3*N ) + 4 ) ); +// returns [ 8, 2, 2, 4 ] +``` + +The function has the following parameters: + +- **arrays**: array-like object containing the following ndarrays: + + - a one-dimensional input ndarray. + - a zero-dimensional ndarray containing the length of the sequence to transform. + +
+ + + +
+ +## 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 dsinqi = require( '@stdlib/fft/base/fftpack/ndarray/dsinqi' ); + +var N = 8; + +var w = new Float64Vector( ( 3*N ) + 34 ); +console.log( ndarray2array( w ) ); + +var len = scalar2ndarray( N, { + 'dtype': 'int32' +}); + +var out = dsinqi( [ w, len ] ); +console.log( ndarray2array( out ) ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js new file mode 100644 index 000000000000..1e7a4b3744a1 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js @@ -0,0 +1,110 @@ +/** +* @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 dsinqi = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - sequence length +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var len; + var w; + + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + w = new Float64Vector( ( 3*N ) + 34 ); + + 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 = dsinqi( [ w, len ] ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( isnan( v.get( 2*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/dsinqi/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/repl.txt new file mode 100644 index 000000000000..8d707b758995 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/repl.txt @@ -0,0 +1,43 @@ + +{{alias}}( arrays ) + Initializes a workspace array for performing a quarter-wave sine + transform on a one-dimensional double-precision floating-point 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 one-dimensional input ndarray. + - a zero-dimensional ndarray containing the length of the sequence to + transform. + + Returns + ------- + out: ndarray + Output ndarray. + + Examples + -------- + > var N = 8; + > var w = new {{alias:@stdlib/ndarray/vector/float64}}( ( 3*N ) + 34 ); + > var len = {{alias:@stdlib/ndarray/from-scalar}}( N, { 'dtype': 'int32' }); + > var out = {{alias}}( [ w, len ] ) + + > var bool = ( out === w ) + true + > var s = new {{alias:@stdlib/slice/ctor}}( 0, N ); + > var cosineTable = {{alias:@stdlib/ndarray/slice}}( w, s ) + [ ~0.98, ~0.92, ~0.83, ~0.7, ~0.56, ~0.38, ~0.2, ~0.0 ] + > s = new {{alias:@stdlib/slice/ctor}}( 2*N, 3*N ); + > var twiddleFactors = {{alias:@stdlib/ndarray/slice}}( w, s ) + [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] + > s = new {{alias:@stdlib/slice/ctor}}( 3*N, ( 3*N ) + 4 ); + > 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/dsinqi/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/index.d.ts new file mode 100644 index 000000000000..8c31e3cce079 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/index.d.ts @@ -0,0 +1,71 @@ +/* +* @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 { typedndarray, float64ndarray } from '@stdlib/types/ndarray'; + +/** +* Initializes a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - 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 +* +* @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 w = new Float64Vector( ( 3*N ) + 34 ); +* +* var out = dsinqi( [ w, len ] ); +* // returns +* +* var bool = ( out === w ); +* // returns true +* +* var cosineTable = slice( w, new Slice( 0, N ) ); +* // returns [ ~0.98, ~0.92, ~0.83, ~0.7, ~0.56, ~0.38, ~0.2, ~0.0 ] +* +* var twiddleFactors = slice( w, new Slice( 2*N, 3*N ) ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] +* +* var factors = slice( w, new Slice( 3*N, ( 3*N ) + 4 ) ); +* // returns [ 8, 2, 2, 4 ] +*/ +declare function dsinqi( arrays: [ float64ndarray, typedndarray ] ): float64ndarray; + + +// EXPORTS // + +export = dsinqi; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/test.ts new file mode 100644 index 000000000000..377753a8ccde --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/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 dsinqi = require( './index' ); + + +// TESTS // + +// The function returns an ndarray... +{ + const w = zeros( [ 10 ], { + 'dtype': 'float64' + }); + const N = zeros( [], { + 'dtype': 'int32' + }); + + dsinqi( [ w, N ] ); // $ExpectType float64ndarray +} + +// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... +{ + dsinqi( '10' ); // $ExpectError + dsinqi( 10 ); // $ExpectError + dsinqi( true ); // $ExpectError + dsinqi( false ); // $ExpectError + dsinqi( null ); // $ExpectError + dsinqi( undefined ); // $ExpectError + dsinqi( [] ); // $ExpectError + dsinqi( {} ); // $ExpectError + dsinqi( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const w = zeros( [ 10 ], { + 'dtype': 'float64' + }); + const N = zeros( [], { + 'dtype': 'int32' + }); + + dsinqi(); // $ExpectError + dsinqi( [ w, N ], {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js new file mode 100644 index 000000000000..d606a4fa1682 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js @@ -0,0 +1,36 @@ +/** +* @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 dsinqi = require( './../lib' ); + +var N = 8; + +var w = new Float64Vector( ( 3*N ) + 34 ); +console.log( ndarray2array( w ) ); + +var len = scalar2ndarray( N, { + 'dtype': 'int32' +}); + +var out = dsinqi( [ w, len ] ); +console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js new file mode 100644 index 000000000000..6b05588809cc --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js @@ -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. +*/ + +'use strict'; + +/** +* Initialize a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. +* +* @module @stdlib/fft/base/fftpack/ndarray/dsinqi +* +* @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 dsinqi = require( '@stdlib/fft/base/fftpack/ndarray/dsinqi' ); +* +* var N = 8; +* var len = scalar2ndarray( N, { +* 'dtype': 'int32' +* }); +* +* var w = new Float64Vector( ( 3*N ) + 34 ); +* +* var out = dsinqi( [ w, len ] ); +* // returns +* +* var bool = ( out === w ); +* // returns true +* +* var cosineTable = slice( w, new Slice( 0, N ) ); +* // returns [ ~0.98, ~0.92, ~0.83, ~0.7, ~0.56, ~0.38, ~0.2, ~0.0 ] +* +* var twiddleFactors = slice( w, new Slice( 2*N, 3*N ) ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] +* +* var factors = slice( w, new Slice( 3*N, ( 3*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/dsinqi/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/main.js new file mode 100644 index 000000000000..c7a00f1f06cd --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/main.js @@ -0,0 +1,86 @@ +/** +* @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/sinqi' ); +var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); + + +// MAIN // + +/** +* Initializes a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - 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 +* +* @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 w = new Float64Vector( ( 3*N ) + 34 ); +* +* var out = dsinqi( [ w, len ] ); +* // returns +* +* var bool = ( out === w ); +* // returns true +* +* var cosineTable = slice( w, new Slice( 0, N ) ); +* // returns [ ~0.98, ~0.92, ~0.83, ~0.7, ~0.56, ~0.38, ~0.2, ~0.0 ] +* +* var twiddleFactors = slice( w, new Slice( 2*N, 3*N ) ); +* // returns [ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ] +* +* var factors = slice( w, new Slice( 3*N, ( 3*N ) + 4 ) ); +* // returns [ 8, 2, 2, 4 ] +*/ +function dsinqi( arrays ) { + var w; + var N; + + w = arrays[ 0 ]; + N = ndarraylike2scalar( arrays[ 1 ] ); + strided( N, getData( w ), getStride( w, 0 ), getOffset( w ) ); + return w; +} + + +// EXPORTS // + +module.exports = dsinqi; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json new file mode 100644 index 000000000000..c073c867d76c --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/fft/base/fftpack/ndarray/dsinqi", + "version": "0.0.0", + "description": "Initialize a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point 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", + "dsinqi", + "fourier", + "transform", + "twiddle", + "sine", + "workspace", + "initialization", + "real", + "ndarray" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js new file mode 100644 index 000000000000..9a8dc3829aa7 --- /dev/null +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js @@ -0,0 +1,315 @@ +/** +* @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 dsinqi = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns a one-dimensional ndarray. +* +* @private +* @param {Float64Array} 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 dsinqi, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 1', function test( t ) { + t.strictEqual( dsinqi.length, 1, 'has expected arity' ); + t.end(); +}); + +tape( 'the function correctly initializes cosine, twiddle and integer factors in a one-dimensional ndarray `w`', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var expectedCosines; + var wBuf; + var ulps; + var len; + var N; + var w; + var v; + var i; + var y; + var e; + + N = 8; + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + wBuf = new Float64Array( ( 3*N ) + 34 ); + w = vector( wBuf, ( 3*N ) + 34, 1, 0 ); + v = dsinqi( [ w, len ] ); + t.strictEqual( v, w, 'returns expected workspace reference' ); + + expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); + 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 < expectedCosines.length; i++ ) { + y = wBuf[ i ]; + e = expectedCosines[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = wBuf[ ( 2*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[ ( 3*N ) + i ]; + e = expectedFactors[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = N; i < 2*N; i++ ) { + y = wBuf[ i ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + } + + t.end(); +}); + +tape( 'if provided an empty ndarray, the function returns the output ndarray unchanged', function test( t ) { + var expected; + var wBuf; + var len; + var w; + var N; + var v; + + N = 4; + wBuf = new Float64Array( [] ); + w = vector( wBuf, 0, 1, 0 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = dsinqi( [ w, len ] ); + + expected = new Float64Array( [] ); + t.strictEqual( v, w, '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 expectedCosines; + var wBuf; + var ulps; + var len; + var w; + var y; + var e; + var i; + var N; + var v; + + N = 8; + wBuf = new Float64Array( ( 6*N ) + 68 ); + w = vector( wBuf, ( 3*N ) + 34, 2, 0 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = dsinqi( [ w, len ] ); + + expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); + 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, w, 'returns expected value' ); + + ulps = 1; + for ( i = 0; i < expectedCosines.length; i++ ) { + y = wBuf[ 2*i ]; + e = expectedCosines[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = wBuf[ ( 4*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[ ( 6*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 = wBuf[ ( 2*N ) + ( 2*i ) ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + + y = wBuf[ ( 4*N ) + ( 2*i ) + 1 ]; + t.strictEqual( y, e, 'returns expected value' ); + } + + t.end(); +}); + +tape( 'the function supports a one-dimensional ndarray having a negative stride', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var expectedCosines; + var wBuf; + var ulps; + var len; + var w; + var v; + var y; + var e; + var i; + var N; + + N = 8; + wBuf = new Float64Array( ( 3*N ) + 34 ); + w = vector( wBuf, ( 3*N ) + 34, -1, ( 3*N ) + 33 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = dsinqi( [ w, len ] ); + t.strictEqual( v, w, 'returns expected value' ); + + expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); + 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 < expectedCosines.length; i++ ) { + y = wBuf[ ( 3*N ) + 33 - i ]; + e = expectedCosines[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedTwiddles.length; 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 ]; + 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 = wBuf[ ( 2*N ) + 33 - i ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + } + + t.end(); +}); + +tape( 'the function supports a one-dimensional ndarray having a non-zero offset', function test( t ) { + var expectedTwiddles; + var expectedFactors; + var expectedCosines; + var wBuf; + var ulps; + var len; + var w; + var v; + var y; + var e; + var i; + var N; + + N = 8; + wBuf = new Float64Array( ( 3*N ) + 34 + 2 ); + w = vector( wBuf, ( 3*N ) + 34, 1, 2 ); + len = scalar2ndarray( N, { + 'dtype': 'int32' + }); + + v = dsinqi( [ w, len ] ); + + t.strictEqual( v, w, 'returns expected value' ); + + expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); + 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 < expectedCosines.length; i++ ) { + y = wBuf[ i+2 ]; + e = expectedCosines[ i ]; + t.strictEqual( isAlmostSameValue( y, e, ulps ), true, 'within ' + ulps + ' ULPs. N: ' + N + '. y: ' + y + '. E: ' + e ); + } + + for ( i = 0; i < expectedTwiddles.length; i++ ) { + y = wBuf[ ( 2*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[ ( 3*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 = wBuf[ N+i+2 ]; + e = 0.0; + t.strictEqual( y, e, 'returns expected value' ); + } + + t.end(); +}); From a10da423b2e36212280b53bf4efe024bb2ee63a7 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Sun, 30 Aug 2026 16:57:41 +0530 Subject: [PATCH 2/3] chore: restructure to ndarray/float64/sinqi --- 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 --- --- .../{dsinqi => float64/sinqi}/README.md | 37 +++++++++++++++---- .../sinqi}/benchmark/benchmark.js | 4 +- .../{dsinqi => float64/sinqi}/docs/repl.txt | 11 +++--- .../sinqi}/docs/types/index.d.ts | 8 ++-- .../sinqi}/docs/types/test.ts | 26 ++++++------- .../sinqi}/examples/index.js | 4 +- .../{dsinqi => float64/sinqi}/lib/index.js | 6 +-- .../{dsinqi => float64/sinqi}/lib/main.js | 10 ++--- .../{dsinqi => float64/sinqi}/package.json | 6 ++- .../{dsinqi => float64/sinqi}/test/test.js | 20 +++++----- 10 files changed, 79 insertions(+), 53 deletions(-) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/README.md (63%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/benchmark/benchmark.js (96%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/docs/repl.txt (84%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/docs/types/index.d.ts (92%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/docs/types/test.ts (71%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/examples/index.js (93%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/lib/index.js (90%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/lib/main.js (92%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/package.json (92%) rename lib/node_modules/@stdlib/fft/base/fftpack/ndarray/{dsinqi => float64/sinqi}/test/test.js (94%) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md similarity index 63% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md index 012c31c5013d..4e71e697da08 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md @@ -18,7 +18,7 @@ limitations under the License. --> -# dsinqi +# sinqi > Initialize a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. @@ -33,10 +33,10 @@ limitations under the License. ## Usage ```javascript -var dsinqi = require( '@stdlib/fft/base/fftpack/ndarray/dsinqi' ); +var sinqi = require( '@stdlib/fft/base/fftpack/ndarray/float64/sinqi' ); ``` -#### dsinqi( arrays ) +#### sinqi( arrays ) Initializes a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. @@ -53,7 +53,7 @@ var len = scalar2ndarray( N, { var w = new Float64Vector( ( 3*N ) + 34 ); -var out = dsinqi( [ w, len ] ); +var out = sinqi( [ w, len ] ); // returns var bool = ( out === w ); @@ -84,7 +84,30 @@ The function has the following parameters: ## Notes -- If provided an empty one-dimensional input ndarray, the function returns the output ndarray unchanged. +- Let `N` equal the number of elements in the input ndarray. The input ndarray is divided into four sections: + + ```text + size = N N N 2+ceil(log2(N)/2) + ↓ ↓ ↓ ↓ + | cosine table | scratch / workspace | twiddle factors | radix factor table | + ↑ ↑ ↑ ↑ + i = 0 ... N ... 2N ... 3N ... + ``` + + - **cosine table**: a table of precomputed cosine coefficients used by quarter-wave sine transforms. + - **scratch/workspace**: used as a scratch space when performing transforms. This section is not updated during initialization. + - **twiddle factors**: a table of reusable complex-exponential constants stored as cosine/sine pairs. + - **radix factor table**: a table containing the sequence length `N`, the number of factors into which `N` was decomposed, and the individual integer radix factors. + +- In general, an input ndarray should have `3N + 34` indexed elements (as `log2(N)/2 ≤ 32` for all `2^64`). During initialization, only the sections for storing the cosine coefficients, twiddle factors, and the factorization of `N` are updated. + +- The radix factor table is comprised as follows: + + ```text + | sequence_length | number_of_factors | integer_factors | + ``` + +- If provided an empty one-dimensional input ndarray, the function returns the input ndarray unchanged. @@ -100,7 +123,7 @@ The function has the following parameters: var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var dsinqi = require( '@stdlib/fft/base/fftpack/ndarray/dsinqi' ); +var sinqi = require( '@stdlib/fft/base/fftpack/ndarray/float64/sinqi' ); var N = 8; @@ -111,7 +134,7 @@ var len = scalar2ndarray( N, { 'dtype': 'int32' }); -var out = dsinqi( [ w, len ] ); +var out = sinqi( [ w, len ] ); console.log( ndarray2array( out ) ); ``` diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/benchmark/benchmark.js similarity index 96% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/benchmark/benchmark.js index 1e7a4b3744a1..d90d41d6f4c2 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/benchmark/benchmark.js @@ -26,7 +26,7 @@ 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 dsinqi = require( './../lib' ); +var sinqi = require( './../lib' ); // FUNCTIONS // @@ -61,7 +61,7 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - v = dsinqi( [ w, len ] ); + v = sinqi( [ w, len ] ); if ( typeof v !== 'object' ) { b.fail( 'should return an ndarray' ); } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt similarity index 84% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/repl.txt rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt index 8d707b758995..1c1d0578464a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt @@ -1,9 +1,9 @@ {{alias}}( arrays ) - Initializes a workspace array for performing a quarter-wave sine - transform on a one-dimensional double-precision floating-point ndarray. + Initializes a workspace array for performing a quarter-wave sine transform + on a one-dimensional double-precision floating-point ndarray. - If provided an empty input ndarray, the function returns the output ndarray + If provided an empty input ndarray, the function returns the input ndarray unchanged. Parameters @@ -18,13 +18,14 @@ Returns ------- out: ndarray - Output ndarray. + Input ndarray. Examples -------- > var N = 8; > var w = new {{alias:@stdlib/ndarray/vector/float64}}( ( 3*N ) + 34 ); - > var len = {{alias:@stdlib/ndarray/from-scalar}}( N, { 'dtype': 'int32' }); + > var opts = { 'dtype': 'int32' }; + > var len = {{alias:@stdlib/ndarray/from-scalar}}( N, opts ); > var out = {{alias}}( [ w, len ] ) > var bool = ( out === w ) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/index.d.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/types/index.d.ts similarity index 92% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/index.d.ts rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/types/index.d.ts index 8c31e3cce079..95ab4c303575 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/types/index.d.ts @@ -33,7 +33,7 @@ import { typedndarray, float64ndarray } from '@stdlib/types/ndarray'; * - a zero-dimensional ndarray containing the length of the sequence to transform. * * @param arrays - array-like object containing ndarrays -* @returns output ndarray +* @returns input ndarray * * @example * var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); @@ -48,7 +48,7 @@ import { typedndarray, float64ndarray } from '@stdlib/types/ndarray'; * * var w = new Float64Vector( ( 3*N ) + 34 ); * -* var out = dsinqi( [ w, len ] ); +* var out = sinqi( [ w, len ] ); * // returns * * var bool = ( out === w ); @@ -63,9 +63,9 @@ import { typedndarray, float64ndarray } from '@stdlib/types/ndarray'; * var factors = slice( w, new Slice( 3*N, ( 3*N ) + 4 ) ); * // returns [ 8, 2, 2, 4 ] */ -declare function dsinqi( arrays: [ float64ndarray, typedndarray ] ): float64ndarray; +declare function sinqi( arrays: [ float64ndarray, typedndarray ] ): float64ndarray; // EXPORTS // -export = dsinqi; +export = sinqi; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/test.ts b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/types/test.ts similarity index 71% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/test.ts rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/types/test.ts index 377753a8ccde..8dd186f80dc9 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/docs/types/test.ts +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/types/test.ts @@ -19,7 +19,7 @@ /* eslint-disable space-in-parens */ import zeros = require( '@stdlib/ndarray/zeros' ); -import dsinqi = require( './index' ); +import sinqi = require( './index' ); // TESTS // @@ -33,20 +33,20 @@ import dsinqi = require( './index' ); 'dtype': 'int32' }); - dsinqi( [ w, N ] ); // $ExpectType float64ndarray + sinqi( [ w, N ] ); // $ExpectType float64ndarray } // The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... { - dsinqi( '10' ); // $ExpectError - dsinqi( 10 ); // $ExpectError - dsinqi( true ); // $ExpectError - dsinqi( false ); // $ExpectError - dsinqi( null ); // $ExpectError - dsinqi( undefined ); // $ExpectError - dsinqi( [] ); // $ExpectError - dsinqi( {} ); // $ExpectError - dsinqi( ( x: number ): number => x ); // $ExpectError + sinqi( '10' ); // $ExpectError + sinqi( 10 ); // $ExpectError + sinqi( true ); // $ExpectError + sinqi( false ); // $ExpectError + sinqi( null ); // $ExpectError + sinqi( undefined ); // $ExpectError + sinqi( [] ); // $ExpectError + sinqi( {} ); // $ExpectError + sinqi( ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided an unsupported number of arguments... @@ -58,6 +58,6 @@ import dsinqi = require( './index' ); 'dtype': 'int32' }); - dsinqi(); // $ExpectError - dsinqi( [ w, N ], {} ); // $ExpectError + sinqi(); // $ExpectError + sinqi( [ w, N ], {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/examples/index.js similarity index 93% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/examples/index.js index d606a4fa1682..dff62c5eb62b 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/examples/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/examples/index.js @@ -21,7 +21,7 @@ var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var dsinqi = require( './../lib' ); +var sinqi = require( './../lib' ); var N = 8; @@ -32,5 +32,5 @@ var len = scalar2ndarray( N, { 'dtype': 'int32' }); -var out = dsinqi( [ w, len ] ); +var out = sinqi( [ w, len ] ); console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/lib/index.js similarity index 90% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/lib/index.js index 6b05588809cc..49eee1845616 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/index.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/lib/index.js @@ -21,14 +21,14 @@ /** * Initialize a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. * -* @module @stdlib/fft/base/fftpack/ndarray/dsinqi +* @module @stdlib/fft/base/fftpack/ndarray/float64/sinqi * * @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 dsinqi = require( '@stdlib/fft/base/fftpack/ndarray/dsinqi' ); +* var sinqi = require( '@stdlib/fft/base/fftpack/ndarray/float64/sinqi' ); * * var N = 8; * var len = scalar2ndarray( N, { @@ -37,7 +37,7 @@ * * var w = new Float64Vector( ( 3*N ) + 34 ); * -* var out = dsinqi( [ w, len ] ); +* var out = sinqi( [ w, len ] ); * // returns * * var bool = ( out === w ); diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/main.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/lib/main.js similarity index 92% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/main.js rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/lib/main.js index c7a00f1f06cd..1a06915ff089 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/lib/main.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/lib/main.js @@ -23,7 +23,7 @@ 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/sinqi' ); +var strided = require( '@stdlib/fft/base/fftpack/float64/sinqi' ); var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); @@ -40,7 +40,7 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * - a zero-dimensional ndarray containing the length of the sequence to transform. * * @param {ArrayLikeObject} arrays - array-like object containing ndarrays -* @returns {ndarrayLike} output ndarray +* @returns {ndarrayLike} input ndarray * * @example * var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); @@ -55,7 +55,7 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * * var w = new Float64Vector( ( 3*N ) + 34 ); * -* var out = dsinqi( [ w, len ] ); +* var out = sinqi( [ w, len ] ); * // returns * * var bool = ( out === w ); @@ -70,7 +70,7 @@ var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); * var factors = slice( w, new Slice( 3*N, ( 3*N ) + 4 ) ); * // returns [ 8, 2, 2, 4 ] */ -function dsinqi( arrays ) { +function sinqi( arrays ) { var w; var N; @@ -83,4 +83,4 @@ function dsinqi( arrays ) { // EXPORTS // -module.exports = dsinqi; +module.exports = sinqi; diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/package.json similarity index 92% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/package.json index c073c867d76c..100fe4f1362a 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/package.json +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/package.json @@ -1,5 +1,5 @@ { - "name": "@stdlib/fft/base/fftpack/ndarray/dsinqi", + "name": "@stdlib/fft/base/fftpack/ndarray/float64/sinqi", "version": "0.0.0", "description": "Initialize a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray.", "license": "Apache-2.0", @@ -60,7 +60,9 @@ "workspace", "initialization", "real", - "ndarray" + "ndarray", + "double", + "float64" ], "__stdlib__": {} } diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js similarity index 94% rename from lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js rename to lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js index 9a8dc3829aa7..ca91a411d4dd 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/dsinqi/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js @@ -29,7 +29,7 @@ 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 dsinqi = require( './../lib' ); +var sinqi = require( './../lib' ); // FUNCTIONS // @@ -53,12 +53,12 @@ function vector( buffer, length, stride, offset ) { tape( 'main export is a function', function test( t ) { t.ok( true, __filename ); - t.strictEqual( typeof dsinqi, 'function', 'main export is a function' ); + t.strictEqual( typeof sinqi, 'function', 'main export is a function' ); t.end(); }); tape( 'the function has an arity of 1', function test( t ) { - t.strictEqual( dsinqi.length, 1, 'has expected arity' ); + t.strictEqual( sinqi.length, 1, 'has expected arity' ); t.end(); }); @@ -82,8 +82,8 @@ tape( 'the function correctly initializes cosine, twiddle and integer factors in }); wBuf = new Float64Array( ( 3*N ) + 34 ); w = vector( wBuf, ( 3*N ) + 34, 1, 0 ); - v = dsinqi( [ w, len ] ); - t.strictEqual( v, w, 'returns expected workspace reference' ); + v = sinqi( [ w, len ] ); + t.strictEqual( v, w, 'returns expected value' ); expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -117,7 +117,7 @@ tape( 'the function correctly initializes cosine, twiddle and integer factors in t.end(); }); -tape( 'if provided an empty ndarray, the function returns the output ndarray unchanged', function test( t ) { +tape( 'if provided an empty ndarray, the function returns the input ndarray unchanged', function test( t ) { var expected; var wBuf; var len; @@ -132,7 +132,7 @@ tape( 'if provided an empty ndarray, the function returns the output ndarray unc 'dtype': 'int32' }); - v = dsinqi( [ w, len ] ); + v = sinqi( [ w, len ] ); expected = new Float64Array( [] ); t.strictEqual( v, w, 'returns expected value' ); @@ -162,7 +162,7 @@ tape( 'the function supports a one-dimensional ndarray having a non-unit stride' 'dtype': 'int32' }); - v = dsinqi( [ w, len ] ); + v = sinqi( [ w, len ] ); expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); expectedTwiddles = new Float64Array( [ 0.7071067811865476, 0.7071067811865475, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -222,7 +222,7 @@ tape( 'the function supports a one-dimensional ndarray having a negative stride' 'dtype': 'int32' }); - v = dsinqi( [ w, len ] ); + v = sinqi( [ w, len ] ); t.strictEqual( v, w, 'returns expected value' ); expectedCosines = new Float64Array( [ 0.9807852804032304, 0.9238795325112867, 0.8314696123025452, 0.7071067811865476, 0.5555702330196023, 0.38268343236508984, 0.19509032201612833, 6.123233995736766e-17 ] ); @@ -278,7 +278,7 @@ tape( 'the function supports a one-dimensional ndarray having a non-zero offset' 'dtype': 'int32' }); - v = dsinqi( [ w, len ] ); + v = sinqi( [ w, len ] ); t.strictEqual( v, w, 'returns expected value' ); From ac4951dd2e8aa839481c38895722366d9b10520b Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Mon, 31 Aug 2026 09:04:17 +0530 Subject: [PATCH 3/3] test: update test and docs --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_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: 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 --- --- .../fft/base/fftpack/ndarray/float64/sinqi/README.md | 4 ++-- .../base/fftpack/ndarray/float64/sinqi/docs/repl.txt | 4 ++-- .../base/fftpack/ndarray/float64/sinqi/test/test.js | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md index 4e71e697da08..dae4727bf746 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/README.md @@ -84,7 +84,7 @@ The function has the following parameters: ## Notes -- Let `N` equal the number of elements in the input ndarray. The input ndarray is divided into four sections: +- Let `N` equal the length of the sequence to transform. The input ndarray is divided into four sections: ```text size = N N N 2+ceil(log2(N)/2) @@ -107,7 +107,7 @@ The function has the following parameters: | sequence_length | number_of_factors | integer_factors | ``` -- If provided an empty one-dimensional input ndarray, the function returns the input ndarray unchanged. +- If `N` equals `0`, the function returns the input ndarray unchanged. diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt index 1c1d0578464a..b35b4594b8ba 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/docs/repl.txt @@ -3,8 +3,8 @@ Initializes a workspace array for performing a quarter-wave sine transform on a one-dimensional double-precision floating-point ndarray. - If provided an empty input ndarray, the function returns the input ndarray - unchanged. + If `N` equals `0`, where `N` is the length of the sequence to transform, the + function returns the input ndarray unchanged. Parameters ---------- diff --git a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js index ca91a411d4dd..6b812b1de494 100644 --- a/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js +++ b/lib/node_modules/@stdlib/fft/base/fftpack/ndarray/float64/sinqi/test/test.js @@ -117,7 +117,7 @@ tape( 'the function correctly initializes cosine, twiddle and integer factors in t.end(); }); -tape( 'if provided an empty ndarray, the function returns the input ndarray unchanged', function test( t ) { +tape( 'the function returns the input ndarray unchanged when N equals 0', function test( t ) { var expected; var wBuf; var len; @@ -125,16 +125,16 @@ tape( 'if provided an empty ndarray, the function returns the input ndarray unch var N; var v; - N = 4; - wBuf = new Float64Array( [] ); - w = vector( wBuf, 0, 1, 0 ); + N = 0; + wBuf = new Float64Array( ( 3*N ) + 34 ); + w = vector( wBuf, ( 3*N ) + 34, 1, 0 ); len = scalar2ndarray( N, { 'dtype': 'int32' }); v = sinqi( [ w, len ] ); - expected = new Float64Array( [] ); + expected = new Float64Array( ( 3*N ) + 34 ); t.strictEqual( v, w, 'returns expected value' ); t.strictEqual( isSameFloat64Array( getData( v ), expected ), true, 'returns expected value' );