From 70f40778c030347da51fc1f3edb9c003dd813dad Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 14 Jan 2025 13:32:16 +0530 Subject: [PATCH 1/4] feat: add Js implementation for dlartv --- 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 status: passed - 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/lapack/base/dlartv/README.md | 263 +++++++++ .../lapack/base/dlartv/benchmark/benchmark.js | 101 ++++ .../dlartv/benchmark/benchmark.ndarray.js | 101 ++++ .../@stdlib/lapack/base/dlartv/docs/repl.txt | 114 ++++ .../lapack/base/dlartv/docs/types/index.d.ts | 127 +++++ .../lapack/base/dlartv/docs/types/test.ts | 440 +++++++++++++++ .../lapack/base/dlartv/examples/index.js | 31 ++ .../@stdlib/lapack/base/dlartv/lib/dlartv.js | 64 +++ .../@stdlib/lapack/base/dlartv/lib/index.js | 74 +++ .../@stdlib/lapack/base/dlartv/lib/main.js | 35 ++ .../@stdlib/lapack/base/dlartv/lib/ndarray.js | 84 +++ .../@stdlib/lapack/base/dlartv/package.json | 70 +++ .../lapack/base/dlartv/test/test.dlartv.js | 412 ++++++++++++++ .../@stdlib/lapack/base/dlartv/test/test.js | 82 +++ .../lapack/base/dlartv/test/test.ndarray.js | 510 ++++++++++++++++++ 15 files changed, 2508 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/README.md create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/examples/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/lib/dlartv.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/package.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/test/test.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/README.md b/lib/node_modules/@stdlib/lapack/base/dlartv/README.md new file mode 100644 index 000000000000..58f285789afb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/README.md @@ -0,0 +1,263 @@ + + +# dlartv + +> Apply a vector of real plane rotations to elements of real vectors `X` and `Y`. + +
+ +## Usage + +```javascript +var dlartv = require( '@stdlib/lapack/base/dlartv' ); +``` + +#### dlartv( N, X, strideX, Y, strideY, C, S, strideCS ) + +Applies a vector of real plane rotations to elements of real vectors `X` and `Y`. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var X = new Float64Array( [ 1.0, 1.0 ] ); +var Y = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var S = new Float64Array( [ 0.0, 0.0 ] ); + +dlartv( 2, X, 1, Y, 1, C, S, 1 ); +// X => [ 1.0, 1.0 ] +// Y => [ 1.0, 1.0 ] +``` + +The function has the following parameters: + +- **N**: number of plane rotations to apply. +- **X**: first input [`Float64Array`][mdn-float64array]. +- **strideX**: `X` stride length. +- **Y**: second input [`Float64Array`][mdn-float64array]. +- **strideY**: `Y` stride length. +- **C**: input [`Float64Array`][mdn-float64array] containing the cosine values of the plane rotations. +- **S**: input [`Float64Array`][mdn-float64array] containing the sine values of the plane rotations. +- **strideCS**: `CS` stride length. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays... +var X0 = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var Y0 = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var C0 = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var S0 = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + +// Create offset views... +var X1 = new Float64Array( X0.buffer, X0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var Y1 = new Float64Array( Y0.buffer, Y0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var C1 = new Float64Array( C0.buffer, C0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var S1 = new Float64Array( S0.buffer, S0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dlartv( 2, X1, 1, Y1, 1, C1, S1, 1 ); +// X0 => [ 0.0, 1.0, 1.0 ] +// Y0 => [ 0.0, 1.0, 1.0 ] +``` + +#### dlartv.ndarray( N, X, sx, ox, Y, sy, oy, C, sc, oc, S, ss, os ) + +Applies a vector of real plane rotations to elements of real vectors `X` and `Y` using alternative semantic indexing. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var X = new Float64Array( [ 1.0, 1.0 ] ); +var Y = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var S = new Float64Array( [ 0.0, 0.0 ] ); + +dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); +// X => [ 1.0, 1.0 ] +// Y => [ 1.0, 1.0 ] +``` + +The function has the following parameters: + +- **N**: number of plane rotations to apply. +- **X**: first input [`Float64Array`][mdn-float64array]. +- **sx**: `X` stride length. +- **ox**: starting index for `X`. +- **Y**: second input [`Float64Array`][mdn-float64array]. +- **sy**: `Y` stride length. +- **oy**: starting index for `Y`. +- **C**: input [`Float64Array`][mdn-float64array] containing the cosine values of the plane rotations. +- **sc**: `C` stride length. +- **oc**: starting index for `C`. +- **S**: input [`Float64Array`][mdn-float64array] containing the sine values of the plane rotations. +- **ss**: `S` stride length. +- **os**: starting index for `S`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var X = new Float64Array( [ 1.0, 1.0 ] ); +var Y = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var S = new Float64Array( [ 0.5, 0.4 ] ); + +dlartv.ndarray( 2, X, -1, 1, Y, 1, 0, C, 1, 0, S, 1, 0 ); +// X => [ 1.4, 1.5 ] +// Y => [ 0.5, 0.6 ] +``` + +
+ + + +
+ +## Notes + +- `dlartv()` corresponds to the [LAPACK][lapack] routine [`dlartv`][lapack-dlartv]. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var dlartv = require( '@stdlib/lapack/base/dlartv' ); + +var X = new Float64Array( [ 1.0, 1.0 ] ); +var Y = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var S = new Float64Array( [ 0.5, 0.5 ] ); + +X = dlartv( 2, X, 1, Y, 1, C, S, 1 ); +console.log( X ); +console.log( Y ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js new file mode 100644 index 000000000000..3e1f8d02a1d7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js @@ -0,0 +1,101 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var dlartv = require( './../lib/dlartv.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var X = uniform( len, -10.0, 10.0, options ); + var Y = uniform( len, -10.0, 10.0, options ); + var C = uniform( len, -1.0, 1.0, options ); + var S = uniform( len, -1.0, 1.0, options ); + + return benchmark; + + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + X = uniform( len, -10.0, 10.0, options ); + Y = uniform( len, -10.0, 10.0, options ); + Y = dlartv( len, X, 1, Y, 1, C, S, 1 ); + if ( isnan( Y[ i%Y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( Y[ i%Y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..9edc24266cbb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js @@ -0,0 +1,101 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var dlartv = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var X = uniform( len, -10.0, 10.0, options ); + var Y = uniform( len, -10.0, 10.0, options ); + var C = uniform( len, -1.0, 1.0, options ); + var S = uniform( len, -1.0, 1.0, options ); + + return benchmark; + + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + X = uniform( len, -10.0, 10.0, options ); + Y = uniform( len, -10.0, 10.0, options ); + Y = dlartv( len, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); + if ( isnan( Y[ i%Y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( Y[ i%Y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray,len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlartv/docs/repl.txt new file mode 100644 index 000000000000..6db8ab2abb62 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/docs/repl.txt @@ -0,0 +1,114 @@ + +{{alias}}( N, X, strideX, Y, strideY, C, S, strideCS ) + Applies a vector of real plane rotations to elements of real vectors `X` + and `Y`. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + Parameters + ---------- + N: number + Number of plane rotations to apply. + + X: Float64Array + First input array. + + strideX: number + `X` stride length. + + Y: Float64Array + Second input array. + + strideY: number + `Y` stride length. + + C: Float64Array + Input array containing the cosine of each plane rotation. + + S: Float64Array + Input array containing the sine of each plane rotation. + + strideCS: number + `CS` stride length. + + Returns + ------- + Y: Float64Array + Second input array. + + Examples + -------- + > var X = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var Y = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var C = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var S = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > {{alias}}( 2, X, 1, Y, 1, C, S, 1 ) + [ 1.0, 1.0 ] + + +{{alias}}.ndarray( N, X, sx, ox, Y, sy, oy, C, sc, oc, S, ss, os ) + Applies a vector of real plane rotations to elements of real vectors `X` + and `Y` using alternative semantic indexing. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + N: number + Number of plane rotations to apply. + + X: Float64Array + First input array. + + sx: number + `X` stride length. + + ox: number + Starting index of `X`. + + Y: Float64Array + Second input array. + + sy: number + `Y` stride length. + + oy: number + Starting index of `Y`. + + C: Float64Array + Input array containing the cosine of each plane rotation. + + sc: number + `C` stride length. + + oc: number + Starting index of `C`. + + S: Float64Array + Input array containing the sine of each plane rotation. + + ss: number + `S` stride length. + + os: number + Starting index of `S`. + + Returns + ------- + Y: Float64Array + Second input array. + + Examples + -------- + > var X = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var Y = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var C = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var S = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > {{alias}}.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ) + [ 1.0, 1.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/index.d.ts new file mode 100644 index 000000000000..0b3f61d3c09b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/index.d.ts @@ -0,0 +1,127 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Interface describing `dlartv`. +*/ +interface Routine { + /** + * Applies a vector of real plane rotations to elements of real vectors `X` and `Y`. + * + * @param N - number of plane rotations to apply + * @param X - first input vector + * @param strideX - X` stride length + * @param Y - second input vector + * @param strideY - `Y` stride length + * @param C - vector of cosines of plane rotations + * @param S - vector of sines of plane rotations + * @param strideCS - `CS` stride length + * @returns `Y` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var X = new Float64Array( [ 1.0, 1.0 ] ); + * var Y = new Float64Array( [ 1.0, 1.0 ] ); + * var C = new Float64Array( [ 1.0, 1.0 ] ); + * var S = new Float64Array( [ 0.0, 0.0 ] ); + * + * dlartv( 2, X, 1, Y, 1, C, S, 1 ); + * // X => [ 1.0, 1.0 ] + * // Y => [ 1.0, 1.0 ] + */ + ( N: number, X: Float64Array, strideX: number, Y: Float64Array, strideY: number, C: Float64Array, S: Float64Array, strideCS: number ): Float64Array; + + /** + * Applies a vector of real plane rotations to elements of real vectors `X` and `Y` using alternative indexing semantics. + * + * @param N - number of plane rotations to apply + * @param X - first input vector + * @param strideX - `X` stride length + * @param offsetX - starting index of `X` + * @param Y - second input vector + * @param strideY - `Y` stride length + * @param offsetY - starting index of `Y` + * @param C - vector of cosines of plane rotations + * @param strideC - `C`stride length + * @param offsetC - starting index of `C` + * @param S - vector of sines of plane rotations + * @param strideS - `S` stride length + * @param offsetS - starting index of `S` + * @returns `Y` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var X = new Float64Array( [ 1.0, 1.0 ] ); + * var Y = new Float64Array( [ 1.0, 1.0 ] ); + * var C = new Float64Array( [ 1.0, 1.0 ] ); + * var S = new Float64Array( [ 0.0, 0.0 ] ); + * + * dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); + * // X => [ 1.0, 1.0 ] + * // Y => [ 1.0, 1.0 ] + */ + ndarray( N: number, X: Float64Array, strideX: number, offsetX: number, Y: Float64Array, strideY: number, offsetY: number, C: Float64Array, strideC: number, offsetC: number, S: Float64Array, strideS: number, offsetS: number ): Float64Array; +} + +/** +* Applies a vector of real plane rotations to elements of real vectors `X` and `Y`. +* +* @param N - number of plane rotations to apply +* @param X - first input vector +* @param strideX - `X` stride length +* @param Y - second input vector +* @param strideY - `Y` stride length +* @param C - vector of cosines of plane rotations +* @param S - vector of sines of plane rotations +* @param strideCS - `CS` stride length +* @returns `Y` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 1.0, 1.0 ] ); +* var Y = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var S = new Float64Array( [ 0.0, 0.0 ] ); +* +* dlartv( 2, X, 1, Y, 1, C, S, 1 ); +* // X => [ 1.0, 1.0 ] +* // Y => [ 1.0, 1.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 1.0, 1.0 ] ); +* var Y = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var S = new Float64Array( [ 0.0, 0.0 ] ); +* +* dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); +* // X => [ 1.0, 1.0 ] +* // Y => [ 1.0, 1.0 ] +*/ +declare var dlartv: Routine; + + +// EXPORTS // + +export = dlartv; diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/test.ts new file mode 100644 index 000000000000..0a2174888aef --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/docs/types/test.ts @@ -0,0 +1,440 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dlartv = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, X, 1, Y, 1, C, S, 1 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( '5', X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( true, X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( false, X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( null, X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( void 0, X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( [], X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( {}, X, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( ( x: number ): number => x, X, 1, Y, 1, C, S, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a Float64Array... +{ + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, '5', 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, 5, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, true, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, false, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, null, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, void 0, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, [], 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, {}, 1, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, ( x: number ): number => x, 1, Y, 1, C, S, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, X, '5', Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, true, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, false, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, null, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, void 0, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, [], Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, {}, Y, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, ( x: number ): number => x, Y, 1, C, S, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, X, 1, '5', 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, 5, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, true, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, false, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, null, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, void 0, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, [], 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, {}, 1, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, ( x: number ): number => x, 1, C, S, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, X, 1, Y, '5', C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, true, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, false, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, null, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, void 0, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, [], C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, {}, C, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, ( x: number ): number => x, C, S, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, X, 1, Y, 1, '5', S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, 5, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, true, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, false, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, null, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, void 0, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, [], S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, {}, S, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, ( x: number ): number => x, S, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + + dlartv( 2, X, 1, Y, 1, C, '5', 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, 5, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, true, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, false, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, null, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, void 0, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, [], 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, {}, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv( 2, X, 1, Y, 1, C, S, '5' ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, true ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, false ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, null ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, void 0 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, [] ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, {} ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv(); // $ExpectError + dlartv( 2 ); // $ExpectError + dlartv( 2, X ); // $ExpectError + dlartv( 2, X, 1 ); // $ExpectError + dlartv( 2, X, 1, Y ); // $ExpectError + dlartv( 2, X, 1, Y, 1 ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S ); // $ExpectError + dlartv( 2, X, 1, Y, 1, C, S, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( '5', X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( true, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( false, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( null, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( void 0, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( [], X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( {}, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( ( x: number ): number => x, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a Float64Array... +{ + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, '5', 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, 5, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, true, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, false, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, null, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, void 0, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, [], 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, {}, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, ( x: number ): number => x, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, '5', 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, true, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, false, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, null, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, void 0, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, [], 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, {}, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, ( x: number ): number => x, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, '5', Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, true, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, false, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, null, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, void 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, [], Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, {}, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, ( x: number ): number => x, Y, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, '5', 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, 5, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, true, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, false, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, null, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, void 0, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, [], 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, {}, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, ( x: number ): number => x, 1, 0, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, '5', 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, true, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, false, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, null, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, void 0, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, [], 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, {}, 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, ( x: number ): number => x, 0, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, '5', C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, true, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, false, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, null, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, void 0, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, [], C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, {}, C, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, ( x: number ): number => x, C, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, '5', 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, 5, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, true, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, false, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, null, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, void 0, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, [], 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, {}, 1, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, ( x: number ): number => x, 1, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, '5', 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, true, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, false, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, null, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, void 0, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, [], 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, {}, 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, ( x: number ): number => x, 0, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, '5', S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, true, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, false, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, null, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, void 0, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, [], S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, {}, S, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, ( x: number ): number => x, S, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a Float64Array... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, '5', 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, 5, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, true, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, false, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, null, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, void 0, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, [], 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, {}, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, '5', 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, true, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, false, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, null, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, void 0, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, [], 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, {}, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, '5' ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, true ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, false ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, null ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, void 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, [] ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, {} ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const X = new Float64Array( [ 1.0, 1.0 ] ); + const Y = new Float64Array( [ 1.0, 1.0 ] ); + const C = new Float64Array( [ 1.0, 1.0 ] ); + const S = new Float64Array( [ 0.0, 0.0 ] ); + + dlartv.ndarray(); // $ExpectError + dlartv.ndarray( 2 ); // $ExpectError + dlartv.ndarray( 2, X ); // $ExpectError + dlartv.ndarray( 2, X, 1 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1 ); // $ExpectError + dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlartv/examples/index.js new file mode 100644 index 000000000000..b712d10a33c0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/examples/index.js @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var dlartv = require( './../lib' ); + +var X = new Float64Array( [ 1.0, 1.0 ] ); +var Y = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var S = new Float64Array( [ 0.5, 0.5 ] ); + +dlartv( 2, X, 1, Y, 1, C, S, 1 ); +console.log( X ); +console.log( Y ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/lib/dlartv.js b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/dlartv.js new file mode 100644 index 000000000000..95b04b1f4d77 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/dlartv.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Applies a vector of real plane rotations to elements of real vectors `X` and `Y`. +* +* @param {NonNegativeInteger} N - number of plane rotations to apply +* @param {Float64Array} X - first input vector +* @param {integer} strideX - `X` stride length +* @param {Float64Array} Y - second input vector +* @param {integer} strideY - `Y` stride length +* @param {Float64Array} C - vector of cosines of plane rotations +* @param {Float64Array} S - vector of sines of plane rotations +* @param {integer} strideCS - `CS` stride length +* @returns {Float64Array} `Y` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 1.0, 1.0 ] ); +* var Y = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var S = new Float64Array( [ 0.0, 0.0 ] ); +* +* dlartv( 2, X, 1, Y, 1, C, S, 1 ); +* // X => [ 1.0, 1.0 ] +* // Y => [ 1.0, 1.0 ] +*/ +function dlartv( N, X, strideX, Y, strideY, C, S, strideCS ) { + var ocs = stride2offset( N, strideCS ); + var ox = stride2offset( N, strideX ); + var oy = stride2offset( N, strideY ); + return ndarray( N, X, strideX, ox, Y, strideY, oy, C, strideCS, ocs, S, strideCS, ocs ); +} + + +// EXPORTS // + +module.exports = dlartv; diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/index.js new file mode 100644 index 000000000000..9fac55448be4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/index.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to apply a vector of real plane rotations to elements of real vectors `X` and `Y`. +* +* @module @stdlib/lapack/base/dlartv +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlartv = require( '@stdlib/lapack/base/dlartv' ); +* +* var X = new Float64Array( [ 1.0, 1.0 ] ); +* var Y = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var S = new Float64Array( [ 0.0, 0.0 ] ); +* +* dlartv( 2, X, 1, Y, 1, C, S, 1 ); +* // X => [ 1.0, 1.0 ] +* // Y => [ 1.0, 1.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlartv = require( '@stdlib/lapack/base/dlartv' ); +* +* var X = new Float64Array( [ 1.0, 1.0 ] ); +* var Y = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var S = new Float64Array( [ 0.0, 0.0 ] ); +* +* dlartv.ndarray( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); +* // X => [ 1.0, 1.0 ] +* // Y => [ 1.0, 1.0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dlartv; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlartv = main; +} else { + dlartv = tmp; +} + + +// EXPORTS // + +module.exports = dlartv; diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/main.js new file mode 100644 index 000000000000..61168a541142 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dlartv = require( './dlartv.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlartv, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlartv; diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/ndarray.js new file mode 100644 index 000000000000..c9eb363bfd40 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/lib/ndarray.js @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len,max-params */ + +'use strict'; + +// MAIN // + +/** +* Applies a vector of real plane rotations to elements of real vectors `X` and `Y` using alternative indexing semantics. +* +* @param {NonNegativeInteger} N - number of plane rotations to apply +* @param {Float64Array} X - first input vector +* @param {integer} strideX - `X` stride length +* @param {NonNegativeInteger} offsetX - starting index of `X` +* @param {Float64Array} Y - second input vector +* @param {integer} strideY - `Y` stride length +* @param {NonNegativeInteger} offsetY - starting index of `Y` +* @param {Float64Array} C - vector of cosines of plane rotations +* @param {integer} strideC - `C` stride length +* @param {NonNegativeInteger} offsetC - starting index of `C` +* @param {Float64Array} S - vector of sines of plane rotations +* @param {integer} strideS - `S` stride length +* @param {NonNegativeInteger} offsetS - starting index of `S` +* @returns {Float64Array} `Y` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 1.0, 1.0 ] ); +* var Y = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var S = new Float64Array( [ 0.0, 0.0 ] ); +* +* dlartv( 2, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); +* // X => [ 1.0, 1.0 ] +* // Y => [ 1.0, 1.0 ] +*/ +function dlartv( N, X, strideX, offsetX, Y, strideY, offsetY, C, strideC, offsetC, S, strideS, offsetS ) { + var ic; + var is; + var ix; + var iy; + var xi; + var yi; + var i; + + ic = offsetC; + is = offsetS; + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + xi = X[ ix ]; + yi = Y[ iy ]; + X[ ix ] = ( C[ ic ] * xi ) + ( S[ is ] * yi ); + Y[ iy ] = ( C[ ic ] * yi ) - ( S[ is ] * xi ); + ix += strideX; + iy += strideY; + ic += strideC; + is += strideS; + } + return Y; +} + + +// EXPORTS // + +module.exports = dlartv; diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/package.json b/lib/node_modules/@stdlib/lapack/base/dlartv/package.json new file mode 100644 index 000000000000..7cd43ba0e0d9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/lapack/base/dlartv", + "version": "0.0.0", + "description": "Apply a vector of real plane rotations to elements of real vectors `X` and `Y`.", + "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", + "stdmath", + "mathematics", + "math", + "lapack", + "dlartv", + "plane", + "rotation", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js new file mode 100644 index 000000000000..f535cfede618 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js @@ -0,0 +1,412 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dlartv = require( './../lib/dlartv.js' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlartv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( dlartv.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=1, sy=1)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, -0.46, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, -0.46, -0.22, 1.06, 0.9, -0.3, -0.4 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.78, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.78, 0.54, 0.08, -0.6, 0.2, 0.8 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, 1, y, 1, c, s, 1 ); + isApprox( t, x, xe[ i ], 6.0 ); + isApprox( t, y, ye[ i ], 6.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=2, sy=-2)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.66, 0.1, -0.1, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.96, 0.1, -0.76, 0.8, 0.9, -0.3, -0.02 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.7, -0.9, -0.12, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.64, -0.9, -0.3, 0.7, -0.18, 0.2, 0.28 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, 2, y, -2, c, s, 1 ); + isApprox( t, x, xe[ i ], 20.0 ); + isApprox( t, y, ye[ i ], 20.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=-2, sy=1)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ -0.06, 0.1, -0.1, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.9, 0.1, -0.22, 0.8, 0.18, -0.3, -0.02 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.7, -1.08, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.64, -1.26, 0.54, 0.2, -0.6, 0.2, 0.8 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, -2, y, 1, c, s, 1 ); + isApprox( t, x, xe[ i ], 20.0 ); + isApprox( t, y, ye[ i ], 20.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=-1, sy=-2)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.26, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.26, -0.76, 1.12, 0.9, -0.3, -0.4 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.18, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.18, 0.7, -0.18, 0.2, 0.16 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, -1, y, -2, c, s, -1 ); + isApprox( t, x, xe[ i ], 4.0 ); + isApprox( t, y, ye[ i ], 4.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6 ] ); + + dlartv( 2, x, 2, y, 1, c, s, 1 ); + + xe = new Float64Array( [ 4.4, 2.0, 6.6, 4.0, 5.0 ] ); + ye = new Float64Array( [ 4.2, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a `y` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 2 + ]); + c = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + s = new Float64Array( [ -1.0, -1.0, -1.0 ] ); + + dlartv( 3, x, 1, y, 2, c, s, 1 ); + + xe = new Float64Array( [ -1.0, -3.0, -5.0, 4.0, 5.0 ] ); + ye = new Float64Array( [ 1.0, 2.0, 2.0, 4.0, 3.0 ] ); + + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input array', function test( t ) { + var out; + var x; + var y; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + y = new Float64Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + + out = dlartv( x.length, x, 1, y, 1, 1, 0 ); + + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 0.6, // 3 + 0.1, + -0.5, // 2 + 0.8, + 0.9, // 1 + -0.3, + -0.4 // 0 + ]); + y = new Float64Array([ + 0.5, // 0 + -0.9, // 1 + 0.3, // 2 + 0.7, // 3 + -0.6, + 0.2, + 0.8 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 4, x, -2, y, 1, c, s, 1 ); + + xe = new Float64Array( [ 0.9, 0.1, -0.22, 0.8, 0.18, -0.3, -0.02 ] ); + ye = new Float64Array( [ 0.64, -1.26, 0.54, 0.2, -0.6, 0.2, 0.8 ] ); + + isApprox( t, x, xe, 20.0 ); + isApprox( t, y, ye, 20.0 ); + + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 0.6, // 1 + 0.1, // 0 + -0.5, + 0.8, + 0.9, + -0.3, + -0.4 + ]); + y = new Float64Array([ + 0.5, // 1 + -0.9, + 0.3, // 0 + 0.7, + -0.6, + 0.2, + 0.8 + ]); + c = new Float64Array( [ 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6 ] ); + + dlartv( 2, x, -1, y, -2, c, s, 1 ); + + xe = new Float64Array( [ 0.78, 0.26, -0.5, 0.8, 0.9, -0.3, -0.4 ] ); + ye = new Float64Array( [ 0.04, -0.9, 0.18, 0.7, -0.6, 0.2, 0.8 ] ); + + isApprox( t, x, xe, 5.0 ); + isApprox( t, y, ye, 5.0 ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.js new file mode 100644 index 000000000000..934d5d58e1a2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dlartv = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlartv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof dlartv.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var dlartv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlartv, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var dlartv; + var main; + + main = require( './../lib/dlartv.js' ); + + dlartv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlartv, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js new file mode 100644 index 000000000000..431cd0f2d2f5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js @@ -0,0 +1,510 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dlartv = require( './../lib/ndarray.js' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlartv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 13', function test( t ) { + t.strictEqual( dlartv.length, 13, 'returns expected value' ); + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=1, sy=1)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var ox; + var oy; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + ox = [ 0, 0, 0, 0 ]; + oy = [ 0, 0, 0, 0 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, -0.46, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, -0.46, -0.22, 1.06, 0.9, -0.3, -0.4 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.78, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.78, 0.54, 0.08, -0.6, 0.2, 0.8 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, 1, ox[ i ], y, 1, oy[ i ], c, 2, 0, s, 2, 0 ); + isApprox( t, x, xe[ i ], 6.0 ); + isApprox( t, y, ye[ i ], 6.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=2, sy=-2)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var ox; + var oy; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + ox = [ 0, 0, 0, 0 ]; + oy = [ 0, 0, 2, 6 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.66, 0.1, -0.1, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.96, 0.1, -0.76, 0.8, 0.9, -0.3, -0.02 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.7, -0.9, -0.12, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.64, -0.9, -0.3, 0.7, -0.18, 0.2, 0.28 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, 2, ox[ i ], y, -2, oy[ i ], c, 2, 2, s, 2, 0 ); + isApprox( t, x, xe[ i ], 20.0 ); + isApprox( t, y, ye[ i ], 20.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=-2, sy=1)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var ox; + var oy; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + ox = [ 0, 0, 2, 6 ]; + oy = [ 0, 0, 0, 0 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ -0.06, 0.1, -0.1, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.9, 0.1, -0.22, 0.8, 0.18, -0.3, -0.02 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.7, -1.08, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.64, -1.26, 0.54, 0.2, -0.6, 0.2, 0.8 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, -2, ox[ i ], y, 1, oy[ i ], c, -2, c.length-1, s, -2, s.length-1 ); + isApprox( t, x, xe[ i ], 20.0 ); + isApprox( t, y, ye[ i ], 20.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function applies a plane rotation (sx=-1, sy=-2)', function test( t ) { + var xbuf; + var ybuf; + var out; + var xe; + var ye; + var ox; + var oy; + var c; + var N; + var s; + var x; + var y; + var i; + + N = [ 0, 1, 2, 4 ]; + + xbuf = [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ]; + ybuf = [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ]; + + ox = [ 0, 0, 1, 3 ]; + oy = [ 0, 0, 2, 6 ]; + + xe = [ + new Float64Array( [ 0.6, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.1, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.26, -0.5, 0.8, 0.9, -0.3, -0.4 ] ), + new Float64Array( [ 0.78, 0.26, -0.76, 1.12, 0.9, -0.3, -0.4 ] ) + ]; + ye = [ + new Float64Array( [ 0.5, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.3, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.18, 0.7, -0.6, 0.2, 0.8 ] ), + new Float64Array( [ 0.04, -0.9, 0.18, 0.7, -0.18, 0.2, 0.16 ] ) + ]; + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + for ( i = 0; i < N.length; i++ ) { + x = new Float64Array( xbuf ); + y = new Float64Array( ybuf ); + out = dlartv( N[ i ], x, -1, ox[ i ], y, -2, oy[ i ], c, 1, 0, s, 1, 0 ); + isApprox( t, x, xe[ i ], 4.0 ); + isApprox( t, y, ye[ i ], 4.0 ); + t.strictEqual( out, y, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 2, 0, y, 1, 0, c, -2, c.length-1, s, -2, s.length-1 ); + + xe = new Float64Array( [ 4.4, 2.0, 6.6, 4.0, 5.0 ] ); + ye = new Float64Array( [ 4.2, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + +tape( 'the function supports an `x` offset', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 1, 1, y, 1, 0, c, -2, c.length-1, s, -2, s.length-1 ); + + xe = new Float64Array( [ 1.0, 5.2, 6.6, 4.0, 5.0 ] ); + ye = new Float64Array( [ 3.6, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a `y` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 2 + ]); + c = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + s = new Float64Array( [ -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0 ] ); + + dlartv( 3, x, 1, 0, y, 2, 0, c, 1, 0, s, 1, 0 ); + + xe = new Float64Array( [ -1.0, -3.0, -5.0, 4.0, 5.0 ] ); + ye = new Float64Array( [ 1.0, 2.0, 2.0, 4.0, 3.0 ] ); + + isApprox( t, x, xe, 1.0 ); + isApprox( t, y, ye, 1.0 ); + + t.end(); +}); + +tape( 'the function supports a `y` offset', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 2.0, // 1 + 3.0, + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, + 7.0, + 8.0, // 0 + 9.0, // 1 + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 1, 0, y, 1, 2, c, -2, c.length-1, s, -2, s.length-1 ); + + xe = new Float64Array( [ 5.6, 7.0, 3.0, 4.0, 5.0 ] ); + ye = new Float64Array( [ 6.0, 7.0, 5.8, 6.0, 10.0 ] ); + + isApprox( t, x, xe, 1.0 ); + isApprox( t, y, ye, 1.0 ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input array', function test( t ) { + var out; + var c; + var s; + var x; + var y; + + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + y = new Float64Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + + out = dlartv( x.length, x, 1, 0, y, 1, 0, c, 1, 0, s, 1, 0 ); + + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 0.6, // 3 + 0.1, + -0.5, // 2 + 0.8, + 0.9, // 1 + -0.3, + -0.4 // 0 + ]); + y = new Float64Array([ + 0.5, // 0 + -0.9, // 1 + 0.3, // 2 + 0.7, // 3 + -0.6, + 0.2, + 0.8 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 4, x, -2, 6, y, 1, 0, c, -2, 8, s, -2, 8 ); + + xe = new Float64Array( [ 0.9, 0.1, -0.22, 0.8, 0.18, -0.3, -0.02 ] ); + ye = new Float64Array( [ 0.64, -1.26, 0.54, 0.2, -0.6, 0.2, 0.8 ] ); + + isApprox( t, x, xe, 20.0 ); + isApprox( t, y, ye, 20.0 ); + + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 0.6, // 1 + 0.1, // 0 + -0.5, + 0.8, + 0.9, + -0.3, + -0.4 + ]); + y = new Float64Array([ + 0.5, // 1 + -0.9, + 0.3, // 0 + 0.7, + -0.6, + 0.2, + 0.8 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, -1, 1, y, -2, 2, c, -2, 8, s, -2, 8 ); + + xe = new Float64Array( [ 0.78, 0.26, -0.5, 0.8, 0.9, -0.3, -0.4 ] ); + ye = new Float64Array( [ 0.04, -0.9, 0.18, 0.7, -0.6, 0.2, 0.8 ] ); + + isApprox( t, x, xe, 5.0 ); + isApprox( t, y, ye, 5.0 ); + + t.end(); +}); From cfbcdafd2747326b9a4bc2a7aa4e289b85cc862b Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 14 Jan 2025 16:18:50 +0530 Subject: [PATCH 2/4] test: add test cases for c and s --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed --- --- .../lapack/base/dlartv/test/test.dlartv.js | 38 ++++- .../lapack/base/dlartv/test/test.ndarray.js | 144 ++++++++++++++++++ 2 files changed, 181 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js index f535cfede618..c07473afc497 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.dlartv.js @@ -317,6 +317,42 @@ tape( 'the function supports a `y` stride', function test( t ) { t.end(); }); +tape( 'the function supports a `cs` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6 ] ); + + dlartv( 2, x, 2, y, 1, c, s, -1 ); + + xe = new Float64Array( [ 4.4, 2.0, 6.6, 4.0, 5.0 ] ); + ye = new Float64Array( [ 4.2, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + tape( 'the function returns a reference to the second input array', function test( t ) { var out; var x; @@ -360,7 +396,7 @@ tape( 'the function supports negative strides', function test( t ) { c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8 ] ); s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6 ] ); - dlartv( 4, x, -2, y, 1, c, s, 1 ); + dlartv( 4, x, -2, y, 1, c, s, -1 ); xe = new Float64Array( [ 0.9, 0.1, -0.22, 0.8, 0.18, -0.3, -0.02 ] ); ye = new Float64Array( [ 0.64, -1.26, 0.54, 0.2, -0.6, 0.2, 0.8 ] ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js index 431cd0f2d2f5..ff51c370cc3c 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/test/test.ndarray.js @@ -410,6 +410,150 @@ tape( 'the function supports a `y` offset', function test( t ) { t.end(); }); +tape( 'the function supports a `c` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 3.0, // 1 + 5.0, + 7.0, + 9.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 1, 0, y, 1, 0, c, 2, 0, s, 1, 0 ); + + xe = new Float64Array( [ 4.4, 6.6, 5.0, 7.0, 9.0 ] ); + ye = new Float64Array( [ 4.2, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a `c` offset', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 1, 1, y, 1, 0, c, 1, 1, s, 1, 0 ); + + xe = new Float64Array( [ 1.0, 5.2, 6.6, 4.0, 5.0 ] ); + ye = new Float64Array( [ 3.6, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + +tape( 'the function supports an `s` stride', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, // 0 + 3.0, // 1 + 5.0, + 7.0, + 9.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 1, 0, y, 1, 0, c, 1, 0, s, 2, 0 ); + + xe = new Float64Array( [ 4.4, 6.6, 5.0, 7.0, 9.0 ] ); + ye = new Float64Array( [ 4.2, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + +tape( 'the function supports an `s` offset', function test( t ) { + var xe; + var ye; + var c; + var s; + var x; + var y; + + x = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, + 5.0 + ]); + y = new Float64Array([ + 6.0, // 0 + 7.0, // 1 + 8.0, + 9.0, + 10.0 + ]); + c = new Float64Array( [ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 ] ); + s = new Float64Array( [ 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6 ] ); + + dlartv( 2, x, 1, 1, y, 1, 0, c, 1, 0, s, 1, 1 ); + + xe = new Float64Array( [ 1.0, 5.2, 6.6, 4.0, 5.0 ] ); + ye = new Float64Array( [ 3.6, 3.8, 8.0, 9.0, 10.0 ] ); + + isApprox( t, x, xe, 2.0 ); + isApprox( t, y, ye, 2.0 ); + + t.end(); +}); + tape( 'the function returns a reference to the second input array', function test( t ) { var out; var c; From 986734bf18bd27b1f157d887cd7a060b01fd9d07 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Mon, 20 Jan 2025 11:23:31 +0530 Subject: [PATCH 3/4] bench: apply review changes --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dlartv/benchmark/benchmark.js | 15 ++++++++++----- .../base/dlartv/benchmark/benchmark.ndarray.js | 18 +++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js index 3e1f8d02a1d7..665377877053 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js @@ -52,20 +52,25 @@ function createBenchmark( len ) { return benchmark; + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ function benchmark( b ) { + var z; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { - X = uniform( len, -10.0, 10.0, options ); - Y = uniform( len, -10.0, 10.0, options ); - Y = dlartv( len, X, 1, Y, 1, C, S, 1 ); - if ( isnan( Y[ i%Y.length ] ) ) { + z = dlartv( len, X, 1, Y, 1, C, S, 1 ); + if ( isnan( z[ i%X.length ] ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( Y[ i%Y.length ] ) ) { + if ( isnan( z[ i%X.length ] ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js index 9edc24266cbb..c026b82f1e66 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js @@ -49,23 +49,27 @@ function createBenchmark( len ) { var Y = uniform( len, -10.0, 10.0, options ); var C = uniform( len, -1.0, 1.0, options ); var S = uniform( len, -1.0, 1.0, options ); - return benchmark; + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ function benchmark( b ) { + var z; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { - X = uniform( len, -10.0, 10.0, options ); - Y = uniform( len, -10.0, 10.0, options ); - Y = dlartv( len, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); - if ( isnan( Y[ i%Y.length ] ) ) { + z = dlartv( len, X, 1, 0, Y, 1, 0, C, 1, 0, S, 1, 0 ); + if ( isnan( z[ i%X.length ] ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( Y[ i%Y.length ] ) ) { + if ( isnan( z[ i%X.length ] ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); @@ -94,7 +98,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+':ndarray,len='+len, f ); + bench( pkg+':ndarray:len='+len, f ); } } From 5c668abf5a111d7f9a14665f22336dd2089f0b9b Mon Sep 17 00:00:00 2001 From: aman-095 Date: Mon, 20 Jan 2025 13:31:55 +0530 Subject: [PATCH 4/4] bench: refactor for cosine and sine --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/lapack/base/dlartv/benchmark/benchmark.js | 7 ++++--- .../lapack/base/dlartv/benchmark/benchmark.ndarray.js | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js index 665377877053..9ba5715bb206 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.js @@ -22,6 +22,8 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var ones = require( '@stdlib/array/ones' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var pkg = require( './../package.json' ).name; @@ -47,9 +49,8 @@ var options = { function createBenchmark( len ) { var X = uniform( len, -10.0, 10.0, options ); var Y = uniform( len, -10.0, 10.0, options ); - var C = uniform( len, -1.0, 1.0, options ); - var S = uniform( len, -1.0, 1.0, options ); - + var C = ones( len ); + var S = zeros( len ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js index c026b82f1e66..726a9025d6a6 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dlartv/benchmark/benchmark.ndarray.js @@ -22,6 +22,8 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); +var ones = require( '@stdlib/array/ones' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var pkg = require( './../package.json' ).name; @@ -47,8 +49,8 @@ var options = { function createBenchmark( len ) { var X = uniform( len, -10.0, 10.0, options ); var Y = uniform( len, -10.0, 10.0, options ); - var C = uniform( len, -1.0, 1.0, options ); - var S = uniform( len, -1.0, 1.0, options ); + var C = ones( len ); + var S = zeros( len ); return benchmark; /**