From d1478198997e3b83114e8faf3ef99ed4e72f680e Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Tue, 31 Dec 2024 01:00:30 +0530 Subject: [PATCH 01/27] feat: add math/base/special/bessely1 --- .../math/base/special/bessely1/README.md | 86 +++++ .../bessely1/benchmark/benchmark.native.js | 60 ++++ .../math/base/special/bessely1/binding.gyp | 170 ++++++++++ .../base/special/bessely1/examples/c/Makefile | 146 +++++++++ .../special/bessely1/examples/c/example.c | 31 ++ .../math/base/special/bessely1/include.gypi | 53 +++ .../stdlib/math/base/special/bessely1.h | 38 +++ .../math/base/special/bessely1/lib/native.js | 74 +++++ .../math/base/special/bessely1/manifest.json | 93 ++++++ .../math/base/special/bessely1/src/Makefile | 70 ++++ .../math/base/special/bessely1/src/addon.c | 22 ++ .../math/base/special/bessely1/src/main.c | 307 ++++++++++++++++++ .../base/special/bessely1/test/test.native.js | 286 ++++++++++++++++ 13 files changed, 1436 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/include/stdlib/math/base/special/bessely1.h create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md index 0b60aa59dc24..5df877592e7c 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md @@ -105,8 +105,94 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/bessely1.h" +``` + +#### stdlib_base_bessely0( x ) + +Computes the [Bessel function of the second kind][bessel-second-kind] of order one at `x`. + +```c +double out = stdlib_base_bessely1( 0.0 ); +// returns -Infinity + +out = stdlib_base_bessely1( 1.0 ); +// returns ~-0.781 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double stdlib_base_bessely1( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/bessely1.h" +#include + +int main( void ) { + const double x[] = { 0.0, 1.0, 2.0, 3.0, 4.0 }; + + double y; + int i; + for ( i = 0; i < 5; i++ ) { + y = stdlib_base_bessely1( x[ i ] ); + printf( "bessely1(%lf) = %lf\n", x[ i ], y ); + } +} +``` + +
+ +
+ + + diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c index d55a97b04833..8ac6c3413419 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c @@ -28,4 +28,4 @@ int main( void ) { y = stdlib_base_bessely1( x[ i ] ); printf( "bessely1(%lf) = %lf\n", x[ i ], y ); } -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c index 7f1bcaeabb8d..a291be6e18a7 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c @@ -304,4 +304,4 @@ double stdlib_base_bessely1(double x) { */ stdlib_base_sincos( xc, &s, &c ); return f * ( ( (y*rs) * ( s - c ) ) - ( rc * ( s + c ) ) ); -} \ No newline at end of file +} From 525a2930d36ae9f8948ace12ea503bf60f4d94b0 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:40:54 +0530 Subject: [PATCH 05/27] Fixed package.json Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/math/base/special/bessely1/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/package.json b/lib/node_modules/@stdlib/math/base/special/bessely1/package.json index 2be9ca28380d..dfc66a99678c 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/package.json +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/package.json @@ -14,6 +14,7 @@ } ], "main": "./lib", + "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", From d9a6552e25544cbd9fbed8176a01ef4dc8862713 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 23 Feb 2025 00:15:39 +0530 Subject: [PATCH 06/27] fix: multiple errors --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../math/base/special/bessely1/README.md | 18 +++++++++++++++++- .../bessely1/benchmark/benchmark.native.js | 6 +++--- .../math/base/special/bessely1/src/main.c | 19 ++----------------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md index a7bcd5dae390..0acfff955e13 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md @@ -105,6 +105,8 @@ for ( i = 0; i < 100; i++ ) { + + * * * @@ -131,7 +133,7 @@ for ( i = 0; i < 100; i++ ) { #include "stdlib/math/base/special/bessely1.h" ``` -#### stdlib_base_bessely0( x ) +#### stdlib_base_bessely1( x ) Computes the [Bessel function of the second kind][bessel-second-kind] of order one at `x`. @@ -197,6 +199,14 @@ int main( void ) { @@ -209,6 +219,12 @@ int main( void ) { +[@stdlib/math/base/special/besselj0]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/besselj0 + +[@stdlib/math/base/special/besselj1]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/besselj1 + +[@stdlib/math/base/special/bessely1]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/bessely1 + diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js index de7a1932d3d5..565ee0e70a1c 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js @@ -30,9 +30,9 @@ var pkg = require( './../package.json' ).name; // VARIABLES // -var y0 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var y1 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); var opts = { - 'skip': ( y0 instanceof Error ) + 'skip': ( y1 instanceof Error ) }; @@ -46,7 +46,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { x = ( randu() * 100000.0 ) - 0.0; - y = y0( x ); + y = y1( x ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c index a291be6e18a7..04dd7da8bbab 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c @@ -225,27 +225,12 @@ static double rational_psqs(const double x ) { /** * Computes the Bessel function of the second kind of order one. * -* @param x - input value -* @returns evaluated Bessel function +* @param x input value +* @return evaluated Bessel function * * @example * double v = y1(0.0); * // returns -Infinity -* -* v = y1(1.0); -* // returns ~-0.781 -* -* v = y1(-1.0); -* // returns NaN -* -* v = y1(INFINITY); -* // returns 0.0 -* -* v = y1(-INFINITY); -* // returns NaN -* -* v = y1(NAN); -* // returns NaN */ // Main function to compute the Bessel function of the second kind of order one From 856d7de71ff3e48712dce01e61de03c13f61e21f Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Mon, 24 Feb 2025 02:02:29 +0530 Subject: [PATCH 07/27] Apply suggestions from code review Signed-off-by: Gunj Joshi --- .../math/base/special/bessely1/examples/c/example.c | 2 +- .../@stdlib/math/base/special/bessely1/lib/native.js | 12 ------------ .../@stdlib/math/base/special/bessely1/src/main.c | 11 +++++++---- .../math/base/special/bessely1/test/test.native.js | 12 ++++++------ 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c index 8ac6c3413419..0f4b9dcf8156 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/examples/c/example.c @@ -16,8 +16,8 @@ * limitations under the License. */ -#include #include "stdlib/math/base/special/bessely1.h" +#include int main( void ) { const double x[] = { 0.0, 1.0, 2.0, 3.0, 4.0 }; diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js index f522a72f99a2..d4be3e7c9abc 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js @@ -15,18 +15,6 @@ * 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. -* -* ## Notice -* -* The original C++ code and copyright notice are from the [Boost library]{@link https://github.com/boostorg/math/blob/develop/include/boost/math/special_functions/detail/bessel_y1.hpp}. The implementation has been modified for JavaScript. -* -* ```text -* Copyright Xiaogang Zhang, 2006. -* -* Use, modification and distribution are subject to the -* Boost Software License, Version 1.0. (See accompanying file -* LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt) -* ``` */ 'use strict'; diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c index 04dd7da8bbab..bd737c932e0a 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c @@ -31,8 +31,8 @@ // MODULES -#include "stdlib/math/base/special/besselj1.h" #include "stdlib/math/base/special/bessely1.h" +#include "stdlib/math/base/special/besselj1.h" #include "stdlib/math/base/special/ln.h" #include "stdlib/math/base/special/sqrt.h" #include "stdlib/math/base/special/sincos.h" @@ -225,16 +225,19 @@ static double rational_psqs(const double x ) { /** * Computes the Bessel function of the second kind of order one. * +* ## Notes +* +* - Accuracy for subnormal `x` is very poor. Full accuracy is achieved at `1.0e-308` but trends progressively to zero at `5e-324`. This suggests that underflow (or overflow, perhaps due to a reciprocal) is effectively cutting off digits of precision until the computation loses all accuracy at `5e-324`. +* * @param x input value * @return evaluated Bessel function * * @example -* double v = y1(0.0); +* double v = y1( 0.0 ); * // returns -Infinity */ -// Main function to compute the Bessel function of the second kind of order one -double stdlib_base_bessely1(double x) { +double stdlib_base_bessely1( double x ) { double rc; double rs; double y; diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js index 5031d662ce50..ceb87ce511a7 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js @@ -197,7 +197,7 @@ tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal valu x = subnormal.x; for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); } t.end(); }); @@ -256,31 +256,31 @@ tape( 'the function returns `NaN` for negative numbers', function test( t ) { for ( i = 0; i < 1000; i++ ) { x = -( randu() * 100.0 ) - EPS; v = y1( x ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); } t.end(); }); tape( 'the function returns `-Infinity` if provided `0`', function test( t ) { var v = y1( 0.0 ); - t.equal( v, NINF, 'returns -Infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = y1( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `0.0` if provided `+infinity`', function test( t ) { var v = y1( PINF ); - t.equal( v, 0.0, 'returns 0.0' ); + t.equal( v, 0.0, 'returns expected value' ); t.end(); }); tape( 'the function returns `NaN` if provided `-infinity`', function test( t ) { var v = y1( NINF ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); From 41d94f9e17ce50c898ed745f307ca9e9fc20eac3 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Wed, 26 Feb 2025 13:55:45 +0530 Subject: [PATCH 08/27] fix: update README.md Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/math/base/special/bessely1/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md index 0acfff955e13..e6a55e361990 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md @@ -205,7 +205,7 @@ int main( void ) { - [`@stdlib/math/base/special/besselj0`][@stdlib/math/base/special/besselj0]: compute the Bessel function of the first kind of order zero. - [`@stdlib/math/base/special/besselj1`][@stdlib/math/base/special/besselj1]: compute the Bessel function of the first kind of order one. -- [`@stdlib/math/base/special/bessely1`][@stdlib/math/base/special/bessely1]: compute the Bessel function of the second kind of order one. +- [`@stdlib/math/base/special/bessely1`][@stdlib/math/base/special/bessely0]: compute the Bessel function of the second kind of order zero. @@ -223,7 +223,7 @@ int main( void ) { [@stdlib/math/base/special/besselj1]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/besselj1 -[@stdlib/math/base/special/bessely1]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/bessely1 +[@stdlib/math/base/special/bessely0]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/bessely0 From dffa63775059cd2613dc250c9f2d75792498819c Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:04:11 +0530 Subject: [PATCH 09/27] fix: update benchmark.native.js Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../special/bessely1/benchmark/benchmark.native.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js index 565ee0e70a1c..522a743793d6 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js @@ -22,7 +22,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var Float64Array = require( '@stdlib/array/float64' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -39,14 +40,19 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { + var len; var x; var y; var i; + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( 0.0, 100000.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 100000.0 ) - 0.0; - y = y1( x ); + y = y1( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } From 5539f3490977d7fed9f94e140f8da427885282d7 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:11:15 +0530 Subject: [PATCH 10/27] fix: update benchmark.js Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../base/special/bessely1/benchmark/benchmark.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js index d6089a2d98b5..a51516d34896 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js @@ -21,7 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var Float64Array = require( '@stdlib/array/float64' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var y1 = require( './../lib' ); @@ -30,14 +31,19 @@ var y1 = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { + var len; var x; var y; var i; + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( 0.0, 100000.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100000.0 ) - 0.0; - y = y1( x ); + y = y1( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } From b80da73d843fc8c51e453c2271219d1c482ed8f7 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:21:53 +0530 Subject: [PATCH 11/27] fix: update main.c Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../math/base/special/bessely1/src/main.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c index bd737c932e0a..504ea366cde0 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c @@ -110,7 +110,7 @@ static double rational_p1q1( const double x ) { * @param {number} x - value at which to evaluate the rational function * @returns {number} evaluated rational function */ -static double rational_p2q2(const double x ) { +static double rational_p2q2( const double x ) { double ax; double ix; double s1; @@ -152,7 +152,7 @@ static double rational_p2q2(const double x ) { * @param {number} x - value at which to evaluate the rational function * @returns {number} evaluated rational function */ -static double rational_pcqc(const double x ) { +static double rational_pcqc( const double x ) { double ax; double ix; double s1; @@ -194,7 +194,7 @@ static double rational_pcqc(const double x ) { * @param {number} x - value at which to evaluate the rational function * @returns {number} evaluated rational function */ -static double rational_psqs(const double x ) { +static double rational_psqs( const double x ) { double ax; double ix; double s1; @@ -238,7 +238,7 @@ static double rational_psqs(const double x ) { */ double stdlib_base_bessely1( double x ) { - double rc; + double rc; double rs; double y; double r; @@ -261,24 +261,24 @@ double stdlib_base_bessely1( double x ) { xc = x; if (xc <= 4.0) { y = xc * xc; - z = ( stdlib_base_ln(xc / x1) * stdlib_base_besselj1(xc)) * TWO_DIV_PI; - r = rational_p1q1(y); - f = ( ( xc+x1 ) * ( (xc - (x11/256.0)) - x12 ) ) / xc; - return z + (f * r); + z = ( stdlib_base_ln( xc / x1 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; + r = rational_p1q1( y ); + f = ( ( xc+x1 ) * ( ( xc - ( x11 / 256.0) ) - x12 ) ) / xc; + return z + ( f * r ); } - if (xc <= 8.0) { + if ( xc <= 8.0 ) { y = xc * xc; - z = ( stdlib_base_ln(xc / x2) * stdlib_base_besselj1(xc) ) * TWO_DIV_PI; - r = rational_p2q2(y); - f = ( ( xc+x2 ) * ( (xc - (x21/256.0)) - x22 ) ) / xc; - return z + (f * r); + z = ( stdlib_base_ln( xc / x2 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; + r = rational_p2q2( y ); + f = ( ( xc + x2 ) * ( ( xc - ( x21 / 256.0 ) ) - x22 ) ) / xc; + return z + ( f * r ); } y = 8.0 / xc; y2 = y * y; - rc = rational_pcqc(y2); - rs = rational_psqs(y2); - f = ONE_DIV_SQRT_PI / stdlib_base_sqrt(xc); + rc = rational_pcqc( y2 ); + rs = rational_psqs( y2 ); + f = ONE_DIV_SQRT_PI / stdlib_base_sqrt( xc ); /* * This code is really just: @@ -291,5 +291,5 @@ double stdlib_base_bessely1( double x ) { * But using the sin/cos addition rules, plus constants for sin/cos of `3π/4` which then cancel out with corresponding terms in "f". */ stdlib_base_sincos( xc, &s, &c ); - return f * ( ( (y*rs) * ( s - c ) ) - ( rc * ( s + c ) ) ); + return f * ( ( ( y * rs ) * ( s - c ) ) - ( rc * ( s + c ) ) ); } From e73daeeea0f76b8774bc2f5f700713e8d578e248 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Mon, 3 Mar 2025 15:18:09 +0530 Subject: [PATCH 12/27] fix: update benchmark.js Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../base/special/bessely1/benchmark/benchmark.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js index 87dc329992ef..a51516d34896 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js @@ -21,12 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); - var Float64Array = require( '@stdlib/array/float64' ); var uniform = require( '@stdlib/random/base/uniform' ); - - - var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var y1 = require( './../lib' ); @@ -40,7 +36,6 @@ bench( pkg, function benchmark( b ) { var y; var i; - len = 100; x = new Float64Array( len ); for ( i = 0; i < len; i++ ) { @@ -49,13 +44,6 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { y = y1( x[ i % len ] ); - - - - - - - if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } From a5470f7ad6d2f56153e827b2e5edf7d4db2d1dbf Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 16 Feb 2025 13:54:04 +0530 Subject: [PATCH 13/27] feat: add /blas/base/zrotg --- .../@stdlib/blas/base/zrotg/examples/index.js | 41 ++++++ .../@stdlib/blas/base/zrotg/lib/assign.js | 136 ++++++++++++++++++ .../@stdlib/blas/base/zrotg/lib/index.js | 82 +++++++++++ .../@stdlib/blas/base/zrotg/lib/main.js | 57 ++++++++ 4 files changed, 316 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js new file mode 100644 index 000000000000..843e2ea7b311 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var logEach = require( '@stdlib/console/log-each' ); +var zrotg = require( './../lib' ); + +var out; +var i; + +function rand() { + return new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); +} + +for ( i = 0; i < 100; i++ ) { + var a = rand(); + var b = rand(); + + zrotg( a, b, out ); + + console.log( out ); +} diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js new file mode 100644 index 000000000000..48f4f998889c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js @@ -0,0 +1,136 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 sqrt = require( '@stdlib/math/base/special/sqrt' ); +var cabs2 = require( '@stdlib/math/base/special/cabs2' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var cmul = require( '@stdlib/complex/float64/base/mul' ); +var conj = require( '@stdlib/complex/float64/conj' ); +var logEach = require( '@stdlib/console/log-each' ); + + +// MAIN // + +/** +* Constructs a Givens plane rotation. +* +* @param {Complex128} a - rotational elimination parameter +* @param {Complex128} b - rotational elimination parameter +* @param {Complex128Array} out - output array +* @param {integer} stride - index increment +* @param {NonNegativeInteger} offset - starting index +* @returns {Complex128Array} output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var a = new Complex128( 4.0, 3.0 ); +* // returns +* +* var b = new Complex128( 0.0, 0.0 ); +* // returns +* +* var out = zrotg( a, b, new Complex128Array( 4 ), 1, 0 ); +* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +*/ +function zrotg( a, b, out, stride, offset ) { + var c; + var s; + var r; + var z; + var a2; + var b2; + var c2; + var d; + var scale; + var temp; + + s = new Complex128( 0.0, 0.0 ); + r = new Complex128( 0.0, 0.0 ); + logEach('a: real=%s, imag=%s', real(a), imag(a)); + logEach('b: real=%s, imag=%s', real(b), imag(b)); + if ( real( b ) === 0.0 && imag( b ) === 0.0 ) { + c = 1.0; + r = a; + z = 0.0; + } else if ( real( a ) === 0.0 && imag( a ) === 0.0 ) { + c = 0; + if ( real( b ) === 0 ) { + r = abs( imag( b ) ); + s = conj( b ) / r; + } else if ( imag( b ) === 0 ) { + r = abs( real( b ) ); + s = conj( b ) / r; + } else { + b2 = cabs2( b ); + d = sqrt( b2 ); + s = conj( b ) / d; + r = d; + } + z = 1; + } else { + a2 = cabs2( a ); + b2 = cabs2( b ); + c2 = a2 + b2; + + if ( a2 >= c2 * EPS ) { + c = sqrt( a2 / c2); + r = new Complex128( real( a ) / c, imag( a ) / c ); + scale = 1 / sqrt(a2 * c2); + temp = new Complex128(real(a) * scale, imag(a) * scale); + s = cmul(conj(b), temp); + } else { + d = sqrt( a2 * c2 ); + c = a2 / d; + while( c < EPS ) { + d *= 2; + c = a2 / d; + } + while( c === 0.0 ) { + c = 1; + } + r = new Complex128( real( a ) / c, imag( a ) / c ); + s = conj( b ) * ( a / d ); + } + z = 1 / c; + } + a = r; + out[offset] = a; + out[offset + stride] = b; + out[offset + 2 * stride] = c; + out[offset + 3 * stride] = s; + logEach('a: real=%s, imag=%s', real(a), imag(a)); + logEach('b: real=%s, imag=%s', real(b), imag(b)); + logEach('s: real=%s, imag=%s', real(s), imag(s)); + console.log( c ); + return out; +} + + +// EXPORTS // + +module.exports = zrotg; diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js new file mode 100644 index 000000000000..37ccb939424d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js @@ -0,0 +1,82 @@ +/** +* @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'; + +/** +* Construct a Givens plane rotation. +* +* @module @stdlib/blas/base/zrotg +* +* @example +* var zrotg = require( '@stdlib/blas/base/zrotg' ); +* +* var a = new Complex128( 4.0, 3.0 ); +* // returns +* +* var b = new Complex128( 0.0, 0.0 ); +* // returns +* +* var out = zrotg( a, b ); +* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* +* a = new Complex128( 1.0, 3.0 ); +* // returns +* +* var b = new Complex128( 2.0, 4.0 ); +* // returns +* +* out = zrotg( a, b ); +* // returns [ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var zrotg = require( '@stdlib/blas/base/zrotg' ); +* +* var a = new Complex128( 4.0, 3.0 ); +* // returns +* +* var b = new Complex128( 0.0, 0.0 ); +* // returns +* +* var out = new Complex128Array( 4 ); +* +* var y = zrotg.assign( a, b, out, 1, 0 ); +* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* +* 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/zrotg/lib/main.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js new file mode 100644 index 000000000000..2cd21920545a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js @@ -0,0 +1,57 @@ +/** +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +var fcn = require( './assign.js' ); + + +// MAIN // + +/** +* Constructs a Givens plane rotation. +* +* @param {number} a - rotational elimination parameter +* @param {number} b - rotational elimination parameter +* @returns {Complex128Array} output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var a = new Complex128( 4.0, 3.0 ); +* // returns +* +* var b = new Complex128( 0.0, 0.0 ); +* // returns +* +* var out = zrotg( a, b, new Complex128Array( 4 ), 1, 0 ); +* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +*/ +function zrotg( a, b ) { + var out = new Complex128Array( 4 ); + return fcn( a, b, out, 1, 0 ); +} + + +// EXPORTS // + +module.exports = zrotg; From 24c63df95bcf7ebe9f1e2af692085a1c96d23229 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Tue, 18 Feb 2025 05:19:14 +0000 Subject: [PATCH 14/27] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js | 2 +- lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js | 2 +- lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js index 843e2ea7b311..28b157d166e9 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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/zrotg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js index 48f4f998889c..4dd8c6a5f157 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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/zrotg/lib/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js index 37ccb939424d..1167d4842e6f 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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/zrotg/lib/main.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js index 2cd21920545a..82710b16b92b 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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. From 134d5a718436bc270e9ac0fe7f8cb8b1b8e25972 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 23 Feb 2025 20:24:45 +0530 Subject: [PATCH 15/27] docs: add files --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../blas/base/zrotg/benchmark/benchmark.js | 96 +++++++++++ .../@stdlib/blas/base/zrotg/docs/repl.txt | 65 ++++++++ .../blas/base/zrotg/docs/types/index.d.ts | 117 +++++++++++++ .../blas/base/zrotg/docs/types/test.ts | 155 ++++++++++++++++++ .../@stdlib/blas/base/zrotg/examples/index.js | 10 +- .../@stdlib/blas/base/zrotg/lib/assign.js | 83 +++++----- .../@stdlib/blas/base/zrotg/lib/index.js | 26 +-- .../@stdlib/blas/base/zrotg/lib/main.js | 17 +- .../@stdlib/blas/base/zrotg/package.json | 72 ++++++++ 9 files changed, 566 insertions(+), 75 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts mode change 100644 => 100755 lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js mode change 100644 => 100755 lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js mode change 100644 => 100755 lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js mode change 100644 => 100755 lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/package.json diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js new file mode 100644 index 000000000000..2b68e64934e6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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/base/discrete-uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var pkg = require( './../package.json' ).name; +var zrotg = require( './../lib' ); + + +// VARIABLES // + +var OPTS = { + 'dtype': 'float64' +}; + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var viewY; + var za; + var zb; + var z; + var i; + + za = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); + zb = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = zrotg( za, zb ); + + viewY = reinterpret( z, 0 ); + if ( isnan( viewY[ i%4 ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( viewY[ i%4 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':assign', function benchmark( b ) { + var viewY; + var out; + var za; + var zb; + var z; + var i; + + za = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); + zb = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); + out = new Complex128Array( 4 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = zrotg.assign( za, zb, out, 1, 0 ); + + viewY = reinterpret( z, 0 ); + if ( typeof z !=='object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( isnan( viewY[ i%4 ] ) ) { + b.fail( 'should return the output array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt new file mode 100644 index 000000000000..46f43733d596 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt @@ -0,0 +1,65 @@ + +{{alias}}( za, zb ) + Constructs a Givens plane rotation from two double-precision complex + floating-point numbers. + + Parameters + ---------- + za: Complex128 + Rotational elimination parameter. + + zb: Complex128 + Rotational elimination parameter. + + Returns + ------- + out: Complex128Array + Computed values. + + Examples + -------- + // Standard usage: + > var za = new {{alias:@stdlib/complex/float64/ctor}}( 4.0, 3.0 ); + > var zb = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); + > var out = {{alias}}( za, zb ) + out => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] + + +{{alias}}.assign( za, zb, out, stride, offset ) + Constructs a Givens plane rotation from two double-precision complex + floating-point numbers and assigns the results to an output array. + + Parameters + ---------- + za: Complex128 + Rotational elimination parameter. + + zb: Complex128 + Rotational elimination parameter. + + out: Complex128Array + Output array. + + stride: integer + Output array stride. + + offset: integer + Output array index offset. + + Returns + ------- + out: Complex128Array + Output array. + + Examples + -------- + > var za = new {{alias:@stdlib/complex/float64/ctor}}( 4.0, 3.0 ); + > var zb = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); + > var out = new {{alias:@stdlib/array/complex128}}( 4 ); + > var y = {{alias}}.assign( za, zb, out, 1, 0 ) + [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] + > var bool = ( y === out ) + true + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts new file mode 100644 index 000000000000..5080734f6502 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts @@ -0,0 +1,117 @@ +/* +* @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 + +/// + +import { Complex128Array } from '@stdlib/types/array'; +import { Complex128 } from '@stdlib/types/complex'; + +/** +* Interface describing `zrotg`. +*/ +interface Routine { + /** + * Constructs a Givens plane rotation. + * + * @param za - rotational elimination parameter + * @param zb - rotational elimination parameter + * @returns output array + * + * @example + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var za = new Complex128( 4.0, 3.0 ); + * var zb = new Complex128( 0.0, 0.0 ); + * + * var out = zrotg( za, zb ); + * // [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] + * + * @example + * var za = new Complex128( 1.0, 2.0 ); + * var zb = new Complex128( 3.0, 4.0 ); + * + * var out = zrotg( za, zb ); + * // returns [ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ] + */ + ( za: Complex128, zb: Complex128 ): Complex128Array; + + /** + * Constructs a Givens plane rotation. + * + * @param za - rotational elimination parameter + * @param zb - rotational elimination parameter + * @param out - output array + * @param stride - index increment + * @param offset - starting index + * @returns output array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var za = new Complex128( 4.0, 3.0 ); + * var zb = new Complex128( 0.0, 0.0 ); + * var out = new Complex128Array( 4 ); + * + * var y = zrotg.assign( za, zb, out, 1, 0 ); + * // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] + * + * var bool = ( y === out ); + * // returns true + */ + assign( za: Complex128, zb: Complex128, out: Complex128Array, stride: number, offset: number ): Complex128Array; +} + +/** +* Constructs a Givens plane rotation. +* +* @param za - rotational elimination parameter +* @param zb - rotational elimination parameter +* @returns output array +* +* @example +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var za = new Complex128( 4.0, 3.0 ); +* var zb = new Complex128( 0.0, 0.0 ); +* +* var out = zrotg( za, zb ); +* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var za = new Complex128( 4.0, 3.0 ); +* var zb = new Complex128( 0.0, 0.0 ); +* var out = new Complex128Array( 4 ); +* +* var y = zrotg.assign( za, zb, out, 1, 0 ); +* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* +* var bool = ( y === out ); +* // returns true +*/ +declare var zrotg: Routine; + + +// EXPORTS // + +export = zrotg; diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts new file mode 100644 index 000000000000..270da048ad55 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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 Complex128Array = require( '@stdlib/array/complex128' ); +import Complex128 = require( '@stdlib/complex/float64/ctor' ); +import zrotg = require( './index' ); + + +// TESTS // + +// The function returns a Complex128Array... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + + zrotg( za, zb ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the function is provided an argument which is not a number... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + + zrotg( true, zb ); // $ExpectError + zrotg( false, zb ); // $ExpectError + zrotg( null, zb ); // $ExpectError + zrotg( undefined, zb ); // $ExpectError + zrotg( '5', zb ); // $ExpectError + zrotg( [], zb ); // $ExpectError + zrotg( {}, zb ); // $ExpectError + + zrotg( za, true ); // $ExpectError + zrotg( za, false ); // $ExpectError + zrotg( za, null ); // $ExpectError + zrotg( za, undefined ); // $ExpectError + zrotg( za, '5' ); // $ExpectError + zrotg( za, [] ); // $ExpectError + zrotg( za, {} ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + + zrotg(); // $ExpectError + zrotg( za ); // $ExpectError + zrotg( za, zb, 3.0 ); // $ExpectError +} + +// Attached to the main export is an `assign` method which returns a Complex128Array... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + const out = new Complex128Array( 4 ); + + zrotg.assign( za, zb, out, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `assign` method is provided a first or second argument which is not a number... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + const out = new Complex128Array( 4 ); + + zrotg.assign( true, zb, out, 1, 0 ); // $ExpectError + zrotg.assign( false, zb, out, 1, 0 ); // $ExpectError + zrotg.assign( null, zb, out, 1, 0 ); // $ExpectError + zrotg.assign( undefined, zb, out, 1, 0 ); // $ExpectError + zrotg.assign( '5', zb, out, 1, 0 ); // $ExpectError + zrotg.assign( [], zb, out, 1, 0 ); // $ExpectError + zrotg.assign( {}, zb, out, 1, 0 ); // $ExpectError + + zrotg.assign( za, true, out, 1, 0 ); // $ExpectError + zrotg.assign( za, false, out, 1, 0 ); // $ExpectError + zrotg.assign( za, null, out, 1, 0 ); // $ExpectError + zrotg.assign( za, undefined, out, 1, 0 ); // $ExpectError + zrotg.assign( za, '5', out, 1, 0 ); // $ExpectError + zrotg.assign( za, [], out, 1, 0 ); // $ExpectError + zrotg.assign( za, {}, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a third argument which is not a Complex128Array... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + + zrotg.assign( za, zb, 1, 1, 0 ); // $ExpectError + zrotg.assign( za, zb, true, 1, 0 ); // $ExpectError + zrotg.assign( za, zb, false, 1, 0 ); // $ExpectError + zrotg.assign( za, zb, null, 1, 0 ); // $ExpectError + zrotg.assign( za, zb, undefined, 1, 0 ); // $ExpectError + zrotg.assign( za, zb, '5', 1, 0 ); // $ExpectError + zrotg.assign( za, zb, [], 1, 0 ); // $ExpectError + zrotg.assign( za, zb, {}, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + const out = new Complex128Array( 4 ); + + zrotg.assign( za, zb, out, '5', 0 ); // $ExpectError + zrotg.assign( za, zb, out, true, 0 ); // $ExpectError + zrotg.assign( za, zb, out, false, 0 ); // $ExpectError + zrotg.assign( za, zb, out, null, 0 ); // $ExpectError + zrotg.assign( za, zb, out, [], 0 ); // $ExpectError + zrotg.assign( za, zb, out, {}, 0 ); // $ExpectError + zrotg.assign( za, zb, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + const out = new Complex128Array( 4 ); + + zrotg.assign( za, zb, out, 1, '5' ); // $ExpectError + zrotg.assign( za, zb, out, 1, true ); // $ExpectError + zrotg.assign( za, zb, out, 1, false ); // $ExpectError + zrotg.assign( za, zb, out, 1, null ); // $ExpectError + zrotg.assign( za, zb, out, 1, [] ); // $ExpectError + zrotg.assign( za, zb, out, 1, {} ); // $ExpectError + zrotg.assign( za, zb, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... +{ + const za = new Complex128( 1.0, 1.0 ); + const zb = new Complex128( 2.0, 2.0 ); + const out = new Complex128Array( 4 ); + + zrotg.assign(); // $ExpectError + zrotg.assign( za ); // $ExpectError + zrotg.assign( za, zb ); // $ExpectError + zrotg.assign( za, zb, out ); // $ExpectError + zrotg.assign( za, zb, out, 1 ); // $ExpectError + zrotg.assign( za, zb, out, 1, 0, 1 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js old mode 100644 new mode 100755 index 28b157d166e9..6b18af0c9147 --- a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js @@ -20,8 +20,6 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var logEach = require( '@stdlib/console/log-each' ); var zrotg = require( './../lib' ); var out; @@ -32,10 +30,6 @@ function rand() { } for ( i = 0; i < 100; i++ ) { - var a = rand(); - var b = rand(); - - zrotg( a, b, out ); - - console.log( out ); + out = zrotg( rand(), rand() ); + console.log( out ); } diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js old mode 100644 new mode 100755 index 4dd8c6a5f157..d5f91f834f17 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js @@ -29,7 +29,6 @@ var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); var cmul = require( '@stdlib/complex/float64/base/mul' ); var conj = require( '@stdlib/complex/float64/conj' ); -var logEach = require( '@stdlib/console/log-each' ); // MAIN // @@ -37,8 +36,8 @@ var logEach = require( '@stdlib/console/log-each' ); /** * Constructs a Givens plane rotation. * -* @param {Complex128} a - rotational elimination parameter -* @param {Complex128} b - rotational elimination parameter +* @param {Complex128} za - rotational elimination parameter +* @param {Complex128} zb - rotational elimination parameter * @param {Complex128Array} out - output array * @param {integer} stride - index increment * @param {NonNegativeInteger} offset - starting index @@ -48,22 +47,22 @@ var logEach = require( '@stdlib/console/log-each' ); * var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var a = new Complex128( 4.0, 3.0 ); +* var za = new Complex128( 4.0, 3.0 ); * // returns * -* var b = new Complex128( 0.0, 0.0 ); +* var zb = new Complex128( 0.0, 0.0 ); * // returns * -* var out = zrotg( a, b, new Complex128Array( 4 ), 1, 0 ); -* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* var out = zrotg( za, zb, new Complex128Array( 4 ), 1, 0 ); +* // out => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] */ -function zrotg( a, b, out, stride, offset ) { +function zrotg( za, zb, out, stride, offset ) { var c; var s; var r; var z; - var a2; - var b2; + var za2; + var zb2; var c2; var d; var scale; @@ -71,62 +70,56 @@ function zrotg( a, b, out, stride, offset ) { s = new Complex128( 0.0, 0.0 ); r = new Complex128( 0.0, 0.0 ); - logEach('a: real=%s, imag=%s', real(a), imag(a)); - logEach('b: real=%s, imag=%s', real(b), imag(b)); - if ( real( b ) === 0.0 && imag( b ) === 0.0 ) { + if ( real( zb ) === 0.0 && imag( zb ) === 0.0 ) { c = 1.0; - r = a; + r = za; z = 0.0; - } else if ( real( a ) === 0.0 && imag( a ) === 0.0 ) { + } else if ( real( za ) === 0.0 && imag( za ) === 0.0 ) { c = 0; - if ( real( b ) === 0 ) { - r = abs( imag( b ) ); - s = conj( b ) / r; - } else if ( imag( b ) === 0 ) { - r = abs( real( b ) ); - s = conj( b ) / r; + if ( real( zb ) === 0 ) { + r = abs( imag( zb ) ); + s = conj( zb ) / r; + } else if ( imag( zb ) === 0 ) { + r = abs( real( zb ) ); + s = conj( zb ) / r; } else { - b2 = cabs2( b ); - d = sqrt( b2 ); - s = conj( b ) / d; + zb2 = cabs2( zb ); + d = sqrt( zb2 ); + s = conj( zb ) / d; r = d; } z = 1; } else { - a2 = cabs2( a ); - b2 = cabs2( b ); - c2 = a2 + b2; + za2 = cabs2( za ); + zb2 = cabs2( zb ); + c2 = za2 + zb2; - if ( a2 >= c2 * EPS ) { - c = sqrt( a2 / c2); - r = new Complex128( real( a ) / c, imag( a ) / c ); - scale = 1 / sqrt(a2 * c2); - temp = new Complex128(real(a) * scale, imag(a) * scale); - s = cmul(conj(b), temp); + if ( za2 >= c2 * EPS ) { + c = sqrt( za2 / c2); + r = new Complex128( real( za ) / c, imag( za ) / c ); + scale = 1 / sqrt(za2 * c2); + temp = new Complex128(real(za) * scale, imag(za) * scale); + s = cmul(conj(zb), temp); } else { - d = sqrt( a2 * c2 ); - c = a2 / d; + d = sqrt( za2 * c2 ); + c = za2 / d; while( c < EPS ) { d *= 2; - c = a2 / d; + c = za2 / d; } while( c === 0.0 ) { c = 1; } - r = new Complex128( real( a ) / c, imag( a ) / c ); - s = conj( b ) * ( a / d ); + r = new Complex128( real( za ) / c, imag( za ) / c ); + s = conj( zb ) * ( za / d ); } z = 1 / c; } - a = r; - out[offset] = a; - out[offset + stride] = b; + za = r; + out[offset] = za; + out[offset + stride] = zb; out[offset + 2 * stride] = c; out[offset + 3 * stride] = s; - logEach('a: real=%s, imag=%s', real(a), imag(a)); - logEach('b: real=%s, imag=%s', real(b), imag(b)); - logEach('s: real=%s, imag=%s', real(s), imag(s)); - console.log( c ); return out; } diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js old mode 100644 new mode 100755 index 1167d4842e6f..670e4e0e79a9 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js @@ -24,40 +24,40 @@ * @module @stdlib/blas/base/zrotg * * @example -* var zrotg = require( '@stdlib/blas/base/zrotg' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var a = new Complex128( 4.0, 3.0 ); +* var za = new Complex128( 4.0, 3.0 ); * // returns * -* var b = new Complex128( 0.0, 0.0 ); +* var zb = new Complex128( 0.0, 0.0 ); * // returns * -* var out = zrotg( a, b ); +* var out = zrotg( za, zb ); * // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] * -* a = new Complex128( 1.0, 3.0 ); +* za = new Complex128( 1.0, 3.0 ); * // returns * -* var b = new Complex128( 2.0, 4.0 ); +* zb = new Complex128( 2.0, 4.0 ); * // returns * -* out = zrotg( a, b ); -* // returns [ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ] +* out = zrotg( za, zb ); +* // out => [ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ] * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); -* var zrotg = require( '@stdlib/blas/base/zrotg' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var a = new Complex128( 4.0, 3.0 ); +* var za = new Complex128( 4.0, 3.0 ); * // returns * -* var b = new Complex128( 0.0, 0.0 ); +* var zb = new Complex128( 0.0, 0.0 ); * // returns * * var out = new Complex128Array( 4 ); * -* var y = zrotg.assign( a, b, out, 1, 0 ); -* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* var y = zrotg.assign( za, zb, out, 1, 0 ); +* // y => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] * * var bool = ( y === out ); * // returns true diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js old mode 100644 new mode 100755 index 82710b16b92b..54b19eaf9439 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js @@ -29,26 +29,25 @@ var fcn = require( './assign.js' ); /** * Constructs a Givens plane rotation. * -* @param {number} a - rotational elimination parameter -* @param {number} b - rotational elimination parameter +* @param {number} za - rotational elimination parameter +* @param {number} zb - rotational elimination parameter * @returns {Complex128Array} output array * * @example -* var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var a = new Complex128( 4.0, 3.0 ); +* var za = new Complex128( 4.0, 3.0 ); * // returns * -* var b = new Complex128( 0.0, 0.0 ); +* var zb = new Complex128( 0.0, 0.0 ); * // returns * -* var out = zrotg( a, b, new Complex128Array( 4 ), 1, 0 ); -* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] +* var out = zrotg( za, zb ); +* // out => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] */ -function zrotg( a, b ) { +function zrotg( za, zb ) { var out = new Complex128Array( 4 ); - return fcn( a, b, out, 1, 0 ); + return fcn( za, zb, out, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/package.json b/lib/node_modules/@stdlib/blas/base/zrotg/package.json new file mode 100644 index 000000000000..40d785d67092 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zrotg/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/blas/base/zrotg", + "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", + "zrotg", + "givens", + "rotation", + "matrix", + "linear", + "algebra", + "subroutines", + "vector", + "array", + "ndarray", + "complex128", + "complex", + "complex128array" + ] + } From 503db28ec4f400253cb1ad43b966aada2f3d0585 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sun, 23 Feb 2025 15:02:49 +0000 Subject: [PATCH 16/27] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js | 2 +- lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts | 2 +- lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js index 2b68e64934e6..94df9c039bdf 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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/zrotg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts index 5080734f6502..f157eb3a5c7c 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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/zrotg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts index 270da048ad55..f2db36486c6c 100644 --- a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/zrotg/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. From 5ab7572b16eb9e2bcbe1f54dd135b405be6b8dc4 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Wed, 23 Apr 2025 11:53:39 +0530 Subject: [PATCH 17/27] chore: update implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/bessely1/src/main.c | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c index 504ea366cde0..7960dbc66572 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c @@ -249,36 +249,36 @@ double stdlib_base_bessely1( double x ) { double y2; double xc; - if (x < 0.0) { - return NAN; - } - if (x == 0.0) { - return -INFINITY; - } - if (x == INFINITY) { - return 0.0; - } + if (x < 0.0) { + return NAN; + } + if (x == 0.0) { + return -INFINITY; + } + if (x == INFINITY) { + return 0.0; + } xc = x; - if (xc <= 4.0) { - y = xc * xc; - z = ( stdlib_base_ln( xc / x1 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; - r = rational_p1q1( y ); - f = ( ( xc+x1 ) * ( ( xc - ( x11 / 256.0) ) - x12 ) ) / xc; - return z + ( f * r ); - } - if ( xc <= 8.0 ) { - y = xc * xc; - z = ( stdlib_base_ln( xc / x2 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; - r = rational_p2q2( y ); - f = ( ( xc + x2 ) * ( ( xc - ( x21 / 256.0 ) ) - x22 ) ) / xc; - return z + ( f * r ); - } + if (xc <= 4.0) { + y = xc * xc; + z = ( stdlib_base_ln( xc / x1 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; + r = rational_p1q1( y ); + f = ( ( xc+x1 ) * ( ( xc - ( x11 / 256.0) ) - x12 ) ) / xc; + return z + ( f * r ); + } + if ( xc <= 8.0 ) { + y = xc * xc; + z = ( stdlib_base_ln( xc / x2 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; + r = rational_p2q2( y ); + f = ( ( xc + x2 ) * ( ( xc - ( x21 / 256.0 ) ) - x22 ) ) / xc; + return z + ( f * r ); + } - y = 8.0 / xc; - y2 = y * y; - rc = rational_pcqc( y2 ); - rs = rational_psqs( y2 ); - f = ONE_DIV_SQRT_PI / stdlib_base_sqrt( xc ); + y = 8.0 / xc; + y2 = y * y; + rc = rational_pcqc( y2 ); + rs = rational_psqs( y2 ); + f = ONE_DIV_SQRT_PI / stdlib_base_sqrt( xc ); /* * This code is really just: From bcb2fe66e7bf45f6b9e584047629ded511300079 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Wed, 23 Apr 2025 15:10:24 +0530 Subject: [PATCH 18/27] remove: unnnecessary files --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/base/zrotg/benchmark/benchmark.js | 96 ----------- .../@stdlib/blas/base/zrotg/docs/repl.txt | 65 -------- .../blas/base/zrotg/docs/types/index.d.ts | 117 ------------- .../blas/base/zrotg/docs/types/test.ts | 155 ------------------ .../@stdlib/blas/base/zrotg/examples/index.js | 35 ---- .../@stdlib/blas/base/zrotg/lib/assign.js | 129 --------------- .../@stdlib/blas/base/zrotg/lib/index.js | 82 --------- .../@stdlib/blas/base/zrotg/lib/main.js | 56 ------- .../@stdlib/blas/base/zrotg/package.json | 72 -------- 9 files changed, 807 deletions(-) delete mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts delete mode 100755 lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js delete mode 100755 lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js delete mode 100755 lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js delete mode 100755 lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js delete mode 100644 lib/node_modules/@stdlib/blas/base/zrotg/package.json diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js deleted file mode 100644 index 94df9c039bdf..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @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 discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); -var pkg = require( './../package.json' ).name; -var zrotg = require( './../lib' ); - - -// VARIABLES // - -var OPTS = { - 'dtype': 'float64' -}; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var viewY; - var za; - var zb; - var z; - var i; - - za = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); - zb = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = zrotg( za, zb ); - - viewY = reinterpret( z, 0 ); - if ( isnan( viewY[ i%4 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( viewY[ i%4 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var viewY; - var out; - var za; - var zb; - var z; - var i; - - za = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); - zb = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); - out = new Complex128Array( 4 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = zrotg.assign( za, zb, out, 1, 0 ); - - viewY = reinterpret( z, 0 ); - if ( typeof z !=='object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( isnan( viewY[ i%4 ] ) ) { - b.fail( 'should return the output array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt deleted file mode 100644 index 46f43733d596..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt +++ /dev/null @@ -1,65 +0,0 @@ - -{{alias}}( za, zb ) - Constructs a Givens plane rotation from two double-precision complex - floating-point numbers. - - Parameters - ---------- - za: Complex128 - Rotational elimination parameter. - - zb: Complex128 - Rotational elimination parameter. - - Returns - ------- - out: Complex128Array - Computed values. - - Examples - -------- - // Standard usage: - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 4.0, 3.0 ); - > var zb = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); - > var out = {{alias}}( za, zb ) - out => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] - - -{{alias}}.assign( za, zb, out, stride, offset ) - Constructs a Givens plane rotation from two double-precision complex - floating-point numbers and assigns the results to an output array. - - Parameters - ---------- - za: Complex128 - Rotational elimination parameter. - - zb: Complex128 - Rotational elimination parameter. - - out: Complex128Array - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: Complex128Array - Output array. - - Examples - -------- - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 4.0, 3.0 ); - > var zb = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); - > var out = new {{alias:@stdlib/array/complex128}}( 4 ); - > var y = {{alias}}.assign( za, zb, out, 1, 0 ) - [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] - > var bool = ( y === out ) - true - - See Also - -------- diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts deleted file mode 100644 index f157eb3a5c7c..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* -* @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 - -/// - -import { Complex128Array } from '@stdlib/types/array'; -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Interface describing `zrotg`. -*/ -interface Routine { - /** - * Constructs a Givens plane rotation. - * - * @param za - rotational elimination parameter - * @param zb - rotational elimination parameter - * @returns output array - * - * @example - * var Complex128 = require( '@stdlib/complex/float64/ctor' ); - * - * var za = new Complex128( 4.0, 3.0 ); - * var zb = new Complex128( 0.0, 0.0 ); - * - * var out = zrotg( za, zb ); - * // [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] - * - * @example - * var za = new Complex128( 1.0, 2.0 ); - * var zb = new Complex128( 3.0, 4.0 ); - * - * var out = zrotg( za, zb ); - * // returns [ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ] - */ - ( za: Complex128, zb: Complex128 ): Complex128Array; - - /** - * Constructs a Givens plane rotation. - * - * @param za - rotational elimination parameter - * @param zb - rotational elimination parameter - * @param out - output array - * @param stride - index increment - * @param offset - starting index - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array/complex128' ); - * - * var Complex128 = require( '@stdlib/complex/float64/ctor' ); - * - * var za = new Complex128( 4.0, 3.0 ); - * var zb = new Complex128( 0.0, 0.0 ); - * var out = new Complex128Array( 4 ); - * - * var y = zrotg.assign( za, zb, out, 1, 0 ); - * // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] - * - * var bool = ( y === out ); - * // returns true - */ - assign( za: Complex128, zb: Complex128, out: Complex128Array, stride: number, offset: number ): Complex128Array; -} - -/** -* Constructs a Givens plane rotation. -* -* @param za - rotational elimination parameter -* @param zb - rotational elimination parameter -* @returns output array -* -* @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* -* var za = new Complex128( 4.0, 3.0 ); -* var zb = new Complex128( 0.0, 0.0 ); -* -* var out = zrotg( za, zb ); -* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var za = new Complex128( 4.0, 3.0 ); -* var zb = new Complex128( 0.0, 0.0 ); -* var out = new Complex128Array( 4 ); -* -* var y = zrotg.assign( za, zb, out, 1, 0 ); -* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] -* -* var bool = ( y === out ); -* // returns true -*/ -declare var zrotg: Routine; - - -// EXPORTS // - -export = zrotg; diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts deleted file mode 100644 index f2db36486c6c..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/docs/types/test.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* -* @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 Complex128Array = require( '@stdlib/array/complex128' ); -import Complex128 = require( '@stdlib/complex/float64/ctor' ); -import zrotg = require( './index' ); - - -// TESTS // - -// The function returns a Complex128Array... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - - zrotg( za, zb ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided an argument which is not a number... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - - zrotg( true, zb ); // $ExpectError - zrotg( false, zb ); // $ExpectError - zrotg( null, zb ); // $ExpectError - zrotg( undefined, zb ); // $ExpectError - zrotg( '5', zb ); // $ExpectError - zrotg( [], zb ); // $ExpectError - zrotg( {}, zb ); // $ExpectError - - zrotg( za, true ); // $ExpectError - zrotg( za, false ); // $ExpectError - zrotg( za, null ); // $ExpectError - zrotg( za, undefined ); // $ExpectError - zrotg( za, '5' ); // $ExpectError - zrotg( za, [] ); // $ExpectError - zrotg( za, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - - zrotg(); // $ExpectError - zrotg( za ); // $ExpectError - zrotg( za, zb, 3.0 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a Complex128Array... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - const out = new Complex128Array( 4 ); - - zrotg.assign( za, zb, out, 1, 0 ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the `assign` method is provided a first or second argument which is not a number... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - const out = new Complex128Array( 4 ); - - zrotg.assign( true, zb, out, 1, 0 ); // $ExpectError - zrotg.assign( false, zb, out, 1, 0 ); // $ExpectError - zrotg.assign( null, zb, out, 1, 0 ); // $ExpectError - zrotg.assign( undefined, zb, out, 1, 0 ); // $ExpectError - zrotg.assign( '5', zb, out, 1, 0 ); // $ExpectError - zrotg.assign( [], zb, out, 1, 0 ); // $ExpectError - zrotg.assign( {}, zb, out, 1, 0 ); // $ExpectError - - zrotg.assign( za, true, out, 1, 0 ); // $ExpectError - zrotg.assign( za, false, out, 1, 0 ); // $ExpectError - zrotg.assign( za, null, out, 1, 0 ); // $ExpectError - zrotg.assign( za, undefined, out, 1, 0 ); // $ExpectError - zrotg.assign( za, '5', out, 1, 0 ); // $ExpectError - zrotg.assign( za, [], out, 1, 0 ); // $ExpectError - zrotg.assign( za, {}, out, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a Complex128Array... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - - zrotg.assign( za, zb, 1, 1, 0 ); // $ExpectError - zrotg.assign( za, zb, true, 1, 0 ); // $ExpectError - zrotg.assign( za, zb, false, 1, 0 ); // $ExpectError - zrotg.assign( za, zb, null, 1, 0 ); // $ExpectError - zrotg.assign( za, zb, undefined, 1, 0 ); // $ExpectError - zrotg.assign( za, zb, '5', 1, 0 ); // $ExpectError - zrotg.assign( za, zb, [], 1, 0 ); // $ExpectError - zrotg.assign( za, zb, {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - const out = new Complex128Array( 4 ); - - zrotg.assign( za, zb, out, '5', 0 ); // $ExpectError - zrotg.assign( za, zb, out, true, 0 ); // $ExpectError - zrotg.assign( za, zb, out, false, 0 ); // $ExpectError - zrotg.assign( za, zb, out, null, 0 ); // $ExpectError - zrotg.assign( za, zb, out, [], 0 ); // $ExpectError - zrotg.assign( za, zb, out, {}, 0 ); // $ExpectError - zrotg.assign( za, zb, out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - const out = new Complex128Array( 4 ); - - zrotg.assign( za, zb, out, 1, '5' ); // $ExpectError - zrotg.assign( za, zb, out, 1, true ); // $ExpectError - zrotg.assign( za, zb, out, 1, false ); // $ExpectError - zrotg.assign( za, zb, out, 1, null ); // $ExpectError - zrotg.assign( za, zb, out, 1, [] ); // $ExpectError - zrotg.assign( za, zb, out, 1, {} ); // $ExpectError - zrotg.assign( za, zb, out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const za = new Complex128( 1.0, 1.0 ); - const zb = new Complex128( 2.0, 2.0 ); - const out = new Complex128Array( 4 ); - - zrotg.assign(); // $ExpectError - zrotg.assign( za ); // $ExpectError - zrotg.assign( za, zb ); // $ExpectError - zrotg.assign( za, zb, out ); // $ExpectError - zrotg.assign( za, zb, out, 1 ); // $ExpectError - zrotg.assign( za, zb, out, 1, 0, 1 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js deleted file mode 100755 index 6b18af0c9147..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @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/base/discrete-uniform' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var zrotg = require( './../lib' ); - -var out; -var i; - -function rand() { - return new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) ); -} - -for ( i = 0; i < 100; i++ ) { - out = zrotg( rand(), rand() ); - console.log( out ); -} diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js deleted file mode 100755 index d5f91f834f17..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/assign.js +++ /dev/null @@ -1,129 +0,0 @@ -/** -* @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 abs = require( '@stdlib/math/base/special/abs' ); -var sqrt = require( '@stdlib/math/base/special/sqrt' ); -var cabs2 = require( '@stdlib/math/base/special/cabs2' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); -var cmul = require( '@stdlib/complex/float64/base/mul' ); -var conj = require( '@stdlib/complex/float64/conj' ); - - -// MAIN // - -/** -* Constructs a Givens plane rotation. -* -* @param {Complex128} za - rotational elimination parameter -* @param {Complex128} zb - rotational elimination parameter -* @param {Complex128Array} out - output array -* @param {integer} stride - index increment -* @param {NonNegativeInteger} offset - starting index -* @returns {Complex128Array} output array -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* -* var za = new Complex128( 4.0, 3.0 ); -* // returns -* -* var zb = new Complex128( 0.0, 0.0 ); -* // returns -* -* var out = zrotg( za, zb, new Complex128Array( 4 ), 1, 0 ); -* // out => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] -*/ -function zrotg( za, zb, out, stride, offset ) { - var c; - var s; - var r; - var z; - var za2; - var zb2; - var c2; - var d; - var scale; - var temp; - - s = new Complex128( 0.0, 0.0 ); - r = new Complex128( 0.0, 0.0 ); - if ( real( zb ) === 0.0 && imag( zb ) === 0.0 ) { - c = 1.0; - r = za; - z = 0.0; - } else if ( real( za ) === 0.0 && imag( za ) === 0.0 ) { - c = 0; - if ( real( zb ) === 0 ) { - r = abs( imag( zb ) ); - s = conj( zb ) / r; - } else if ( imag( zb ) === 0 ) { - r = abs( real( zb ) ); - s = conj( zb ) / r; - } else { - zb2 = cabs2( zb ); - d = sqrt( zb2 ); - s = conj( zb ) / d; - r = d; - } - z = 1; - } else { - za2 = cabs2( za ); - zb2 = cabs2( zb ); - c2 = za2 + zb2; - - if ( za2 >= c2 * EPS ) { - c = sqrt( za2 / c2); - r = new Complex128( real( za ) / c, imag( za ) / c ); - scale = 1 / sqrt(za2 * c2); - temp = new Complex128(real(za) * scale, imag(za) * scale); - s = cmul(conj(zb), temp); - } else { - d = sqrt( za2 * c2 ); - c = za2 / d; - while( c < EPS ) { - d *= 2; - c = za2 / d; - } - while( c === 0.0 ) { - c = 1; - } - r = new Complex128( real( za ) / c, imag( za ) / c ); - s = conj( zb ) * ( za / d ); - } - z = 1 / c; - } - za = r; - out[offset] = za; - out[offset + stride] = zb; - out[offset + 2 * stride] = c; - out[offset + 3 * stride] = s; - return out; -} - - -// EXPORTS // - -module.exports = zrotg; diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js deleted file mode 100755 index 670e4e0e79a9..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/index.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @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'; - -/** -* Construct a Givens plane rotation. -* -* @module @stdlib/blas/base/zrotg -* -* @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* -* var za = new Complex128( 4.0, 3.0 ); -* // returns -* -* var zb = new Complex128( 0.0, 0.0 ); -* // returns -* -* var out = zrotg( za, zb ); -* // returns [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] -* -* za = new Complex128( 1.0, 3.0 ); -* // returns -* -* zb = new Complex128( 2.0, 4.0 ); -* // returns -* -* out = zrotg( za, zb ); -* // out => [ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ] -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* -* var za = new Complex128( 4.0, 3.0 ); -* // returns -* -* var zb = new Complex128( 0.0, 0.0 ); -* // returns -* -* var out = new Complex128Array( 4 ); -* -* var y = zrotg.assign( za, zb, out, 1, 0 ); -* // y => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] -* -* 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/zrotg/lib/main.js b/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js deleted file mode 100755 index 54b19eaf9439..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/lib/main.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @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 Complex128Array = require( '@stdlib/array/complex128' ); -var fcn = require( './assign.js' ); - - -// MAIN // - -/** -* Constructs a Givens plane rotation. -* -* @param {number} za - rotational elimination parameter -* @param {number} zb - rotational elimination parameter -* @returns {Complex128Array} output array -* -* @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* -* var za = new Complex128( 4.0, 3.0 ); -* // returns -* -* var zb = new Complex128( 0.0, 0.0 ); -* // returns -* -* var out = zrotg( za, zb ); -* // out => [ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] -*/ -function zrotg( za, zb ) { - var out = new Complex128Array( 4 ); - return fcn( za, zb, out, 1, 0 ); -} - - -// EXPORTS // - -module.exports = zrotg; diff --git a/lib/node_modules/@stdlib/blas/base/zrotg/package.json b/lib/node_modules/@stdlib/blas/base/zrotg/package.json deleted file mode 100644 index 40d785d67092..000000000000 --- a/lib/node_modules/@stdlib/blas/base/zrotg/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/blas/base/zrotg", - "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", - "zrotg", - "givens", - "rotation", - "matrix", - "linear", - "algebra", - "subroutines", - "vector", - "array", - "ndarray", - "complex128", - "complex", - "complex128array" - ] - } From 50ffc1071968acf2823b3c6325ad5b379ab207f9 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:14:53 -0700 Subject: [PATCH 19/27] docs: revert the changes in related section --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/math/base/special/bessely1/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md index afc566a1ca24..3c79acea7d02 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/README.md +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/README.md @@ -205,7 +205,7 @@ int main( void ) { - [`@stdlib/math/base/special/besselj0`][@stdlib/math/base/special/besselj0]: compute the Bessel function of the first kind of order zero. - [`@stdlib/math/base/special/besselj1`][@stdlib/math/base/special/besselj1]: compute the Bessel function of the first kind of order one. -- [`@stdlib/math/base/special/bessely1`][@stdlib/math/base/special/bessely0]: compute the Bessel function of the second kind of order zero. +- [`@stdlib/math/base/special/bessely0`][@stdlib/math/base/special/bessely0]: compute the Bessel function of the second kind of order zero. From 9344423c98cff33ac7a15836ba06968e209c13d4 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:16:28 -0700 Subject: [PATCH 20/27] bench: revert JS changes and native C benchmarks --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../special/bessely1/benchmark/benchmark.js | 13 +- .../bessely1/benchmark/benchmark.native.js | 13 +- .../bessely1/benchmark/c/native/Makefile | 146 ++++++++++++++++++ .../bessely1/benchmark/c/native/benchmark.c | 136 ++++++++++++++++ 4 files changed, 290 insertions(+), 18 deletions(-) create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js index a51516d34896..a9a084661354 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var y1 = require( './../lib' ); @@ -31,19 +30,15 @@ var y1 = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 100000.0 ); - } + x = uniform( 100, 0.0, 100000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = y1( x[ i % len ] ); + y = y1( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js index 522a743793d6..70aab6b2289d 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -40,19 +39,15 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 100000.0 ); - } + x = uniform( 100, 0.0, 100000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = y1( x[ i % len ] ); + y = y1( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c new file mode 100644 index 000000000000..5b943226661f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c @@ -0,0 +1,136 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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. +*/ + +#include "stdlib/math/base/special/bessely1.h" +#include +#include +#include +#include +#include + +#define NAME "bessely1" +#define ITERATIONS 1000000 +#define REPEATS 3 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param elapsed elapsed time in seconds +*/ +static void print_results( double elapsed ) { + double rate = (double)ITERATIONS / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", ITERATIONS ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [0,1). +* +* @return random number +*/ +static double rand_double( void ) { + int r = rand(); + return (double)r / ( (double)RAND_MAX + 1.0 ); +} + +/** +* Runs a benchmark. +* +* @return elapsed time in seconds +*/ +static double benchmark( void ) { + double x[ 100 ]; + double elapsed; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = 100000.0 * rand_double(); + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_bessely1( x[ i%100 ] ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y != y ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int i; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + for ( i = 0; i < REPEATS; i++ ) { + printf( "# c::native::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} From de2ad7dfe2548b58f2ace65974676cf9c1911d8c Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:18:09 -0700 Subject: [PATCH 21/27] docs: add JSDoc tags --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/bessely1/docs/types/index.d.ts | 5 +++++ .../@stdlib/math/base/special/bessely1/lib/main.js | 5 +++++ .../@stdlib/math/base/special/bessely1/lib/native.js | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts index 97cc96fd6ee9..8b55fed326fe 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts @@ -32,18 +32,23 @@ * var v = y1( 0.0 ); * // returns -Infinity * +* @example * v = y1( 1.0 ); * // returns ~-0.781 * +* @example * v = y1( -1.0 ); * // returns NaN * +* @example * v = y1( Infinity ); * // returns 0.0 * +* @example * v = y1( -Infinity ); * // returns NaN * +* @example * v = y1( NaN ); * // returns NaN */ diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js index ce76b8e6b71f..66045b04728c 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js @@ -79,18 +79,23 @@ var sc = [ 0.0, 0.0 ]; * var v = y1( 0.0 ); * // returns -Infinity * +* @example * v = y1( 1.0 ); * // returns ~-0.781 * +* @example * v = y1( -1.0 ); * // returns NaN * +* @example * v = y1( Infinity ); * // returns 0.0 * +* @example * v = y1( -Infinity ); * // returns NaN * +* @example * v = y1( NaN ); * // returns NaN */ diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js index d4be3e7c9abc..b59f7fd76cb2 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js @@ -37,18 +37,23 @@ var addon = require( './../src/addon.node' ); * var v = y1( 0.0 ); * // returns -Infinity * +* @example * v = y1( 1.0 ); * // returns ~-0.781 * +* @example * v = y1( -1.0 ); * // returns NaN * +* @example * v = y1( Infinity ); * // returns 0.0 * +* @example * v = y1( -Infinity ); * // returns NaN * +* @example * v = y1( NaN ); * // returns NaN */ From 8cd69840691320974e5dbad4c4cdb000b20f7165 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:19:08 -0700 Subject: [PATCH 22/27] feat: add polyval scripting for C --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../special/bessely1/scripts/evalrational.js | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/scripts/evalrational.js b/lib/node_modules/@stdlib/math/base/special/bessely1/scripts/evalrational.js index 172dc7fed7f9..8f1b368db0e3 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/scripts/evalrational.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/scripts/evalrational.js @@ -24,10 +24,15 @@ // MODULES // var resolve = require( 'path' ).resolve; +var readFileSync = require( '@stdlib/fs/read-file' ).sync; var writeFileSync = require( '@stdlib/fs/write-file' ).sync; var currentYear = require( '@stdlib/time/current-year' ); var licenseHeader = require( '@stdlib/_tools/licenses/header' ); var compile = require( '@stdlib/math/base/tools/evalrational-compile' ); +var compileC = require( '@stdlib/math/base/tools/evalrational-compile-c' ); +var substringBefore = require( '@stdlib/string/substring-before' ); +var substringAfter = require( '@stdlib/string/substring-after' ); +var format = require( '@stdlib/string/format' ); // VARIABLES // @@ -125,6 +130,33 @@ var header = licenseHeader( 'Apache-2.0', 'js', { header += '\n/* This is a generated file. Do not edit directly. */\n'; +// FUNCTIONS // + +/** +* Inserts a compiled function into file content. +* +* @private +* @param {string} text - source content +* @param {string} id - function identifier +* @param {string} str - function string +* @returns {string} updated content +*/ +function insert( text, id, str ) { + var before; + var after; + var begin; + var end; + + begin = '// BEGIN: '+id; + end = '// END: '+id; + + before = substringBefore( text, begin ); + after = substringAfter( text, end ); + + return format( '%s// BEGIN: %s\n\n%s\n%s%s', before, id, str, end, after ); +} + + // MAIN // /** @@ -134,7 +166,9 @@ header += '\n/* This is a generated file. Do not edit directly. */\n'; */ function main() { var fpath; + var copts; var opts; + var file; var str; opts = { @@ -156,6 +190,32 @@ function main() { fpath = resolve( __dirname, '..', 'lib', 'rational_psqs.js' ); str = header + compile( PS, QS ); writeFileSync( fpath, str, opts ); + + copts = { + 'dtype': 'double', + 'name': '' + }; + + fpath = resolve( __dirname, '..', 'src', 'main.c' ); + file = readFileSync( fpath, opts ); + + copts.name = 'rational_p1q1'; + str = compileC( P1, Q1, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'rational_p2q2'; + str = compileC( P2, Q2, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'rational_pcqc'; + str = compileC( PC, QC, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'rational_psqs'; + str = compileC( PS, QS, copts ); + file = insert( file, copts.name, str ); + + writeFileSync( fpath, file, opts ); } main(); From 8e9e7c4e92111d8f2ce5abbc49bb14a8698deda8 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:20:36 -0700 Subject: [PATCH 23/27] fix: apply suggestions from review --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/bessely1/src/addon.c | 1 - .../math/base/special/bessely1/src/main.c | 74 +++++++++---------- 2 files changed, 33 insertions(+), 42 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/addon.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/addon.c index ca0ce78bcb88..1f1306c3e32a 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/addon.c @@ -19,5 +19,4 @@ #include "stdlib/math/base/special/bessely1.h" #include "stdlib/math/base/napi/unary.h" -// cppcheck-suppress shadowFunction STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_bessely1 ) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c index 7960dbc66572..62fcc640dc1b 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/src/main.c @@ -67,7 +67,6 @@ static const double x22 = -6.4592058648672279948e-06; * @param x value at which to evaluate the rational function * @return evaluated rational function */ - static double rational_p1q1( const double x ) { double ax; double ix; @@ -87,7 +86,7 @@ static double rational_p1q1( const double x ) { } else { ix = 1.0 / x; s1 = -317.1442466004613 + (ix * (221579.5322228026 + (ix * (-59157479.9974084 + (ix * (7214454821.450256 + (ix * (-375959744978.196 + (ix * (5470861171652.543 + (ix * 40535726612579.55))))))))))); - s2 = 1.0 + (x * (820.7990816839387 + (x * (381364.70753052575 + (x * (122504351.22182964 + (x * (27800352738.690586 + (x * (4127228620040.646 + (x * 307378739210792.9))))))))))); + s2 = 1.0 + (ix * (820.7990816839387 + (ix * (381364.70753052575 + (ix * (122504351.22182964 + (ix * (27800352738.690586 + (ix * (4127228620040.646 + (ix * 307378739210792.9))))))))))); } return s1 / s2; } @@ -97,7 +96,7 @@ static double rational_p1q1( const double x ) { // BEGIN: rational_p2q2 /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * @@ -106,9 +105,8 @@ static double rational_p1q1( const double x ) { * * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method * -* @private -* @param {number} x - value at which to evaluate the rational function -* @returns {number} evaluated rational function +* @param x value at which to evaluate the rational function +* @return evaluated rational function */ static double rational_p2q2( const double x ) { double ax; @@ -139,7 +137,7 @@ static double rational_p2q2( const double x ) { // BEGIN: rational_pcqc /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * @@ -148,9 +146,8 @@ static double rational_p2q2( const double x ) { * * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method * -* @private -* @param {number} x - value at which to evaluate the rational function -* @returns {number} evaluated rational function +* @param x value at which to evaluate the rational function +* @return evaluated rational function */ static double rational_pcqc( const double x ) { double ax; @@ -181,7 +178,7 @@ static double rational_pcqc( const double x ) { // BEGIN: rational_psqs /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * @@ -190,9 +187,8 @@ static double rational_pcqc( const double x ) { * * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method * -* @private -* @param {number} x - value at which to evaluate the rational function -* @returns {number} evaluated rational function +* @param x value at which to evaluate the rational function +* @return evaluated rational function */ static double rational_psqs( const double x ) { double ax; @@ -233,63 +229,59 @@ static double rational_psqs( const double x ) { * @return evaluated Bessel function * * @example -* double v = y1( 0.0 ); +* double v = stdlib_base_bessely1( 0.0 ); * // returns -Infinity */ - double stdlib_base_bessely1( double x ) { double rc; double rs; - double y; + double y2; double r; + double y; double s; double c; double z; double f; - double y2; - double xc; - if (x < 0.0) { - return NAN; + if ( x < 0.0 ) { + return 0.0 / 0.0; // NaN } - if (x == 0.0) { - return -INFINITY; + if ( x == 0.0 ) { + return STDLIB_CONSTANT_FLOAT64_NINF; } - if (x == INFINITY) { + if ( x == STDLIB_CONSTANT_FLOAT64_PINF ) { return 0.0; } - xc = x; - if (xc <= 4.0) { - y = xc * xc; - z = ( stdlib_base_ln( xc / x1 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; + if ( x <= 4.0 ) { + y = x * x; + z = ( stdlib_base_ln( x / x1 ) * stdlib_base_besselj1( x ) ) * TWO_DIV_PI; r = rational_p1q1( y ); - f = ( ( xc+x1 ) * ( ( xc - ( x11 / 256.0) ) - x12 ) ) / xc; - return z + ( f * r ); + f = ( ( x+x1 ) * ( (x - (x11/256.0)) - x12 ) ) / x; + return z + ( f*r ); } - if ( xc <= 8.0 ) { - y = xc * xc; - z = ( stdlib_base_ln( xc / x2 ) * stdlib_base_besselj1( xc ) ) * TWO_DIV_PI; + if ( x <= 8.0 ) { + y = x * x; + z = ( stdlib_base_ln( x / x2 ) * stdlib_base_besselj1( x ) ) * TWO_DIV_PI; r = rational_p2q2( y ); - f = ( ( xc + x2 ) * ( ( xc - ( x21 / 256.0 ) ) - x22 ) ) / xc; - return z + ( f * r ); + f = ( ( x+x2 ) * ( (x - (x21/256.0)) - x22 ) ) / x; + return z + ( f*r ); } - - y = 8.0 / xc; + y = 8.0 / x; y2 = y * y; rc = rational_pcqc( y2 ); rs = rational_psqs( y2 ); - f = ONE_DIV_SQRT_PI / stdlib_base_sqrt( xc ); + f = ONE_DIV_SQRT_PI / stdlib_base_sqrt( x ); /* * This code is really just: * * ``` - * z = x - 0.75 * pi; + * z = x - 0.75 * PI; * return f * (rc * sin(z) + y * rs * cos(z)); * ``` * * But using the sin/cos addition rules, plus constants for sin/cos of `3π/4` which then cancel out with corresponding terms in "f". */ - stdlib_base_sincos( xc, &s, &c ); - return f * ( ( ( y * rs ) * ( s - c ) ) - ( rc * ( s + c ) ) ); + stdlib_base_sincos( x, &s, &c ); + return f * ( ( ( (y*rs) * (s-c) ) - ( rc * (s+c) ) ) ); } From 97e9f3d1bfa9973f513c518b659905e2d68b7b8b Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:21:12 -0700 Subject: [PATCH 24/27] test: apply suggestions from review --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/special/bessely1/test/test.native.js | 85 ++++++++++--------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js index ceb87ce511a7..fc9766c8eb57 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js @@ -20,6 +20,7 @@ // MODULES // +var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var randu = require( '@stdlib/random/base/randu' ); @@ -27,7 +28,15 @@ var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var EPS = require( '@stdlib/constants/float64/eps' ); var abs = require( '@stdlib/math/base/special/abs' ); -var y1 = require( './../lib' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var y1 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( y1 instanceof Error ) +}; // FIXTURES // @@ -45,13 +54,13 @@ var subnormal = require( './fixtures/julia/subnormal.json' ); // TESTS // -tape( 'main export is a function', function test( t ) { +tape( 'main export is a function', opts, function test( t ) { t.ok( true, __filename ); t.strictEqual( typeof y1, 'function', 'main export is a function' ); t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (very large positive values)', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (very large positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -64,17 +73,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 300.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (large positive values)', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (large positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -87,17 +96,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 600.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (medium positive values)', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (medium positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -110,17 +119,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 300.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (small positive values)', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (small positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -133,17 +142,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 1800.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'the function evaluates Bessel function of the second kind of one order (Y_1) (smaller positive values)', function test( t ) { +tape( 'the function evaluates Bessel function of the second kind of one order (Y_1) (smaller positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -156,17 +165,17 @@ tape( 'the function evaluates Bessel function of the second kind of one order (Y for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 4.5 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (tiny positive values)', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (tiny positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -179,17 +188,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 8.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal values)', function test( t ) { +tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal values)', opts, function test( t ) { var x; var y; var i; @@ -197,12 +206,12 @@ tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal valu x = subnormal.x; for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); - t.equal( y, NINF, 'returns expected value' ); + t.strictEqual( y, NINF, 'returns -Infinity' ); } t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (huge positive values)', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (huge positive values)', opts, function test( t ) { var expected; var delta; var tol; @@ -215,17 +224,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 4500.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' ); } } t.end(); }); -tape( 'the function evaluates the Bessel function of the second kind of order one (Y_1) for positive x over a wide range of magnitudes', function test( t ) { +tape( 'the function evaluates the Bessel function of the second kind of order one (Y_1) for positive x over a wide range of magnitudes', opts, function test( t ) { var expected; var delta; var tol; @@ -238,17 +247,17 @@ tape( 'the function evaluates the Bessel function of the second kind of order on for ( i = 0; i < x.length; i++ ) { y = y1( x[i] ); if ( y === expected[i] ) { - t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); + t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] ); } else { delta = abs( y - expected[i] ); tol = 16.0 * EPS * abs( expected[i] ); - t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); + t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' ); } } t.end(); }); -tape( 'the function returns `NaN` for negative numbers', function test( t ) { +tape( 'the function returns `NaN` for negative numbers', opts, function test( t ) { var v; var x; var i; @@ -256,31 +265,31 @@ tape( 'the function returns `NaN` for negative numbers', function test( t ) { for ( i = 0; i < 1000; i++ ) { x = -( randu() * 100.0 ) - EPS; v = y1( x ); - t.equal( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); } t.end(); }); -tape( 'the function returns `-Infinity` if provided `0`', function test( t ) { +tape( 'the function returns `-Infinity` if provided `0`', opts, function test( t ) { var v = y1( 0.0 ); - t.equal( v, NINF, 'returns expected value' ); + t.strictEqual( v, NINF, 'returns -Infinity' ); t.end(); }); -tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { +tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = y1( NaN ); - t.equal( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); -tape( 'the function returns `0.0` if provided `+infinity`', function test( t ) { +tape( 'the function returns `0.0` if provided `+infinity`', opts, function test( t ) { var v = y1( PINF ); - t.equal( v, 0.0, 'returns expected value' ); + t.strictEqual( v, 0.0, 'returns 0.0' ); t.end(); }); -tape( 'the function returns `NaN` if provided `-infinity`', function test( t ) { +tape( 'the function returns `NaN` if provided `-infinity`', opts, function test( t ) { var v = y1( NINF ); - t.equal( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); From 3c6b4e2f19d6bfa73166d78acf468614035c4eed Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:24:01 -0700 Subject: [PATCH 25/27] chore: update copyright years --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: 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: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/bessely1/benchmark/c/native/Makefile | 2 +- .../math/base/special/bessely1/benchmark/c/native/benchmark.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile index f69e9da2b4d3..a4bd7b38fd74 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 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/math/base/special/bessely1/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c index 5b943226661f..c5620f7c78ad 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/benchmark/c/native/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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 fac76865e6521a42745b78fe291d5b5efb517ab6 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Thu, 8 May 2025 23:28:01 -0700 Subject: [PATCH 26/27] chore: update polyval files --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/bessely1/lib/rational_p1q1.js | 4 ++-- .../@stdlib/math/base/special/bessely1/lib/rational_p2q2.js | 4 ++-- .../@stdlib/math/base/special/bessely1/lib/rational_pcqc.js | 4 ++-- .../@stdlib/math/base/special/bessely1/lib/rational_psqs.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p1q1.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p1q1.js index ee4efa7b696e..97f2bbdac44c 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p1q1.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p1q1.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 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. @@ -22,7 +22,7 @@ // MAIN // /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p2q2.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p2q2.js index d3ed648b1f38..e49a26649182 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p2q2.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_p2q2.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 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. @@ -22,7 +22,7 @@ // MAIN // /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_pcqc.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_pcqc.js index 6ac7f1e1d7b0..6f3574ea7324 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_pcqc.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_pcqc.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 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. @@ -22,7 +22,7 @@ // MAIN // /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_psqs.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_psqs.js index 7465aae5e055..5f74723c91f4 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_psqs.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/rational_psqs.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 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. @@ -22,7 +22,7 @@ // MAIN // /** -* Evaluates a rational function, i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\). +* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)). * * ## Notes * From 40236f233725c4d607b7aaf52d3a3ed9b99ce2ac Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Fri, 9 May 2025 00:01:32 -0700 Subject: [PATCH 27/27] docs: add missing `var` declarations in examples --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/bessely1/docs/types/index.d.ts | 10 +++++----- .../@stdlib/math/base/special/bessely1/lib/main.js | 10 +++++----- .../@stdlib/math/base/special/bessely1/lib/native.js | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts index 8b55fed326fe..ad716c87f8a5 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/docs/types/index.d.ts @@ -33,23 +33,23 @@ * // returns -Infinity * * @example -* v = y1( 1.0 ); +* var v = y1( 1.0 ); * // returns ~-0.781 * * @example -* v = y1( -1.0 ); +* var v = y1( -1.0 ); * // returns NaN * * @example -* v = y1( Infinity ); +* var v = y1( Infinity ); * // returns 0.0 * * @example -* v = y1( -Infinity ); +* var v = y1( -Infinity ); * // returns NaN * * @example -* v = y1( NaN ); +* var v = y1( NaN ); * // returns NaN */ declare function y1( x: number ): number; diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js index 66045b04728c..7b2bfe0f4a60 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/main.js @@ -80,23 +80,23 @@ var sc = [ 0.0, 0.0 ]; * // returns -Infinity * * @example -* v = y1( 1.0 ); +* var v = y1( 1.0 ); * // returns ~-0.781 * * @example -* v = y1( -1.0 ); +* var v = y1( -1.0 ); * // returns NaN * * @example -* v = y1( Infinity ); +* var v = y1( Infinity ); * // returns 0.0 * * @example -* v = y1( -Infinity ); +* var v = y1( -Infinity ); * // returns NaN * * @example -* v = y1( NaN ); +* var v = y1( NaN ); * // returns NaN */ function y1( x ) { diff --git a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js index b59f7fd76cb2..adda63dcec80 100644 --- a/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/bessely1/lib/native.js @@ -38,23 +38,23 @@ var addon = require( './../src/addon.node' ); * // returns -Infinity * * @example -* v = y1( 1.0 ); +* var v = y1( 1.0 ); * // returns ~-0.781 * * @example -* v = y1( -1.0 ); +* var v = y1( -1.0 ); * // returns NaN * * @example -* v = y1( Infinity ); +* var v = y1( Infinity ); * // returns 0.0 * * @example -* v = y1( -Infinity ); +* var v = y1( -Infinity ); * // returns NaN * * @example -* v = y1( NaN ); +* var v = y1( NaN ); * // returns NaN */ function y1( x ) {