diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/README.md b/lib/node_modules/@stdlib/lapack/base/dladiv2/README.md new file mode 100644 index 000000000000..03f63d86b9d4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/README.md @@ -0,0 +1,181 @@ + + +# dladiv2 + +> LAPACK routine to perform complex division in a manner which doesn't cause unnecessary overflow. + +
+ +## Usage + +```javascript +var dladiv2 = require( '@stdlib/lapack/base/dladiv2' ); +``` + +#### dladiv2( a, b, c, d, r, t ) + +Performs complex division `A + iB / C + iD` using real double-precision arithmetic. + +```javascript +var out = dladiv2( 3.0, 4.0, 1.0, 2.0, 4.0, 5.0 ); +// returns 95.0 +``` + +The function has the following parameters: + +- **a**: real part of the dividend complex number. +- **b**: imaginary part of the dividend complex number. +- **c**: real part of the divisor complex number. +- **d**: imaginary part of the divisor complex number. +- **r**: represents the ratio of the smaller-magnitude component to the larger-magnitude component of the denominator complex number `C + iD`. +- **t**: scaling factor. + +
+ + + +
+ +## Notes + +- `dladiv2()` corresponds to the [LAPACK][LAPACK] function [`dladiv2`][lapack-dladiv2]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var dladiv2 = require( '@stdlib/lapack/base/dladiv2' ); + +var opts = { + 'dtype': 'float64' +}; +var a = discreteUniform( 100, -50, 50, opts ); +var b = discreteUniform( 100, -50, 50, opts ); +var c = discreteUniform( 100, -50, 50, opts ); +var d = discreteUniform( 100, -50, 50, opts ); +var r = discreteUniform( 100, -50, 50, opts ); +var t = discreteUniform( 100, -50, 50, opts ); + +logEachMap( 'dladiv2( %d, %d, %d, %d, %d, %d ) = %0.4f', a, b, c, d, r, t, dladiv2 ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dladiv2/benchmark/benchmark.js new file mode 100644 index 000000000000..0f15e14a31d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/benchmark/benchmark.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var pkg = require( './../package.json' ).name; +var dladiv2 = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var len; + var B; + var A; + var C; + var D; + var R; + var T; + var z; + var i; + + len = 100; + A = uniform( len, -50, 50 ); + B = uniform( len, -50, 50 ); + C = uniform( len, -50, 50 ); + D = uniform( len, -50, 50 ); + R = uniform( len, -50, 50 ); + T = uniform( len, -50, 50 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dladiv2( A[ i % len ], B[ i % len ], C[ i % len ], D[ i % len ], R[ i % len ], T[ i % len ] ); // eslint-disable-line + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/repl.txt new file mode 100644 index 000000000000..0010a5bc4d30 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/repl.txt @@ -0,0 +1,38 @@ + +{{alias}}( a, b, c, d, r, t ) + Performs complex division `A + iB / C + iD` using real double-precision + arithmetic. + + Parameters + ---------- + a: number + Real part of the dividend complex number. + + b: number + Imaginary part of the dividend complex number. + + c: number + Real part of the divisor complex number. + + d: number + Imaginary part of the divisor complex number. + + r: number + Represents the ratio of the smaller-magnitude component to the + larger-magnitude component of the denominator complex number `C + iD`. + + t: number + Scaling factor. + + Returns + ------- + out: number + A + iB / C + iD. + + Examples + -------- + > var out = {{alias}}( 3.0, 4.0, 1.0, 2.0, 4.0, 5.0 ) + 95.0 + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/types/index.d.ts new file mode 100644 index 000000000000..e9fb3af887ab --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/types/index.d.ts @@ -0,0 +1,41 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Performs complex division `A + iB / C + iD` using real double-precision arithmetic. +* +* @param a - real part of the dividend complex number +* @param b - imaginary part of the dividend complex number +* @param c - real part of the divisor complex number +* @param d - imaginary part of the divisor complex number +* @param r - represents the ratio of the smaller-magnitude component to the larger-magnitude component of the denominator complex number `C + iD` +* @param t - scaling factor +* @returns `A + iB / C + iD` +* +* @example +* var out = dladiv2( 3.0, 4.0, 1.0, 2.0, 4.0, 5.0 ); +* // returns 95.0 +*/ +declare function dladiv2( a: number, b: number, c: number, d: number, r: number, t: number ): number; + + +// EXPORTS // + +export = dladiv2; diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/types/test.ts new file mode 100644 index 000000000000..c9b42de8edb6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/docs/types/test.ts @@ -0,0 +1,82 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dladiv2 = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + dladiv2( 8.0, 2.0, 10.0, 3.0, 4.0, 5.0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided values other than six numbers... +{ + dladiv2( true, 3.0, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( false, 2.0, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( '5', 1.0, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( [], 1.0, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( {}, 2.0, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( ( x: number ): number => x, 2.0, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + + dladiv2( 9.0, true, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 9.0, false, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 5.0, '5', 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 8.0, [], 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 9.0, {}, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 8.0, ( x: number ): number => x, 1.0, 3.0, 4.0, 5.0 ); // $ExpectError + + dladiv2( 9.0, 1.0, true, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 9.0, 1.0, false, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 5.0, 1.0, '5', 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 8.0, 1.0, [], 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 9.0, 1.0, {}, 3.0, 4.0, 5.0 ); // $ExpectError + dladiv2( 8.0, 1.0, ( x: number ): number => x, 3.0, 4.0, 5.0 ); // $ExpectError + + dladiv2( 9.0, 1.0, 3.0, true, 4.0, 5.0 ); // $ExpectError + dladiv2( 9.0, 1.0, 3.0, false, 4.0, 5.0 ); // $ExpectError + dladiv2( 5.0, 1.0, 3.0, '5', 4.0, 5.0 ); // $ExpectError + dladiv2( 8.0, 1.0, 3.0, [], 4.0, 5.0 ); // $ExpectError + dladiv2( 9.0, 1.0, 3.0, {}, 4.0, 5.0 ); // $ExpectError + dladiv2( 8.0, 1.0, 3.0, ( x: number ): number => x, 4.0, 5.0 ); // $ExpectError + + dladiv2( 9.0, 1.0, 3.0, 4.0, true, 5.0 ); // $ExpectError + dladiv2( 9.0, 1.0, 3.0, 4.0, false, 5.0 ); // $ExpectError + dladiv2( 5.0, 1.0, 3.0, 4.0, '5', 5.0 ); // $ExpectError + dladiv2( 8.0, 1.0, 3.0, 4.0, [], 5.0 ); // $ExpectError + dladiv2( 9.0, 1.0, 3.0, 4.0, {}, 5.0 ); // $ExpectError + dladiv2( 8.0, 1.0, 3.0, 4.0, ( x: number ): number => x, 5.0 ); // $ExpectError + + dladiv2( 9.0, 1.0, 3.0, 4.0, 5.0, true ); // $ExpectError + dladiv2( 9.0, 1.0, 3.0, 4.0, 5.0, false ); // $ExpectError + dladiv2( 5.0, 1.0, 3.0, 4.0, 5.0, '5' ); // $ExpectError + dladiv2( 8.0, 1.0, 3.0, 4.0, 5.0, [] ); // $ExpectError + dladiv2( 9.0, 1.0, 3.0, 4.0, 5.0, {} ); // $ExpectError + dladiv2( 8.0, 1.0, 3.0, 4.0, 5.0, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + dladiv2(); // $ExpectError + dladiv2( 3.0 ); // $ExpectError + dladiv2( 3.0, 5.0 ); // $ExpectError + dladiv2( 3.0, 5.0, 3.0 ); // $ExpectError + dladiv2( 3.0, 5.0, 3.0, 4.0 ); // $ExpectError + dladiv2( 3.0, 5.0, 3.0, 4.0, 5.0 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dladiv2/examples/index.js new file mode 100644 index 000000000000..d7efe78db33e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var dladiv2 = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; +var a = discreteUniform( 100, -50, 50, opts ); +var b = discreteUniform( 100, -50, 50, opts ); +var c = discreteUniform( 100, -50, 50, opts ); +var d = discreteUniform( 100, -50, 50, opts ); +var r = discreteUniform( 100, -50, 50, opts ); +var t = discreteUniform( 100, -50, 50, opts ); + +logEachMap( 'dladiv2( %d, %d, %d ) = %0.4f', a, b, c, d, r, t, dladiv2 ); diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dladiv2/lib/index.js new file mode 100644 index 000000000000..95e7ac7f468e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to perform complex division `A + iB / C + iD` using real double-precision arithmetic. +* +* @module @stdlib/lapack/base/dladiv2 +* +* @example +* var dladiv2 = require( '@stdlib/lapack/base/dladiv2' ); +* +* var out = dladiv2( 3.0, 4.0, 1.0, 2.0, 4.0, 5.0 ); +* // returns 95.0 +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dladiv2/lib/main.js new file mode 100644 index 000000000000..84d06e1ff54c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/lib/main.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Performs complex division `A + iB / C + iD` using real double-precision arithmetic. +* +* @param {number} a - real part of the dividend complex number +* @param {number} b - imaginary part of the dividend complex number +* @param {number} c - real part of the divisor complex number +* @param {number} d - imaginary part of the divisor complex number +* @param {number} r - represents the ratio of the smaller-magnitude component to the larger-magnitude component of the denominator complex number `C + iD` +* @param {number} t - scaling factor +* @returns {number} `A + iB / C + iD` +* +* @example +* var out = dladiv2( 3.0, 4.0, 1.0, 2.0, 4.0, 5.0 ); +* // returns 95.0 +*/ +function dladiv2( a, b, c, d, r, t ) { + var br; + + if ( r !== 0.0 ) { + br = b * r; + if ( br !== 0.0 ) { + return ( a + br ) * t; + } + return ( a * t ) + ( ( b * t ) * r ); + } + return ( a + ( d * ( b / c ) ) ) * t; +} + + +// EXPORTS // + +module.exports = dladiv2; diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/package.json b/lib/node_modules/@stdlib/lapack/base/dladiv2/package.json new file mode 100644 index 000000000000..293a1a8c8264 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/lapack/base/dladiv2", + "version": "0.0.0", + "description": "LAPACK routine to perform complex division `A + iB / C + iD` using real double-precision arithmetic.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "lapack", + "dladiv2", + "copy", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dladiv2/test/test.js b/lib/node_modules/@stdlib/lapack/base/dladiv2/test/test.js new file mode 100644 index 000000000000..85d34ee785a4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dladiv2/test/test.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var dladiv2 = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dladiv2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns expected values if r = 0', function test( t ) { + var expected; + var actual; + + actual = dladiv2( 3.0, 4.0, 1.0, 2.0, 0.0, 5.0 ); + expected = 55.0; + + t.strictEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values if r != 0 and b != 0', function test( t ) { + var expected; + var actual; + + actual = dladiv2( 3.0, 4.0, 1.0, 2.0, 5.0, 5.0 ); + expected = 115.0; + + t.strictEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values if r != 0 and b = 0', function test( t ) { + var expected; + var actual; + + actual = dladiv2( 3.0, 0.0, 1.0, 2.0, 21.0, 5.0 ); + expected = 15.0; + + t.strictEqual( actual, expected, 'returns expected value' ); + t.end(); +});