From dfd32fd7b1c5a4fb24570607b0925606a156e84e Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 2 Feb 2025 15:57:30 +0530 Subject: [PATCH 01/13] feat: add /blas/base/drotmg --- .../@stdlib/blas/base/drotmg/README.md | 119 ++++++++++ .../blas/base/drotmg/benchmark/benchmark.js | 96 +++++++++ .../@stdlib/blas/base/drotmg/docs/repl.txt | 70 ++++++ .../blas/base/drotmg/docs/types/index.d.ts | 91 ++++++++ .../blas/base/drotmg/docs/types/test.ts | 155 +++++++++++++ .../blas/base/drotmg/examples/index.js | 29 +++ .../@stdlib/blas/base/drotmg/lib/assign.js | 204 ++++++++++++++++++ .../@stdlib/blas/base/drotmg/lib/index.js | 61 ++++++ .../@stdlib/blas/base/drotmg/lib/main.js | 50 +++++ .../@stdlib/blas/base/drotmg/package.json | 75 +++++++ .../blas/base/drotmg/test/test.assign.js | 0 .../@stdlib/blas/base/drotmg/test/test.js | 40 ++++ .../blas/base/drotmg/test/test.main.js | 128 +++++++++++ 13 files changed, 1118 insertions(+) create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/README.md create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/package.json create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/test/test.js create mode 100755 lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/README.md b/lib/node_modules/@stdlib/blas/base/drotmg/README.md new file mode 100755 index 000000000000..6b0cd8cd8a15 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/README.md @@ -0,0 +1,119 @@ + + +# drotmg + +> Constructs the parameters for a modified Givens plane rotation. + +
+ +## Usage + +```javascript +var drotmg = require( '@stdlib/blas/base/drotmg' ); +``` + +#### drotmg( d1, d2, x1, y1 ) + +Constructs a Givens plane rotation provided two double-precision floating-point values `d1` and `d2`. + +```javascript +var out = drotmg( -3.0, -4.0, 1.5, 2.5 ); +// returns [ 0.6000000238418579, 0.800000011920929, 2, 1.5, 2.5 ] +``` + +The function has the following parameters: + +- **d1**: scaling factor for the first vector component. +- **d2**: scaling factor for the second vector component. +- **x1**: first component of the first vector. +- **y1**: first component of the second vector. + +#### drotmg.assign( d1, d2, x1, y1, out, stride, offset ) + +Constructs a Givens plane rotation provided two double-precision floating-point values `d1` and `d2` and assigns results to an output array. + +```javascript +var Float64Array = require( '@stdlib/array/float32' ); + +var out = new Float64Array( 5 ); + +var y = drotmg.assign( -3.0, -4.0, 1.5, 2.5, out, 1, 0 ); +// returns [ 0.6000000238418579, 0.800000011920929, 2, 1.5, 2.5 ] + +var bool = ( y === out ); +// returns true +``` + +
+ + + +
+ +## Notes + +- `drotmg()` corresponds to the [BLAS][blas] level 1 function [`drotmg`][drotmg]. + +
+ + + +
+ +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var drotmg = require( '@stdlib/blas/base/drotmg' ); + +var out; +var i; +for ( i = 0; i < 100; i++ ) { + d1 = discreteUniform( -5, 5 ); + d2 = discreteUniform( -5, 5 ); + x1 = discreteUniform( -5, 5 ); + y1 = discreteUniform( -5, 5 ); + out = drotmg( d1, d2, x1, y1 ); + console.log( out ); +} +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js new file mode 100755 index 000000000000..9a87fc4d9899 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js @@ -0,0 +1,96 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pkg = require( './../package.json' ).name; +var drotmg = require( './../lib' ); + + +// VARIABLES // + +var OPTS = { + 'dtype': 'float64' +}; + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var param; + var d1; + var d2; + var x1; + var y1; + var i; + + d1 = discreteUniform( 100, -5, 5, OPTS ); + d2 = discreteUniform( 100, -5, 5, OPTS ); + x1 = discreteUniform( 100, -5, 5, OPTS ); + y1 = discreteUniform( 100, -5, 5, OPTS ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + param = drotmg( d1[ i%d1.length ], d2[ i%d2.length ], x1[ i%x1.length ], y1[ i%y1.length ] ); + if ( isnanf( param[ i%5 ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( param[ i%5 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':assign', function benchmark( b ) { + var param; + var d1; + var d2; + var x1; + var y1; + var z; + var i; + + d1 = discreteUniform( 100, -5, 5, OPTS ); + d2 = discreteUniform( 100, -5, 5, OPTS ); + x1 = discreteUniform( 100, -5, 5, OPTS ); + y1 = discreteUniform( 100, -5, 5, OPTS ); + param = new Float64Array( 5 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = drotmg.assign( d1[ i%d1.length ], d2[ i%d2.length ], x1[ i%x1.length ], y1[ i%y1.length ], param, 1, 0 ); + if ( typeof z !=='object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( isnanf( z[ i%5 ] ) ) { + b.fail( 'should return the output array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt new file mode 100755 index 000000000000..68f36f51ae3c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt @@ -0,0 +1,70 @@ + +{{alias}}( d1, d2, x1, y1 ) + Constructs the parameters for a modified Givens plane rotation. + + Parameters + ---------- + d1: float + Scaling factor for the first vector component. + + d2: float + Scaling factor for the second vector component. + + x1: float + First component of the first vector. + + y1: float + First component of the second vector. + + Returns + ------- + out: Float64Array + Computed values. + + Examples + -------- + > var out = {{alias}}( 1.0, 1.0, 1.0, 0.0 ) + [ -2.0, 0.0, 0.0, 1.0, 0.0 ] + + +{{alias}}.assign( d1, d2, x1. y1, out, stride, offset ) + Constructs the parameters for a modified Givens plane rotation. + + Parameters + ---------- + d1: float + Scaling factor for the first vector component. + + d2: float + Scaling factor for the second vector component. + + x1: float + First component of the first vector. + + y1: float + First component of the second vector. + + out: Float64Array + Output array. + + stride: integer + Output array stride. + + offset: integer + Output array index offset. + + Returns + ------- + out: Float64Array + Output array. + + Examples + -------- + > var out = new {{alias:@stdlib/array/float64}}( 5 ); + > var y = {{alias}}.assign( 1.0, 1.0, 1.0, 0.0, out, 1, 0 ) + [ -2.0, 0.0, 0.0, 1.0, 0.0 ] + > var bool = ( y === out ) + true + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts new file mode 100755 index 000000000000..37b72ed5c51c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts @@ -0,0 +1,91 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2023 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 + +/** +* Inteface describing `drotmg`. +*/ +interface Routine { + /** + * Constructs the parameters for a modified Givens plane rotation. + * + * @param d1 - scaling factor for the first vector component + * @param d2 - scaling factor for the second vector component + * @param x1 - first component of the first vector + * @param y1 - first component of the second vector + * @returns - output array containing the rotation parameters + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var out = drotmg( 1.0, 1.0, 1.0, 0.0 ); + * // returns [ 0.0, 1.0, 0.0, 1.0, 0.0 ] + */ + ( d1: number, d2: number, x1: number, y1: number ): Float64Array; + + /** + * Constructs the parameters for a modified Givens plane rotation. + * + * @param d1 - scaling factor for the first vector component + * @param d2 - scaling factor for the second vector component + * @param x1 - first component of the first vector + * @param y1 - first component of the second vector + * @param out - output array + * @param stride - index increment + * @param offset - starting index + * @returns - output array containing the rotation parameters + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var out = drotmg( 1.0, 1.0, 1.0, 0.0 ); + * // returns [ 0.0, 1.0, 0.0, 1.0, 0.0 ] + * + * var bool = (y === out); + * // returns true + */ + assign( d1: number, d2: number, x1: number, y1: number, out: Float64Array, stride: number, offset: number ): Float64Array; +} + +/** +* Constructs the parameters for a modified Givens plane rotation. +* +* @param d1 - scaling factor for the first vector component +* @param d2 - scaling factor for the second vector component +* @param x1 - first component of the first vector +* @param y1 - first component of the second vector +* @param out - output array +* @param stride - index increment +* @param offset - starting index +* @returns - output array containing the rotation parameters +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var out = drotmg( 1.0, 1.0, 1.0, 0.0 ); +* // returns [ 0.0, 1.0, 0.0, 1.0, 0.0 ] +* +* var bool = (y === out); +* // returns true +*/ +declare var drotmg: Routine; + +// EXPORTS // + +export = drotmg; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts new file mode 100755 index 000000000000..34d38e82bde7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts @@ -0,0 +1,155 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2023 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 drotmg = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + drotmg( 0.0, 1.0, 2.0, 3.0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided an argument which is not a number... +{ + drotmg( true, 1.0, 2.0, 3.0 ); // $ExpectError + drotmg( false, 1.0, 2.0, 3.0 ); // $ExpectError + drotmg( null, 1.0, 2.0, 3.0 ); // $ExpectError + drotmg( undefined, 1.0, 2.0, 3.0 ); // $ExpectError + drotmg( '5', 1.0, 2.0, 3.0 ); // $ExpectError + drotmg( [], 1.0, 2.0, 3.0 ); // $ExpectError + drotmg( {}, 1.0, 2.0, 3.0 ); // $ExpectError + + drotmg( 0.0, true, 2.0, 3.0 ); // $ExpectError + drotmg( 0.0, false, 2.0, 3.0 ); // $ExpectError + drotmg( 0.0, null, 2.0, 3.0 ); // $ExpectError + drotmg( 0.0, undefined, 2.0, 3.0 ); // $ExpectError + drotmg( 0.0, '5', 2.0, 3.0 ); // $ExpectError + drotmg( 0.0, [], 2.0, 3.0 ); // $ExpectError + drotmg( 0.0, {}, 2.0, 3.0 ); // $ExpectError + + drotmg( 0.0, 1.0, true, 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, false, 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, null, 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, undefined, 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, '5', 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, [], 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, {}, 3.0 ); // $ExpectError + + drotmg( 0.0, 1.0, 2.0, true ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, false ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, null ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, undefined ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, '5' ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, [] ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, {} ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + drotmg(); // $ExpectError + drotmg( 0.0 ); // $ExpectError + drotmg( 0.0, 1.0 ); // $ExpectError + drotmg( 0.0, 1.0, 2.0 ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, 3.0, 4.0 ); // $ExpectError +} + +// Attached to the main export is an `assign` method which returns a Float64Array... +{ + const out = new Float64Array( 5 ); + + drotmg.assign( 0.0, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the `assign` method is provided a first or second argument which is not a number... +{ + const out = new Float64Array( 5 ); + + drotmg.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + + drotmg.assign( 0.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError + + drotmg.assign( 0.0, 2.0 ,true, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0 ,false, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0 ,null, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0 ,undefined, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0 ,'5', 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0 ,[], 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0 ,{}, 4.0, out, 1, 0 ); // $ExpectError + + drotmg.assign( 0.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +{ + const out = new Float64Array( 5 ); + + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number... +{ + const out = new Float64Array( 5 ); + + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... +{ + const out = new Float64Array( 5 ); + + drotmg.assign(); // $ExpectError + drotmg.assign( 1.0 ); // $ExpectError + drotmg.assign( 1.0, 2.0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, out ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, out ); // $ExpectError + drotmg.assign( 1.0, 2.0, out, 1 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, out, 1 ); // $ExpectError + drotmg.assign( 1.0, 2.0, out, 1, 0, 1 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, out, 1, 0, 1 ); // $ExpectError +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js new file mode 100755 index 000000000000..b4e15810a29b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var drotmg = require( './../lib' ); + +var param; +var i; +for ( i = 0; i < 100; i++ ) { + param = drotmg( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ), discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); + console.log( param ); +} diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js new file mode 100755 index 000000000000..29a6be2ea0f6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js @@ -0,0 +1,204 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 abs = require( '@stdlib/math/base/special/abs' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); + +// VARIABLES // + +var GAM = 4096; +var GAM_SQ = GAM ** 2; +var RGAM_SQ = 1 / GAM_SQ; + + +// MAIN // + +/** +* Constructs the parameters for a modified Givens plane rotation. +* +* @param {number} d1 - scaling factor for the first vector component +* @param {number} d2 - scaling factor for the second vector component +* @param {number} x1 - first component of the first vector +* @param {number} y1 - first component of the second vector +* @param {Float64Array} param - output array +* @param {integer} stride - index increment +* @param {NonNegativeInteger} offset - starting index +* @returns {Float64Array} - output array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var out = drotmg( 3.0, -4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 ); +* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +*/ +function drotmg( d1, d2, x1, y1, param, stride, offset ) { + var param; + var flag + var ad1; + var ad2; + var h11; + var h12; + var h21; + var h22; + var u; + var p1; + var p2; + var q1; + var q2; + var temp; + if ( isnan( d1 ) || isnan( d2 ) || isnan( x1 ) || isnan( y1 ) ) { + param[ offset ] = NaN; + param[ offset + stride ] = NaN; + param[ offset + ( 2 * stride ) ] = NaN; + param[ offset + ( 3 * stride ) ] = NaN; + param[ offset + ( 4 * stride ) ] = NaN; + } else { + if ( d1 < 0.0 ) { + flag = -1.0; + h11 = 0.0; + h12 = 0.0; + h21 = 0.0; + h22 = 0.0; + d1 = 0.0; + d2 = 0.0; + x1 = 0.0; + } else { + p2 = d2 * y1; + if ( d2 === 0.0 ) { + flag = -2.0; + param = flag; + } + p1 = d1 * x1; + q2 = p2 * y1; + q1 = p1 * x1; + ad1 = abs(q1); + ad2 = abs(q2); + if ( ad1 > ad2 ) { + h21 = -y1/x1; + h12 = p2/p1; + u = 1 - h12*h21; + if ( u > 0.0 ){ + flag = 0.0; + d1 = d1 / u; + d2 = d2 / u; + x1 = x1 * u; + } else{ + flag = -1.0; + h11 = 0.0; + h12 = 0.0; + h21 = 0.0; + h22 = 0.0; + dd1 = 0.0; + dd2 = 0.0; + dx1 = 0.0; + } + } else { + if ( q2 < 0.0 ){ + flag = -1.0; + h11 = 0.0; + h12 = 0.0; + h21 = 0.0; + h22 = 0.0; + d1 = 0.0; + d2 = 0.0; + x1 = 0.0; + } else { + flag = 1.0; + h11 = p1 / p2; + h22 = x1 / y1; + u = 1 + h11*h22; + temp = d2 / u; + d2 = d1 / u; + d1 = temp; + x1 = y1 * u; + } + } + if ( d1 !== 0.0 ){ + while( ( d1 < RGAM_SQ ) || ( d1 > GAM_SQ ) ) { + if( flag === 0.0) { + h11 = 1.0; + h22 = 1.0; + fla = -1.0; + } else { + h21 = -1.0; + h12 = 1.0; + flag = -1.0; + } + if( d1 < RGAM_SQ ){ + d1 = d1 * GAM ** 2; + x1 = x1 / GAM; + h11 = h11 / GAM; + h12 = h12 / GAM; + } else { + d1 = d1 / GAM ** 2; + x1 = x1 * GAM; + h11 = h11 * GAM; + h12 = h12 * GAM; + } + } + } + if ( d1 !== 0.0 ){ + while ( ( abs( d2 ) <= RGAM_SQ ) || ( abs( d2 ) >= RGAM_SQ ) ){ + if( flag === 0.0 ) { + h11 = 1.0; + h22 = 1.0; + flag = -1.0; + } else { + h21 = -1.0; + h12 = 1.0; + flag = -1.0; + } + if ( abs( d2 ) <= RGAM_SQ ){ + d2 = d2 * GAM ** 2; + h21 = h21 / GAM; + h22 = h22 / GAM; + } else { + d2 = d2 / GAM ** 2; + h21 = h21 * GAM; + h22 = h22 * GAM; + } + } + } + } + if ( flag < 0.0) { + param[ offset + stride ] = h11; + param[ offset + ( 2 * stride ) ] = h21; + param[ offset + ( 3 * stride ) ] = h12; + param[ offset + ( 4 * stride ) ] = h22; + } + else if ( flag === 0.0 ) { + param[ offset + ( 2 * stride ) ] = h21; + param[ offset + ( 3 * stride ) ] = h12; + } else { + param[ offset + stride ] = h11; + param[ offset + ( 4 * stride ) ] = h22; + } + } + param[ offset ] = flag; + + return param; +} + + +// EXPORTS // + +module.exports = drotmg; diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js new file mode 100755 index 000000000000..08441865558c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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'; + +/** +* Constructs the parameters for a modified Givens plane rotation. +* +* @module @stdlib/blas/base/drotmg +* +* @example +* var drotmg = require( '@stdlib/blas/base/drotmg' ); +* +* var out = drotmg( 3.0, -4.0, 1.5, 2.5 ); +* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float32' ); +* var drotmg = require( '@stdlib/blas/base/drotmg' ); +* +* var out = new Float64Array( 5 ); +* +* var y = drotmg.assign( 3.0, -4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 ); +* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +* +* var bool = ( y === out ); +* // returns true +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var assign = require( './assign.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "assign": "main.assign" } diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js new file mode 100755 index 000000000000..cead273ffe67 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 Float64Array = require( '@stdlib/array/float64' ); +var fcn = require( './assign.js' ); + + +// MAIN // + +/** +* Constructs the parameters for a modified Givens plane rotation. +* +* @param {number} d1 - scaling factor for the first vector component +* @param {number} d2 - scaling factor for the second vector component +* @param {number} x1 - first component of the first vector +* @param {number} y1 - first component of the second vector +* @returns {Float64Array} output array containing the rotation parameters +* +* @example +* var out = drotmg( 3.0, -4.0, 1.5, 2.5 ); +* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +*/ +function drotmg( d1, d2, x1, y1 ) { + var out = new Float64Array( 5 ); + return fcn( d1, d2, x1, y1, out, 1, 0 ); +} + + +// EXPORTS // + +module.exports = drotmg; diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/package.json b/lib/node_modules/@stdlib/blas/base/drotmg/package.json new file mode 100755 index 000000000000..e49efdebe0e9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/package.json @@ -0,0 +1,75 @@ +{ + "name": "@stdlib/blas/base/drotmg", + "version": "0.0.0", + "description": "Construct a Givens plane rotation.", + "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", + "blas", + "level 1", + "drotmg", + "parameters", + "modified", + "givens", + "rotation", + "matrix", + "linear", + "algebra", + "subroutines", + "vector", + "array", + "ndarray", + "float64", + "float", + "single", + "float32array" + ] + } diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js new file mode 100755 index 000000000000..ca71093c1d18 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var drotmg = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof drotmg, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.strictEqual( hasOwnProp( drotmg, 'assign' ), true, 'has property' ); + t.strictEqual( typeof drotmg.assign, 'function', 'has method' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js new file mode 100755 index 000000000000..4729760ad185 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js @@ -0,0 +1,128 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var drotmg = require( './../lib/main.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof drotmg, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 4', function test( t ) { + t.strictEqual( drotmg.length, 4, 'returns expected value' ); + t.end(); +}); + +tape( 'the function constructs the parameters for a modified Givens plane rotation', function test( t ) { + var expected; + var values; + var out; + var i; + + expected = [ + [ 0.8944271802902222, 0.4472135901451111, 1.0, 1.0, 3.0 ], + [ 0.3162277638912201, 0.9486832618713379, 2.0, -4.0, -5.0 ], + [ 0.7071067690849304, 0.7071067690849304, 2.0, 2.0, 6.0 ], + [ 0.6, 0.8, 2.0, -2.0, -4.0 ], + [ 0.6, 0.8, 2.0, 1.5, 2.5 ], + [ 0.906183123588562, 0.4228854477405548, 1.0, -1.50, -2.50 ], + [ 0.4472135901451111, 0.8944271802902222, 2.0, 3.50, -7.50 ], + [ 0.800000011920929, 0.6000000238418579, 1.0, 4.50, -9.50 ] + ]; + values = [ + [ 4.0, 2.0, 1.0, 3.0 ], + [ 1.0, 3.0, -4.0, -5.0 ], + [ 5.0, 5.0, 2.0, 6.0 ], + [ 6.0, 8.0, -2.0, -4.0 ], + [ -3.0, -4.0, 1.5, 2.5 ], + [ -7.5, -3.5, -1.5, -2.5 ], + [ 10.0, 20.0, 3.5, -7.5 ], + [ -8.0, -6.0, 4.5, -9.5 ] + ]; + + for ( i = 0; i < values.length; i++ ) { + expected[i] = new Float64Array( expected[i] ); + out = drotmg( values[i][0], values[i][1], values[i][2], values[i][3], out, 1, 0 ); // eslint-disable-line max-len + t.deepEqual( out, expected[i], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns an array of NaNs if provided a rotational elimination parameter equal to NaN', function test(t) { + var actual; + var i; + + actual = drotmg( NaN, 1.0, 2.0, 3.0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, 2.0, 3.0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, 2.0, NaN, 3.0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, 2.0, 3.0, NaN ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, 3.0, 4.0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, NaN, 3.0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, 2.0, NaN, NaN ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + actual = drotmg( NaN, 2.0, NaN, 3.0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + actual = drotmg( NaN, 1.0, 2.0, NaN ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + actual = drotmg( 1.0, NaN, 3.0, NaN ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + } + t.end(); +}); From 02e81f2a32ef41ecc2ccb2cd87956197138eb2da Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 28 Feb 2025 14:44:00 +0530 Subject: [PATCH 02/13] fix: multiple errors --- .../blas/base/drotmg/benchmark/benchmark.js | 16 +- .../@stdlib/blas/base/drotmg/docs/repl.txt | 17 +- .../blas/base/drotmg/docs/types/index.d.ts | 33 ++- .../blas/base/drotmg/docs/types/test.ts | 54 ++-- .../@stdlib/blas/base/drotmg/lib/assign.js | 248 ++++++++-------- .../@stdlib/blas/base/drotmg/lib/index.js | 10 +- .../@stdlib/blas/base/drotmg/lib/main.js | 8 +- .../blas/base/drotmg/test/test.assign.js | 271 ++++++++++++++++++ .../blas/base/drotmg/test/test.main.js | 102 ++++--- 9 files changed, 536 insertions(+), 223 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js index 9a87fc4d9899..7f40d0f44ead 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js @@ -22,7 +22,7 @@ var bench = require( '@stdlib/bench' ); var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isnan = require( '@stdlib/math/base/assert/is-nanf' ); var Float64Array = require( '@stdlib/array/float64' ); var pkg = require( './../package.json' ).name; var drotmg = require( './../lib' ); @@ -53,12 +53,12 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { param = drotmg( d1[ i%d1.length ], d2[ i%d2.length ], x1[ i%x1.length ], y1[ i%y1.length ] ); - if ( isnanf( param[ i%5 ] ) ) { + if ( isnan( param[ i%5 ] ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnanf( param[ i%5 ] ) ) { + if ( isnan( param[ i%5 ] ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); @@ -69,15 +69,15 @@ bench( pkg+':assign', function benchmark( b ) { var param; var d1; var d2; - var x1; - var y1; + var x1; + var y1; var z; var i; d1 = discreteUniform( 100, -5, 5, OPTS ); d2 = discreteUniform( 100, -5, 5, OPTS ); - x1 = discreteUniform( 100, -5, 5, OPTS ); - y1 = discreteUniform( 100, -5, 5, OPTS ); + x1 = discreteUniform( 100, -5, 5, OPTS ); + y1 = discreteUniform( 100, -5, 5, OPTS ); param = new Float64Array( 5 ); b.tic(); @@ -88,7 +88,7 @@ bench( pkg+':assign', function benchmark( b ) { } } b.toc(); - if ( isnanf( z[ i%5 ] ) ) { + if ( isnan( z[ i%5 ] ) ) { b.fail( 'should return the output array' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt index 68f36f51ae3c..8921fdf15c16 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/repl.txt @@ -1,6 +1,7 @@ {{alias}}( d1, d2, x1, y1 ) - Constructs the parameters for a modified Givens plane rotation. + Constructs the parameters for a modified Givens plane rotation from four + double-precision floating-point numbers. Parameters ---------- @@ -23,12 +24,14 @@ Examples -------- - > var out = {{alias}}( 1.0, 1.0, 1.0, 0.0 ) - [ -2.0, 0.0, 0.0, 1.0, 0.0 ] + > var out = {{alias}}( 3.0, 4.0, 1.5, 2.5 ) + [ 1.0, 0.45, 0.0, 0.0, 0.6 ] -{{alias}}.assign( d1, d2, x1. y1, out, stride, offset ) - Constructs the parameters for a modified Givens plane rotation. +{{alias}}.assign( d1, d2, x1, y1, out, stride, offset ) + Constructs the parameters for a modified Givens plane rotation from four + double-precision floating-point numbers and assigns the results to an + output array. Parameters ---------- @@ -61,8 +64,8 @@ Examples -------- > var out = new {{alias:@stdlib/array/float64}}( 5 ); - > var y = {{alias}}.assign( 1.0, 1.0, 1.0, 0.0, out, 1, 0 ) - [ -2.0, 0.0, 0.0, 1.0, 0.0 ] + > var y = {{alias}}.assign( 3.0, 4.0, 1.5, 2.5, out, 1, 0 ) + [ 1.0, 0.45, 0.0, 0.0, 0.6 ] > var bool = ( y === out ) true diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts index 37b72ed5c51c..b689be26a659 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts @@ -22,7 +22,7 @@ * Inteface describing `drotmg`. */ interface Routine { - /** + /** * Constructs the parameters for a modified Givens plane rotation. * * @param d1 - scaling factor for the first vector component @@ -32,14 +32,16 @@ interface Routine { * @returns - output array containing the rotation parameters * * @example - * var Float64Array = require( '@stdlib/array/float64' ); + * var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); + * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] * - * var out = drotmg( 1.0, 1.0, 1.0, 0.0 ); - * // returns [ 0.0, 1.0, 0.0, 1.0, 0.0 ] + * @example + * var out = drotmg( 3.0, 5.0, 1.0, 2.0 ); + * // returns [ 1.0, 0.3, 0.0, 0.0, 0.5 ] */ - ( d1: number, d2: number, x1: number, y1: number ): Float64Array; + ( d1: number, d2: number, x1: number, y1: number ): Float64Array; - /** + /** * Constructs the parameters for a modified Givens plane rotation. * * @param d1 - scaling factor for the first vector component @@ -54,13 +56,15 @@ interface Routine { * @example * var Float64Array = require( '@stdlib/array/float64' ); * - * var out = drotmg( 1.0, 1.0, 1.0, 0.0 ); - * // returns [ 0.0, 1.0, 0.0, 1.0, 0.0 ] + * var out = new Float64Array( 5 ); + * + * var y = drotmg.assign( 3.0, 4.0, 1.5, 2.5, out, 1, 0 ); + * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] * * var bool = (y === out); * // returns true */ - assign( d1: number, d2: number, x1: number, y1: number, out: Float64Array, stride: number, offset: number ): Float64Array; + assign( d1: number, d2: number, x1: number, y1: number, out: Float64Array, stride: number, offset: number ): Float64Array; } /** @@ -76,10 +80,15 @@ interface Routine { * @returns - output array containing the rotation parameters * * @example +* var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); +* // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] +* +* @example * var Float64Array = require( '@stdlib/array/float64' ); * -* var out = drotmg( 1.0, 1.0, 1.0, 0.0 ); -* // returns [ 0.0, 1.0, 0.0, 1.0, 0.0 ] +* var out = new Float64Array( 4 ); +* var y = drotg.assign( 3.0, 4.0, 1.5, 2.5 out, 1, 0 ); +* // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] * * var bool = (y === out); * // returns true @@ -88,4 +97,4 @@ declare var drotmg: Routine; // EXPORTS // -export = drotmg; \ No newline at end of file +export = drotmg; diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts index 34d38e82bde7..50b36d21cd61 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts @@ -44,7 +44,7 @@ import drotmg = require( './index' ); drotmg( 0.0, [], 2.0, 3.0 ); // $ExpectError drotmg( 0.0, {}, 2.0, 3.0 ); // $ExpectError - drotmg( 0.0, 1.0, true, 3.0 ); // $ExpectError + drotmg( 0.0, 1.0, true, 3.0 ); // $ExpectError drotmg( 0.0, 1.0, false, 3.0 ); // $ExpectError drotmg( 0.0, 1.0, null, 3.0 ); // $ExpectError drotmg( 0.0, 1.0, undefined, 3.0 ); // $ExpectError @@ -52,7 +52,7 @@ import drotmg = require( './index' ); drotmg( 0.0, 1.0, [], 3.0 ); // $ExpectError drotmg( 0.0, 1.0, {}, 3.0 ); // $ExpectError - drotmg( 0.0, 1.0, 2.0, true ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, true ); // $ExpectError drotmg( 0.0, 1.0, 2.0, false ); // $ExpectError drotmg( 0.0, 1.0, 2.0, null ); // $ExpectError drotmg( 0.0, 1.0, 2.0, undefined ); // $ExpectError @@ -66,8 +66,8 @@ import drotmg = require( './index' ); drotmg(); // $ExpectError drotmg( 0.0 ); // $ExpectError drotmg( 0.0, 1.0 ); // $ExpectError - drotmg( 0.0, 1.0, 2.0 ); // $ExpectError - drotmg( 0.0, 1.0, 2.0, 3.0, 4.0 ); // $ExpectError + drotmg( 0.0, 1.0, 2.0 ); // $ExpectError + drotmg( 0.0, 1.0, 2.0, 3.0, 4.0 ); // $ExpectError } // Attached to the main export is an `assign` method which returns a Float64Array... @@ -77,7 +77,7 @@ import drotmg = require( './index' ); drotmg.assign( 0.0, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectType Float64Array } -// The compiler throws an error if the `assign` method is provided a first or second argument which is not a number... +// The compiler throws an error if the `assign` method is provided a first, second, third or fourth argument which is not a number... { const out = new Float64Array( 5 ); @@ -97,24 +97,24 @@ import drotmg = require( './index' ); drotmg.assign( 0.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError drotmg.assign( 0.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,true, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,false, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,null, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,undefined, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,'5', 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,[], 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, 2.0 ,{}, 4.0, out, 1, 0 ); // $ExpectError - - drotmg.assign( 0.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError - drotmg.assign( 0.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError + + drotmg.assign( 0.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError + drotmg.assign( 0.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError } -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... { const out = new Float64Array( 5 ); @@ -126,7 +126,7 @@ import drotmg = require( './index' ); drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError } -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number... +// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... { const out = new Float64Array( 5 ); @@ -145,11 +145,11 @@ import drotmg = require( './index' ); drotmg.assign(); // $ExpectError drotmg.assign( 1.0 ); // $ExpectError drotmg.assign( 1.0, 2.0 ); // $ExpectError - drotmg.assign( 1.0, 2.0, 3.0 ); // $ExpectError drotmg.assign( 1.0, 2.0, out ); // $ExpectError - drotmg.assign( 1.0, 2.0, 3.0, out ); // $ExpectError drotmg.assign( 1.0, 2.0, out, 1 ); // $ExpectError - drotmg.assign( 1.0, 2.0, 3.0, out, 1 ); // $ExpectError drotmg.assign( 1.0, 2.0, out, 1, 0, 1 ); // $ExpectError - drotmg.assign( 1.0, 2.0, 3.0, out, 1, 0, 1 ); // $ExpectError -} \ No newline at end of file + drotmg.assign( 1.0, 2.0, 3.0 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, out ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, out, 1 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, out, 1, 0, 1 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js index 29a6be2ea0f6..6724e66510c9 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js @@ -21,19 +21,21 @@ // MODULES // var abs = require( '@stdlib/math/base/special/abs' ); +var abs2 = require( '@stdlib/math/base/special/abs2' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); + // VARIABLES // -var GAM = 4096; -var GAM_SQ = GAM ** 2; -var RGAM_SQ = 1 / GAM_SQ; +var GAM = 4096.0; +var GAM_SQ = abs2( GAM ); +var RGAM_SQ = abs2( 1.0 / GAM ); // MAIN // /** -* Constructs the parameters for a modified Givens plane rotation. +* Construct the parameters for a modified Givens plane rotation. * * @param {number} d1 - scaling factor for the first vector component * @param {number} d2 - scaling factor for the second vector component @@ -47,154 +49,154 @@ var RGAM_SQ = 1 / GAM_SQ; * @example * var Float64Array = require( '@stdlib/array/float64' ); * -* var out = drotmg( 3.0, -4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 ); -* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +* var out = drotmg( 3.0, 4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 ); +* // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] */ function drotmg( d1, d2, x1, y1, param, stride, offset ) { - var param; - var flag + var flag; + var temp; var ad1; var ad2; var h11; var h12; var h21; var h22; - var u; var p1; var p2; var q1; var q2; - var temp; + var u; + + h11 = 1.0; + h12 = 0.0; + h21 = 0.0; + h22 = 1.0; if ( isnan( d1 ) || isnan( d2 ) || isnan( x1 ) || isnan( y1 ) ) { param[ offset ] = NaN; param[ offset + stride ] = NaN; - param[ offset + ( 2 * stride ) ] = NaN; - param[ offset + ( 3 * stride ) ] = NaN; - param[ offset + ( 4 * stride ) ] = NaN; + param[ offset + ( 2 * stride ) ] = NaN; + param[ offset + ( 3 * stride ) ] = NaN; + param[ offset + ( 4 * stride ) ] = NaN; + return param; + } + + if ( d1 < 0.0 ) { + flag = -1.0; + h11 = 0.0; + h12 = 0.0; + h21 = 0.0; + h22 = 0.0; + d1 = 0.0; + d2 = 0.0; + x1 = 0.0; } else { - if ( d1 < 0.0 ) { + p2 = d2 * y1; + if ( p2 === 0.0 ) { + flag = -2.0; + param[ offset ] = flag; + return param; + } + p1 = d1 * x1; + q2 = p2 * y1; + q1 = p1 * x1; + ad1 = abs( q1 ); + ad2 = abs( q2 ); + + if ( ad1 > ad2 ) { + h21 = -y1 / x1; + h12 = p2 / p1; + u = 1 - ( h12 * h21 ); + if ( u > 0.0 ) { + flag = 0.0; + d1 /= u; + d2 /= u; + x1 *= u; + } else { + flag = -1.0; + h11 = 0.0; + h12 = 0.0; + h21 = 0.0; + h22 = 0.0; + d1 = 0.0; + d2 = 0.0; + x1 = 0.0; + } + } + if ( q2 < 0.0 || q1 < 0.0 ) { flag = -1.0; - h11 = 0.0; - h12 = 0.0; - h21 = 0.0; - h22 = 0.0; - d1 = 0.0; - d2 = 0.0; - x1 = 0.0; + h11 = 0.0; + h12 = 0.0; + h21 = 0.0; + h22 = 0.0; + d1 = 0.0; + d2 = 0.0; + x1 = 0.0; } else { - p2 = d2 * y1; - if ( d2 === 0.0 ) { - flag = -2.0; - param = flag; - } - p1 = d1 * x1; - q2 = p2 * y1; - q1 = p1 * x1; - ad1 = abs(q1); - ad2 = abs(q2); - if ( ad1 > ad2 ) { - h21 = -y1/x1; - h12 = p2/p1; - u = 1 - h12*h21; - if ( u > 0.0 ){ - flag = 0.0; - d1 = d1 / u; - d2 = d2 / u; - x1 = x1 * u; - } else{ - flag = -1.0; - h11 = 0.0; - h12 = 0.0; - h21 = 0.0; - h22 = 0.0; - dd1 = 0.0; - dd2 = 0.0; - dx1 = 0.0; - } - } else { - if ( q2 < 0.0 ){ + flag = 1.0; + h11 = p1 / p2; + h22 = x1 / y1; + u = 1 + ( h11 * h22 ); + temp = d2 / u; + d2 = d1 / u; + d1 = temp; + x1 = y1 * u; + } + + if ( d1 !== 0.0 ) { + while ( ( d1 < RGAM_SQ ) || ( d1 > GAM_SQ ) ) { + if ( flag === 0.0 ) { flag = -1.0; - h11 = 0.0; - h12 = 0.0; - h21 = 0.0; - h22 = 0.0; - d1 = 0.0; - d2 = 0.0; - x1 = 0.0; + h11 = 1.0; + h22 = 1.0; } else { - flag = 1.0; - h11 = p1 / p2; - h22 = x1 / y1; - u = 1 + h11*h22; - temp = d2 / u; - d2 = d1 / u; - d1 = temp; - x1 = y1 * u; + flag = -1.0; + h21 = -1.0; + h12 = 1.0; } - } - if ( d1 !== 0.0 ){ - while( ( d1 < RGAM_SQ ) || ( d1 > GAM_SQ ) ) { - if( flag === 0.0) { - h11 = 1.0; - h22 = 1.0; - fla = -1.0; - } else { - h21 = -1.0; - h12 = 1.0; - flag = -1.0; - } - if( d1 < RGAM_SQ ){ - d1 = d1 * GAM ** 2; - x1 = x1 / GAM; - h11 = h11 / GAM; - h12 = h12 / GAM; - } else { - d1 = d1 / GAM ** 2; - x1 = x1 * GAM; - h11 = h11 * GAM; - h12 = h12 * GAM; - } + if ( d1 < RGAM_SQ ) { + d1 *= GAM_SQ; + x1 /= GAM; + h11 /= GAM; + h12 /= GAM; + } else { + d1 /= GAM_SQ; + x1 *= GAM; + h11 *= GAM; + h12 *= GAM; } } - if ( d1 !== 0.0 ){ - while ( ( abs( d2 ) <= RGAM_SQ ) || ( abs( d2 ) >= RGAM_SQ ) ){ - if( flag === 0.0 ) { - h11 = 1.0; - h22 = 1.0; - flag = -1.0; - } else { - h21 = -1.0; - h12 = 1.0; - flag = -1.0; - } - if ( abs( d2 ) <= RGAM_SQ ){ - d2 = d2 * GAM ** 2; - h21 = h21 / GAM; - h22 = h22 / GAM; - } else { - d2 = d2 / GAM ** 2; - h21 = h21 * GAM; - h22 = h22 * GAM; - } + } + + if ( d2 !== 0.0 ) { + while ( ( abs( d2 ) < RGAM_SQ ) || ( abs( d2 ) > GAM_SQ ) ) { + if ( abs(d2) < RGAM_SQ ) { + d2 *= GAM_SQ; + h21 /= GAM; + h22 /= GAM; + } else { + d2 /= GAM_SQ; + h21 *= GAM; + h22 *= GAM; } } } - if ( flag < 0.0) { - param[ offset + stride ] = h11; - param[ offset + ( 2 * stride ) ] = h21; - param[ offset + ( 3 * stride ) ] = h12; - param[ offset + ( 4 * stride ) ] = h22; - } - else if ( flag === 0.0 ) { - param[ offset + ( 2 * stride ) ] = h21; - param[ offset + ( 3 * stride ) ] = h12; - } else { - param[ offset + stride ] = h11; - param[ offset + ( 4 * stride ) ] = h22; - } } + param[ offset ] = flag; + if ( flag < 0.0 ) { + param[ offset + stride ] = h11; + param[ offset + ( 2 * stride ) ] = h21; + param[ offset + ( 3 * stride ) ] = h12; + param[ offset + ( 4 * stride ) ] = h22; + } else if ( flag === 0.0 ) { + param[ offset + ( 2 * stride ) ] = h21; + param[ offset + ( 3 * stride ) ] = h12; + } else { + param[ offset + stride ] = h11; + param[ offset + ( 4 * stride ) ] = h22; + } + return param; } diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js index 08441865558c..8a41b7963cc0 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js @@ -19,15 +19,15 @@ 'use strict'; /** -* Constructs the parameters for a modified Givens plane rotation. +* Construct the parameters for a modified Givens plane rotation. * * @module @stdlib/blas/base/drotmg * * @example * var drotmg = require( '@stdlib/blas/base/drotmg' ); * -* var out = drotmg( 3.0, -4.0, 1.5, 2.5 ); -* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +* var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); +* // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] * * @example * var Float64Array = require( '@stdlib/array/float32' ); @@ -35,8 +35,8 @@ * * var out = new Float64Array( 5 ); * -* var y = drotmg.assign( 3.0, -4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 ); -* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +* var y = drotmg.assign( 3.0, 4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 ); +* // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] * * var bool = ( y === out ); * // returns true diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js index cead273ffe67..19642a5f246a 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js @@ -36,12 +36,12 @@ var fcn = require( './assign.js' ); * @returns {Float64Array} output array containing the rotation parameters * * @example -* var out = drotmg( 3.0, -4.0, 1.5, 2.5 ); -* // returns [ 0.6, 0.8, 2.0, 1.5, 2.5 ] +* var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); +* // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] */ function drotmg( d1, d2, x1, y1 ) { - var out = new Float64Array( 5 ); - return fcn( d1, d2, x1, y1, out, 1, 0 ); + var out = new Float64Array( 5 ); + return fcn( d1, d2, x1, y1, out, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js index e69de29bb2d1..2f3be5ed66e6 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js @@ -0,0 +1,271 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var drotmg = require( './../lib/assign.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof drotmg, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( drotmg.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes a Givens plane rotation', function test( t ) { + var expected; + var values; + var delta; + var tol; + var out; + var e; + var i; + var j; + + expected = [ + [ 1.0, 0.375, 0.0, 0.0, 0.5 ], + [ 1.0, 0.625, 0.0, 0.0, 0.5 ], + [ -1.0, 0.0, 0.0, 0.0, 0.0 ], + [ 1.0, -0.625, 0.0, 0.0, -0.5 ], + [ 1.0, -0.625, 0.0, 0.0, -0.5 ], + [ -2.0, 0.0, 0.0, 0.0, 0.0 ], + [ 1.0, 0.0, 0.0, 0.0, 0.0 ], + [ -2.0, 0.0, 0.0, 0.0, 0.0 ] + ]; + values = [ + [ 3.0, 4.0, 1.0, 2.0 ], + [ 5.0, 4.0, 1.0, 2.0 ], + [ -5.0, 4.0, 1.0, 2.0 ], + [ 5.0, 4.0, -1.0, 2.0 ], + [ 5.0, 4.0, 1.0, -2.0 ], + [ 5.0, 0.0, 1.0, 2.0 ], + [ 5.0, 3.0, 0.0, 2.0 ], + [ 5.0, 3.0, 1.0, 0.0 ] + ]; + + for ( i = 0; i < values.length; i++ ) { + e = new Float64Array( expected[i] ); + out = new Float64Array( 5 ); + drotmg( values[i][0], values[i][1], values[i][2], values[i][3], out, 1, 0 ); + for ( j = 0; j < out.length; j++ ) { + if ( out[j] === e[j] ) { + t.strictEqual( out[j], e[j], 'returns expected value' ); + } else { + delta = abs( out[j] - e[j] ); + tol = 1.5 * EPS * abs( e[j] ); + t.ok( delta <= tol, 'within tolerance. out: '+out[j]+'. expected: '+e[j]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + } + t.end(); +}); + +tape( 'the function returns an array of NaNs if provided a rotation elimination parameter equal to NaN', function test(t) { + var actual; + var i; + + actual = drotmg( NaN, 1.0, 2.0, 3.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, 3.0, 4.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, 2.0, NaN, 3.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, 2.0, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, 3.0, 4.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, 2.0, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, 2.0, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, 2.0, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, 2.0, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function supports providing a positive stride', function test(t) { + var expected; + var actual; + var delta; + var tol; + var out; + var i; + + expected = new Float64Array( [ 1.0, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5 ] ); + out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = drotmg( 3.0, 4.0, 1.0, 2.0, out, 2, 0 ); + t.strictEqual( actual, out, 'returns expected value' ); + for ( i = 0; i < out.length; i++ ) { + if ( out[i] === expected[i] ) { + t.strictEqual( out[i], expected[i], 'returns expected value' ); + } else { + delta = abs( out[i] - expected[i] ); + tol = 1.5 * EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'the function supports providing a negative stride', function test(t) { + var expected; + var actual; + var delta; + var tol; + var out; + var i; + + expected = new Float64Array( [ 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.375, 0.0, 1.0 ] ); + out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = drotmg( 3.0, 4.0, 1.0, 2.0, out, -2, 8 ); + t.strictEqual( actual, out, 'returns expected value' ); + for ( i = 0; i < out.length; i++ ) { + if ( out[i] === expected[i] ) { + t.strictEqual( out[i], expected[i], 'returns expected value' ); + } else { + delta = abs( out[i] - expected[i] ); + tol = 1.5 * EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'the function supports providing a positive offset', function test(t) { + var expected; + var actual; + var delta; + var tol; + var out; + var i; + + expected = new Float64Array( [ 0.0, 1.0, 0.375, 0.0, 0.0, 0.5 ] ); + out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = drotmg( 3.0, 4.0, 1.0, 2.0, out, 1, 1 ); + t.strictEqual( actual, out, 'returns expected value' ); + for ( i = 0; i < out.length; i++ ) { + if ( out[i] === expected[i] ) { + t.strictEqual( out[i], expected[i], 'returns expected value' ); + } else { + delta = abs( out[i] - expected[i] ); + tol = 1.5 * EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'the function supports providing both a stride and offset', function test(t) { + var expected; + var actual; + var delta; + var tol; + var out; + var i; + + expected = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5 ] ); // eslint-disable-line max-len + out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = drotmg( 3.0, 4.0, 1.0, 2.0, out, 2, 2 ); + t.strictEqual( actual, out, 'returns expected value' ); + for ( i = 0; i < out.length; i++ ) { + if ( out[i] === expected[i] ) { + t.strictEqual( out[i], expected[i], 'returns expected value' ); + } else { + delta = abs( out[i] - expected[i] ); + tol = 1.5 * EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js index 4729760ad185..4c4104f96ca3 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js @@ -22,7 +22,7 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isnan = require( '@stdlib/math/base/assert/is-nanf' ); var drotmg = require( './../lib/main.js' ); @@ -46,24 +46,24 @@ tape( 'the function constructs the parameters for a modified Givens plane rotati var i; expected = [ - [ 0.8944271802902222, 0.4472135901451111, 1.0, 1.0, 3.0 ], - [ 0.3162277638912201, 0.9486832618713379, 2.0, -4.0, -5.0 ], - [ 0.7071067690849304, 0.7071067690849304, 2.0, 2.0, 6.0 ], - [ 0.6, 0.8, 2.0, -2.0, -4.0 ], - [ 0.6, 0.8, 2.0, 1.5, 2.5 ], - [ 0.906183123588562, 0.4228854477405548, 1.0, -1.50, -2.50 ], - [ 0.4472135901451111, 0.8944271802902222, 2.0, 3.50, -7.50 ], - [ 0.800000011920929, 0.6000000238418579, 1.0, 4.50, -9.50 ] + [ 1.0, 0.375, 0.0, 0.0, 0.5 ], + [ 1.0, 0.625, 0.0, 0.0, 0.5 ], + [ -1.0, 0.0, 0.0, 0.0, 0.0 ], + [ 1.0, -0.625, 0.0, 0.0, -0.5 ], + [ 1.0, -0.625, 0.0, 0.0, -0.5 ], + [ -2.0, 0.0, 0.0, 0.0, 0.0 ], + [ 1.0, 0.0, 0.0, 0.0, 0.0 ], + [ -2.0, 0.0, 0.0, 0.0, 0.0 ] ]; values = [ - [ 4.0, 2.0, 1.0, 3.0 ], - [ 1.0, 3.0, -4.0, -5.0 ], - [ 5.0, 5.0, 2.0, 6.0 ], - [ 6.0, 8.0, -2.0, -4.0 ], - [ -3.0, -4.0, 1.5, 2.5 ], - [ -7.5, -3.5, -1.5, -2.5 ], - [ 10.0, 20.0, 3.5, -7.5 ], - [ -8.0, -6.0, 4.5, -9.5 ] + [ 3.0, 4.0, 1.0, 2.0 ], + [ 5.0, 4.0, 1.0, 2.0 ], + [ -5.0, 4.0, 1.0, 2.0 ], + [ 5.0, 4.0, -1.0, 2.0 ], + [ 5.0, 4.0, 1.0, -2.0 ], + [ 5.0, 0.0, 1.0, 2.0 ], + [ 5.0, 3.0, 0.0, 2.0 ], + [ 5.0, 3.0, 1.0, 0.0 ] ]; for ( i = 0; i < values.length; i++ ) { @@ -78,51 +78,79 @@ tape( 'the function returns an array of NaNs if provided a rotational eliminatio var actual; var i; - actual = drotmg( NaN, 1.0, 2.0, 3.0 ); + actual = drotmg( NaN, 1.0, 2.0, 3.0, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, 2.0, 3.0 ); + actual = drotmg( 1.0, NaN, 3.0, 4.0, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, 2.0, NaN, 3.0 ); + actual = drotmg( 1.0, 2.0, NaN, 3.0, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, 2.0, 3.0, NaN ); + actual = drotmg( 1.0, 2.0, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, NaN, 3.0, 4.0 ); + actual = drotmg( NaN, NaN, 3.0, 4.0, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, NaN, 3.0 ); + actual = drotmg( 1.0, NaN, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, 2.0, NaN, NaN ); + actual = drotmg( 1.0, 2.0, NaN, NaN, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, 2.0, NaN, 3.0 ); + + actual = drotmg( NaN, 2.0, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( 1.0, NaN, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, 2.0, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, 1.0, 2.0, NaN ); + + actual = drotmg( 1.0, NaN, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, 3.0, NaN ); + + actual = drotmg( NaN, 2.0, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + for ( i = 0; i < actual.length; i++ ) { + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); + } + + actual = drotmg( NaN, NaN, NaN, NaN, new Float64Array( 5 ), 1, 0 ); for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' ); + t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } t.end(); }); From 65052fc12347161dc5c68c3b5ec0bb882b1010a4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 28 Feb 2025 09:18:06 +0000 Subject: [PATCH 03/13] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/drotmg/README.md | 2 +- .../@stdlib/blas/base/drotmg/benchmark/benchmark.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/test/test.js | 2 +- lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/README.md b/lib/node_modules/@stdlib/blas/base/drotmg/README.md index 6b0cd8cd8a15..3b2ea3238d0c 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/README.md +++ b/lib/node_modules/@stdlib/blas/base/drotmg/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2023 The Stdlib Authors. +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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js index 7f40d0f44ead..4c2bf7bc611c 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts index b689be26a659..0b622d070310 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts index 50b36d21cd61..84d63417c94d 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js index b4e15810a29b..9d98bce7c687 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js index 6724e66510c9..e1774df17bd8 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js index 8a41b7963cc0..6f8fd88da7ee 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js index 19642a5f246a..acf7320d6d52 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js index 2f3be5ed66e6..0a042e4a3923 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js index ca71093c1d18..6e659efe0dc6 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js index 4c4104f96ca3..9d2cb5c84fe3 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. From 0eb1e1506c32e133734150313f451bcb44c77ad8 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 1 Mar 2025 12:56:58 +0530 Subject: [PATCH 04/13] fix: update test files --- .../@stdlib/blas/base/drotmg/lib/assign.js | 45 +++++++++---------- .../blas/base/drotmg/test/test.assign.js | 6 +++ .../blas/base/drotmg/test/test.main.js | 6 +++ 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js index e1774df17bd8..af811b7d5671 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js @@ -21,15 +21,14 @@ // MODULES // var abs = require( '@stdlib/math/base/special/abs' ); -var abs2 = require( '@stdlib/math/base/special/abs2' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); // VARIABLES // var GAM = 4096.0; -var GAM_SQ = abs2( GAM ); -var RGAM_SQ = abs2( 1.0 / GAM ); +var GAM_SQ = 16777216.0; +var RGAM_SQ = 5.9604645e-8; // MAIN // @@ -67,10 +66,6 @@ function drotmg( d1, d2, x1, y1, param, stride, offset ) { var q2; var u; - h11 = 1.0; - h12 = 0.0; - h21 = 0.0; - h22 = 1.0; if ( isnan( d1 ) || isnan( d2 ) || isnan( x1 ) || isnan( y1 ) ) { param[ offset ] = NaN; param[ offset + stride ] = NaN; @@ -111,18 +106,8 @@ function drotmg( d1, d2, x1, y1, param, stride, offset ) { d1 /= u; d2 /= u; x1 *= u; - } else { - flag = -1.0; - h11 = 0.0; - h12 = 0.0; - h21 = 0.0; - h22 = 0.0; - d1 = 0.0; - d2 = 0.0; - x1 = 0.0; } - } - if ( q2 < 0.0 || q1 < 0.0 ) { + } else if ( q2 < 0.0 ) { flag = -1.0; h11 = 0.0; h12 = 0.0; @@ -141,25 +126,24 @@ function drotmg( d1, d2, x1, y1, param, stride, offset ) { d1 = temp; x1 = y1 * u; } - if ( d1 !== 0.0 ) { while ( ( d1 < RGAM_SQ ) || ( d1 > GAM_SQ ) ) { if ( flag === 0.0 ) { - flag = -1.0; h11 = 1.0; h22 = 1.0; - } else { flag = -1.0; + } else { h21 = -1.0; h12 = 1.0; + flag = -1.0; } if ( d1 < RGAM_SQ ) { - d1 *= GAM_SQ; + d1 *= GAM * GAM; x1 /= GAM; h11 /= GAM; h12 /= GAM; } else { - d1 /= GAM_SQ; + d1 /= GAM * GAM; x1 *= GAM; h11 *= GAM; h12 *= GAM; @@ -169,12 +153,21 @@ function drotmg( d1, d2, x1, y1, param, stride, offset ) { if ( d2 !== 0.0 ) { while ( ( abs( d2 ) < RGAM_SQ ) || ( abs( d2 ) > GAM_SQ ) ) { + if ( flag === 0.0 ) { + h11 = 1.0; + h22 = 1.0; + flag = -1.0; + } else { + h21 = -1.0; + h12 = 1.0; + flag = -1.0; + } if ( abs(d2) < RGAM_SQ ) { - d2 *= GAM_SQ; + d2 *= GAM * GAM; h21 /= GAM; h22 /= GAM; } else { - d2 /= GAM_SQ; + d2 /= GAM * GAM; h21 *= GAM; h22 *= GAM; } @@ -197,6 +190,8 @@ function drotmg( d1, d2, x1, y1, param, stride, offset ) { param[ offset + ( 4 * stride ) ] = h22; } + param[ offset ] = flag; + return param; } diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js index 0a042e4a3923..3d3cf0c686f0 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js @@ -53,6 +53,9 @@ tape( 'the function computes a Givens plane rotation', function test( t ) { expected = [ [ 1.0, 0.375, 0.0, 0.0, 0.5 ], + [ -1.0, 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, -0.5, 0.125, 0.0 ], + [ 0.0, 0.0, -0.25, 0.1, 0.0 ], [ 1.0, 0.625, 0.0, 0.0, 0.5 ], [ -1.0, 0.0, 0.0, 0.0, 0.0 ], [ 1.0, -0.625, 0.0, 0.0, -0.5 ], @@ -63,6 +66,9 @@ tape( 'the function computes a Givens plane rotation', function test( t ) { ]; values = [ [ 3.0, 4.0, 1.0, 2.0 ], + [ -3.0, 2.0, 2.0, 3.0 ], + [ 4.0, 1.0, 2.0, 1.0 ], + [ 5.0, 2.0, 4.0, 1.0 ], [ 5.0, 4.0, 1.0, 2.0 ], [ -5.0, 4.0, 1.0, 2.0 ], [ 5.0, 4.0, -1.0, 2.0 ], diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js index 9d2cb5c84fe3..f201adbebcdc 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js @@ -47,6 +47,9 @@ tape( 'the function constructs the parameters for a modified Givens plane rotati expected = [ [ 1.0, 0.375, 0.0, 0.0, 0.5 ], + [ -1.0, 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, -0.5, 0.125, 0.0 ], + [ 0.0, 0.0, -0.25, 0.1, 0.0 ], [ 1.0, 0.625, 0.0, 0.0, 0.5 ], [ -1.0, 0.0, 0.0, 0.0, 0.0 ], [ 1.0, -0.625, 0.0, 0.0, -0.5 ], @@ -57,6 +60,9 @@ tape( 'the function constructs the parameters for a modified Givens plane rotati ]; values = [ [ 3.0, 4.0, 1.0, 2.0 ], + [ -3.0, 2.0, 2.0, 3.0 ], + [ 4.0, 1.0, 2.0, 1.0 ], + [ 5.0, 2.0, 4.0, 1.0 ], [ 5.0, 4.0, 1.0, 2.0 ], [ -5.0, 4.0, 1.0, 2.0 ], [ 5.0, 4.0, -1.0, 2.0 ], From 89cc4e45ba03eb819638d604e73cd3f488101ea9 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:22:50 +0530 Subject: [PATCH 05/13] fix: update assign.js Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js index af811b7d5671..a18981a66c9a 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/assign.js @@ -162,7 +162,7 @@ function drotmg( d1, d2, x1, y1, param, stride, offset ) { h12 = 1.0; flag = -1.0; } - if ( abs(d2) < RGAM_SQ ) { + if ( abs( d2 ) < RGAM_SQ ) { d2 *= GAM * GAM; h21 /= GAM; h22 /= GAM; From 0ed851364f7f138b05b76dfb49a2bbed67334915 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:40:20 +0530 Subject: [PATCH 06/13] fix: update index.js Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js index 6f8fd88da7ee..d5a6d372c084 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/lib/index.js @@ -29,6 +29,9 @@ * var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] * +* var out = drotmg( 4.0, 6.0, 2.0, 1.0 ); +* // returns [ 0.0, 0.0, -0.5, 0.75, 0.0 ] +* * @example * var Float64Array = require( '@stdlib/array/float32' ); * var drotmg = require( '@stdlib/blas/base/drotmg' ); From 3657ce5ca95c73dffcc1db56cc33fd576b2d1841 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 1 Mar 2025 14:02:45 +0530 Subject: [PATCH 07/13] fix: update test.ts Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts index 84d63417c94d..181c97d1309a 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/test.ts @@ -152,4 +152,7 @@ import drotmg = require( './index' ); drotmg.assign( 1.0, 2.0, 3.0, out ); // $ExpectError drotmg.assign( 1.0, 2.0, 3.0, out, 1 ); // $ExpectError drotmg.assign( 1.0, 2.0, 3.0, out, 1, 0, 1 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError + drotmg.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, 1 ); // $ExpectError } From da53714f600ee0c96f7f6d7384bfb30e0b8e0bdf Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 1 Mar 2025 14:13:27 +0530 Subject: [PATCH 08/13] fix: update README --- .../@stdlib/blas/base/drotmg/README.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/README.md b/lib/node_modules/@stdlib/blas/base/drotmg/README.md index 3b2ea3238d0c..4a16707ae699 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/README.md +++ b/lib/node_modules/@stdlib/blas/base/drotmg/README.md @@ -32,11 +32,11 @@ var drotmg = require( '@stdlib/blas/base/drotmg' ); #### drotmg( d1, d2, x1, y1 ) -Constructs a Givens plane rotation provided two double-precision floating-point values `d1` and `d2`. +Constructs a Givens plane rotation provided four double-precision floating-point values `d1`, `d2`, `x1` and `y1`. ```javascript -var out = drotmg( -3.0, -4.0, 1.5, 2.5 ); -// returns [ 0.6000000238418579, 0.800000011920929, 2, 1.5, 2.5 ] +var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); +// returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] ``` The function has the following parameters: @@ -48,15 +48,15 @@ The function has the following parameters: #### drotmg.assign( d1, d2, x1, y1, out, stride, offset ) -Constructs a Givens plane rotation provided two double-precision floating-point values `d1` and `d2` and assigns results to an output array. +Constructs a Givens plane rotation provided four double-precision floating-point values `d1`, `d2`, `x1` and `y1` and assigns results to an output array. ```javascript -var Float64Array = require( '@stdlib/array/float32' ); +var Float64Array = require( '@stdlib/array/float64' ); var out = new Float64Array( 5 ); -var y = drotmg.assign( -3.0, -4.0, 1.5, 2.5, out, 1, 0 ); -// returns [ 0.6000000238418579, 0.800000011920929, 2, 1.5, 2.5 ] +var y = drotmg.assign( 3.0, 4.0, 1.5, 2.5, out, 1, 0 ); +// returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] var bool = ( y === out ); // returns true @@ -82,15 +82,15 @@ var bool = ( y === out ); var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var drotmg = require( '@stdlib/blas/base/drotmg' ); -var out; +var param; var i; for ( i = 0; i < 100; i++ ) { d1 = discreteUniform( -5, 5 ); d2 = discreteUniform( -5, 5 ); x1 = discreteUniform( -5, 5 ); y1 = discreteUniform( -5, 5 ); - out = drotmg( d1, d2, x1, y1 ); - console.log( out ); + param = drotmg( d1, d2, x1, y1 ); + console.log( param ); } ``` From 577c270954fd30d72a6d187165150459c3c86043 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 1 Mar 2025 14:15:10 +0530 Subject: [PATCH 09/13] fix: update examples --- .../@stdlib/blas/base/drotmg/examples/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js b/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js index 9d98bce7c687..1b9ac62c87e1 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/examples/index.js @@ -23,7 +23,15 @@ var drotmg = require( './../lib' ); var param; var i; +var d1; +var d2; +var x1; +var y1; for ( i = 0; i < 100; i++ ) { - param = drotmg( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ), discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); + d1 = discreteUniform( -5, 5 ); + d2 = discreteUniform( -5, 5 ); + x1 = discreteUniform( -5, 5 ); + y1 = discreteUniform( -5, 5 ); + param = drotmg( d1, d2, x1, y1 ); console.log( param ); } From 0df89ab5225b10b3960282b5bf42043b0627b42f Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 1 Mar 2025 17:36:11 +0530 Subject: [PATCH 10/13] fix: update test.assign.js Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js index 3d3cf0c686f0..830d9a2c5fd9 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.assign.js @@ -41,7 +41,7 @@ tape( 'the function has an arity of 7', function test( t ) { t.end(); }); -tape( 'the function computes a Givens plane rotation', function test( t ) { +tape( 'the function computes parameters for a modified Givens plane rotation', function test( t ) { var expected; var values; var delta; From 621bbf46287e77afac885722d642ee19a48be87b Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 1 Mar 2025 18:10:00 +0530 Subject: [PATCH 11/13] fix: update test.main.js --- .../blas/base/drotmg/test/test.main.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js index f201adbebcdc..6c910c2f0e74 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/drotmg/test/test.main.js @@ -74,7 +74,7 @@ tape( 'the function constructs the parameters for a modified Givens plane rotati for ( i = 0; i < values.length; i++ ) { expected[i] = new Float64Array( expected[i] ); - out = drotmg( values[i][0], values[i][1], values[i][2], values[i][3], out, 1, 0 ); // eslint-disable-line max-len + out = drotmg( values[i][0], values[i][1], values[i][2], values[i][3] ); t.deepEqual( out, expected[i], 'returns expected value' ); } t.end(); @@ -84,77 +84,77 @@ tape( 'the function returns an array of NaNs if provided a rotational eliminatio var actual; var i; - actual = drotmg( NaN, 1.0, 2.0, 3.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, 1.0, 2.0, 3.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, 3.0, 4.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, NaN, 3.0, 4.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, 2.0, NaN, 3.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, 2.0, NaN, 3.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, 2.0, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, 2.0, 3.0, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, NaN, 3.0, 4.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, NaN, 3.0, 4.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, NaN, NaN, 4.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, 2.0, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, 2.0, NaN, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, 2.0, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, 2.0, NaN, 4.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, NaN, 3.0, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, 2.0, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, 2.0, 3.0, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, NaN, NaN, 4.0, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, NaN, NaN, 4.0 ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( 1.0, NaN, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( 1.0, NaN, NaN, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, NaN, 3.0, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, NaN, 3.0, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, 2.0, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, 2.0, NaN, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } - actual = drotmg( NaN, NaN, NaN, NaN, new Float64Array( 5 ), 1, 0 ); + actual = drotmg( NaN, NaN, NaN, NaN ); for ( i = 0; i < actual.length; i++ ) { t.strictEqual( isnan( actual[i] ), true, 'returns expected value' ); } From f9618397d08a14d148740f07838f5e29620c9c5a Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 1 Mar 2025 18:19:41 +0530 Subject: [PATCH 12/13] fix: update README.md Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/drotmg/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/README.md b/lib/node_modules/@stdlib/blas/base/drotmg/README.md index 4a16707ae699..141b817a5fcd 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/README.md +++ b/lib/node_modules/@stdlib/blas/base/drotmg/README.md @@ -112,7 +112,7 @@ for ( i = 0; i < 100; i++ ) { [blas]: http://www.netlib.org/blas -[drotmg]: http://www.netlib.org/lapack/explore-html/df/d28/group__double__blas__level1.html +[drotmg]: https://netlib.org/lapack/explore-html-3.6.1/de/da4/group__double__blas__level1_ga13e351a3dfafa2cd8dc5302dcf53f69a.html From 038983c10a7753f87b4e6f862e1682775092eddd Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Thu, 1 May 2025 23:13:44 +0530 Subject: [PATCH 13/13] fix: indentation --- 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: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/base/drotmg/docs/types/index.d.ts | 76 ++++----- .../@stdlib/blas/base/drotmg/package.json | 144 +++++++++--------- 2 files changed, 110 insertions(+), 110 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts index 0b622d070310..1fc4fffcca8a 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/drotmg/docs/types/index.d.ts @@ -23,47 +23,47 @@ */ interface Routine { /** - * Constructs the parameters for a modified Givens plane rotation. - * - * @param d1 - scaling factor for the first vector component - * @param d2 - scaling factor for the second vector component - * @param x1 - first component of the first vector - * @param y1 - first component of the second vector - * @returns - output array containing the rotation parameters - * - * @example - * var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); - * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] - * - * @example - * var out = drotmg( 3.0, 5.0, 1.0, 2.0 ); - * // returns [ 1.0, 0.3, 0.0, 0.0, 0.5 ] - */ + * Constructs the parameters for a modified Givens plane rotation. + * + * @param d1 - scaling factor for the first vector component + * @param d2 - scaling factor for the second vector component + * @param x1 - first component of the first vector + * @param y1 - first component of the second vector + * @returns - output array containing the rotation parameters + * + * @example + * var out = drotmg( 3.0, 4.0, 1.5, 2.5 ); + * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] + * + * @example + * var out = drotmg( 3.0, 5.0, 1.0, 2.0 ); + * // returns [ 1.0, 0.3, 0.0, 0.0, 0.5 ] + */ ( d1: number, d2: number, x1: number, y1: number ): Float64Array; /** - * Constructs the parameters for a modified Givens plane rotation. - * - * @param d1 - scaling factor for the first vector component - * @param d2 - scaling factor for the second vector component - * @param x1 - first component of the first vector - * @param y1 - first component of the second vector - * @param out - output array - * @param stride - index increment - * @param offset - starting index - * @returns - output array containing the rotation parameters - * - * @example - * var Float64Array = require( '@stdlib/array/float64' ); - * - * var out = new Float64Array( 5 ); - * - * var y = drotmg.assign( 3.0, 4.0, 1.5, 2.5, out, 1, 0 ); - * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] - * - * var bool = (y === out); - * // returns true - */ + * Constructs the parameters for a modified Givens plane rotation. + * + * @param d1 - scaling factor for the first vector component + * @param d2 - scaling factor for the second vector component + * @param x1 - first component of the first vector + * @param y1 - first component of the second vector + * @param out - output array + * @param stride - index increment + * @param offset - starting index + * @returns - output array containing the rotation parameters + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var out = new Float64Array( 5 ); + * + * var y = drotmg.assign( 3.0, 4.0, 1.5, 2.5, out, 1, 0 ); + * // returns [ 1.0, 0.45, 0.0, 0.0, 0.6 ] + * + * var bool = (y === out); + * // returns true + */ assign( d1: number, d2: number, x1: number, y1: number, out: Float64Array, stride: number, offset: number ): Float64Array; } diff --git a/lib/node_modules/@stdlib/blas/base/drotmg/package.json b/lib/node_modules/@stdlib/blas/base/drotmg/package.json index e49efdebe0e9..2cc899354339 100755 --- a/lib/node_modules/@stdlib/blas/base/drotmg/package.json +++ b/lib/node_modules/@stdlib/blas/base/drotmg/package.json @@ -1,75 +1,75 @@ { - "name": "@stdlib/blas/base/drotmg", - "version": "0.0.0", - "description": "Construct a Givens plane rotation.", - "license": "Apache-2.0", - "author": { + "name": "@stdlib/blas/base/drotmg", + "version": "0.0.0", + "description": "Construct a Givens plane rotation.", + "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" - }, - "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", - "blas", - "level 1", - "drotmg", - "parameters", - "modified", - "givens", - "rotation", - "matrix", - "linear", - "algebra", - "subroutines", - "vector", - "array", - "ndarray", - "float64", - "float", - "single", - "float32array" - ] - } + } + ], + "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", + "blas", + "level 1", + "drotmg", + "parameters", + "modified", + "givens", + "rotation", + "matrix", + "linear", + "algebra", + "subroutines", + "vector", + "array", + "ndarray", + "float64", + "float", + "single", + "float32array" + ] +}