From d3923d88e45951015dedef00f6129ca9b9d5cf7b Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 17 Nov 2025 01:36:49 +0530 Subject: [PATCH 1/4] feat: add math/base/special/absgammaln --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: missing_dependencies - task: lint_r status: passed - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../math/base/special/absgammaln/LICENSE | 192 ++++++ .../math/base/special/absgammaln/README.md | 213 +++++++ .../special/absgammaln/benchmark/benchmark.js | 52 ++ .../absgammaln/benchmark/benchmark.native.js | 61 ++ .../special/absgammaln/benchmark/c/Makefile | 127 ++++ .../absgammaln/benchmark/c/benchmark.c | 135 +++++ .../absgammaln/benchmark/c/cephes/Makefile | 114 ++++ .../absgammaln/benchmark/c/cephes/benchmark.c | 140 +++++ .../absgammaln/benchmark/c/native/Makefile | 146 +++++ .../absgammaln/benchmark/c/native/benchmark.c | 136 +++++ .../absgammaln/benchmark/cpp/boost/Makefile | 110 ++++ .../benchmark/cpp/boost/benchmark.cpp | 132 +++++ .../absgammaln/benchmark/julia/REQUIRE | 2 + .../absgammaln/benchmark/julia/benchmark.jl | 144 +++++ .../absgammaln/benchmark/python/benchmark.py | 97 +++ .../benchmark/python/scipy/benchmark.py | 97 +++ .../absgammaln/benchmark/r/DESCRIPTION | 9 + .../absgammaln/benchmark/r/benchmark.R | 109 ++++ .../math/base/special/absgammaln/binding.gyp | 170 ++++++ .../base/special/absgammaln/docs/repl.txt | 35 ++ .../special/absgammaln/docs/types/index.d.ts | 60 ++ .../special/absgammaln/docs/types/test.ts | 44 ++ .../special/absgammaln/examples/c/Makefile | 146 +++++ .../special/absgammaln/examples/c/example.c | 31 + .../base/special/absgammaln/examples/index.js | 30 + .../math/base/special/absgammaln/include.gypi | 53 ++ .../stdlib/math/base/special/absgammaln.h | 38 ++ .../math/base/special/absgammaln/lib/index.js | 58 ++ .../math/base/special/absgammaln/lib/main.js | 405 +++++++++++++ .../base/special/absgammaln/lib/native.js | 70 +++ .../base/special/absgammaln/lib/polyval_a1.js | 47 ++ .../base/special/absgammaln/lib/polyval_a2.js | 47 ++ .../base/special/absgammaln/lib/polyval_r.js | 47 ++ .../base/special/absgammaln/lib/polyval_s.js | 47 ++ .../base/special/absgammaln/lib/polyval_t1.js | 47 ++ .../base/special/absgammaln/lib/polyval_t2.js | 47 ++ .../base/special/absgammaln/lib/polyval_t3.js | 47 ++ .../base/special/absgammaln/lib/polyval_u.js | 47 ++ .../base/special/absgammaln/lib/polyval_v.js | 47 ++ .../base/special/absgammaln/lib/polyval_w.js | 47 ++ .../base/special/absgammaln/manifest.json | 93 +++ .../math/base/special/absgammaln/package.json | 151 +++++ .../special/absgammaln/scripts/evalpoly.js | 256 ++++++++ .../math/base/special/absgammaln/src/Makefile | 70 +++ .../math/base/special/absgammaln/src/addon.c | 22 + .../math/base/special/absgammaln/src/main.c | 550 ++++++++++++++++++ .../absgammaln/test/fixtures/r/DESCRIPTION | 9 + .../absgammaln/test/fixtures/r/data1.json | 1 + .../absgammaln/test/fixtures/r/data2.json | 1 + .../absgammaln/test/fixtures/r/expected1.json | 1 + .../absgammaln/test/fixtures/r/expected2.json | 1 + .../absgammaln/test/fixtures/r/runner.R | 117 ++++ .../math/base/special/absgammaln/test/test.js | 159 +++++ .../special/absgammaln/test/test.native.js | 168 ++++++ 54 files changed, 5225 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/LICENSE create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/README.md create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/native/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/benchmark.cpp create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/REQUIRE create mode 100755 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/benchmark.jl create mode 100755 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/benchmark.py create mode 100755 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/scipy/benchmark.py create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/DESCRIPTION create mode 100755 lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/benchmark.R create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/examples/index.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/include/stdlib/math/base/special/absgammaln.h create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/index.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/main.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a1.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a2.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_r.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_s.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t1.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t2.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t3.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_u.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_v.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_w.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/package.json create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/scripts/evalpoly.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/DESCRIPTION create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data1.json create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data2.json create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected1.json create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected2.json create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/runner.R create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.js create mode 100644 lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/LICENSE b/lib/node_modules/@stdlib/math/base/special/absgammaln/LICENSE new file mode 100644 index 000000000000..a7566ad6f2c3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/LICENSE @@ -0,0 +1,192 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +DEPENDENCIES & ATTRIBUTION + +The library links against the following external libraries or contains +implementations from the following external libraries, which have their own +licenses: + +* FreeBSD + +Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/README.md b/lib/node_modules/@stdlib/math/base/special/absgammaln/README.md new file mode 100644 index 000000000000..e8498ed4ca59 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/README.md @@ -0,0 +1,213 @@ + + +# absgammaln + +> [Natural logarithm][@stdlib/math/base/special/ln] of the [absolute][@stdlib/math/base/special/abs] value of the [gamma][@stdlib/math/base/special/gamma] function. + +
+ +## Usage + +```javascript +var absgammaln = require( '@stdlib/math/base/special/absgammaln' ); +``` + +#### absgammaln( x ) + +Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [absolute][@stdlib/math/base/special/abs] value of the [gamma][@stdlib/math/base/special/gamma] function. + +```javascript +var v = absgammaln( 2.0 ); +// returns 0.0 + +v = absgammaln( 1.0 ); +// returns 0.0 + +v = absgammaln( 4.0 ); +// returns ~1.792 + +v = absgammaln( -0.5 ); +// returns ~1.266 + +v = absgammaln( 0.5 ); +// returns ~0.572 + +v = absgammaln( 0.0 ); +// returns Infinity + +v = absgammaln( NaN ); +// returns NaN +``` + +
+ + + +
+ +## Examples + + + +```javascript +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var absgammaln = require( '@stdlib/math/base/special/absgammaln' ); + +var opts = { + 'dtype': 'float64' +}; +var x = uniform( 100, -10.0, 10.0, opts ); + +logEachMap( 'x: %0.4f, f(x): %0.4f', x, absgammaln ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/absgammaln.h" +``` + +#### stdlib_base_absgammaln( x ) + +Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [absolute][@stdlib/math/base/special/abs] value of the [gamma][@stdlib/math/base/special/gamma] function. + +```c +double out = stdlib_base_absgammaln( 2.0 ); +// returns 0.0 + +out = stdlib_base_absgammaln( 4.0 ); +// returns ~1.792 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double stdlib_base_absgammaln( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/absgammaln.h" +#include +#include + +int main( void ) { + const double x[] = { 4.0, -1.5, -0.5, 0.5 }; + + double y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_absgammaln( x[ i ] ); + printf( "absgammaln(%lf) = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.js new file mode 100644 index 000000000000..0161bff6546b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pkg = require( './../package.json' ).name; +var absgammaln = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, -500.0, 500.0 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = absgammaln( x[ i%x.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.native.js new file mode 100644 index 000000000000..e707aa7023c1 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/benchmark.native.js @@ -0,0 +1,61 @@ +/** +* @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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +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; + + +// VARIABLES // + +var absgammaln = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( absgammaln instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, -500.0, 500.0 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = absgammaln( x[ i%x.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/Makefile new file mode 100644 index 000000000000..e64c0050f3da --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/Makefile @@ -0,0 +1,127 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2018 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 C targets: +c_targets := benchmark.out + + +# RULES # + +#/ +# Compiles C source files. +# +# @param {string} [C_COMPILER] - C compiler +# @param {string} [CFLAGS] - C compiler flags +# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler +# @param {string} CFLAGS - C compiler flags +# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm + +#/ +# 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/absgammaln/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/benchmark.c new file mode 100644 index 000000000000..96f1bd525242 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/benchmark.c @@ -0,0 +1,135 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 +#include +#include +#include +#include + +#define NAME "absgammaln" +#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 elapsed; + double x[ 100 ]; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = lgamma( 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::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/Makefile b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/Makefile new file mode 100644 index 000000000000..45f6931fc1c4 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/Makefile @@ -0,0 +1,114 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2018 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 := @ +endif + +# Specify the path to Cephes: +CEPHES ?= + +# Specify a list of Cephes source files: +CEPHES_SRC ?= + +# Determine the OS: +# +# [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 +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 \ + -Wno-deprecated-declarations + +# Determine whether to generate [position independent code][1]: +# +# [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 C targets: +c_targets := benchmark.out + + +# TARGETS # + +# Default target. +# +# This target is the default target. + +all: $(c_targets) + +.PHONY: all + + +# Compile C source. +# +# This target compiles C source files. + +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $(CEPHES_SRC) $< -lm + + +# Run a benchmark. +# +# This target runs a benchmark. + +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + + +# Perform clean-up. +# +# This target removes generated files. + +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/benchmark.c new file mode 100644 index 000000000000..19242e5b5869 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/cephes/benchmark.c @@ -0,0 +1,140 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 +#include +#include +#include +#include + +#define NAME "absgammaln" +#define ITERATIONS 1000000 +#define REPEATS 3 + +/** +* Define prototypes for external functions. +*/ +extern double lgam( double x ); + +/** +* 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 elapsed; + double x[ 100 ]; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = lgam( 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::cephes::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/native/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/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/absgammaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/c/native/benchmark.c new file mode 100644 index 000000000000..13500d2c8e11 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/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/absgammaln.h" +#include +#include +#include +#include +#include + +#define NAME "absgammaln" +#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 elapsed; + double x[ 100 ]; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_absgammaln( 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 ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/Makefile b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/Makefile new file mode 100644 index 000000000000..ba3ed4330d65 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/Makefile @@ -0,0 +1,110 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2018 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 := @ +endif + +# Specify the path to Boost: +BOOST ?= + +# Determine the OS: +# +# [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 +endif +endif +endif + +# Define the program used for compiling C++ source files: +ifdef CXX_COMPILER + CXX := $(CXX_COMPILER) +else + CXX := g++ +endif + +# Define the command-line options when compiling C++ files: +CXXFLAGS ?= \ + -std=c++11 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate [position independent code][1]: +# +# [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 C++ targets: +cxx_targets := benchmark.out + + +# TARGETS # + +# Default target. +# +# This target is the default target. + +all: $(cxx_targets) + +.PHONY: all + + +# Compile C++ source. +# +# This target compiles C++ source files. + +$(cxx_targets): %.out: %.cpp $(BOOST) + $(QUIET) $(CXX) $(CXXFLAGS) $(fPIC) -I $(BOOST) -o $@ $< -lm + + +# Run a benchmark. +# +# This target runs a benchmark. + +run: $(cxx_targets) + $(QUIET) ./$< + +.PHONY: run + + +# Perform clean-up. +# +# This target removes generated files. + +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/benchmark.cpp b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/benchmark.cpp new file mode 100644 index 000000000000..7113eb6fa38d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/cpp/boost/benchmark.cpp @@ -0,0 +1,132 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 +#include +#include +#include +#include +#include +#include +#include + +using boost::random::uniform_real_distribution; +using boost::random::mt19937; + +#define NAME "absgammaln" +#define ITERATIONS 1000000 +#define REPEATS 3 + +/** +* Prints the TAP version. +*/ +void print_version() { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +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 +*/ +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 +*/ +double tic() { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Runs a benchmark. +* +* @return elapsed time in seconds +*/ +double benchmark() { + double elapsed; + double x; + double y; + double t; + int i; + + // Define a new pseudorandom number generator: + mt19937 rng; + + // Define a uniform distribution for generating pseudorandom numbers as "doubles" between a minimum value (inclusive) and a maximum value (exclusive): + uniform_real_distribution<> randu( -500.0, 500.0 ); + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + x = randu( rng ); + y = boost::math::lgamma( x ); + 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; + + print_version(); + for ( i = 0; i < REPEATS; i++ ) { + printf( "# cpp::boost::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); + return 0; +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/REQUIRE b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/REQUIRE new file mode 100644 index 000000000000..98645e192e41 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/REQUIRE @@ -0,0 +1,2 @@ +julia 1.5 +BenchmarkTools 0.5.0 diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/benchmark.jl new file mode 100755 index 000000000000..7121880e1297 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/julia/benchmark.jl @@ -0,0 +1,144 @@ +#!/usr/bin/env julia +# +# @license Apache-2.0 +# +# Copyright (c) 2018 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 BenchmarkTools +using Printf + +# Benchmark variables: +name = "absgammaln"; +repeats = 3; + +""" + print_version() + +Prints the TAP version. + +# Examples + +``` julia +julia> print_version() +``` +""" +function print_version() + @printf( "TAP version 13\n" ); +end + +""" + print_summary( total, passing ) + +Print the benchmark summary. + +# Arguments + +* `total`: total number of tests +* `passing`: number of passing tests + +# Examples + +``` julia +julia> print_summary( 3, 3 ) +``` +""" +function print_summary( total, 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" ); +end + +""" + print_results( iterations, elapsed ) + +Print benchmark results. + +# Arguments + +* `iterations`: number of iterations +* `elapsed`: elapsed time (in seconds) + +# Examples + +``` julia +julia> print_results( 1000000, 0.131009101868 ) +``` +""" +function print_results( iterations, elapsed ) + rate = iterations / elapsed + + @printf( " ---\n" ); + @printf( " iterations: %d\n", iterations ); + @printf( " elapsed: %0.9f\n", elapsed ); + @printf( " rate: %0.9f\n", rate ); + @printf( " ...\n" ); +end + +""" + benchmark() + +Run a benchmark. + +# Notes + +* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. +* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. +* The elapsed time is in seconds. + +# Examples + +``` julia +julia> out = benchmark(); +``` +""" +function benchmark() + t = BenchmarkTools.@benchmark lgamma( (1000.0*rand()) - 500.0 ) samples=1e6 + + # Compute the total "elapsed" time and convert from nanoseconds to seconds: + s = sum( t.times ) / 1.0e9; + + # Determine the number of "iterations": + iter = length( t.times ); + + # Return the results: + [ iter, s ]; +end + +""" + main() + +Run benchmarks. + +# Examples + +``` julia +julia> main(); +``` +""" +function main() + print_version(); + for i in 1:repeats + @printf( "# julia::%s\n", name ); + results = benchmark(); + print_results( results[ 1 ], results[ 2 ] ); + @printf( "ok %d benchmark finished\n", i ); + end + print_summary( repeats, repeats ); +end + +main(); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/benchmark.py b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/benchmark.py new file mode 100755 index 000000000000..6a482a32cce1 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/benchmark.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# +# @license Apache-2.0 +# +# Copyright (c) 2018 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. + +"""Benchmark lgamma.""" + +from __future__ import print_function +import timeit + +NAME = "absgammaln" +REPEATS = 3 +ITERATIONS = 1000000 + + +def print_version(): + """Print the TAP version.""" + print("TAP version 13") + + +def print_summary(total, passing): + """Print the benchmark summary. + + # Arguments + + * `total`: total number of tests + * `passing`: number of passing tests + + """ + print("#") + print("1.." + str(total)) # TAP plan + print("# total " + str(total)) + print("# pass " + str(passing)) + print("#") + print("# ok") + + +def print_results(elapsed): + """Print benchmark results. + + # Arguments + + * `elapsed`: elapsed time (in seconds) + + # Examples + + ``` python + python> print_results(0.131009101868) + ``` + """ + rate = ITERATIONS / elapsed + + print(" ---") + print(" iterations: " + str(ITERATIONS)) + print(" elapsed: " + str(elapsed)) + print(" rate: " + str(rate)) + print(" ...") + + +def benchmark(): + """Run the benchmark and print benchmark results.""" + setup = "from math import lgamma; from random import random;" + stmt = "y = lgamma(1000.0*random() - 500.0)" + + t = timeit.Timer(stmt, setup=setup) + + print_version() + + for i in range(REPEATS): + print("# python::" + NAME) + elapsed = t.timeit(number=ITERATIONS) + print_results(elapsed) + print("ok " + str(i+1) + " benchmark finished") + + print_summary(REPEATS, REPEATS) + + +def main(): + """Run the benchmark.""" + benchmark() + + +if __name__ == "__main__": + main() diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/scipy/benchmark.py b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/scipy/benchmark.py new file mode 100755 index 000000000000..469a0ed4acd8 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/python/scipy/benchmark.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# +# @license Apache-2.0 +# +# Copyright (c) 2018 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. + +"""Benchmark scipy.special.absgammaln.""" + +from __future__ import print_function +import timeit + +NAME = "absgammaln" +REPEATS = 3 +ITERATIONS = 1000000 + + +def print_version(): + """Print the TAP version.""" + print("TAP version 13") + + +def print_summary(total, passing): + """Print the benchmark summary. + + # Arguments + + * `total`: total number of tests + * `passing`: number of passing tests + + """ + print("#") + print("1.." + str(total)) # TAP plan + print("# total " + str(total)) + print("# pass " + str(passing)) + print("#") + print("# ok") + + +def print_results(elapsed): + """Print benchmark results. + + # Arguments + + * `elapsed`: elapsed time (in seconds) + + # Examples + + ``` python + python> print_results(0.131009101868) + ``` + """ + rate = ITERATIONS / elapsed + + print(" ---") + print(" iterations: " + str(ITERATIONS)) + print(" elapsed: " + str(elapsed)) + print(" rate: " + str(rate)) + print(" ...") + + +def benchmark(): + """Run the benchmark and print benchmark results.""" + setup = "from scipy.special import gammaln; from random import random;" + stmt = "y = gammaln(1000.0*random() - 500.0)" + + t = timeit.Timer(stmt, setup=setup) + + print_version() + + for i in range(REPEATS): + print("# python::scipy::" + NAME) + elapsed = t.timeit(number=ITERATIONS) + print_results(elapsed) + print("ok " + str(i+1) + " benchmark finished") + + print_summary(REPEATS, REPEATS) + + +def main(): + """Run the benchmark.""" + benchmark() + + +if __name__ == "__main__": + main() diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/DESCRIPTION b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/DESCRIPTION new file mode 100644 index 000000000000..131d2ce2fd83 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/DESCRIPTION @@ -0,0 +1,9 @@ +Package: lgamma-benchmarks +Title: Benchmarks +Version: 0.0.0 +Authors@R: person("stdlib", "js", role = c("aut","cre")) +Description: Benchmarks. +Depends: R (>=3.4.0) +Imports: + microbenchmark +LazyData: true diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/benchmark.R b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/benchmark.R new file mode 100755 index 000000000000..af50f82e42ef --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/benchmark/r/benchmark.R @@ -0,0 +1,109 @@ +#!/usr/bin/env Rscript +# +# @license Apache-2.0 +# +# Copyright (c) 2018 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. + +# Set the precision to 16 digits: +options( digits = 16L ); + +#' Run benchmarks. +#' +#' @examples +#' main(); +main <- function() { + # Define benchmark parameters: + name <- 'absgammaln'; + iterations <- 1000000L; + repeats <- 3L; + + #' Print the TAP version. + #' + #' @examples + #' print_version(); + print_version <- function() { + cat( 'TAP version 13\n' ); + } + + #' Print the TAP summary. + #' + #' @param total Total number of tests. + #' @param passing Total number of passing tests. + #' + #' @examples + #' print_summary( 3, 3 ); + print_summary <- function( total, passing ) { + cat( '#\n' ); + cat( paste0( '1..', total, '\n' ) ); # TAP plan + cat( paste0( '# total ', total, '\n' ) ); + cat( paste0( '# pass ', passing, '\n' ) ); + cat( '#\n' ); + cat( '# ok\n' ); + } + + #' Print benchmark results. + #' + #' @param iterations Number of iterations. + #' @param elapsed Elapsed time in seconds. + #' + #' @examples + #' print_results( 10000L, 0.131009101868 ); + print_results <- function( iterations, elapsed ) { + rate <- iterations / elapsed; + cat( ' ---\n' ); + cat( paste0( ' iterations: ', iterations, '\n' ) ); + cat( paste0( ' elapsed: ', elapsed, '\n' ) ); + cat( paste0( ' rate: ', rate, '\n' ) ); + cat( ' ...\n' ); + } + + #' Run a benchmark. + #' + #' ## Notes + #' + #' * We compute and return a total "elapsed" time, rather than the minimum + #' evaluation time, to match benchmark results in other languages (e.g., + #' Python). + #' + #' + #' @param iterations Number of Iterations. + #' @return Elapsed time in seconds. + #' + #' @examples + #' elapsed <- benchmark( 10000L ); + benchmark <- function( iterations ) { + # Run the benchmarks: + results <- microbenchmark::microbenchmark( lgamma( (1000.0*runif(1.0)) - 500.0 ), times = iterations ); + + # Sum all the raw timing results to get a total "elapsed" time: + elapsed <- sum( results[['time']] ); + + # Convert the elapsed time from nanoseconds to seconds: + elapsed <- elapsed / 1.0e9; + + return( elapsed ); + } + + print_version(); + for ( i in 1L:repeats ) { + cat( paste0( '# r::', name, '\n' ) ); + elapsed <- benchmark( iterations ); + print_results( iterations, elapsed ); + cat( paste0( 'ok ', i, ' benchmark finished', '\n' ) ); + } + print_summary( repeats, repeats ); +} + +main(); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/binding.gyp b/lib/node_modules/@stdlib/math/base/special/absgammaln/binding.gyp new file mode 100644 index 000000000000..ec3992233442 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/binding.gyp @@ -0,0 +1,170 @@ +# @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. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/repl.txt new file mode 100644 index 000000000000..dc491be4c812 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/repl.txt @@ -0,0 +1,35 @@ + +{{alias}}( x ) + Evaluates the natural logarithm of the absolute value of the gamma function + for a double-precision floating-point number. + + Parameters + ---------- + x: number + Input value. + + Returns + ------- + y: number + Natural logarithm of the absolute value of the gamma function. + + Examples + -------- + > var y = {{alias}}( 1.0 ) + 0.0 + > y = {{alias}}( 2.0 ) + 0.0 + > y = {{alias}}( 4.0 ) + ~1.792 + > y = {{alias}}( -0.5 ) + ~1.266 + > y = {{alias}}( 0.5 ) + ~0.572 + > y = {{alias}}( 0.0 ) + Infinity + > y = {{alias}}( NaN ) + NaN + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/index.d.ts new file mode 100644 index 000000000000..6df20be3473c --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/index.d.ts @@ -0,0 +1,60 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 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 + +/** +* Evaluates the natural logarithm of the absolute value of the gamma function for a double-precision floating-point number. +* +* @param x - input value +* @returns function value +* +* @example +* var v = absgammaln( 1.0 ); +* // returns 0.0 +* +* @example +* var v = absgammaln( 2.0 ); +* // returns 0.0 +* +* @example +* var v = absgammaln( 4.0 ); +* // returns ~1.792 +* +* @example +* var v = absgammaln( -0.5 ); +* // returns ~1.266 +* +* @example +* var v = absgammaln( 0.5 ); +* // returns ~0.572 +* +* @example +* var v = absgammaln( 0.0 ); +* // returns Infinity +* +* @example +* var v = absgammaln( NaN ); +* // returns NaN +*/ +declare function absgammaln( x: number ): number; + + +// EXPORTS // + +export = absgammaln; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/test.ts new file mode 100644 index 000000000000..45ac23d5fc9f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/docs/types/test.ts @@ -0,0 +1,44 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 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 absgammaln = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + absgammaln( 8 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a value other than a number... +{ + absgammaln( true ); // $ExpectError + absgammaln( false ); // $ExpectError + absgammaln( null ); // $ExpectError + absgammaln( undefined ); // $ExpectError + absgammaln( '5' ); // $ExpectError + absgammaln( [] ); // $ExpectError + absgammaln( {} ); // $ExpectError + absgammaln( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + absgammaln(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/Makefile new file mode 100644 index 000000000000..6aed70daf167 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/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 := example.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 examples. +# +# @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/absgammaln/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/example.c new file mode 100644 index 000000000000..2f34a2c75cf5 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/c/example.c @@ -0,0 +1,31 @@ +/** +* @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/absgammaln.h" +#include + +int main( void ) { + const double x[] = { 4.0, -1.5, -0.5, 0.5 }; + + double y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_absgammaln( x[ i ] ); + printf( "absgammaln(%lf) = %lf\n", x[ i ], y ); + } +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/index.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/index.js new file mode 100644 index 000000000000..e355166a8b62 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var absgammaln = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; +var x = uniform( 100, -10.0, 10.0, opts ); + +logEachMap( 'x: %0.4f, f(x): %0.4f', x, absgammaln ); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/include.gypi b/lib/node_modules/@stdlib/math/base/special/absgammaln/include.gypi new file mode 100644 index 000000000000..575cb043c0bf --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/include.gypi @@ -0,0 +1,53 @@ +# @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. + +# A GYP include file for building a Node.js native add-on. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + ' TT = -(tail of TF) + + +// MAIN // + +/** +* Evaluates the natural logarithm of the absolute value of the gamma function for a double-precision floating-point number. +* +* ## Method +* +* 1. Argument reduction for \\(0 < x \leq 8\\). Since \\(\Gamma(1+s) = s \Gamma(s)\\), for \\(x \in \[0,8]\\), we may reduce \\(x\\) to a number in \\(\[1.5,2.5]\\) by +* +* ```tex +* \operatorname{lgamma}(1+s) = \ln(s) + \operatorname{lgamma}(s) +* ``` +* +* For example, +* +* ```tex +* \begin{align*} +* \operatorname{lgamma}(7.3) &= \ln(6.3) + \operatorname{lgamma}(6.3) \\ +* &= \ln(6.3 \cdot 5.3) + \operatorname{lgamma}(5.3) \\ +* &= \ln(6.3 \cdot 5.3 \cdot 4.3 \cdot 3.3 \cdot2.3) + \operatorname{lgamma}(2.3) +* \end{align*} +* ``` +* +* 2. Compute a polynomial approximation of \\(\mathrm{lgamma}\\) around its minimum (\\(\mathrm{ymin} = 1.461632144968362245\\)) to maintain monotonicity. On the interval \\(\[\mathrm{ymin} - 0.23, \mathrm{ymin} + 0.27]\\) (i.e., \\(\[1.23164,1.73163]\\)), we let \\(z = x - \mathrm{ymin}\\) and use +* +* ```tex +* \operatorname{lgamma}(x) = -1.214862905358496078218 + z^2 \cdot \operatorname{poly}(z) +* ``` +* +* where \\(\operatorname{poly}(z)\\) is a \\(14\\) degree polynomial. +* +* 3. Compute a rational approximation in the primary interval \\(\[2,3]\\). Let \\( s = x - 2.0 \\). We can thus use the approximation +* +* ```tex +* \operatorname{lgamma}(x) = \frac{s}{2} + s\frac{\operatorname{P}(s)}{\operatorname{Q}(s)} +* ``` +* +* with accuracy +* +* ```tex +* \biggl|\frac{\mathrm{P}}{\mathrm{Q}} - \biggr(\operatorname{lgamma}(x)-\frac{s}{2}\biggl)\biggl| < 2^{-61.71} +* ``` +* +* The algorithms are based on the observation +* +* ```tex +* \operatorname{lgamma}(2+s) = s(1 - \gamma) + \frac{\zeta(2) - 1}{2} s^2 - \frac{\zeta(3) - 1}{3} s^3 + \ldots +* ``` +* +* where \\(\zeta\\) is the zeta function and \\(\gamma = 0.5772156649...\\) is the Euler-Mascheroni constant, which is very close to \\(0.5\\). +* +* 4. For \\(x \geq 8\\), +* +* ```tex +* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr) \ln(x) - x + \frac{\ln(2\pi)}{2} + \frac{1}{12x} - \frac{1}{360x^3} + \ldots +* ``` +* +* which can be expressed +* +* ```tex +* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1)-\frac{\ln(2\pi)-1}{2} + \ldots +* ``` +* +* Let \\(z = \frac{1}{x}\\). We can then use the approximation +* +* ```tex +* f(z) = \operatorname{lgamma}(x) - \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1) +* ``` +* +* by +* +* ```tex +* w = w_0 + w_1 z + w_2 z^3 + w_3 z^5 + \ldots + w_6 z^{11} +* ``` +* +* where +* +* ```tex +* |w - f(z)| < 2^{-58.74} +* ``` +* +* 5. For negative \\(x\\), since +* +* ```tex +* -x \Gamma(-x) \Gamma(x) = \frac{\pi}{\sin(\pi x)} +* ``` +* +* where \\(\Gamma\\) is the gamma function, we have +* +* ```tex +* \Gamma(x) = \frac{\pi}{\sin(\pi x)(-x)\Gamma(-x)} +* ``` +* +* Since \\(\Gamma(-x)\\) is positive, +* +* ```tex +* \operatorname{sign}(\Gamma(x)) = \operatorname{sign}(\sin(\pi x)) +* ``` +* +* for \\(x < 0\\). Hence, for \\(x < 0\\), +* +* ```tex +* \mathrm{signgam} = \operatorname{sign}(\sin(\pi x)) +* ``` +* +* and +* +* ```tex +* \begin{align*} +* \operatorname{lgamma}(x) &= \ln(|\Gamma(x)|) \\ +* &= \ln\biggl(\frac{\pi}{|x \sin(\pi x)|}\biggr) - \operatorname{lgamma}(-x) +* \end{align*} +* ``` +* +* +* +* Note that one should avoid computing \\(\pi (-x)\\) directly in the computation of \\(\sin(\pi (-x))\\). +* +* +* +* ## Special Cases +* +* ```tex +* \begin{align*} +* \operatorname{lgamma}(2+s) &\approx s (1-\gamma) & \mathrm{for\ tiny\ s} \\ +* \operatorname{lgamma}(x) &\approx -\ln(x) & \mathrm{for\ tiny\ x} \\ +* \operatorname{lgamma}(1) &= 0 & \\ +* \operatorname{lgamma}(2) &= 0 & \\ +* \operatorname{lgamma}(0) &= \infty & \\ +* \operatorname{lgamma}(\infty) &= \infty & \\ +* \operatorname{lgamma}(-\mathrm{integer}) &= \pm \infty +* \end{align*} +* ``` +* +* @param {number} x - input value +* @returns {number} function value +* +* @example +* var v = absgammaln( 1.0 ); +* // returns 0.0 +* +* @example +* var v = absgammaln( 2.0 ); +* // returns 0.0 +* +* @example +* var v = absgammaln( 4.0 ); +* // returns ~1.792 +* +* @example +* var v = absgammaln( -0.5 ); +* // returns ~1.266 +* +* @example +* var v = absgammaln( 0.5 ); +* // returns ~0.572 +* +* @example +* var v = absgammaln( 0.0 ); +* // returns Infinity +* +* @example +* var v = absgammaln( NaN ); +* // returns NaN +*/ +function absgammaln( x ) { + var isNegative; + var nadj; + var flg; + var p3; + var p2; + var p1; + var p; + var q; + var t; + var w; + var y; + var z; + var r; + + // Special cases: NaN, +-infinity + if ( isnan( x ) || isInfinite( x ) ) { + return x; + } + // Special case: 0 + if ( x === 0.0 ) { + return PINF; + } + if ( x < 0.0 ) { + isNegative = true; + x = -x; + } else { + isNegative = false; + } + // If |x| < 2**-56, return -ln(|x|) + if ( x < TINY ) { + return -ln( x ); + } + if ( isNegative ) { + // If |x| >= 2**52, must be -integer + if ( x >= TWO52 ) { + return PINF; + } + t = sinpi( x ); + if ( t === 0.0 ) { + return PINF; + } + nadj = ln( PI / abs( t*x ) ); + } + // If x equals 1 or 2, return 0 + if ( x === 1.0 || x === 2.0 ) { + return 0.0; + } + // If x < 2, use lgamma(x) = lgamma(x+1) - log(x) + if ( x < 2.0 ) { + if ( x <= 0.9 ) { + r = -ln( x ); + + // 0.7316 <= x <= 0.9 + if ( x >= ( YMIN - 1.0 + 0.27 ) ) { + y = 1.0 - x; + flg = 0; + } + // 0.2316 <= x < 0.7316 + else if ( x >= (YMIN - 1.0 - 0.27) ) { + y = x - (TC - 1.0); + flg = 1; + } + // 0 < x < 0.2316 + else { + y = x; + flg = 2; + } + } else { + r = 0.0; + + // 1.7316 <= x < 2 + if ( x >= (YMIN + 0.27) ) { + y = 2.0 - x; + flg = 0; + } + // 1.2316 <= x < 1.7316 + else if ( x >= (YMIN - 0.27) ) { + y = x - TC; + flg = 1; + } + // 0.9 < x < 1.2316 + else { + y = x - 1.0; + flg = 2; + } + } + switch ( flg ) { // eslint-disable-line default-case + case 0: + z = y * y; + p1 = A1C + (z*polyvalA1( z )); + p2 = z * (A2C + (z*polyvalA2( z ))); + p = (y*p1) + p2; + r += ( p - (0.5*y) ); + break; + case 1: + z = y * y; + w = z * y; + p1 = T1C + (w*polyvalT1( w )); + p2 = T2C + (w*polyvalT2( w )); + p3 = T3C + (w*polyvalT3( w )); + p = (z*p1) - (TT - (w*(p2+(y*p3)))); + r += ( TF + p ); + break; + case 2: + p1 = y * (UC + (y*polyvalU( y ))); + p2 = VC + (y*polyvalV( y )); + r += (-0.5*y) + (p1/p2); + break; + } + } + // 2 <= x < 8 + else if ( x < 8.0 ) { + flg = trunc( x ); + y = x - flg; + p = y * (SC + (y*polyvalS( y ))); + q = RC + (y*polyvalR( y )); + r = (0.5*y) + (p/q); + z = 1.0; // absgammaln(1+s) = ln(s) + absgammaln(s) + switch ( flg ) { // eslint-disable-line default-case + case 7: + z *= y + 6.0; + + /* Falls through */ + case 6: + z *= y + 5.0; + + /* Falls through */ + case 5: + z *= y + 4.0; + + /* Falls through */ + case 4: + z *= y + 3.0; + + /* Falls through */ + case 3: + z *= y + 2.0; + r += ln( z ); + } + } + // 8 <= x < 2**56 + else if ( x < TWO56 ) { + t = ln( x ); + z = 1.0 / x; + y = z * z; + w = WC + (z*polyvalW( y )); + r = ((x-0.5)*(t-1.0)) + w; + } + // 2**56 <= x <= Inf + else { + r = x * ( ln(x)-1.0 ); + } + if ( isNegative ) { + r = nadj - r; + } + return r; +} + + +// EXPORTS // + +module.exports = absgammaln; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/native.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/native.js new file mode 100644 index 000000000000..f274744ae16c --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/native.js @@ -0,0 +1,70 @@ +/** +* @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 addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Evaluates the natural logarithm of the absolute value of the gamma function for a double-precision floating-point number. +* +* @private +* @param {number} x - input value +* @returns {number} function value +* +* @example +* var v = absgammaln( 1.0 ); +* // returns 0.0 +* +* @example +* var v = absgammaln( 2.0 ); +* // returns 0.0 +* +* @example +* var v = absgammaln( 4.0 ); +* // returns ~1.792 +* +* @example +* var v = absgammaln( -0.5 ); +* // returns ~1.266 +* +* @example +* var v = absgammaln( 0.5 ); +* // returns ~0.572 +* +* @example +* var v = absgammaln( 0.0 ); +* // returns Infinity +* +* @example +* var v = absgammaln( NaN ); +* // returns NaN +*/ +function absgammaln( x ) { + return addon( x ); +} + + +// EXPORTS // + +module.exports = absgammaln; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a1.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a1.js new file mode 100644 index 000000000000..087229c23151 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a1.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 0.06735230105312927; + } + return 0.06735230105312927 + (x * (0.007385550860814029 + (x * (0.0011927076318336207 + (x * (0.00022086279071390839 + (x * 0.000025214456545125733))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a2.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a2.js new file mode 100644 index 000000000000..f14a76ec845f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_a2.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 0.020580808432516733; + } + return 0.020580808432516733 + (x * (0.0028905138367341563 + (x * (0.0005100697921535113 + (x * (0.00010801156724758394 + (x * 0.000044864094961891516))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_r.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_r.js new file mode 100644 index 000000000000..9668daabbb44 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_r.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 1.3920053346762105; + } + return 1.3920053346762105 + (x * (0.7219355475671381 + (x * (0.17193386563280308 + (x * (0.01864591917156529 + (x * (0.0007779424963818936 + (x * 0.000007326684307446256))))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_s.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_s.js new file mode 100644 index 000000000000..ef9876b2992f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_s.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 0.21498241596060885; + } + return 0.21498241596060885 + (x * (0.325778796408931 + (x * (0.14635047265246445 + (x * (0.02664227030336386 + (x * (0.0018402845140733772 + (x * 0.00003194753265841009))))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t1.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t1.js new file mode 100644 index 000000000000..78100e70e14a --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t1.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return -0.032788541075985965; + } + return -0.032788541075985965 + (x * (0.006100538702462913 + (x * (-0.0014034646998923284 + (x * 0.00031563207090362595))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t2.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t2.js new file mode 100644 index 000000000000..dc1fff68a6ec --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t2.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 0.01797067508118204; + } + return 0.01797067508118204 + (x * (-0.0036845201678113826 + (x * (0.000881081882437654 + (x * -0.00031275416837512086))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t3.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t3.js new file mode 100644 index 000000000000..709cdf906668 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_t3.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return -0.010314224129834144; + } + return -0.010314224129834144 + (x * (0.0022596478090061247 + (x * (-0.0005385953053567405 + (x * 0.0003355291926355191))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_u.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_u.js new file mode 100644 index 000000000000..0c083f527cb8 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_u.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 0.6328270640250934; + } + return 0.6328270640250934 + (x * (1.4549225013723477 + (x * (0.9777175279633727 + (x * (0.22896372806469245 + (x * 0.013381091853678766))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_v.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_v.js new file mode 100644 index 000000000000..bab17ad8c55b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_v.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 2.4559779371304113; + } + return 2.4559779371304113 + (x * (2.128489763798934 + (x * (0.7692851504566728 + (x * (0.10422264559336913 + (x * 0.003217092422824239))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_w.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_w.js new file mode 100644 index 000000000000..8061d22e4fa1 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/lib/polyval_w.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 0.08333333333333297; + } + return 0.08333333333333297 + (x * (-0.0027777777772877554 + (x * (0.0007936505586430196 + (x * (-0.00059518755745034 + (x * (0.0008363399189962821 + (x * -0.0016309293409657527))))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/manifest.json b/lib/node_modules/@stdlib/math/base/special/absgammaln/manifest.json new file mode 100644 index 000000000000..bcc36da007e6 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/manifest.json @@ -0,0 +1,93 @@ +{ + "options": { + "task": "build" + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/napi/unary", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-infinite", + "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/ln", + "@stdlib/math/base/special/trunc", + "@stdlib/math/base/special/sinpi", + "@stdlib/constants/float64/pinf", + "@stdlib/constants/float64/pi" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-infinite", + "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/ln", + "@stdlib/math/base/special/trunc", + "@stdlib/math/base/special/sinpi", + "@stdlib/constants/float64/pinf", + "@stdlib/constants/float64/pi" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-infinite", + "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/ln", + "@stdlib/math/base/special/trunc", + "@stdlib/math/base/special/sinpi", + "@stdlib/constants/float64/pinf", + "@stdlib/constants/float64/pi" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/package.json b/lib/node_modules/@stdlib/math/base/special/absgammaln/package.json new file mode 100644 index 000000000000..db79d28e7c29 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/package.json @@ -0,0 +1,151 @@ +{ + "name": "@stdlib/math/base/special/absgammaln", + "version": "0.0.0", + "description": "Natural logarithm of the absolute value of the gamma function for a double-precision floating-point number.", + "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", + "gypfile": true, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "scripts": "./scripts", + "src": "./src", + "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", + "special function", + "special", + "function", + "gamma", + "factorial", + "natural", + "absolute", + "logarithm", + "log", + "ln", + "lgamma", + "number" + ], + "__stdlib__": { + "scaffold": { + "$schema": "math/base@v1.0", + "base_alias": "absgammaln", + "alias": "absgammaln", + "pkg_desc": "evaluate the natural logarithm of the absolute value of the gamma function", + "desc": "evaluates the natural logarithm of the absolute value of the gamma function", + "short_desc": "natural logarithm of the absolute value of the gamma function", + "parameters": [ + { + "name": "x", + "desc": "input value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "double", + "dtype": "float64" + }, + "domain": [ + { + "min": "-infinity", + "max": "infinity" + } + ], + "rand": { + "prng": "random/base/uniform", + "parameters": [ + -10, + 10 + ] + }, + "example_values": [ + 1, + 3.5, + 4.5, + -0.5, + 2, + 3, + -3.5, + 0.1, + 4, + 1.5, + 5, + 0.5, + 2.5, + -1.5, + -2.5, + 50, + 100, + -50.5, + -100.5, + 2.2 + ] + } + ], + "output_policy": "real_floating_point_and_generic", + "returns": { + "desc": "function value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "double", + "dtype": "float64" + } + }, + "keywords": [ + "gamma", + "factorial", + "natural", + "absolute", + "logarithm", + "log", + "ln", + "lgamma" + ], + "extra_keywords": [] + } + } +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/scripts/evalpoly.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/scripts/evalpoly.js new file mode 100644 index 000000000000..d3456b09248f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/scripts/evalpoly.js @@ -0,0 +1,256 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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. +*/ + +/* +* This script compiles modules for evaluating polynomial functions. If any polynomial coefficients change, this script should be rerun to update the compiled files. +*/ +'use strict'; + +// 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/evalpoly-compile' ); +var compileC = require( '@stdlib/math/base/tools/evalpoly-compile-c' ); +var substringBefore = require( '@stdlib/string/substring-before' ); +var substringAfter = require( '@stdlib/string/substring-after' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +// Polynomial coefficients ordered in ascending degree... +var A1 = [ + 6.73523010531292681824e-02, // 0x3FB13E001A5562A7 + 7.38555086081402883957e-03, // 0x3F7E404FB68FEFE8 + 1.19270763183362067845e-03, // 0x3F538A94116F3F5D + 2.20862790713908385557e-04, // 0x3F2CF2ECED10E54D + 2.52144565451257326939e-05 // 0x3EFA7074428CFA52 +]; +var A2 = [ + 2.05808084325167332806e-02, // 0x3F951322AC92547B + 2.89051383673415629091e-03, // 0x3F67ADD8CCB7926B + 5.10069792153511336608e-04, // 0x3F40B6C689B99C00 + 1.08011567247583939954e-04, // 0x3F1C5088987DFB07 + 4.48640949618915160150e-05 // 0x3F07858E90A45837 +]; +var R = [ + 1.39200533467621045958e+00, // 0x3FF645A762C4AB74 + 7.21935547567138069525e-01, // 0x3FE71A1893D3DCDC + 1.71933865632803078993e-01, // 0x3FC601EDCCFBDF27 + 1.86459191715652901344e-02, // 0x3F9317EA742ED475 + 7.77942496381893596434e-04, // 0x3F497DDACA41A95B + 7.32668430744625636189e-06 // 0x3EDEBAF7A5B38140 +]; +var S = [ + 2.14982415960608852501e-01, // 0x3FCB848B36E20878 + 3.25778796408930981787e-01, // 0x3FD4D98F4F139F59 + 1.46350472652464452805e-01, // 0x3FC2BB9CBEE5F2F7 + 2.66422703033638609560e-02, // 0x3F9B481C7E939961 + 1.84028451407337715652e-03, // 0x3F5E26B67368F239 + 3.19475326584100867617e-05 // 0x3F00BFECDD17E945 +]; +var T1 = [ + -3.27885410759859649565e-02, // 0xBFA0C9A8DF35B713 + 6.10053870246291332635e-03, // 0x3F78FCE0E370E344 + -1.40346469989232843813e-03, // 0xBF56FE8EBF2D1AF1 + 3.15632070903625950361e-04 // 0x3F34AF6D6C0EBBF7 +]; +var T2 = [ + 1.79706750811820387126e-02, // 0x3F9266E7970AF9EC + -3.68452016781138256760e-03, // 0xBF6E2EFFB3E914D7 + 8.81081882437654011382e-04, // 0x3F4CDF0CEF61A8E9 + -3.12754168375120860518e-04 // 0xBF347F24ECC38C38 +]; +var T3 = [ + -1.03142241298341437450e-02, // 0xBF851F9FBA91EC6A + 2.25964780900612472250e-03, // 0x3F6282D32E15C915 + -5.38595305356740546715e-04, // 0xBF41A6109C73E0EC + 3.35529192635519073543e-04 // 0x3F35FD3EE8C2D3F4 +]; +var U = [ + 6.32827064025093366517e-01, // 0x3FE4401E8B005DFF + 1.45492250137234768737e+00, // 0x3FF7475CD119BD6F + 9.77717527963372745603e-01, // 0x3FEF497644EA8450 + 2.28963728064692451092e-01, // 0x3FCD4EAEF6010924 + 1.33810918536787660377e-02 // 0x3F8B678BBF2BAB09 +]; +var V = [ + 2.45597793713041134822e+00, // 0x4003A5D7C2BD619C + 2.12848976379893395361e+00, // 0x40010725A42B18F5 + 7.69285150456672783825e-01, // 0x3FE89DFBE45050AF + 1.04222645593369134254e-01, // 0x3FBAAE55D6537C88 + 3.21709242282423911810e-03 // 0x3F6A5ABB57D0CF61 +]; +var W = [ + 8.33333333333329678849e-02, // 0x3FB555555555553B + -2.77777777728775536470e-03, // 0xBF66C16C16B02E5C + 7.93650558643019558500e-04, // 0x3F4A019F98CF38B6 + -5.95187557450339963135e-04, // 0xBF4380CB8C0FE741 + 8.36339918996282139126e-04, // 0x3F4B67BA4CDAD5D1 + -1.63092934096575273989e-03 // 0xBF5AB89D0B9E43E4 +]; + +// Header to add to output files: +var header = licenseHeader( 'Apache-2.0', 'js', { + 'year': currentYear(), + 'copyright': 'The Stdlib Authors' +}); +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 // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var fpath; + var copts; + var opts; + var file; + var str; + + opts = { + 'encoding': 'utf8' + }; + + fpath = resolve( __dirname, '..', 'lib', 'polyval_a1.js' ); + str = header + compile( A1 ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_a2.js' ); + str = header + compile( A2 ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_r.js' ); + str = header + compile( R ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_s.js' ); + str = header + compile( S ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_t1.js' ); + str = header + compile( T1 ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_t2.js' ); + str = header + compile( T2 ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_t3.js' ); + str = header + compile( T3 ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_u.js' ); + str = header + compile( U ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_v.js' ); + str = header + compile( V ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_w.js' ); + str = header + compile( W ); + writeFileSync( fpath, str, opts ); + + copts = { + 'dtype': 'double', + 'name': '' + }; + + fpath = resolve( __dirname, '..', 'src', 'main.c' ); + file = readFileSync( fpath, opts ); + + copts.name = 'polyval_a1'; + str = compileC( A1, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_a2'; + str = compileC( A2, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_r'; + str = compileC( R, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_s'; + str = compileC( S, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_t1'; + str = compileC( T1, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_t2'; + str = compileC( T2, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_t3'; + str = compileC( T3, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_u'; + str = compileC( U, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_v'; + str = compileC( V, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_w'; + str = compileC( W, copts ); + file = insert( file, copts.name, str ); + + writeFileSync( fpath, file, opts ); +} + +main(); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/src/Makefile b/lib/node_modules/@stdlib/math/base/special/absgammaln/src/Makefile new file mode 100644 index 000000000000..bcf18aa46655 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @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 + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/src/addon.c b/lib/node_modules/@stdlib/math/base/special/absgammaln/src/addon.c new file mode 100644 index 000000000000..74c1e45f607b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/src/addon.c @@ -0,0 +1,22 @@ +/** +* @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/absgammaln.h" +#include "stdlib/math/base/napi/unary.h" + +STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_absgammaln ) diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/src/main.c b/lib/node_modules/@stdlib/math/base/special/absgammaln/src/main.c new file mode 100644 index 000000000000..01209d783540 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/src/main.c @@ -0,0 +1,550 @@ +/** +* @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. +* +* +* ## Notice +* +* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/12.2.0/lib/msun/src/e_lgamma_r.c}. The implementation follows the original, but has been modified for JavaScript. +* +* ```text +* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +* +* Developed at SunPro, a Sun Microsystems, Inc. business. +* Permission to use, copy, modify, and distribute this +* software is freely granted, provided that this notice +* is preserved. +* ``` +*/ + +#include "stdlib/math/base/special/absgammaln.h" +#include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/math/base/assert/is_infinite.h" +#include "stdlib/math/base/special/abs.h" +#include "stdlib/math/base/special/ln.h" +#include "stdlib/math/base/special/trunc.h" +#include "stdlib/math/base/special/sinpi.h" +#include "stdlib/constants/float64/pi.h" +#include "stdlib/constants/float64/pinf.h" +#include + +static const double A1C = 7.72156649015328655494e-02; // 0x3FB3C467E37DB0C8 +static const double A2C = 3.22467033424113591611e-01; // 0x3FD4A34CC4A60FAD +static const double RC = 1.0; +static const double SC = -7.72156649015328655494e-02; // 0xBFB3C467E37DB0C8 +static const double T1C = 4.83836122723810047042e-01; // 0x3FDEF72BC8EE38A2 +static const double T2C = -1.47587722994593911752e-01; // 0xBFC2E4278DC6C509 +static const double T3C = 6.46249402391333854778e-02; // 0x3FB08B4294D5419B +static const double UC = -7.72156649015328655494e-02; // 0xBFB3C467E37DB0C8 +static const double VC = 1.0; +static const double WC = 4.18938533204672725052e-01; // 0x3FDACFE390C97D69 +static const double YMIN = 1.461632144968362245; +static const double TWO52 = 4503599627370496; // 2**52 +static const double TWO56 = 72057594037927936; // 2**56 +static const double TINY = 1.3877787807814457e-17; +static const double TC = 1.46163214496836224576e+00; // 0x3FF762D86356BE3F +static const double TF = -1.21486290535849611461e-01; // 0xBFBF19B9BCC38A42 +static const double TT = -3.63867699703950536541e-18; // 0xBC50C7CAA48A971F => TT = -(tail of TF) + +/* Begin auto-generated functions. The following functions are auto-generated. Do not edit directly. */ + +// BEGIN: polyval_a1 + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_a1( const double x ) { + return 0.06735230105312927 + (x * (0.007385550860814029 + (x * (0.0011927076318336207 + (x * (0.00022086279071390839 + (x * 0.000025214456545125733))))))); +} + +// END: polyval_a1 + +// BEGIN: polyval_a2 + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_a2( const double x ) { + return 0.020580808432516733 + (x * (0.0028905138367341563 + (x * (0.0005100697921535113 + (x * (0.00010801156724758394 + (x * 0.000044864094961891516))))))); +} + +// END: polyval_a2 + +// BEGIN: polyval_r + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_r( const double x ) { + return 1.3920053346762105 + (x * (0.7219355475671381 + (x * (0.17193386563280308 + (x * (0.01864591917156529 + (x * (0.0007779424963818936 + (x * 0.000007326684307446256))))))))); +} + +// END: polyval_r + +// BEGIN: polyval_s + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_s( const double x ) { + return 0.21498241596060885 + (x * (0.325778796408931 + (x * (0.14635047265246445 + (x * (0.02664227030336386 + (x * (0.0018402845140733772 + (x * 0.00003194753265841009))))))))); +} + +// END: polyval_s + +// BEGIN: polyval_t1 + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_t1( const double x ) { + return -0.032788541075985965 + (x * (0.006100538702462913 + (x * (-0.0014034646998923284 + (x * 0.00031563207090362595))))); +} + +// END: polyval_t1 + +// BEGIN: polyval_t2 + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_t2( const double x ) { + return 0.01797067508118204 + (x * (-0.0036845201678113826 + (x * (0.000881081882437654 + (x * -0.00031275416837512086))))); +} + +// END: polyval_t2 + +// BEGIN: polyval_t3 + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_t3( const double x ) { + return -0.010314224129834144 + (x * (0.0022596478090061247 + (x * (-0.0005385953053567405 + (x * 0.0003355291926355191))))); +} + +// END: polyval_t3 + +// BEGIN: polyval_u + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_u( const double x ) { + return 0.6328270640250934 + (x * (1.4549225013723477 + (x * (0.9777175279633727 + (x * (0.22896372806469245 + (x * 0.013381091853678766))))))); +} + +// END: polyval_u + +// BEGIN: polyval_v + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_v( const double x ) { + return 2.4559779371304113 + (x * (2.128489763798934 + (x * (0.7692851504566728 + (x * (0.10422264559336913 + (x * 0.003217092422824239))))))); +} + +// END: polyval_v + +// BEGIN: polyval_w + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static double polyval_w( const double x ) { + return 0.08333333333333297 + (x * (-0.0027777777772877554 + (x * (0.0007936505586430196 + (x * (-0.00059518755745034 + (x * (0.0008363399189962821 + (x * -0.0016309293409657527))))))))); +} + +// END: polyval_w + +/* End auto-generated functions. */ + +/** +* Evaluates the natural logarithm of the absolute value of the gamma function for a double-precision floating-point number. +* +* ## Method +* +* 1. Argument reduction for \\(0 < x \leq 8\\). Since \\(\Gamma(1+s) = s \Gamma(s)\\), for \\(x \in \[0,8]\\), we may reduce \\(x\\) to a number in \\(\[1.5,2.5]\\) by +* +* ```tex +* \operatorname{lgamma}(1+s) = \ln(s) + \operatorname{lgamma}(s) +* ``` +* +* For example, +* +* ```tex +* \begin{align*} +* \operatorname{lgamma}(7.3) &= \ln(6.3) + \operatorname{lgamma}(6.3) \\ +* &= \ln(6.3 \cdot 5.3) + \operatorname{lgamma}(5.3) \\ +* &= \ln(6.3 \cdot 5.3 \cdot 4.3 \cdot 3.3 \cdot2.3) + \operatorname{lgamma}(2.3) +* \end{align*} +* ``` +* +* 2. Compute a polynomial approximation of \\(\mathrm{lgamma}\\) around its minimum (\\(\mathrm{ymin} = 1.461632144968362245\\)) to maintain monotonicity. On the interval \\(\[\mathrm{ymin} - 0.23, \mathrm{ymin} + 0.27]\\) (i.e., \\(\[1.23164,1.73163]\\)), we let \\(z = x - \mathrm{ymin}\\) and use +* +* ```tex +* \operatorname{lgamma}(x) = -1.214862905358496078218 + z^2 \cdot \operatorname{poly}(z) +* ``` +* +* where \\(\operatorname{poly}(z)\\) is a \\(14\\) degree polynomial. +* +* 3. Compute a rational approximation in the primary interval \\(\[2,3]\\). Let \\( s = x - 2.0 \\). We can thus use the approximation +* +* ```tex +* \operatorname{lgamma}(x) = \frac{s}{2} + s\frac{\operatorname{P}(s)}{\operatorname{Q}(s)} +* ``` +* +* with accuracy +* +* ```tex +* \biggl|\frac{\mathrm{P}}{\mathrm{Q}} - \biggr(\operatorname{lgamma}(x)-\frac{s}{2}\biggl)\biggl| < 2^{-61.71} +* ``` +* +* The algorithms are based on the observation +* +* ```tex +* \operatorname{lgamma}(2+s) = s(1 - \gamma) + \frac{\zeta(2) - 1}{2} s^2 - \frac{\zeta(3) - 1}{3} s^3 + \ldots +* ``` +* +* where \\(\zeta\\) is the zeta function and \\(\gamma = 0.5772156649...\\) is the Euler-Mascheroni constant, which is very close to \\(0.5\\). +* +* 4. For \\(x \geq 8\\), +* +* ```tex +* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr) \ln(x) - x + \frac{\ln(2\pi)}{2} + \frac{1}{12x} - \frac{1}{360x^3} + \ldots +* ``` +* +* which can be expressed +* +* ```tex +* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1)-\frac{\ln(2\pi)-1}{2} + \ldots +* ``` +* +* Let \\(z = \frac{1}{x}\\). We can then use the approximation +* +* ```tex +* f(z) = \operatorname{lgamma}(x) - \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1) +* ``` +* +* by +* +* ```tex +* w = w_0 + w_1 z + w_2 z^3 + w_3 z^5 + \ldots + w_6 z^{11} +* ``` +* +* where +* +* ```tex +* |w - f(z)| < 2^{-58.74} +* ``` +* +* 5. For negative \\(x\\), since +* +* ```tex +* -x \Gamma(-x) \Gamma(x) = \frac{\pi}{\sin(\pi x)} +* ``` +* +* where \\(\Gamma\\) is the gamma function, we have +* +* ```tex +* \Gamma(x) = \frac{\pi}{\sin(\pi x)(-x)\Gamma(-x)} +* ``` +* +* Since \\(\Gamma(-x)\\) is positive, +* +* ```tex +* \operatorname{sign}(\Gamma(x)) = \operatorname{sign}(\sin(\pi x)) +* ``` +* +* for \\(x < 0\\). Hence, for \\(x < 0\\), +* +* ```tex +* \mathrm{signgam} = \operatorname{sign}(\sin(\pi x)) +* ``` +* +* and +* +* ```tex +* \begin{align*} +* \operatorname{lgamma}(x) &= \ln(|\Gamma(x)|) \\ +* &= \ln\biggl(\frac{\pi}{|x \sin(\pi x)|}\biggr) - \operatorname{lgamma}(-x) +* \end{align*} +* ``` +* +* +* +* Note that one should avoid computing \\(\pi (-x)\\) directly in the computation of \\(\sin(\pi (-x))\\). +* +* +* +* ## Special Cases +* +* ```tex +* \begin{align*} +* \operatorname{lgamma}(2+s) &\approx s (1-\gamma) & \mathrm{for\ tiny\ s} \\ +* \operatorname{lgamma}(x) &\approx -\ln(x) & \mathrm{for\ tiny\ x} \\ +* \operatorname{lgamma}(1) &= 0 & \\ +* \operatorname{lgamma}(2) &= 0 & \\ +* \operatorname{lgamma}(0) &= \infty & \\ +* \operatorname{lgamma}(\infty) &= \infty & \\ +* \operatorname{lgamma}(-\mathrm{integer}) &= \pm \infty +* \end{align*} +* ``` +* +* @param x input value +* @return function value +* +* @example +* double out = stdlib_base_absgammaln( 1.0 ); +* // returns 0.0 +*/ +double stdlib_base_absgammaln( const double x ) { + uint8_t isNegative; + int32_t flg; + double nadj; + double xc; + double p3; + double p2; + double p1; + double p; + double q; + double t; + double w; + double y; + double z; + double r; + + // Special cases: NaN, +-infinity + if ( stdlib_base_is_nan( x ) || stdlib_base_is_infinite( x ) ) { + return x; + } + + // Special case: 0 + if ( x == 0.0 ) { + return STDLIB_CONSTANT_FLOAT64_PINF; + } + xc = x; + if ( xc < 0.0 ) { + isNegative = 1; + xc = -xc; + } else { + isNegative = 0; + } + + // If |x| < 2**-56, return -ln(|x|) + if ( xc < TINY ) { + return -stdlib_base_ln( xc ); + } + if ( isNegative ) { + // If |x| >= 2**52, must be -integer + if ( xc >= TWO52 ) { + return STDLIB_CONSTANT_FLOAT64_PINF; + } + t = stdlib_base_sinpi( xc ); + if ( t == 0.0 ) { + return STDLIB_CONSTANT_FLOAT64_PINF; + } + nadj = stdlib_base_ln( STDLIB_CONSTANT_FLOAT64_PI / stdlib_base_abs( t * xc ) ); + } + + // If x equals 1 or 2, return 0 + if ( xc == 1.0 || xc == 2.0 ) { + return 0.0; + } + + // If x < 2, use lgamma(x) = lgamma(x+1) - log(x) + if ( xc < 2.0 ) { + if ( xc <= 0.9 ) { + r = -stdlib_base_ln( xc ); + if ( xc >= ( YMIN - 1.0 + 0.27 ) ) { // 0.7316 <= x <= 0.9 + y = 1.0 - xc; + flg = 0; + } else if ( xc >= ( YMIN - 1.0 - 0.27 ) ) { // 0.2316 <= x < 0.7316 + y = xc - ( TC - 1.0 ); + flg = 1; + } else { // 0 < x < 0.2316 + y = xc; + flg = 2; + } + } else { + r = 0.0; + if ( xc >= ( YMIN + 0.27 ) ) { // 1.7316 <= x < 2 + y = 2.0 - xc; + flg = 0; + } else if ( xc >= ( YMIN - 0.27 ) ) { // 1.2316 <= x < 1.7316 + y = xc - TC; + flg = 1; + } else { // 0.9 < x < 1.2316 + y = xc - 1.0; + flg = 2; + } + } + switch ( flg ) { + case 0: + z = y * y; + p1 = A1C + ( z * polyval_a1( z ) ); + p2 = z * ( A2C + ( z * polyval_a2( z ) ) ); + p = ( y * p1 ) + p2; + r += ( p - ( 0.5 * y ) ); + break; + case 1: + z = y * y; + w = z * y; + p1 = T1C + ( w * polyval_t1( w ) ); + p2 = T2C + ( w * polyval_t2( w ) ); + p3 = T3C + ( w * polyval_t3( w ) ); + p = ( z * p1 ) - ( TT - ( w * ( p2 + ( y * p3 ) ) ) ); + r += ( TF + p ); + break; + case 2: + p1 = y * ( UC + ( y * polyval_u( y ) ) ); + p2 = VC + ( y * polyval_v( y ) ); + r += ( -0.5 * y ) + ( p1 / p2 ); + break; + } + } else if ( xc < 8.0 ) { // 2 <= x < 8 + flg = stdlib_base_trunc( xc ); + y = xc - flg; + p = y * ( SC + ( y * polyval_s( y ) ) ); + q = RC + ( y * polyval_r( y ) ); + r = ( 0.5 * y ) + ( p / q ); + z = 1.0; // absgammaln(1+s) = ln(s) + absgammaln(s) + switch ( flg ) { + case 7: + z *= y + 6.0; + + /* Falls through */ + case 6: + z *= y + 5.0; + + /* Falls through */ + case 5: + z *= y + 4.0; + + /* Falls through */ + case 4: + z *= y + 3.0; + + /* Falls through */ + case 3: + z *= y + 2.0; + r += stdlib_base_ln( z ); + } + } else if ( xc < TWO56 ) { // 8 <= x < 2**56 + t = stdlib_base_ln( xc ); + z = 1.0 / xc; + y = z * z; + w = WC + ( z * polyval_w( y ) ); + r = ( ( xc - 0.5 ) * ( t - 1.0 ) ) + w; + } else { // 2**56 <= x <= Inf + r = xc * ( stdlib_base_ln( xc ) - 1.0 ); + } + if ( isNegative ) { + r = nadj - r; + } + return r; +} diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/DESCRIPTION b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/DESCRIPTION new file mode 100644 index 000000000000..4ede445a3a55 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/DESCRIPTION @@ -0,0 +1,9 @@ +Package: absgammaln-test-fixtures +Title: Test Fixtures +Version: 0.0.0 +Authors@R: person("stdlib", "js", role = c("aut","cre")) +Description: Generates test fixtures. +Depends: R (>=3.4.0) +Imports: + jsonlite +LazyData: true diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data1.json b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data1.json new file mode 100644 index 000000000000..d8f9053e25fd --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data1.json @@ -0,0 +1 @@ +[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171] diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data2.json b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data2.json new file mode 100644 index 000000000000..62a2a599c910 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/data2.json @@ -0,0 +1 @@ +[-170.55,-170.208608608609,-169.867217217217,-169.525825825826,-169.184434434434,-168.843043043043,-168.501651651652,-168.16026026026,-167.818868868869,-167.477477477477,-167.136086086086,-166.794694694695,-166.453303303303,-166.111911911912,-165.770520520521,-165.429129129129,-165.087737737738,-164.746346346346,-164.404954954955,-164.063563563564,-163.722172172172,-163.380780780781,-163.039389389389,-162.697997997998,-162.356606606607,-162.015215215215,-161.673823823824,-161.332432432432,-160.991041041041,-160.64964964965,-160.308258258258,-159.966866866867,-159.625475475475,-159.284084084084,-158.942692692693,-158.601301301301,-158.25990990991,-157.918518518519,-157.577127127127,-157.235735735736,-156.894344344344,-156.552952952953,-156.211561561562,-155.87017017017,-155.528778778779,-155.187387387387,-154.845995995996,-154.504604604605,-154.163213213213,-153.821821821822,-153.48043043043,-153.139039039039,-152.797647647648,-152.456256256256,-152.114864864865,-151.773473473473,-151.432082082082,-151.090690690691,-150.749299299299,-150.407907907908,-150.066516516517,-149.725125125125,-149.383733733734,-149.042342342342,-148.700950950951,-148.35955955956,-148.018168168168,-147.676776776777,-147.335385385385,-146.993993993994,-146.652602602603,-146.311211211211,-145.96981981982,-145.628428428428,-145.287037037037,-144.945645645646,-144.604254254254,-144.262862862863,-143.921471471471,-143.58008008008,-143.238688688689,-142.897297297297,-142.555905905906,-142.214514514515,-141.873123123123,-141.531731731732,-141.19034034034,-140.848948948949,-140.507557557558,-140.166166166166,-139.824774774775,-139.483383383383,-139.141991991992,-138.800600600601,-138.459209209209,-138.117817817818,-137.776426426426,-137.435035035035,-137.093643643644,-136.752252252252,-136.410860860861,-136.069469469469,-135.728078078078,-135.386686686687,-135.045295295295,-134.703903903904,-134.362512512513,-134.021121121121,-133.67972972973,-133.338338338338,-132.996946946947,-132.655555555556,-132.314164164164,-131.972772772773,-131.631381381381,-131.28998998999,-130.948598598599,-130.607207207207,-130.265815815816,-129.924424424424,-129.583033033033,-129.241641641642,-128.90025025025,-128.558858858859,-128.217467467467,-127.876076076076,-127.534684684685,-127.193293293293,-126.851901901902,-126.510510510511,-126.169119119119,-125.827727727728,-125.486336336336,-125.144944944945,-124.803553553554,-124.462162162162,-124.120770770771,-123.779379379379,-123.437987987988,-123.096596596597,-122.755205205205,-122.413813813814,-122.072422422422,-121.731031031031,-121.38963963964,-121.048248248248,-120.706856856857,-120.365465465465,-120.024074074074,-119.682682682683,-119.341291291291,-118.9998998999,-118.658508508509,-118.317117117117,-117.975725725726,-117.634334334334,-117.292942942943,-116.951551551552,-116.61016016016,-116.268768768769,-115.927377377377,-115.585985985986,-115.244594594595,-114.903203203203,-114.561811811812,-114.22042042042,-113.879029029029,-113.537637637638,-113.196246246246,-112.854854854855,-112.513463463463,-112.172072072072,-111.830680680681,-111.489289289289,-111.147897897898,-110.806506506507,-110.465115115115,-110.123723723724,-109.782332332332,-109.440940940941,-109.09954954955,-108.758158158158,-108.416766766767,-108.075375375375,-107.733983983984,-107.392592592593,-107.051201201201,-106.70980980981,-106.368418418418,-106.027027027027,-105.685635635636,-105.344244244244,-105.002852852853,-104.661461461461,-104.32007007007,-103.978678678679,-103.637287287287,-103.295895895896,-102.954504504505,-102.613113113113,-102.271721721722,-101.93033033033,-101.588938938939,-101.247547547548,-100.906156156156,-100.564764764765,-100.223373373373,-99.881981981982,-99.5405905905906,-99.1991991991992,-98.8578078078078,-98.5164164164164,-98.175025025025,-97.8336336336336,-97.4922422422423,-97.1508508508509,-96.8094594594595,-96.4680680680681,-96.1266766766767,-95.7852852852853,-95.4438938938939,-95.1025025025025,-94.7611111111111,-94.4197197197197,-94.0783283283283,-93.7369369369369,-93.3955455455456,-93.0541541541542,-92.7127627627628,-92.3713713713714,-92.02997997998,-91.6885885885886,-91.3471971971972,-91.0058058058058,-90.6644144144144,-90.323023023023,-89.9816316316316,-89.6402402402402,-89.2988488488489,-88.9574574574575,-88.6160660660661,-88.2746746746747,-87.9332832832833,-87.5918918918919,-87.2505005005005,-86.9091091091091,-86.5677177177177,-86.2263263263263,-85.8849349349349,-85.5435435435435,-85.2021521521522,-84.8607607607608,-84.5193693693694,-84.177977977978,-83.8365865865866,-83.4951951951952,-83.1538038038038,-82.8124124124124,-82.471021021021,-82.1296296296296,-81.7882382382383,-81.4468468468469,-81.1054554554555,-80.7640640640641,-80.4226726726727,-80.0812812812813,-79.7398898898899,-79.3984984984985,-79.0571071071071,-78.7157157157157,-78.3743243243243,-78.0329329329329,-77.6915415415416,-77.3501501501502,-77.0087587587588,-76.6673673673674,-76.325975975976,-75.9845845845846,-75.6431931931932,-75.3018018018018,-74.9604104104104,-74.619019019019,-74.2776276276276,-73.9362362362362,-73.5948448448449,-73.2534534534535,-72.9120620620621,-72.5706706706707,-72.2292792792793,-71.8878878878879,-71.5464964964965,-71.2051051051051,-70.8637137137137,-70.5223223223223,-70.1809309309309,-69.8395395395395,-69.4981481481482,-69.1567567567568,-68.8153653653654,-68.473973973974,-68.1325825825826,-67.7911911911912,-67.4497997997998,-67.1084084084084,-66.767017017017,-66.4256256256256,-66.0842342342342,-65.7428428428428,-65.4014514514515,-65.0600600600601,-64.7186686686687,-64.3772772772773,-64.0358858858859,-63.6944944944945,-63.3531031031031,-63.0117117117117,-62.6703203203203,-62.3289289289289,-61.9875375375375,-61.6461461461462,-61.3047547547548,-60.9633633633634,-60.621971971972,-60.2805805805806,-59.9391891891892,-59.5977977977978,-59.2564064064064,-58.915015015015,-58.5736236236236,-58.2322322322322,-57.8908408408409,-57.5494494494495,-57.2080580580581,-56.8666666666667,-56.5252752752753,-56.1838838838839,-55.8424924924925,-55.5011011011011,-55.1597097097097,-54.8183183183183,-54.4769269269269,-54.1355355355355,-53.7941441441442,-53.4527527527528,-53.1113613613614,-52.76996996997,-52.4285785785786,-52.0871871871872,-51.7457957957958,-51.4044044044044,-51.063013013013,-50.7216216216216,-50.3802302302302,-50.0388388388388,-49.6974474474475,-49.3560560560561,-49.0146646646647,-48.6732732732733,-48.3318818818819,-47.9904904904905,-47.6490990990991,-47.3077077077077,-46.9663163163163,-46.6249249249249,-46.2835335335335,-45.9421421421421,-45.6007507507508,-45.2593593593594,-44.917967967968,-44.5765765765766,-44.2351851851852,-43.8937937937938,-43.5524024024024,-43.211011011011,-42.8696196196196,-42.5282282282282,-42.1868368368368,-41.8454454454454,-41.5040540540541,-41.1626626626627,-40.8212712712713,-40.4798798798799,-40.1384884884885,-39.7970970970971,-39.4557057057057,-39.1143143143143,-38.7729229229229,-38.4315315315315,-38.0901401401401,-37.7487487487488,-37.4073573573574,-37.065965965966,-36.7245745745746,-36.3831831831832,-36.0417917917918,-35.7004004004004,-35.359009009009,-35.0176176176176,-34.6762262262262,-34.3348348348349,-33.9934434434435,-33.6520520520521,-33.3106606606607,-32.9692692692693,-32.6278778778779,-32.2864864864865,-31.9450950950951,-31.6037037037037,-31.2623123123123,-30.9209209209209,-30.5795295295295,-30.2381381381381,-29.8967467467467,-29.5553553553554,-29.213963963964,-28.8725725725726,-28.5311811811812,-28.1897897897898,-27.8483983983984,-27.507007007007,-27.1656156156156,-26.8242242242242,-26.4828328328328,-26.1414414414415,-25.8000500500501,-25.4586586586587,-25.1172672672673,-24.7758758758759,-24.4344844844845,-24.0930930930931,-23.7517017017017,-23.4103103103103,-23.0689189189189,-22.7275275275275,-22.3861361361361,-22.0447447447447,-21.7033533533534,-21.361961961962,-21.0205705705706,-20.6791791791792,-20.3377877877878,-19.9963963963964,-19.655005005005,-19.3136136136136,-18.9722222222222,-18.6308308308308,-18.2894394394394,-17.9480480480481,-17.6066566566567,-17.2652652652653,-16.9238738738739,-16.5824824824825,-16.2410910910911,-15.8996996996997,-15.5583083083083,-15.2169169169169,-14.8755255255255,-14.5341341341341,-14.1927427427428,-13.8513513513514,-13.50995995996,-13.1685685685686,-12.8271771771772,-12.4857857857858,-12.1443943943944,-11.803003003003,-11.4616116116116,-11.1202202202202,-10.7788288288288,-10.4374374374374,-10.096046046046,-9.75465465465467,-9.41326326326327,-9.07187187187188,-8.73048048048048,-8.38908908908908,-8.04769769769771,-7.70630630630632,-7.36491491491492,-7.02352352352352,-6.68213213213212,-6.34074074074076,-5.99934934934936,-5.65795795795796,-5.31656656656656,-4.97517517517517,-4.6337837837838,-4.2923923923924,-3.951001001001,-3.60960960960961,-3.26821821821821,-2.92682682682684,-2.58543543543544,-2.24404404404405,-1.90265265265265,-1.56126126126125,-1.21986986986988,-0.878478478478485,-0.537087087087087,-0.19569569569569,0.145695695695679,0.487087087087076,0.828478478478473,1.16986986986987,1.51126126126127,1.85265265265264,2.19404404404403,2.53543543543543,2.87682682682683,3.21821821821823,3.55960960960959,3.90100100100099,4.24239239239239,4.58378378378379,4.92517517517518,5.26656656656655,5.60795795795795,5.94934934934935,6.29074074074074,6.63213213213214,6.97352352352351,7.31491491491491,7.65630630630631,7.9976976976977,8.3390890890891,8.68048048048047,9.02187187187187,9.36326326326326,9.70465465465466,10.046046046046,10.3874374374374,10.7288288288288,11.0702202202202,11.4116116116116,11.753003003003,12.0943943943944,12.4357857857858,12.7771771771772,13.1185685685686,13.4599599599599,13.8013513513513,14.1427427427427,14.4841341341341,14.8255255255255,15.1669169169169,15.5083083083083,15.8496996996997,16.1910910910911,16.5324824824825,16.8738738738739,17.2152652652653,17.5566566566567,17.8980480480481,18.2394394394395,18.5808308308308,18.9222222222222,19.2636136136136,19.605005005005,19.9463963963964,20.2877877877878,20.6291791791792,20.9705705705706,21.311961961962,21.6533533533533,21.9947447447447,22.3361361361361,22.6775275275275,23.0189189189189,23.3603103103103,23.7017017017017,24.0430930930931,24.3844844844845,24.7258758758759,25.0672672672673,25.4086586586587,25.75005005005,26.0914414414414,26.4328328328328,26.7742242242242,27.1156156156156,27.457007007007,27.7983983983984,28.1397897897898,28.4811811811812,28.8225725725726,29.163963963964,29.5053553553554,29.8467467467467,30.1881381381381,30.5295295295295,30.8709209209209,31.2123123123123,31.5537037037037,31.8950950950951,32.2364864864865,32.5778778778779,32.9192692692693,33.2606606606606,33.602052052052,33.9434434434434,34.2848348348348,34.6262262262262,34.9676176176176,35.309009009009,35.6504004004004,35.9917917917918,36.3331831831832,36.6745745745746,37.015965965966,37.3573573573574,37.6987487487488,38.0401401401402,38.3815315315315,38.7229229229229,39.0643143143143,39.4057057057057,39.7470970970971,40.0884884884885,40.4298798798799,40.7712712712713,41.1126626626627,41.454054054054,41.7954454454454,42.1368368368368,42.4782282282282,42.8196196196196,43.161011011011,43.5024024024024,43.8437937937938,44.1851851851852,44.5265765765766,44.867967967968,45.2093593593594,45.5507507507508,45.8921421421421,46.2335335335335,46.5749249249249,46.9163163163163,47.2577077077077,47.5990990990991,47.9404904904905,48.2818818818819,48.6232732732733,48.9646646646647,49.3060560560561,49.6474474474474,49.9888388388388,50.3302302302302,50.6716216216216,51.013013013013,51.3544044044044,51.6957957957958,52.0371871871872,52.3785785785786,52.71996996997,53.0613613613613,53.4027527527527,53.7441441441441,54.0855355355355,54.4269269269269,54.7683183183183,55.1097097097097,55.4511011011011,55.7924924924925,56.1338838838839,56.4752752752753,56.8166666666667,57.1580580580581,57.4994494494495,57.8408408408408,58.1822322322322,58.5236236236236,58.865015015015,59.2064064064064,59.5477977977978,59.8891891891892,60.2305805805806,60.571971971972,60.9133633633634,61.2547547547547,61.5961461461461,61.9375375375375,62.2789289289289,62.6203203203203,62.9617117117117,63.3031031031031,63.6444944944945,63.9858858858859,64.3272772772773,64.6686686686687,65.0100600600601,65.3514514514515,65.6928428428429,66.0342342342342,66.3756256256256,66.717017017017,67.0584084084084,67.3997997997998,67.7411911911912,68.0825825825826,68.423973973974,68.7653653653654,69.1067567567568,69.4481481481481,69.7895395395395,70.1309309309309,70.4723223223223,70.8137137137137,71.1551051051051,71.4964964964965,71.8378878878879,72.1792792792793,72.5206706706707,72.8620620620621,73.2034534534534,73.5448448448448,73.8862362362362,74.2276276276276,74.569019019019,74.9104104104104,75.2518018018018,75.5931931931932,75.9345845845846,76.275975975976,76.6173673673674,76.9587587587588,77.3001501501502,77.6415415415415,77.9829329329329,78.3243243243243,78.6657157157157,79.0071071071071,79.3484984984985,79.6898898898899,80.0312812812813,80.3726726726727,80.7140640640641,81.0554554554554,81.3968468468468,81.7382382382382,82.0796296296296,82.421021021021,82.7624124124124,83.1038038038038,83.4451951951952,83.7865865865866,84.127977977978,84.4693693693694,84.8107607607608,85.1521521521522,85.4935435435435,85.8349349349349,86.1763263263263,86.5177177177177,86.8591091091091,87.2005005005005,87.5418918918919,87.8832832832833,88.2246746746747,88.5660660660661,88.9074574574574,89.2488488488489,89.5902402402402,89.9316316316317,90.273023023023,90.6144144144144,90.9558058058058,91.2971971971972,91.6385885885886,91.97997997998,92.3213713713714,92.6627627627628,93.0041541541542,93.3455455455455,93.6869369369369,94.0283283283283,94.3697197197197,94.7111111111111,95.0525025025025,95.3938938938939,95.7352852852853,96.0766766766767,96.4180680680681,96.7594594594594,97.1008508508509,97.4422422422422,97.7836336336337,98.125025025025,98.4664164164164,98.8078078078078,99.1491991991992,99.4905905905906,99.831981981982,100.173373373373,100.514764764765,100.856156156156,101.197547547548,101.538938938939,101.88033033033,102.221721721722,102.563113113113,102.904504504505,103.245895895896,103.587287287287,103.928678678679,104.27007007007,104.611461461461,104.952852852853,105.294244244244,105.635635635636,105.977027027027,106.318418418418,106.65980980981,107.001201201201,107.342592592593,107.683983983984,108.025375375375,108.366766766767,108.708158158158,109.04954954955,109.390940940941,109.732332332332,110.073723723724,110.415115115115,110.756506506507,111.097897897898,111.439289289289,111.780680680681,112.122072072072,112.463463463463,112.804854854855,113.146246246246,113.487637637638,113.829029029029,114.17042042042,114.511811811812,114.853203203203,115.194594594595,115.535985985986,115.877377377377,116.218768768769,116.56016016016,116.901551551552,117.242942942943,117.584334334334,117.925725725726,118.267117117117,118.608508508509,118.9498998999,119.291291291291,119.632682682683,119.974074074074,120.315465465465,120.656856856857,120.998248248248,121.33963963964,121.681031031031,122.022422422422,122.363813813814,122.705205205205,123.046596596597,123.387987987988,123.729379379379,124.070770770771,124.412162162162,124.753553553554,125.094944944945,125.436336336336,125.777727727728,126.119119119119,126.460510510511,126.801901901902,127.143293293293,127.484684684685,127.826076076076,128.167467467467,128.508858858859,128.85025025025,129.191641641642,129.533033033033,129.874424424424,130.215815815816,130.557207207207,130.898598598599,131.23998998999,131.581381381381,131.922772772773,132.264164164164,132.605555555556,132.946946946947,133.288338338338,133.62972972973,133.971121121121,134.312512512513,134.653903903904,134.995295295295,135.336686686687,135.678078078078,136.019469469469,136.360860860861,136.702252252252,137.043643643644,137.385035035035,137.726426426426,138.067817817818,138.409209209209,138.750600600601,139.091991991992,139.433383383383,139.774774774775,140.116166166166,140.457557557558,140.798948948949,141.14034034034,141.481731731732,141.823123123123,142.164514514515,142.505905905906,142.847297297297,143.188688688689,143.53008008008,143.871471471471,144.212862862863,144.554254254254,144.895645645646,145.237037037037,145.578428428428,145.91981981982,146.261211211211,146.602602602603,146.943993993994,147.285385385385,147.626776776777,147.968168168168,148.30955955956,148.650950950951,148.992342342342,149.333733733734,149.675125125125,150.016516516517,150.357907907908,150.699299299299,151.040690690691,151.382082082082,151.723473473473,152.064864864865,152.406256256256,152.747647647648,153.089039039039,153.43043043043,153.771821821822,154.113213213213,154.454604604605,154.795995995996,155.137387387387,155.478778778779,155.82017017017,156.161561561562,156.502952952953,156.844344344344,157.185735735736,157.527127127127,157.868518518518,158.20990990991,158.551301301301,158.892692692693,159.234084084084,159.575475475475,159.916866866867,160.258258258258,160.59964964965,160.941041041041,161.282432432432,161.623823823824,161.965215215215,162.306606606607,162.647997997998,162.989389389389,163.330780780781,163.672172172172,164.013563563564,164.354954954955,164.696346346346,165.037737737738,165.379129129129,165.720520520521,166.061911911912,166.403303303303,166.744694694695,167.086086086086,167.427477477478,167.768868868869,168.11026026026,168.451651651652,168.793043043043,169.134434434434,169.475825825826,169.817217217217,170.158608608609,170.5] diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected1.json b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected1.json new file mode 100644 index 000000000000..9b55cb0a67d0 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected1.json @@ -0,0 +1 @@ +[0,0,0.693147180559945,1.79175946922805,3.17805383034795,4.78749174278205,6.5792512120101,8.52516136106541,10.6046029027453,12.8018274800815,15.1044125730755,17.5023078458739,19.9872144956619,22.5521638531234,25.1912211827387,27.8992713838409,30.6718601060807,33.5050734501369,36.3954452080331,39.3398841871995,42.3356164607535,45.3801388984769,48.4711813518352,51.6066755677644,54.7847293981123,58.0036052229805,61.261701761002,64.5575386270063,67.8897431371815,71.257038967168,74.6582363488302,78.0922235533153,81.557959456115,85.0544670175815,88.5808275421977,92.1361756036871,95.7196945421432,99.3306124547874,102.968198614514,106.631760260643,110.320639714757,114.034211781462,117.771881399745,121.533081515439,125.317271149357,129.123933639127,132.952575035616,136.802722637326,140.673923648234,144.565743946345,148.477766951773,152.409592584497,156.360836303079,160.331128216631,164.320112263195,168.327445448428,172.352797139163,176.395848406997,180.456291417544,184.533828861449,188.628173423672,192.739047287845,196.86618167289,201.009316399281,205.168199482641,209.342586752537,213.532241494563,217.736934113954,221.95644181913,226.190548323728,230.439043565777,234.701723442818,238.978389561834,243.268849002983,247.572914096187,251.890402209723,256.22113555001,260.564940971863,264.921649798553,269.29109765102,273.673124285694,278.067573440366,282.47429268763,286.893133295427,291.32395009427,295.766601350761,300.220948647014,304.686856765669,309.164193580147,313.652829949879,318.152639620209,322.663499126726,327.185287703775,331.717887196928,336.261181979198,340.815058870799,345.379407062267,349.95411804077,354.539085519441,359.134205369575,363.739375555563,368.354496072405,372.979468885689,377.614197873919,382.25858877306,386.912549123218,391.57598821733,396.248817051791,400.930948278916,405.622296161145,410.322776526937,415.03230672825,419.750805599545,424.478193418257,429.214391866652,433.959323995015,438.712914186121,443.475088120919,448.245772745385,453.024896238496,457.812387981278,462.608178526875,467.412199571608,472.224383926981,477.044665492586,481.872979229888,486.709261136839,491.553448223298,496.405478487218,501.265290891579,506.132825342035,511.008022665236,515.890824587823,520.781173716044,525.679013515995,530.584288294434,535.49694318017,540.416924105998,545.344177791155,550.278651724286,555.220294146895,560.169054037273,565.124881094874,570.087725725134,575.05753902471,580.034272767131,585.017879388839,590.008311975618,595.005524249382,600.009470555327,605.020105849424,610.037385686239,615.061266207085,620.091704128477,625.128656730891,630.17208184781,635.22193785506,640.278183660408,645.340778693435,650.409682895655,655.484856710889,660.566261075874,665.653857411106,670.747607611913,675.847474039737,680.953419513638,686.065407301994,691.183401114411,696.307365093814,701.437263808737,706.573062245787] diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected2.json b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected2.json new file mode 100644 index 000000000000..d2109d782c61 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/expected2.json @@ -0,0 +1 @@ +[-708.24313562762,-706.0052418387,-703.842565120593,-702.98904108446,-700.636983917122,-698.739058277586,-697.735304275731,-695.255519170722,-693.615717940444,-692.482000714991,-689.855232541798,-688.478582438882,-687.229139316134,-684.427143592678,-683.33166117758,-681.976661044856,-678.955594527905,-678.177748458703,-676.724434285623,-673.409475796886,-673.018864738297,-671.472246443799,-667.711560506726,-667.856512702183,-666.219790871918,-661.545473722192,-662.691833996347,-660.966647602287,-655.805476160054,-657.525709284142,-655.712255442213,-651.907572323237,-652.358824276659,-650.455871491627,-647.254292760232,-647.191714408489,-645.196511605176,-642.40970975862,-642.024795560589,-639.932860813943,-637.47766150581,-636.858385300828,-634.663134310212,-632.496541359493,-631.692717404632,-629.384852982469,-627.484855244878,-626.527951374964,-624.094462373561,-622.452956337526,-621.364178008316,-618.7866433314,-617.407225691611,-616.201421587167,-613.452957164236,-612.351873583682,-611.03963892037,-608.078866748351,-607.28982144065,-605.878715133278,-602.636038486889,-602.223175462698,-600.718455772474,-597.056578694477,-597.153499454225,-595.558574373993,-591.087749622921,-592.081980836536,-590.398674064869,-584.863264478014,-587.009536141921,-585.238220891481,-581.365304531303,-581.936880382986,-580.076505160688,-576.846493487845,-576.864573866965,-574.912584706423,-572.112558065392,-571.793054343546,-569.745199803568,-567.284378282531,-566.722659233828,-564.572641678922,-562.404551983031,-561.653640867878,-559.392541330006,-557.493129557774,-556.586176553371,-554.201513445721,-552.56116879096,-551.520374590576,-548.994517769056,-547.615421080477,-546.456276863777,-543.763618180218,-542.660312475229,-541.39385827113,-538.495297062155,-537.698900715083,-536.333022933641,-533.163676455982,-532.733384124177,-531.273596792162,-527.708720046109,-527.765392531213,-526.215315798843,-521.92432610018,-522.796163229404,-521.157808356184,-514.974603271628,-517.826652261498,-516.10056982666,-512.153021696236,-512.857607327226,-511.042925611208,-507.784805085825,-507.889616853615,-505.9839770737,-503.17265505268,-502.923143639832,-500.92252068885,-498.458666360042,-497.958548120274,-495.856923604014,-493.690294414494,-492.996104348763,-490.784924815715,-488.889314292576,-488.03601063535,-485.703302116622,-484.067555807949,-483.078396022837,-480.607279742633,-479.232171826886,-478.12332328442,-475.489390001886,-474.387821198675,-473.170788745717,-470.337046578101,-469.537708778266,-468.220718910573,-465.126554271377,-464.684132805873,-463.272963542564,-459.804547770728,-459.828795378745,-458.327284463985,-454.200171682456,-454.972989081553,-453.383338804768,-443.81507753966,-450.117714445507,-448.440654646665,-444.410560002097,-445.263756609151,-443.498595760287,-440.213052396502,-440.411736771832,-438.556310052552,-435.736236701945,-435.562147414259,-433.612652710604,-431.149048518017,-430.715376646416,-428.666068376969,-426.50458990605,-425.871724972283,-423.714403835744,-421.826569135389,-421.031416518084,-418.754596226971,-417.127664795626,-416.194605986469,-413.782123001361,-412.415466827708,-411.361382071284,-408.789956031929,-407.694886856614,-406.531767678211,-403.76636418263,-402.969290058012,-401.705716969386,-398.689602494377,-398.241084592632,-396.883108926011,-393.512014267843,-393.512053235304,-392.063736744117,-388.090038065993,-388.783551464715,-387.247291871485,-381.066390617164,-384.056631513508,-382.433340746753,-378.310668452761,-379.332123017067,-377.621291125647,-374.309579058157,-374.610686990127,-372.810342929985,-369.984943995775,-369.892852711187,-367.999415171026,-365.540323307425,-365.179043213921,-363.18703433826,-361.0354277749,-360.469592873519,-358.371157821324,-356.496141885251,-355.764759256615,-353.548881795606,-351.936081447972,-351.064730576317,-348.715929910855,-347.36331520169,-346.36962954223,-343.86569097247,-342.78303195444,-341.679513993797,-338.987225042905,-338.198774295808,-336.994374373824,-334.060540411844,-333.61307405577,-332.31412777759,-329.042903289337,-329.027806860732,-327.63860794423,-323.812313975169,-324.444402548516,-322.967550070566,-317.540768018703,-319.86397626802,-318.300568617913,-314.072205203744,-315.287413377107,-313.637125173067,-310.30141391239,-310.715426101797,-308.976481596642,-306.150494884375,-306.148592189186,-304.317630536216,-301.86875058819,-301.587381616176,-299.65918967136,-297.523685701227,-297.032175053504,-294.9992351731,-293.143647094159,-292.48327638286,-290.33502781995,-288.743291811715,-287.940920691844,-285.662537214021,-284.331218296466,-283.405278594207,-280.975555132023,-279.912924350659,-278.87645730791,-276.263882787428,-275.492154016584,-274.354498586901,-271.509118247128,-271.071583493409,-269.839373282893,-266.672808393715,-266.653200584196,-265.330971953808,-261.650279745395,-262.238528399496,-260.829090468166,-255.865217288529,-257.828764024698,-256.33340887989,-251.98149766121,-253.424867971992,-251.8434608008,-248.487453085667,-249.027623719308,-247.358588782658,-244.538800948562,-244.637678272099,-242.877878275764,-240.447129641815,-240.255570199271,-238.400057433986,-236.289215998862,-235.881749068455,-233.923340006784,-232.096211706117,-231.516588715594,-229.445168411429,-227.883941974607,-227.160395861483,-224.961770625895,-223.661601628179,-222.813414983118,-220.467342226599,-219.435043390793,-218.475829918166,-215.952395341183,-215.208250812871,-214.147762338308,-211.399991005722,-210.984079638673,-209.829266908606,-206.775438147648,-206.764664362855,-205.520322598623,-201.988203845016,-202.551656335578,-201.220819161393,-196.610541809846,-198.346370627036,-196.930537154036,-192.429358776143,-194.149880437333,-192.649118884618,-189.279234714966,-189.963079809503,-188.376026059053,-185.572640227503,-185.786726341493,-184.110477152065,-181.709452453006,-181.621470766892,-179.851352608746,-177.777594175725,-177.467877571617,-175.597046734107,-173.811444181384,-173.32643922845,-171.345226691701,-169.828162606431,-169.197585656294,-167.092419644224,-165.837639844199,-165.081689876838,-162.83325741502,-161.846161301505,-160.979070396188,-158.558970275967,-157.858021167381,-156.889990489866,-154.25400867894,-153.876324992572,-152.814654251451,-149.887049040997,-149.903426010676,-148.753198921418,-145.37929033327,-145.94117909377,-144.705682579808,-140.40029927317,-141.991096757967,-140.67206567494,-135.98140090713,-138.054449259053,-136.652183925703,-133.280081616066,-134.132331123204,-132.645708622123,-129.875188894221,-130.225706634701,-128.652087780257,-126.299092015527,-126.335441606121,-124.670457039996,-122.65329470585,-122.46232586411,-120.699500658412,-118.9759607477,-118.607089197354,-116.73722606475,-115.285841904069,-114.770412483212,-112.780579695569,-111.593709067575,-110.952935045456,-108.824749595558,-107.906448111727,-107.155258835428,-104.861790084725,-104.228832154275,-103.377949674716,-100.87758631866,-100.564392711878,-99.6215354818869,-96.8439709851641,-96.9158897701794,-95.8865010722868,-92.6921279429136,-93.2855843838598,-92.1732787067652,-88.1597007346231,-89.675406240005,-88.4822329875486,-83.5302509925101,-86.0870618316405,-84.8136378220592,-81.4625215717122,-82.5221073564656,-81.1676417613477,-78.4597502819831,-78.9819998070978,-77.5442156283865,-75.2718829632466,-75.4681341304233,-73.9430721178823,-72.017345791969,-71.9818712494432,-70.3635391797867,-68.7389818547371,-68.5245599626133,-66.8043535347322,-65.4576935470957,-65.0975546677353,-63.2633082098164,-62.1856415575574,-61.7022301885998,-59.7366141178073,-58.9308411739321,-58.3399945411384,-56.2176495625198,-55.6991195221764,-55.0123001607198,-52.6942351651302,-52.4950711638699,-51.7206538572202,-49.1417088327388,-49.3225755325301,-48.4666255175119,-45.5004661766306,-46.1851024397446,-45.2518552827463,-41.5586722013471,-43.085907531562,-42.0780585194005,-36.698889711974,-40.028168016727,-38.9470272656553,-35.6726009216095,-37.0150856517153,-35.8606257689586,-33.2820483751482,-34.0499727306093,-32.8207758607365,-30.7024259043216,-31.1363312595611,-29.8294244938489,-28.074782265379,-28.2779328447301,-26.8884792363701,-25.4493139306941,-25.4789058797454,-23.9996844094355,-22.851662505273,-22.7438369009302,-21.1643826490218,-20.2983198543778,-20.0778944216756,-18.3830426800152,-17.8019222403853,-17.4869864439179,-15.6542727933017,-15.3735815428602,-14.9779678957964,-12.9725785931691,-13.024165344369,-12.5589229228908,-10.3225542895131,-10.76519577749,-10.2395621805789,-7.66022270380137,-8.6096751497451,-8.03180305717123,-4.8219483908833,-6.57304994664814,-5.95065429910065,0.759505674965929,-4.67455428662645,-4.01563707750267,-1.04826856867839,-2.93933714342887,-2.25322387181986,-0.0846143622323258,-1.40222292367738,-0.701407433676224,0.923138998038882,-0.115225813466852,0.580618058528916,1.73989489151408,0.834695032013229,1.48766931600594,2.17856435935493,1.27032586274654,1.77912162965342,1.8584665162817,0.598137153881244,0.125493523165651,-0.0760831504355754,-0.120312236894024,-0.0550692787346708,0.0937158523028068,0.309905658902866,0.582529976403065,0.903662550281847,1.26731548682091,1.66880904964184,2.10438693456189,2.57096845033915,3.0659818408901,3.58724813009757,4.13289773529161,4.70130907715801,5.2910623942531,5.90090433673316,6.52972037242922,7.17651296597155,7.8403840980344,8.52052109793887,9.2161850408851,9.9267011551539,10.6514508224792,11.3898648542962,12.1414177994427,12.9056230929679,13.6820288963284,14.4702145101129,15.2697872641303,16.0803798080537,16.9016477401769,17.7332675231603,18.5749346446424,19.4263619877996,20.2872783827425,21.157427314348,22.0365657659753,22.9244631816637,23.8209005320246,24.7256694711937,25.6385715740155,26.5594176441403,27.4880270849819,28.4242273265591,29.3678533021504,30.3187469694665,31.2767568717087,32.2417377344428,33.2135500947113,34.1920599592251,35.1771384888389,36.1686617068336,37.1665102287999,38.1705690121636,39.180727123597,40.1968775227486,41.218916860886,42.2467452931868,43.2802663035422,44.3193865408473,45.3640156658517,46.4140662077321,47.4694534296302,48.5300952024622,49.5959118863771,50.6668262192915,51.7427632119801,52.8236500492482,53.9094159967515,54.9999923130645,56.0953121666353,57.1953105572889,58.2999242419754,59.409091664477,60.5227528888153,61.6408495361182,62.7633247247236,63.8901230133167,65.0211903469105,66.1564740054934,67.2959225551828,68.439485801732,69.5871147462519,70.7387615430155,71.8943794592269,73.0539228366378,74.2173470549107,75.384608496628,76.5556645138563,77.730473396181,78.9089943401302,80.0911874199143,81.2770135594107,82.4664345053279,83.6594128014885,84.8559117641721,86.0558954584651,87.259328675566,88.4661769109987,89.676406343689,90.8899838158608,92.106876813714,93.3270534488454,94.5504824403771,95.7771330977601,97.0069753042201,98.2399795008167,99.4761166710879,100.715358326253,101.957676490947,103.20304368947,104.451432932517,105.702817704373,106.957171950564,108.214470065919,109.474686883052,110.73779766123,112.003778075611,113.272604206851,114.544252531045,115.818699910002,117.095923581836,118.375901151861,119.658610583778,120.944030191135,122.23213862907,123.522914886296,124.816338277347,126.112388435056,127.411045303265,128.712289129756,130.016100459392,131.322460127467,132.631349253251,133.942749233723,135.256641737491,136.573008698885,137.891832312219,139.213095026225,140.536779538632,141.862868790909,143.19134596315,144.522194469101,145.855397951325,147.190940276502,148.52880553085,149.86897801568,151.211442243059,152.556182931597,153.903185002343,155.252433574788,156.603913962975,157.957611671705,159.31351239285,160.671602001747,162.0318665537,163.394292280557,164.758865587382,166.125573049201,167.494401407843,168.865337568843,170.238368598432,171.613481720598,172.990664314214,174.369903910242,175.751188188998,177.134504977484,178.519842246787,179.907188109534,181.296530817407,182.687858758719,184.081160456046,185.476424563907,186.873639866508,188.272795275524,189.673879827946,191.076882683961,192.481793124892,193.888600551179,195.2972944804,196.707864545345,198.120300492122,199.534592178315,200.95072957117,202.368702745831,203.788501883605,205.210117270271,206.633539294419,208.058758445825,209.485765313868,210.914550585967,212.345105046058,213.777419573104,215.21148513963,216.647292810293,218.084833740478,219.524099174921,220.965080446365,222.407768974238,223.85215626336,225.298233902673,226.745993563999,228.195427000821,229.646526047088,231.099282616042,232.553688699068,234.00973636457,235.467417756863,236.926725095086,238.387650672145,239.850186853662,241.314326076954,242.780060850026,244.247383750589,245.716287425085,247.186764587742,248.658808019639,250.132410567791,251.607565144247,253.084264725211,254.562502350172,256.042271121055,257.523564201382,259.006374815453,260.490696247537,261.976521841081,263.46384499793,264.952659177564,266.442957896343,267.934734726771,269.427983296768,270.922697288957,272.418870439965,273.916496539728,275.415569430819,276.916083007778,278.418031216458,279.921408053381,281.426207565106,282.932423847602,284.44005104564,285.949083352186,287.459515007813,288.971340300115,290.484553563133,291.999149176794,293.515121566352,295.032465201846,296.551174597557,298.071244311485,299.592668944824,301.115443141454,302.639561587432,304.165019010498,305.69181017959,307.219929904355,308.749373034684,310.280134460239,311.812209109999,313.345591951807,314.88027799192,316.416262274579,317.953539881571,319.492105931806,321.0319555809,322.57308402076,324.115486479176,325.659158219427,327.204094539881,328.750290773608,330.297742288,331.846444484389,333.39639279768,334.947582695979,336.50000968024,338.053669283902,339.608557072542,341.164668643529,342.721999625682,344.280545678936,345.840302494009,347.401265792079,348.963431324457,350.526794872274,352.091352246169,353.657099285974,355.224031860419,356.792145866824,358.361437230807,359.931901905992,361.503535873723,363.076335142775,364.650295749078,366.225413755442,367.801685251279,369.379106352341,370.957673200451,372.53738196324,374.118228833893,375.70021003089,377.283321797761,378.867560402829,380.452922138973,382.039403323382,383.62700029732,385.215709425888,386.805527097791,388.396449725115,389.98847374309,391.58159560988,393.175811806349,394.771118835855,396.367513224026,397.964991518554,399.563550288982,401.163186126501,402.763895643739,404.365675474569,405.968522273899,407.572432717484,409.177403501728,410.783431343493,412.390512979909,413.998645168187,415.607824685435,417.218048328474,418.829312913659,420.441615276701,422.054952272489,423.669320774919,425.284717676721,426.901139889287,428.518584342507,430.137047984603,431.756527781961,433.377020718976,434.998523797885,436.621034038615,438.244548478625,439.869064172749,441.494578193047,443.121087628654,444.748589585628,446.377081186809,448.006559571665,449.637021896157,451.268465332588,452.900887069472,454.534284311386,456.16865427884,457.803994208136,459.440301351237,461.077572975631,462.715806364206,464.354998815112,465.995147641639,467.636250172087,469.278303749641,470.92130573225,472.565253492499,474.210144417491,475.855975908728,477.502745381989,479.150450267216,480.799088008394,482.448656063442,484.099151904091,485.750573015781,487.402916897545,489.056181061896,490.710363034725,492.36546035519,494.021470575609,495.678391261355,497.336219990753,498.994954354976,500.654591957944,502.315130416221,503.976567358917,505.63890042759,507.302127276144,508.966245570739,510.631252989688,512.297147223369,513.963925974124,515.631586956175,517.300127895523,518.969546529864,520.639840608497,522.311007892232,523.983046153306,525.655953175296,527.329726753026,529.004364692492,530.679864810768,532.356224935927,534.033442906957,535.711516573681,537.39044379667,539.07022244717,540.750850407017,542.43232556856,544.114645834582,545.797809118225,547.481813342912,549.166656442269,550.852336360055,552.538851050082,554.226198476147,555.914376611953,557.603383441045,559.293216956728,560.983875162007,562.675356069508,564.367657701416,566.060778089398,567.754715274546,569.449467307297,571.145032247376,572.841408163725,574.538593134438,576.2365852467,577.935382596715,579.634983289649,581.335385439566,583.03658716936,584.738586610703,586.441381903972,588.144971198197,589.849352650999,591.554524428527,593.260484705402,594.967231664658,596.674763497682,598.383078404159,600.092174592015,601.802050277359,603.512703684426,605.224133045525,606.936336600984,608.649312599089,610.36305929604,612.07757495589,613.792857850495,615.508906259462,617.225718470094,618.943292777344,620.661627483757,622.380720899424,624.100571341931,625.82117713631,627.542536614985,629.264648117731,630.987509991618,632.711120590968,634.435478277305,636.160581419308,637.886428392766,639.613017580529,641.340347372464,643.068416165408,644.797222363126,646.526764376261,648.257040622292,649.988049525496,651.719789516891,653.452259034206,655.18545652183,656.919380430774,658.654029218626,660.389401349509,662.125495294043,663.8623095293,665.599842538765,667.338092812295,669.07705884608,670.816739142603,672.557132210598,674.298236565016,676.040050726981,677.782573223755,679.525802588697,681.26973736123,683.014376086799,684.759717316833,686.505759608714,688.252501525734,689.999941637063,691.748078517712,693.496910748495,695.246436915996,696.996655612536,698.747565436131,700.499164990465,702.251452884853,704.004427734205] diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/runner.R b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/runner.R new file mode 100644 index 000000000000..1f4c5028457e --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/fixtures/r/runner.R @@ -0,0 +1,117 @@ +#!/usr/bin/env Rscript +# +# @license Apache-2.0 +# +# Copyright (c) 2018 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. + +# Set the precision to 16 digits: +options( digits = 16L ); + +#' Generate test fixtures. +#' +#' @examples +#' main(); +main <- function() { + #' Get the script filepath. + #' + #' @return The absolute path of this script + #' + #' @examples + #' filepath <- get_script_path(); + get_script_path <- function() { + args <- commandArgs( trailingOnly = FALSE ); + needle <- '--file='; + match <- grep( needle, args ); + if ( length( match ) > 0.0 ) { + # Rscript: + filepath <- sub( needle, '', args[match] ); + } else { + ls_vars <- ls( sys.frames()[[1L]] ) + if ( 'fileName' %in% ls_vars ) { + # Source'd via RStudio: + filepath <- sys.frames()[[1L]][['fileName']]; # nolint + } else { + # Source'd via R console: + filepath <- sys.frames()[[1L]][['ofile']]; + } + } + return( normalizePath( filepath ) ); + } + + #' Convert a data structure to JSON. + #' + #' @param x A data structure to convert + #' @return JSON blob + #' + #' @examples + #' x <- seq( -6.5, 25, 0.5 ); + #' json <- to_json( x ); + to_json <- function( x ) { + return( jsonlite::toJSON( x, digits = 16L, auto_unbox = TRUE ) ); + } + + #' Generate an output absolute filepath based on the script directory. + #' + #' @param name An output filename + #' @return An absolute filepath + #' + #' @examples + #' filepath <- get_filepath( "data.json" ); + get_filepath <- function( name ) { + return( paste( source_dir, '/', name, sep = '' ) ); + } + + # Get the directory of this script: + source_dir <- dirname( get_script_path() ); + + # Generate integer test data: + x <- seq( 1L, 171L, 1L ); + y <- lgamma( x ); + + # Deal with NaNs: + cat( y, sep = ',\n' ); + + # Convert fixture data to JSON: + x <- to_json( x ); + y <- to_json( y ); + + # Write the data to file... + filepath <- get_filepath( 'data1.json' ); + write( x, filepath ); + + filepath <- get_filepath( 'expected1.json' ); + write( y, filepath ); + + + # Generate decimal test data: + x <- seq( -170.55, 170.5, length.out = 1000L ) + y <- lgamma( x ) + + # Deal with NaNs: + cat( y, sep = ',\n' ); + + # Convert fixture data to JSON: + x <- to_json( x ); + y <- to_json( y ); + + # Write the data to file... + filepath <- get_filepath( 'data2.json' ); + write( x, filepath ); + + filepath <- get_filepath( 'expected2.json' ); + write( y, filepath ); +} + +main(); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.js new file mode 100644 index 000000000000..2f7c8e3f57b9 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.js @@ -0,0 +1,159 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var ln = require( '@stdlib/math/base/special/ln' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var absgammaln = require( './../lib' ); + + +// FIXTURES // + +var data1 = require( './fixtures/r/data1.json' ); +var expected1 = require( './fixtures/r/expected1.json' ); +var data2 = require( './fixtures/r/data2.json' ); +var expected2 = require( './fixtures/r/expected2.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof absgammaln, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) { + var v = absgammaln( NaN ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `infinity` when provided `infinity`', function test( t ) { + var v = absgammaln( PINF ); + t.strictEqual( v, PINF, 'returns expected value' ); + + v = absgammaln( NINF ); + t.strictEqual( v, NINF, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `+infinity` when provided `0`', function test( t ) { + var v = absgammaln( 0.0 ); + t.strictEqual( v, PINF, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `+infinity` for x smaller than `-2^52`', function test( t ) { + var v = absgammaln( -pow( 2.0, 53 ) ); + t.strictEqual( v, PINF, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `-ln(x)` for very small x', function test( t ) { + var x; + var v; + + x = 2.0e-90; + v = absgammaln( x ); + t.strictEqual( v, -ln( x ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function evaluates the natural logarithm of the gamma function (positive integers)', function test( t ) { + var expected; + var delta; + var tol; + var x; + var y; + var i; + + x = data1; + expected = expected1; + + for ( i = 0; i < x.length; i++ ) { + y = absgammaln( x[ i ] ); + if ( y === expected[ i ] ) { + t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 21.2 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function evaluates the natural logarithm of the gamma function (decimal values)', function test( t ) { + var expected; + var delta; + var tol; + var x; + var y; + var i; + + x = data2; + expected = expected2; + + for ( i = 0; i < x.length; i++ ) { + y = absgammaln( x[ i ] ); + if ( y === expected[ i ] ) { + t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 1.1e4 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function evaluates the natural logarithm of the gamma function for x > 2^58', function test( t ) { + var x; + var v; + + x = pow( 2.0, 59 ); + v = absgammaln( x ); + t.strictEqual( v, x * (ln(x)-1.0), 'returns x*(ln(x)-1) for x>2^58' ); + + t.end(); +}); + +tape( 'if provided a positive integer, the function returns the natural logarithm of the factorial of (n-1)', function test( t ) { + t.strictEqual( absgammaln( 4.0 ), ln(6.0), 'returns ln(6)' ); + t.strictEqual( absgammaln( 5.0 ), ln(24.0), 'returns ln(24)' ); + t.strictEqual( absgammaln( 6.0 ), ln(120.0), 'returns ln(120)' ); + t.end(); +}); + +tape( 'returns `+infinity` for `x=-2^51`', function test( t ) { + var v = absgammaln( -pow( 2.0, 51 ) ); + t.strictEqual( v, PINF, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.native.js new file mode 100644 index 000000000000..36d63bca8b65 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/absgammaln/test/test.native.js @@ -0,0 +1,168 @@ +/** +* @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 resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var ln = require( '@stdlib/math/base/special/ln' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// FIXTURES // + +var data1 = require( './fixtures/r/data1.json' ); +var expected1 = require( './fixtures/r/expected1.json' ); +var data2 = require( './fixtures/r/data2.json' ); +var expected2 = require( './fixtures/r/expected2.json' ); + + +// VARIABLES // + +var absgammaln = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( absgammaln instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof absgammaln, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { + var v = absgammaln( NaN ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `infinity` when provided `infinity`', opts, function test( t ) { + var v = absgammaln( PINF ); + t.strictEqual( v, PINF, 'returns expected value' ); + + v = absgammaln( NINF ); + t.strictEqual( v, NINF, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `+infinity` when provided `0`', opts, function test( t ) { + var v = absgammaln( 0.0 ); + t.strictEqual( v, PINF, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `+infinity` for x smaller than `-2^52`', opts, function test( t ) { + var v = absgammaln( -pow( 2.0, 53 ) ); + t.strictEqual( v, PINF, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `-ln(x)` for very small x', opts, function test( t ) { + var x; + var v; + + x = 2.0e-90; + v = absgammaln( x ); + t.strictEqual( v, -ln( x ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function evaluates the natural logarithm of the gamma function (positive integers)', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var y; + var i; + + x = data1; + expected = expected1; + + for ( i = 0; i < x.length; i++ ) { + y = absgammaln( x[ i ] ); + if ( y === expected[ i ] ) { + t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 21.2 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function evaluates the natural logarithm of the gamma function (decimal values)', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var y; + var i; + + x = data2; + expected = expected2; + + for ( i = 0; i < x.length; i++ ) { + y = absgammaln( x[ i ] ); + if ( y === expected[ i ] ) { + t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 1.1e4 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function evaluates the natural logarithm of the gamma function for x > 2^58', opts, function test( t ) { + var x; + var v; + + x = pow( 2.0, 59 ); + v = absgammaln( x ); + t.strictEqual( v, x * (ln(x)-1.0), 'returns x*(ln(x)-1) for x>2^58' ); + + t.end(); +}); + +tape( 'if provided a positive integer, the function returns the natural logarithm of the factorial of (n-1)', opts, function test( t ) { + t.strictEqual( absgammaln( 4.0 ), ln(6.0), 'returns ln(6)' ); + t.strictEqual( absgammaln( 5.0 ), ln(24.0), 'returns ln(24)' ); + t.strictEqual( absgammaln( 6.0 ), ln(120.0), 'returns ln(120)' ); + t.end(); +}); + +tape( 'returns `+infinity` for `x=-2^51`', opts, function test( t ) { + var v = absgammaln( -pow( 2.0, 51 ) ); + t.strictEqual( v, PINF, 'returns expected value' ); + t.end(); +}); From 0458ff42f0489f6c1371aeb2b9ced3d7a4f9e672 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 17 Nov 2025 09:36:33 +0530 Subject: [PATCH 2/4] remove: remove `gammaln` from namespace This commit removes the `gammaln` symbol from the `@stdlib/math/base/special` namespace due to a package migration. BREAKING CHANGE: remove `gammaln` To migrate, users should access the `absgammaln` symbol via the same namespace. --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/docs/types/index.d.ts | 37 ------------------- .../@stdlib/math/base/special/lib/index.js | 9 ----- 2 files changed, 46 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts index dc0fbb78daef..3cbbdbaf938b 100644 --- a/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/docs/types/index.d.ts @@ -204,7 +204,6 @@ import gammaLanczosSumExpgScaledf = require( '@stdlib/math/base/special/gamma-la import gamma1pm1 = require( '@stdlib/math/base/special/gamma1pm1' ); import gammainc = require( '@stdlib/math/base/special/gammainc' ); import gammaincinv = require( '@stdlib/math/base/special/gammaincinv' ); -import gammaln = require( '@stdlib/math/base/special/gammaln' ); import gammasgn = require( '@stdlib/math/base/special/gammasgn' ); import gammasgnf = require( '@stdlib/math/base/special/gammasgnf' ); import gcd = require( '@stdlib/math/base/special/gcd' ); @@ -5585,42 +5584,6 @@ interface Namespace { */ gammaincinv: typeof gammaincinv; - /** - * Evaluates the natural logarithm of the gamma function. - * - * @param x - input value - * @returns function value - * - * @example - * var v = ns.gammaln( 1.0 ); - * // returns 0.0 - * - * @example - * var v = ns.gammaln( 2.0 ); - * // returns 0.0 - * - * @example - * var v = ns.gammaln( 4.0 ); - * // returns ~1.792 - * - * @example - * var v = ns.gammaln( -0.5 ); - * // returns ~1.266 - * - * @example - * var v = ns.gammaln( 0.5 ); - * // returns ~0.572 - * - * @example - * var v = ns.gammaln( 0.0 ); - * // returns Infinity - * - * @example - * var v = ns.gammaln( NaN ); - * // returns NaN - */ - gammaln: typeof gammaln; - /** * Computes the sign of the gamma function. * diff --git a/lib/node_modules/@stdlib/math/base/special/lib/index.js b/lib/node_modules/@stdlib/math/base/special/lib/index.js index 4d2281574fe3..8afdcdbc4bff 100644 --- a/lib/node_modules/@stdlib/math/base/special/lib/index.js +++ b/lib/node_modules/@stdlib/math/base/special/lib/index.js @@ -1694,15 +1694,6 @@ setReadOnly( special, 'gammainc', require( '@stdlib/math/base/special/gammainc' */ setReadOnly( special, 'gammaincinv', require( '@stdlib/math/base/special/gammaincinv' ) ); -/** -* @name gammaln -* @memberof special -* @readonly -* @type {Function} -* @see {@link module:@stdlib/math/base/special/gammaln} -*/ -setReadOnly( special, 'gammaln', require( '@stdlib/math/base/special/gammaln' ) ); - /** * @name gammasgn * @memberof special From 047347041dcb24cde38e090aecb512991c9327aa Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 17 Nov 2025 09:59:28 +0530 Subject: [PATCH 3/4] refactor: update paths --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- docs/migration-guides/jstat/data/jstat_1_9_x.csv | 2 +- .../simple-statistics/data/simple_statistics_7_0_2.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/migration-guides/jstat/data/jstat_1_9_x.csv b/docs/migration-guides/jstat/data/jstat_1_9_x.csv index 51cb587c3587..3b02f2412332 100644 --- a/docs/migration-guides/jstat/data/jstat_1_9_x.csv +++ b/docs/migration-guides/jstat/data/jstat_1_9_x.csv @@ -224,7 +224,7 @@ betacf,(planned) ibetainv,@stdlib/math/base/special/betaincinv ibeta,@stdlib/math/base/special/betainc gammafn,@stdlib/math/base/special/gamma -gammaln,@stdlib/math/base/special/gammaln +absgammaln,@stdlib/math/base/special/absgammaln gammap,@stdlib/math/base/special/gammainc lowRegGamma,@stdlib/math/base/special/gammainc gammapinv,@stdlib/math/base/special/gammaincinv diff --git a/docs/migration-guides/simple-statistics/data/simple_statistics_7_0_2.csv b/docs/migration-guides/simple-statistics/data/simple_statistics_7_0_2.csv index cdcf6ff20451..b89aa1a68291 100644 --- a/docs/migration-guides/simple-statistics/data/simple_statistics_7_0_2.csv +++ b/docs/migration-guides/simple-statistics/data/simple_statistics_7_0_2.csv @@ -61,7 +61,7 @@ chiSquaredGoodnessOfFit,@stdlib/stats/chi2gof epsilon,@stdlib/constants/math/float64-eps factorial,@stdlib/math/base/special/factorial gamma,@stdlib/math/base/special/gamma -gammaln,@stdlib/math/base/special/gammaln +absgammaln,@stdlib/math/base/special/absgammaln uniqueCountSorted,N/A extent,@stdlib/stats/base/range extentSorted,(planned) From c2d6c5ee59d9f1e5bd69f035713e05cef6a62af2 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 17 Nov 2025 10:01:42 +0530 Subject: [PATCH 4/4] remove: remove `math/base/special/gammaln` This commit removes `@stdlib/math/base/special/gammaln` in favor of `@stdlib/math/base/special/absgammaln`. BREAKING CHANGE: remove `math/base/special/gammaln` To migrate, users should update their require/import paths to use `@stdlib/math/base/special/absgammaln` which provides the `absgammaln` API with the same 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: 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/gammaln/LICENSE | 192 ------ .../math/base/special/gammaln/README.md | 210 ------- .../special/gammaln/benchmark/benchmark.js | 52 -- .../gammaln/benchmark/benchmark.native.js | 61 -- .../base/special/gammaln/benchmark/c/Makefile | 127 ---- .../special/gammaln/benchmark/c/benchmark.c | 135 ----- .../gammaln/benchmark/c/cephes/Makefile | 114 ---- .../gammaln/benchmark/c/cephes/benchmark.c | 140 ----- .../gammaln/benchmark/c/native/Makefile | 146 ----- .../gammaln/benchmark/c/native/benchmark.c | 136 ----- .../gammaln/benchmark/cpp/boost/Makefile | 110 ---- .../gammaln/benchmark/cpp/boost/benchmark.cpp | 132 ----- .../special/gammaln/benchmark/julia/REQUIRE | 2 - .../gammaln/benchmark/julia/benchmark.jl | 144 ----- .../gammaln/benchmark/python/benchmark.py | 97 --- .../benchmark/python/scipy/benchmark.py | 97 --- .../special/gammaln/benchmark/r/DESCRIPTION | 9 - .../special/gammaln/benchmark/r/benchmark.R | 109 ---- .../math/base/special/gammaln/binding.gyp | 170 ------ .../math/base/special/gammaln/docs/repl.txt | 34 -- .../special/gammaln/docs/types/index.d.ts | 60 -- .../base/special/gammaln/docs/types/test.ts | 44 -- .../base/special/gammaln/examples/c/Makefile | 146 ----- .../base/special/gammaln/examples/c/example.c | 31 - .../base/special/gammaln/examples/index.js | 30 - .../math/base/special/gammaln/include.gypi | 53 -- .../stdlib/math/base/special/gammaln.h | 38 -- .../math/base/special/gammaln/lib/index.js | 58 -- .../math/base/special/gammaln/lib/main.js | 405 ------------- .../math/base/special/gammaln/lib/native.js | 70 --- .../base/special/gammaln/lib/polyval_a1.js | 47 -- .../base/special/gammaln/lib/polyval_a2.js | 47 -- .../base/special/gammaln/lib/polyval_r.js | 47 -- .../base/special/gammaln/lib/polyval_s.js | 47 -- .../base/special/gammaln/lib/polyval_t1.js | 47 -- .../base/special/gammaln/lib/polyval_t2.js | 47 -- .../base/special/gammaln/lib/polyval_t3.js | 47 -- .../base/special/gammaln/lib/polyval_u.js | 47 -- .../base/special/gammaln/lib/polyval_v.js | 47 -- .../base/special/gammaln/lib/polyval_w.js | 47 -- .../math/base/special/gammaln/manifest.json | 93 --- .../math/base/special/gammaln/package.json | 149 ----- .../base/special/gammaln/scripts/evalpoly.js | 256 -------- .../math/base/special/gammaln/src/Makefile | 70 --- .../math/base/special/gammaln/src/addon.c | 22 - .../math/base/special/gammaln/src/main.c | 550 ------------------ .../gammaln/test/fixtures/r/DESCRIPTION | 9 - .../gammaln/test/fixtures/r/data1.json | 1 - .../gammaln/test/fixtures/r/data2.json | 1 - .../gammaln/test/fixtures/r/expected1.json | 1 - .../gammaln/test/fixtures/r/expected2.json | 1 - .../special/gammaln/test/fixtures/r/runner.R | 117 ---- .../math/base/special/gammaln/test/test.js | 159 ----- .../base/special/gammaln/test/test.native.js | 168 ------ 54 files changed, 5219 deletions(-) delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/LICENSE delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/README.md delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/Makefile delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/Makefile delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/Makefile delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/Makefile delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/benchmark.cpp delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/REQUIRE delete mode 100755 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/benchmark.jl delete mode 100755 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/benchmark.py delete mode 100755 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/scipy/benchmark.py delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/DESCRIPTION delete mode 100755 lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/benchmark.R delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/binding.gyp delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/Makefile delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/example.c delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/examples/index.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/include.gypi delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/include/stdlib/math/base/special/gammaln.h delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/index.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/main.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/native.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a1.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a2.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_r.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_s.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t1.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t2.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t3.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_u.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_v.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_w.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/manifest.json delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/package.json delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/scripts/evalpoly.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/src/Makefile delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/src/addon.c delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/src/main.c delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/DESCRIPTION delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data1.json delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data2.json delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected1.json delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected2.json delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/runner.R delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/LICENSE b/lib/node_modules/@stdlib/math/base/special/gammaln/LICENSE deleted file mode 100644 index a7566ad6f2c3..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/LICENSE +++ /dev/null @@ -1,192 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - -DEPENDENCIES & ATTRIBUTION - -The library links against the following external libraries or contains -implementations from the following external libraries, which have their own -licenses: - -* FreeBSD - -Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. - -Developed at SunPro, a Sun Microsystems, Inc. business. -Permission to use, copy, modify, and distribute this -software is freely granted, provided that this notice -is preserved. diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/README.md b/lib/node_modules/@stdlib/math/base/special/gammaln/README.md deleted file mode 100644 index 72401ee74be9..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/README.md +++ /dev/null @@ -1,210 +0,0 @@ - - -# gammaln - -> [Natural logarithm][@stdlib/math/base/special/ln] of the [gamma][@stdlib/math/base/special/gamma] function. - -
- -## Usage - -```javascript -var gammaln = require( '@stdlib/math/base/special/gammaln' ); -``` - -#### gammaln( x ) - -Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [gamma function][@stdlib/math/base/special/gamma]. - -```javascript -var v = gammaln( 2.0 ); -// returns 0.0 - -v = gammaln( 1.0 ); -// returns 0.0 - -v = gammaln( 4.0 ); -// returns ~1.792 - -v = gammaln( -0.5 ); -// returns ~1.266 - -v = gammaln( 0.5 ); -// returns ~0.572 - -v = gammaln( 0.0 ); -// returns Infinity - -v = gammaln( NaN ); -// returns NaN -``` - -
- - - -
- -## Examples - - - -```javascript -var uniform = require( '@stdlib/random/array/uniform' ); -var logEachMap = require( '@stdlib/console/log-each-map' ); -var gammaln = require( '@stdlib/math/base/special/gammaln' ); - -var opts = { - 'dtype': 'float64' -}; -var x = uniform( 100, -10.0, 10.0, opts ); - -logEachMap( 'x: %0.4f, f(x): %0.4f', x, gammaln ); -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/math/base/special/gammaln.h" -``` - -#### stdlib_base_gammaln( x ) - -Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [gamma function][@stdlib/math/base/special/gamma]. - -```c -double out = stdlib_base_gammaln( 2.0 ); -// returns 0.0 - -out = stdlib_base_gammaln( 4.0 ); -// returns ~1.792 -``` - -The function accepts the following arguments: - -- **x**: `[in] double` input value. - -```c -double stdlib_base_gammaln( const double x ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/math/base/special/gammaln.h" -#include -#include - -int main( void ) { - const double x[] = { 4.0, -1.5, -0.5, 0.5 }; - - double y; - int i; - for ( i = 0; i < 4; i++ ) { - y = stdlib_base_gammaln( x[ i ] ); - printf( "gammaln(%lf) = %lf\n", x[ i ], y ); - } -} -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js deleted file mode 100644 index c85cb24376d9..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var pkg = require( './../package.json' ).name; -var gammaln = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var x; - var y; - var i; - - x = uniform( 100, -500.0, 500.0 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - y = gammaln( x[ i%x.length ] ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js deleted file mode 100644 index beaecf7e12ec..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @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 resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench' ); -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; - - -// VARIABLES // - -var gammaln = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( gammaln instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var x; - var y; - var i; - - x = uniform( 100, -500.0, 500.0 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - y = gammaln( x[ i%x.length ] ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/Makefile deleted file mode 100644 index e64c0050f3da..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/Makefile +++ /dev/null @@ -1,127 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2018 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 C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler -# @param {string} [CFLAGS] - C compiler flags -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# 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/gammaln/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c deleted file mode 100644 index f7c04b9c24df..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c +++ /dev/null @@ -1,135 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 -#include -#include -#include -#include - -#define NAME "gammaln" -#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 elapsed; - double x[ 100 ]; - double y; - double t; - int i; - - for ( i = 0; i < 100; i++ ) { - x[ i ] = ( 1000.0*rand_double() ) - 500.0; - } - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - y = lgamma( 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::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/Makefile b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/Makefile deleted file mode 100644 index 45f6931fc1c4..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2018 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 := @ -endif - -# Specify the path to Cephes: -CEPHES ?= - -# Specify a list of Cephes source files: -CEPHES_SRC ?= - -# Determine the OS: -# -# [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 -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 \ - -Wno-deprecated-declarations - -# Determine whether to generate [position independent code][1]: -# -# [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 C targets: -c_targets := benchmark.out - - -# TARGETS # - -# Default target. -# -# This target is the default target. - -all: $(c_targets) - -.PHONY: all - - -# Compile C source. -# -# This target compiles C source files. - -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $(CEPHES_SRC) $< -lm - - -# Run a benchmark. -# -# This target runs a benchmark. - -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - - -# Perform clean-up. -# -# This target removes generated files. - -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c deleted file mode 100644 index 8b568a095a25..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c +++ /dev/null @@ -1,140 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 -#include -#include -#include -#include - -#define NAME "gammaln" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Define prototypes for external functions. -*/ -extern double lgam( double x ); - -/** -* 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 elapsed; - double x[ 100 ]; - double y; - double t; - int i; - - for ( i = 0; i < 100; i++ ) { - x[ i ] = ( 1000.0*rand_double() ) - 500.0; - } - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - y = lgam( 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::cephes::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/Makefile deleted file mode 100644 index f69e9da2b4d3..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @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/gammaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c deleted file mode 100644 index fa823e29fbb3..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,136 +0,0 @@ -/** -* @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/gammaln.h" -#include -#include -#include -#include -#include - -#define NAME "gammaln" -#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 elapsed; - double x[ 100 ]; - double y; - double t; - int i; - - for ( i = 0; i < 100; i++ ) { - x[ i ] = ( 1000.0*rand_double() ) - 500.0; - } - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_gammaln( 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 ); -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/Makefile b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/Makefile deleted file mode 100644 index ba3ed4330d65..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/Makefile +++ /dev/null @@ -1,110 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2018 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 := @ -endif - -# Specify the path to Boost: -BOOST ?= - -# Determine the OS: -# -# [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 -endif -endif -endif - -# Define the program used for compiling C++ source files: -ifdef CXX_COMPILER - CXX := $(CXX_COMPILER) -else - CXX := g++ -endif - -# Define the command-line options when compiling C++ files: -CXXFLAGS ?= \ - -std=c++11 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate [position independent code][1]: -# -# [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 C++ targets: -cxx_targets := benchmark.out - - -# TARGETS # - -# Default target. -# -# This target is the default target. - -all: $(cxx_targets) - -.PHONY: all - - -# Compile C++ source. -# -# This target compiles C++ source files. - -$(cxx_targets): %.out: %.cpp $(BOOST) - $(QUIET) $(CXX) $(CXXFLAGS) $(fPIC) -I $(BOOST) -o $@ $< -lm - - -# Run a benchmark. -# -# This target runs a benchmark. - -run: $(cxx_targets) - $(QUIET) ./$< - -.PHONY: run - - -# Perform clean-up. -# -# This target removes generated files. - -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/benchmark.cpp b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/benchmark.cpp deleted file mode 100644 index 93733a2019d9..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/cpp/boost/benchmark.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 -#include -#include -#include -#include -#include -#include -#include - -using boost::random::uniform_real_distribution; -using boost::random::mt19937; - -#define NAME "gammaln" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -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 -*/ -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 -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double x; - double y; - double t; - int i; - - // Define a new pseudorandom number generator: - mt19937 rng; - - // Define a uniform distribution for generating pseudorandom numbers as "doubles" between a minimum value (inclusive) and a maximum value (exclusive): - uniform_real_distribution<> randu( -500.0, 500.0 ); - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - x = randu( rng ); - y = boost::math::lgamma( x ); - 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; - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# cpp::boost::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); - return 0; -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/REQUIRE b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e192e41..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/benchmark.jl deleted file mode 100755 index 0afafa276289..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 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 BenchmarkTools -using Printf - -# Benchmark variables: -name = "gammaln"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, 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" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark lgamma( (1000.0*rand()) - 500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/benchmark.py b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/benchmark.py deleted file mode 100755 index 670d361d874a..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/benchmark.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# -# @license Apache-2.0 -# -# Copyright (c) 2018 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. - -"""Benchmark lgamma.""" - -from __future__ import print_function -import timeit - -NAME = "gammaln" -REPEATS = 3 -ITERATIONS = 1000000 - - -def print_version(): - """Print the TAP version.""" - print("TAP version 13") - - -def print_summary(total, passing): - """Print the benchmark summary. - - # Arguments - - * `total`: total number of tests - * `passing`: number of passing tests - - """ - print("#") - print("1.." + str(total)) # TAP plan - print("# total " + str(total)) - print("# pass " + str(passing)) - print("#") - print("# ok") - - -def print_results(elapsed): - """Print benchmark results. - - # Arguments - - * `elapsed`: elapsed time (in seconds) - - # Examples - - ``` python - python> print_results(0.131009101868) - ``` - """ - rate = ITERATIONS / elapsed - - print(" ---") - print(" iterations: " + str(ITERATIONS)) - print(" elapsed: " + str(elapsed)) - print(" rate: " + str(rate)) - print(" ...") - - -def benchmark(): - """Run the benchmark and print benchmark results.""" - setup = "from math import lgamma; from random import random;" - stmt = "y = lgamma(1000.0*random() - 500.0)" - - t = timeit.Timer(stmt, setup=setup) - - print_version() - - for i in range(REPEATS): - print("# python::" + NAME) - elapsed = t.timeit(number=ITERATIONS) - print_results(elapsed) - print("ok " + str(i+1) + " benchmark finished") - - print_summary(REPEATS, REPEATS) - - -def main(): - """Run the benchmark.""" - benchmark() - - -if __name__ == "__main__": - main() diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/scipy/benchmark.py b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/scipy/benchmark.py deleted file mode 100755 index 0ba1c19f8689..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/python/scipy/benchmark.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# -# @license Apache-2.0 -# -# Copyright (c) 2018 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. - -"""Benchmark scipy.special.gammaln.""" - -from __future__ import print_function -import timeit - -NAME = "gammaln" -REPEATS = 3 -ITERATIONS = 1000000 - - -def print_version(): - """Print the TAP version.""" - print("TAP version 13") - - -def print_summary(total, passing): - """Print the benchmark summary. - - # Arguments - - * `total`: total number of tests - * `passing`: number of passing tests - - """ - print("#") - print("1.." + str(total)) # TAP plan - print("# total " + str(total)) - print("# pass " + str(passing)) - print("#") - print("# ok") - - -def print_results(elapsed): - """Print benchmark results. - - # Arguments - - * `elapsed`: elapsed time (in seconds) - - # Examples - - ``` python - python> print_results(0.131009101868) - ``` - """ - rate = ITERATIONS / elapsed - - print(" ---") - print(" iterations: " + str(ITERATIONS)) - print(" elapsed: " + str(elapsed)) - print(" rate: " + str(rate)) - print(" ...") - - -def benchmark(): - """Run the benchmark and print benchmark results.""" - setup = "from scipy.special import gammaln; from random import random;" - stmt = "y = gammaln(1000.0*random() - 500.0)" - - t = timeit.Timer(stmt, setup=setup) - - print_version() - - for i in range(REPEATS): - print("# python::scipy::" + NAME) - elapsed = t.timeit(number=ITERATIONS) - print_results(elapsed) - print("ok " + str(i+1) + " benchmark finished") - - print_summary(REPEATS, REPEATS) - - -def main(): - """Run the benchmark.""" - benchmark() - - -if __name__ == "__main__": - main() diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/DESCRIPTION b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/DESCRIPTION deleted file mode 100644 index 131d2ce2fd83..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/DESCRIPTION +++ /dev/null @@ -1,9 +0,0 @@ -Package: lgamma-benchmarks -Title: Benchmarks -Version: 0.0.0 -Authors@R: person("stdlib", "js", role = c("aut","cre")) -Description: Benchmarks. -Depends: R (>=3.4.0) -Imports: - microbenchmark -LazyData: true diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/benchmark.R b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/benchmark.R deleted file mode 100755 index 4560caa7a296..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/r/benchmark.R +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env Rscript -# -# @license Apache-2.0 -# -# Copyright (c) 2018 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. - -# Set the precision to 16 digits: -options( digits = 16L ); - -#' Run benchmarks. -#' -#' @examples -#' main(); -main <- function() { - # Define benchmark parameters: - name <- "gammaln"; - iterations <- 1000000L; - repeats <- 3L; - - #' Print the TAP version. - #' - #' @examples - #' print_version(); - print_version <- function() { - cat( "TAP version 13\n" ); - } - - #' Print the TAP summary. - #' - #' @param total Total number of tests. - #' @param passing Total number of passing tests. - #' - #' @examples - #' print_summary( 3, 3 ); - print_summary <- function( total, passing ) { - cat( "#\n" ); - cat( paste0( "1..", total, "\n" ) ); # TAP plan - cat( paste0( "# total ", total, "\n" ) ); - cat( paste0( "# pass ", passing, "\n" ) ); - cat( "#\n" ); - cat( "# ok\n" ); - } - - #' Print benchmark results. - #' - #' @param iterations Number of iterations. - #' @param elapsed Elapsed time in seconds. - #' - #' @examples - #' print_results( 10000L, 0.131009101868 ); - print_results <- function( iterations, elapsed ) { - rate <- iterations / elapsed; - cat( " ---\n" ); - cat( paste0( " iterations: ", iterations, "\n" ) ); - cat( paste0( " elapsed: ", elapsed, "\n" ) ); - cat( paste0( " rate: ", rate, "\n" ) ); - cat( " ...\n" ); - } - - #' Run a benchmark. - #' - #' ## Notes - #' - #' * We compute and return a total "elapsed" time, rather than the minimum - #' evaluation time, to match benchmark results in other languages (e.g., - #' Python). - #' - #' - #' @param iterations Number of Iterations. - #' @return Elapsed time in seconds. - #' - #' @examples - #' elapsed <- benchmark( 10000L ); - benchmark <- function( iterations ) { - # Run the benchmarks: - results <- microbenchmark::microbenchmark( lgamma( (1000.0*runif(1)) - 500.0 ), times = iterations ); - - # Sum all the raw timing results to get a total "elapsed" time: - elapsed <- sum( results$time ); - - # Convert the elapsed time from nanoseconds to seconds: - elapsed <- elapsed / 1.0e9; - - return( elapsed ); - } - - print_version(); - for ( i in 1:repeats ) { - cat( paste0( "# r::", name, "\n" ) ); - elapsed <- benchmark( iterations ); - print_results( iterations, elapsed ); - cat( paste0( "ok ", i, " benchmark finished", "\n" ) ); - } - print_summary( repeats, repeats ); -} - -main(); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/binding.gyp b/lib/node_modules/@stdlib/math/base/special/gammaln/binding.gyp deleted file mode 100644 index ec3992233442..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @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. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/gammaln/docs/repl.txt deleted file mode 100644 index fa159390a3b1..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/docs/repl.txt +++ /dev/null @@ -1,34 +0,0 @@ - -{{alias}}( x ) - Evaluates the natural logarithm of the gamma function. - - Parameters - ---------- - x: number - Input value. - - Returns - ------- - y: number - Natural logarithm of the gamma function. - - Examples - -------- - > var y = {{alias}}( 1.0 ) - 0.0 - > y = {{alias}}( 2.0 ) - 0.0 - > y = {{alias}}( 4.0 ) - ~1.792 - > y = {{alias}}( -0.5 ) - ~1.266 - > y = {{alias}}( 0.5 ) - ~0.572 - > y = {{alias}}( 0.0 ) - Infinity - > y = {{alias}}( NaN ) - NaN - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/index.d.ts deleted file mode 100644 index 9d092feaabff..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/index.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 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 - -/** -* Evaluates the natural logarithm of the gamma function. -* -* @param x - input value -* @returns function value -* -* @example -* var v = gammaln( 1.0 ); -* // returns 0.0 -* -* @example -* var v = gammaln( 2.0 ); -* // returns 0.0 -* -* @example -* var v = gammaln( 4.0 ); -* // returns ~1.792 -* -* @example -* var v = gammaln( -0.5 ); -* // returns ~1.266 -* -* @example -* var v = gammaln( 0.5 ); -* // returns ~0.572 -* -* @example -* var v = gammaln( 0.0 ); -* // returns Infinity -* -* @example -* var v = gammaln( NaN ); -* // returns NaN -*/ -declare function gammaln( x: number ): number; - - -// EXPORTS // - -export = gammaln; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/test.ts deleted file mode 100644 index 6d134035327d..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 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 gammaln = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - gammaln( 8 ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a value other than a number... -{ - gammaln( true ); // $ExpectError - gammaln( false ); // $ExpectError - gammaln( null ); // $ExpectError - gammaln( undefined ); // $ExpectError - gammaln( '5' ); // $ExpectError - gammaln( [] ); // $ExpectError - gammaln( {} ); // $ExpectError - gammaln( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - gammaln(); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/Makefile deleted file mode 100644 index 6aed70daf167..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @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 := example.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 examples. -# -# @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/gammaln/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/example.c deleted file mode 100644 index e6825b98b96f..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/examples/c/example.c +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @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/gammaln.h" -#include - -int main( void ) { - const double x[] = { 4.0, -1.5, -0.5, 0.5 }; - - double y; - int i; - for ( i = 0; i < 4; i++ ) { - y = stdlib_base_gammaln( x[ i ] ); - printf( "gammaln(%lf) = %lf\n", x[ i ], y ); - } -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/examples/index.js b/lib/node_modules/@stdlib/math/base/special/gammaln/examples/index.js deleted file mode 100644 index d02d37c9e7cd..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 uniform = require( '@stdlib/random/array/uniform' ); -var logEachMap = require( '@stdlib/console/log-each-map' ); -var gammaln = require( './../lib' ); - -var opts = { - 'dtype': 'float64' -}; -var x = uniform( 100, -10.0, 10.0, opts ); - -logEachMap( 'x: %0.4f, f(x): %0.4f', x, gammaln ); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/include.gypi b/lib/node_modules/@stdlib/math/base/special/gammaln/include.gypi deleted file mode 100644 index 575cb043c0bf..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @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. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' TT = -(tail of TF) - - -// MAIN // - -/** -* Evaluates the natural logarithm of the gamma function. -* -* ## Method -* -* 1. Argument reduction for \\(0 < x \leq 8\\). Since \\(\Gamma(1+s) = s \Gamma(s)\\), for \\(x \in \[0,8]\\), we may reduce \\(x\\) to a number in \\(\[1.5,2.5]\\) by -* -* ```tex -* \operatorname{lgamma}(1+s) = \ln(s) + \operatorname{lgamma}(s) -* ``` -* -* For example, -* -* ```tex -* \begin{align*} -* \operatorname{lgamma}(7.3) &= \ln(6.3) + \operatorname{lgamma}(6.3) \\ -* &= \ln(6.3 \cdot 5.3) + \operatorname{lgamma}(5.3) \\ -* &= \ln(6.3 \cdot 5.3 \cdot 4.3 \cdot 3.3 \cdot2.3) + \operatorname{lgamma}(2.3) -* \end{align*} -* ``` -* -* 2. Compute a polynomial approximation of \\(\mathrm{lgamma}\\) around its minimum (\\(\mathrm{ymin} = 1.461632144968362245\\)) to maintain monotonicity. On the interval \\(\[\mathrm{ymin} - 0.23, \mathrm{ymin} + 0.27]\\) (i.e., \\(\[1.23164,1.73163]\\)), we let \\(z = x - \mathrm{ymin}\\) and use -* -* ```tex -* \operatorname{lgamma}(x) = -1.214862905358496078218 + z^2 \cdot \operatorname{poly}(z) -* ``` -* -* where \\(\operatorname{poly}(z)\\) is a \\(14\\) degree polynomial. -* -* 3. Compute a rational approximation in the primary interval \\(\[2,3]\\). Let \\( s = x - 2.0 \\). We can thus use the approximation -* -* ```tex -* \operatorname{lgamma}(x) = \frac{s}{2} + s\frac{\operatorname{P}(s)}{\operatorname{Q}(s)} -* ``` -* -* with accuracy -* -* ```tex -* \biggl|\frac{\mathrm{P}}{\mathrm{Q}} - \biggr(\operatorname{lgamma}(x)-\frac{s}{2}\biggl)\biggl| < 2^{-61.71} -* ``` -* -* The algorithms are based on the observation -* -* ```tex -* \operatorname{lgamma}(2+s) = s(1 - \gamma) + \frac{\zeta(2) - 1}{2} s^2 - \frac{\zeta(3) - 1}{3} s^3 + \ldots -* ``` -* -* where \\(\zeta\\) is the zeta function and \\(\gamma = 0.5772156649...\\) is the Euler-Mascheroni constant, which is very close to \\(0.5\\). -* -* 4. For \\(x \geq 8\\), -* -* ```tex -* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr) \ln(x) - x + \frac{\ln(2\pi)}{2} + \frac{1}{12x} - \frac{1}{360x^3} + \ldots -* ``` -* -* which can be expressed -* -* ```tex -* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1)-\frac{\ln(2\pi)-1}{2} + \ldots -* ``` -* -* Let \\(z = \frac{1}{x}\\). We can then use the approximation -* -* ```tex -* f(z) = \operatorname{lgamma}(x) - \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1) -* ``` -* -* by -* -* ```tex -* w = w_0 + w_1 z + w_2 z^3 + w_3 z^5 + \ldots + w_6 z^{11} -* ``` -* -* where -* -* ```tex -* |w - f(z)| < 2^{-58.74} -* ``` -* -* 5. For negative \\(x\\), since -* -* ```tex -* -x \Gamma(-x) \Gamma(x) = \frac{\pi}{\sin(\pi x)} -* ``` -* -* where \\(\Gamma\\) is the gamma function, we have -* -* ```tex -* \Gamma(x) = \frac{\pi}{\sin(\pi x)(-x)\Gamma(-x)} -* ``` -* -* Since \\(\Gamma(-x)\\) is positive, -* -* ```tex -* \operatorname{sign}(\Gamma(x)) = \operatorname{sign}(\sin(\pi x)) -* ``` -* -* for \\(x < 0\\). Hence, for \\(x < 0\\), -* -* ```tex -* \mathrm{signgam} = \operatorname{sign}(\sin(\pi x)) -* ``` -* -* and -* -* ```tex -* \begin{align*} -* \operatorname{lgamma}(x) &= \ln(|\Gamma(x)|) \\ -* &= \ln\biggl(\frac{\pi}{|x \sin(\pi x)|}\biggr) - \operatorname{lgamma}(-x) -* \end{align*} -* ``` -* -* -* -* Note that one should avoid computing \\(\pi (-x)\\) directly in the computation of \\(\sin(\pi (-x))\\). -* -* -* -* ## Special Cases -* -* ```tex -* \begin{align*} -* \operatorname{lgamma}(2+s) &\approx s (1-\gamma) & \mathrm{for\ tiny\ s} \\ -* \operatorname{lgamma}(x) &\approx -\ln(x) & \mathrm{for\ tiny\ x} \\ -* \operatorname{lgamma}(1) &= 0 & \\ -* \operatorname{lgamma}(2) &= 0 & \\ -* \operatorname{lgamma}(0) &= \infty & \\ -* \operatorname{lgamma}(\infty) &= \infty & \\ -* \operatorname{lgamma}(-\mathrm{integer}) &= \pm \infty -* \end{align*} -* ``` -* -* @param {number} x - input value -* @returns {number} function value -* -* @example -* var v = gammaln( 1.0 ); -* // returns 0.0 -* -* @example -* var v = gammaln( 2.0 ); -* // returns 0.0 -* -* @example -* var v = gammaln( 4.0 ); -* // returns ~1.792 -* -* @example -* var v = gammaln( -0.5 ); -* // returns ~1.266 -* -* @example -* var v = gammaln( 0.5 ); -* // returns ~0.572 -* -* @example -* var v = gammaln( 0.0 ); -* // returns Infinity -* -* @example -* var v = gammaln( NaN ); -* // returns NaN -*/ -function gammaln( x ) { - var isNegative; - var nadj; - var flg; - var p3; - var p2; - var p1; - var p; - var q; - var t; - var w; - var y; - var z; - var r; - - // Special cases: NaN, +-infinity - if ( isnan( x ) || isInfinite( x ) ) { - return x; - } - // Special case: 0 - if ( x === 0.0 ) { - return PINF; - } - if ( x < 0.0 ) { - isNegative = true; - x = -x; - } else { - isNegative = false; - } - // If |x| < 2**-56, return -ln(|x|) - if ( x < TINY ) { - return -ln( x ); - } - if ( isNegative ) { - // If |x| >= 2**52, must be -integer - if ( x >= TWO52 ) { - return PINF; - } - t = sinpi( x ); - if ( t === 0.0 ) { - return PINF; - } - nadj = ln( PI / abs( t*x ) ); - } - // If x equals 1 or 2, return 0 - if ( x === 1.0 || x === 2.0 ) { - return 0.0; - } - // If x < 2, use lgamma(x) = lgamma(x+1) - log(x) - if ( x < 2.0 ) { - if ( x <= 0.9 ) { - r = -ln( x ); - - // 0.7316 <= x <= 0.9 - if ( x >= ( YMIN - 1.0 + 0.27 ) ) { - y = 1.0 - x; - flg = 0; - } - // 0.2316 <= x < 0.7316 - else if ( x >= (YMIN - 1.0 - 0.27) ) { - y = x - (TC - 1.0); - flg = 1; - } - // 0 < x < 0.2316 - else { - y = x; - flg = 2; - } - } else { - r = 0.0; - - // 1.7316 <= x < 2 - if ( x >= (YMIN + 0.27) ) { - y = 2.0 - x; - flg = 0; - } - // 1.2316 <= x < 1.7316 - else if ( x >= (YMIN - 0.27) ) { - y = x - TC; - flg = 1; - } - // 0.9 < x < 1.2316 - else { - y = x - 1.0; - flg = 2; - } - } - switch ( flg ) { // eslint-disable-line default-case - case 0: - z = y * y; - p1 = A1C + (z*polyvalA1( z )); - p2 = z * (A2C + (z*polyvalA2( z ))); - p = (y*p1) + p2; - r += ( p - (0.5*y) ); - break; - case 1: - z = y * y; - w = z * y; - p1 = T1C + (w*polyvalT1( w )); - p2 = T2C + (w*polyvalT2( w )); - p3 = T3C + (w*polyvalT3( w )); - p = (z*p1) - (TT - (w*(p2+(y*p3)))); - r += ( TF + p ); - break; - case 2: - p1 = y * (UC + (y*polyvalU( y ))); - p2 = VC + (y*polyvalV( y )); - r += (-0.5*y) + (p1/p2); - break; - } - } - // 2 <= x < 8 - else if ( x < 8.0 ) { - flg = trunc( x ); - y = x - flg; - p = y * (SC + (y*polyvalS( y ))); - q = RC + (y*polyvalR( y )); - r = (0.5*y) + (p/q); - z = 1.0; // gammaln(1+s) = ln(s) + gammaln(s) - switch ( flg ) { // eslint-disable-line default-case - case 7: - z *= y + 6.0; - - /* Falls through */ - case 6: - z *= y + 5.0; - - /* Falls through */ - case 5: - z *= y + 4.0; - - /* Falls through */ - case 4: - z *= y + 3.0; - - /* Falls through */ - case 3: - z *= y + 2.0; - r += ln( z ); - } - } - // 8 <= x < 2**56 - else if ( x < TWO56 ) { - t = ln( x ); - z = 1.0 / x; - y = z * z; - w = WC + (z*polyvalW( y )); - r = ((x-0.5)*(t-1.0)) + w; - } - // 2**56 <= x <= Inf - else { - r = x * ( ln(x)-1.0 ); - } - if ( isNegative ) { - r = nadj - r; - } - return r; -} - - -// EXPORTS // - -module.exports = gammaln; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/native.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/native.js deleted file mode 100644 index 962c61b10140..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/native.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @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 addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Evaluates the natural logarithm of the gamma function. -* -* @private -* @param {number} x - input value -* @returns {number} function value -* -* @example -* var v = gammaln( 1.0 ); -* // returns 0.0 -* -* @example -* var v = gammaln( 2.0 ); -* // returns 0.0 -* -* @example -* var v = gammaln( 4.0 ); -* // returns ~1.792 -* -* @example -* var v = gammaln( -0.5 ); -* // returns ~1.266 -* -* @example -* var v = gammaln( 0.5 ); -* // returns ~0.572 -* -* @example -* var v = gammaln( 0.0 ); -* // returns Infinity -* -* @example -* var v = gammaln( NaN ); -* // returns NaN -*/ -function gammaln( x ) { - return addon( x ); -} - - -// EXPORTS // - -module.exports = gammaln; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a1.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a1.js deleted file mode 100644 index ac2694d47a75..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a1.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 0.06735230105312927; - } - return 0.06735230105312927 + (x * (0.007385550860814029 + (x * (0.0011927076318336207 + (x * (0.00022086279071390839 + (x * 0.000025214456545125733))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a2.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a2.js deleted file mode 100644 index eb2508895247..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_a2.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 0.020580808432516733; - } - return 0.020580808432516733 + (x * (0.0028905138367341563 + (x * (0.0005100697921535113 + (x * (0.00010801156724758394 + (x * 0.000044864094961891516))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_r.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_r.js deleted file mode 100644 index 26b94f1ee192..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_r.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 1.3920053346762105; - } - return 1.3920053346762105 + (x * (0.7219355475671381 + (x * (0.17193386563280308 + (x * (0.01864591917156529 + (x * (0.0007779424963818936 + (x * 0.000007326684307446256))))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_s.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_s.js deleted file mode 100644 index 1df93401c3e9..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_s.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 0.21498241596060885; - } - return 0.21498241596060885 + (x * (0.325778796408931 + (x * (0.14635047265246445 + (x * (0.02664227030336386 + (x * (0.0018402845140733772 + (x * 0.00003194753265841009))))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t1.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t1.js deleted file mode 100644 index ca2c1f4a5082..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t1.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return -0.032788541075985965; - } - return -0.032788541075985965 + (x * (0.006100538702462913 + (x * (-0.0014034646998923284 + (x * 0.00031563207090362595))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t2.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t2.js deleted file mode 100644 index b340af8be842..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t2.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 0.01797067508118204; - } - return 0.01797067508118204 + (x * (-0.0036845201678113826 + (x * (0.000881081882437654 + (x * -0.00031275416837512086))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t3.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t3.js deleted file mode 100644 index 002cce134253..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_t3.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return -0.010314224129834144; - } - return -0.010314224129834144 + (x * (0.0022596478090061247 + (x * (-0.0005385953053567405 + (x * 0.0003355291926355191))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_u.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_u.js deleted file mode 100644 index 3e63b1634e84..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_u.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 0.6328270640250934; - } - return 0.6328270640250934 + (x * (1.4549225013723477 + (x * (0.9777175279633727 + (x * (0.22896372806469245 + (x * 0.013381091853678766))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_v.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_v.js deleted file mode 100644 index 96fff3e6975b..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_v.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 2.4559779371304113; - } - return 2.4559779371304113 + (x * (2.128489763798934 + (x * (0.7692851504566728 + (x * (0.10422264559336913 + (x * 0.003217092422824239))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_w.js b/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_w.js deleted file mode 100644 index 52066128a4eb..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/lib/polyval_w.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @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. -*/ - -/* This is a generated file. Do not edit directly. */ -'use strict'; - -// MAIN // - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @private -* @param {number} x - value at which to evaluate the polynomial -* @returns {number} evaluated polynomial -*/ -function evalpoly( x ) { - if ( x === 0.0 ) { - return 0.08333333333333297; - } - return 0.08333333333333297 + (x * (-0.0027777777772877554 + (x * (0.0007936505586430196 + (x * (-0.00059518755745034 + (x * (0.0008363399189962821 + (x * -0.0016309293409657527))))))))); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/manifest.json b/lib/node_modules/@stdlib/math/base/special/gammaln/manifest.json deleted file mode 100644 index bcc36da007e6..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/manifest.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/napi/unary", - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-infinite", - "@stdlib/math/base/special/abs", - "@stdlib/math/base/special/ln", - "@stdlib/math/base/special/trunc", - "@stdlib/math/base/special/sinpi", - "@stdlib/constants/float64/pinf", - "@stdlib/constants/float64/pi" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-infinite", - "@stdlib/math/base/special/abs", - "@stdlib/math/base/special/ln", - "@stdlib/math/base/special/trunc", - "@stdlib/math/base/special/sinpi", - "@stdlib/constants/float64/pinf", - "@stdlib/constants/float64/pi" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-infinite", - "@stdlib/math/base/special/abs", - "@stdlib/math/base/special/ln", - "@stdlib/math/base/special/trunc", - "@stdlib/math/base/special/sinpi", - "@stdlib/constants/float64/pinf", - "@stdlib/constants/float64/pi" - ] - } - ] -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/package.json b/lib/node_modules/@stdlib/math/base/special/gammaln/package.json deleted file mode 100644 index fddf7a2a0fc5..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/package.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "name": "@stdlib/math/base/special/gammaln", - "version": "0.0.0", - "description": "Natural logarithm of the gamma function.", - "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", - "gypfile": true, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "scripts": "./scripts", - "src": "./src", - "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", - "special function", - "special", - "function", - "gamma", - "factorial", - "natural", - "logarithm", - "log", - "ln", - "lgamma", - "number" - ], - "__stdlib__": { - "scaffold": { - "$schema": "math/base@v1.0", - "base_alias": "gammaln", - "alias": "gammaln", - "pkg_desc": "evaluate the natural logarithm of the gamma function", - "desc": "evaluates the natural logarithm of the gamma function", - "short_desc": "natural logarithm of the gamma function", - "parameters": [ - { - "name": "x", - "desc": "input value", - "type": { - "javascript": "number", - "jsdoc": "number", - "c": "double", - "dtype": "float64" - }, - "domain": [ - { - "min": "-infinity", - "max": "infinity" - } - ], - "rand": { - "prng": "random/base/uniform", - "parameters": [ - -10, - 10 - ] - }, - "example_values": [ - 1, - 3.5, - 4.5, - -0.5, - 2, - 3, - -3.5, - 0.1, - 4, - 1.5, - 5, - 0.5, - 2.5, - -1.5, - -2.5, - 50, - 100, - -50.5, - -100.5, - 2.2 - ] - } - ], - "output_policy": "real_floating_point_and_generic", - "returns": { - "desc": "function value", - "type": { - "javascript": "number", - "jsdoc": "number", - "c": "double", - "dtype": "float64" - } - }, - "keywords": [ - "gamma", - "factorial", - "natural", - "logarithm", - "log", - "ln", - "lgamma" - ], - "extra_keywords": [] - } - } -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/scripts/evalpoly.js b/lib/node_modules/@stdlib/math/base/special/gammaln/scripts/evalpoly.js deleted file mode 100644 index d3456b09248f..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/scripts/evalpoly.js +++ /dev/null @@ -1,256 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ - -/* -* This script compiles modules for evaluating polynomial functions. If any polynomial coefficients change, this script should be rerun to update the compiled files. -*/ -'use strict'; - -// 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/evalpoly-compile' ); -var compileC = require( '@stdlib/math/base/tools/evalpoly-compile-c' ); -var substringBefore = require( '@stdlib/string/substring-before' ); -var substringAfter = require( '@stdlib/string/substring-after' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -// Polynomial coefficients ordered in ascending degree... -var A1 = [ - 6.73523010531292681824e-02, // 0x3FB13E001A5562A7 - 7.38555086081402883957e-03, // 0x3F7E404FB68FEFE8 - 1.19270763183362067845e-03, // 0x3F538A94116F3F5D - 2.20862790713908385557e-04, // 0x3F2CF2ECED10E54D - 2.52144565451257326939e-05 // 0x3EFA7074428CFA52 -]; -var A2 = [ - 2.05808084325167332806e-02, // 0x3F951322AC92547B - 2.89051383673415629091e-03, // 0x3F67ADD8CCB7926B - 5.10069792153511336608e-04, // 0x3F40B6C689B99C00 - 1.08011567247583939954e-04, // 0x3F1C5088987DFB07 - 4.48640949618915160150e-05 // 0x3F07858E90A45837 -]; -var R = [ - 1.39200533467621045958e+00, // 0x3FF645A762C4AB74 - 7.21935547567138069525e-01, // 0x3FE71A1893D3DCDC - 1.71933865632803078993e-01, // 0x3FC601EDCCFBDF27 - 1.86459191715652901344e-02, // 0x3F9317EA742ED475 - 7.77942496381893596434e-04, // 0x3F497DDACA41A95B - 7.32668430744625636189e-06 // 0x3EDEBAF7A5B38140 -]; -var S = [ - 2.14982415960608852501e-01, // 0x3FCB848B36E20878 - 3.25778796408930981787e-01, // 0x3FD4D98F4F139F59 - 1.46350472652464452805e-01, // 0x3FC2BB9CBEE5F2F7 - 2.66422703033638609560e-02, // 0x3F9B481C7E939961 - 1.84028451407337715652e-03, // 0x3F5E26B67368F239 - 3.19475326584100867617e-05 // 0x3F00BFECDD17E945 -]; -var T1 = [ - -3.27885410759859649565e-02, // 0xBFA0C9A8DF35B713 - 6.10053870246291332635e-03, // 0x3F78FCE0E370E344 - -1.40346469989232843813e-03, // 0xBF56FE8EBF2D1AF1 - 3.15632070903625950361e-04 // 0x3F34AF6D6C0EBBF7 -]; -var T2 = [ - 1.79706750811820387126e-02, // 0x3F9266E7970AF9EC - -3.68452016781138256760e-03, // 0xBF6E2EFFB3E914D7 - 8.81081882437654011382e-04, // 0x3F4CDF0CEF61A8E9 - -3.12754168375120860518e-04 // 0xBF347F24ECC38C38 -]; -var T3 = [ - -1.03142241298341437450e-02, // 0xBF851F9FBA91EC6A - 2.25964780900612472250e-03, // 0x3F6282D32E15C915 - -5.38595305356740546715e-04, // 0xBF41A6109C73E0EC - 3.35529192635519073543e-04 // 0x3F35FD3EE8C2D3F4 -]; -var U = [ - 6.32827064025093366517e-01, // 0x3FE4401E8B005DFF - 1.45492250137234768737e+00, // 0x3FF7475CD119BD6F - 9.77717527963372745603e-01, // 0x3FEF497644EA8450 - 2.28963728064692451092e-01, // 0x3FCD4EAEF6010924 - 1.33810918536787660377e-02 // 0x3F8B678BBF2BAB09 -]; -var V = [ - 2.45597793713041134822e+00, // 0x4003A5D7C2BD619C - 2.12848976379893395361e+00, // 0x40010725A42B18F5 - 7.69285150456672783825e-01, // 0x3FE89DFBE45050AF - 1.04222645593369134254e-01, // 0x3FBAAE55D6537C88 - 3.21709242282423911810e-03 // 0x3F6A5ABB57D0CF61 -]; -var W = [ - 8.33333333333329678849e-02, // 0x3FB555555555553B - -2.77777777728775536470e-03, // 0xBF66C16C16B02E5C - 7.93650558643019558500e-04, // 0x3F4A019F98CF38B6 - -5.95187557450339963135e-04, // 0xBF4380CB8C0FE741 - 8.36339918996282139126e-04, // 0x3F4B67BA4CDAD5D1 - -1.63092934096575273989e-03 // 0xBF5AB89D0B9E43E4 -]; - -// Header to add to output files: -var header = licenseHeader( 'Apache-2.0', 'js', { - 'year': currentYear(), - 'copyright': 'The Stdlib Authors' -}); -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 // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var fpath; - var copts; - var opts; - var file; - var str; - - opts = { - 'encoding': 'utf8' - }; - - fpath = resolve( __dirname, '..', 'lib', 'polyval_a1.js' ); - str = header + compile( A1 ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_a2.js' ); - str = header + compile( A2 ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_r.js' ); - str = header + compile( R ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_s.js' ); - str = header + compile( S ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_t1.js' ); - str = header + compile( T1 ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_t2.js' ); - str = header + compile( T2 ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_t3.js' ); - str = header + compile( T3 ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_u.js' ); - str = header + compile( U ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_v.js' ); - str = header + compile( V ); - writeFileSync( fpath, str, opts ); - - fpath = resolve( __dirname, '..', 'lib', 'polyval_w.js' ); - str = header + compile( W ); - writeFileSync( fpath, str, opts ); - - copts = { - 'dtype': 'double', - 'name': '' - }; - - fpath = resolve( __dirname, '..', 'src', 'main.c' ); - file = readFileSync( fpath, opts ); - - copts.name = 'polyval_a1'; - str = compileC( A1, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_a2'; - str = compileC( A2, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_r'; - str = compileC( R, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_s'; - str = compileC( S, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_t1'; - str = compileC( T1, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_t2'; - str = compileC( T2, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_t3'; - str = compileC( T3, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_u'; - str = compileC( U, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_v'; - str = compileC( V, copts ); - file = insert( file, copts.name, str ); - - copts.name = 'polyval_w'; - str = compileC( W, copts ); - file = insert( file, copts.name, str ); - - writeFileSync( fpath, file, opts ); -} - -main(); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/src/Makefile b/lib/node_modules/@stdlib/math/base/special/gammaln/src/Makefile deleted file mode 100644 index bcf18aa46655..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @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 - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/src/addon.c b/lib/node_modules/@stdlib/math/base/special/gammaln/src/addon.c deleted file mode 100644 index 71e5d2e88764..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/src/addon.c +++ /dev/null @@ -1,22 +0,0 @@ -/** -* @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/gammaln.h" -#include "stdlib/math/base/napi/unary.h" - -STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_gammaln ) diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/src/main.c b/lib/node_modules/@stdlib/math/base/special/gammaln/src/main.c deleted file mode 100644 index 0005d74900fb..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/src/main.c +++ /dev/null @@ -1,550 +0,0 @@ -/** -* @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. -* -* -* ## Notice -* -* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/12.2.0/lib/msun/src/e_lgamma_r.c}. The implementation follows the original, but has been modified for JavaScript. -* -* ```text -* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. -* -* Developed at SunPro, a Sun Microsystems, Inc. business. -* Permission to use, copy, modify, and distribute this -* software is freely granted, provided that this notice -* is preserved. -* ``` -*/ - -#include "stdlib/math/base/special/gammaln.h" -#include "stdlib/math/base/assert/is_nan.h" -#include "stdlib/math/base/assert/is_infinite.h" -#include "stdlib/math/base/special/abs.h" -#include "stdlib/math/base/special/ln.h" -#include "stdlib/math/base/special/trunc.h" -#include "stdlib/math/base/special/sinpi.h" -#include "stdlib/constants/float64/pi.h" -#include "stdlib/constants/float64/pinf.h" -#include - -static const double A1C = 7.72156649015328655494e-02; // 0x3FB3C467E37DB0C8 -static const double A2C = 3.22467033424113591611e-01; // 0x3FD4A34CC4A60FAD -static const double RC = 1.0; -static const double SC = -7.72156649015328655494e-02; // 0xBFB3C467E37DB0C8 -static const double T1C = 4.83836122723810047042e-01; // 0x3FDEF72BC8EE38A2 -static const double T2C = -1.47587722994593911752e-01; // 0xBFC2E4278DC6C509 -static const double T3C = 6.46249402391333854778e-02; // 0x3FB08B4294D5419B -static const double UC = -7.72156649015328655494e-02; // 0xBFB3C467E37DB0C8 -static const double VC = 1.0; -static const double WC = 4.18938533204672725052e-01; // 0x3FDACFE390C97D69 -static const double YMIN = 1.461632144968362245; -static const double TWO52 = 4503599627370496; // 2**52 -static const double TWO56 = 72057594037927936; // 2**56 -static const double TINY = 1.3877787807814457e-17; -static const double TC = 1.46163214496836224576e+00; // 0x3FF762D86356BE3F -static const double TF = -1.21486290535849611461e-01; // 0xBFBF19B9BCC38A42 -static const double TT = -3.63867699703950536541e-18; // 0xBC50C7CAA48A971F => TT = -(tail of TF) - -/* Begin auto-generated functions. The following functions are auto-generated. Do not edit directly. */ - -// BEGIN: polyval_a1 - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_a1( const double x ) { - return 0.06735230105312927 + (x * (0.007385550860814029 + (x * (0.0011927076318336207 + (x * (0.00022086279071390839 + (x * 0.000025214456545125733))))))); -} - -// END: polyval_a1 - -// BEGIN: polyval_a2 - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_a2( const double x ) { - return 0.020580808432516733 + (x * (0.0028905138367341563 + (x * (0.0005100697921535113 + (x * (0.00010801156724758394 + (x * 0.000044864094961891516))))))); -} - -// END: polyval_a2 - -// BEGIN: polyval_r - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_r( const double x ) { - return 1.3920053346762105 + (x * (0.7219355475671381 + (x * (0.17193386563280308 + (x * (0.01864591917156529 + (x * (0.0007779424963818936 + (x * 0.000007326684307446256))))))))); -} - -// END: polyval_r - -// BEGIN: polyval_s - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_s( const double x ) { - return 0.21498241596060885 + (x * (0.325778796408931 + (x * (0.14635047265246445 + (x * (0.02664227030336386 + (x * (0.0018402845140733772 + (x * 0.00003194753265841009))))))))); -} - -// END: polyval_s - -// BEGIN: polyval_t1 - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_t1( const double x ) { - return -0.032788541075985965 + (x * (0.006100538702462913 + (x * (-0.0014034646998923284 + (x * 0.00031563207090362595))))); -} - -// END: polyval_t1 - -// BEGIN: polyval_t2 - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_t2( const double x ) { - return 0.01797067508118204 + (x * (-0.0036845201678113826 + (x * (0.000881081882437654 + (x * -0.00031275416837512086))))); -} - -// END: polyval_t2 - -// BEGIN: polyval_t3 - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_t3( const double x ) { - return -0.010314224129834144 + (x * (0.0022596478090061247 + (x * (-0.0005385953053567405 + (x * 0.0003355291926355191))))); -} - -// END: polyval_t3 - -// BEGIN: polyval_u - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_u( const double x ) { - return 0.6328270640250934 + (x * (1.4549225013723477 + (x * (0.9777175279633727 + (x * (0.22896372806469245 + (x * 0.013381091853678766))))))); -} - -// END: polyval_u - -// BEGIN: polyval_v - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_v( const double x ) { - return 2.4559779371304113 + (x * (2.128489763798934 + (x * (0.7692851504566728 + (x * (0.10422264559336913 + (x * 0.003217092422824239))))))); -} - -// END: polyval_v - -// BEGIN: polyval_w - -/** -* Evaluates a polynomial. -* -* ## Notes -* -* - The implementation uses [Horner's rule][horners-method] for efficient computation. -* -* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method -* -* @param x value at which to evaluate the polynomial -* @return evaluated polynomial -*/ -static double polyval_w( const double x ) { - return 0.08333333333333297 + (x * (-0.0027777777772877554 + (x * (0.0007936505586430196 + (x * (-0.00059518755745034 + (x * (0.0008363399189962821 + (x * -0.0016309293409657527))))))))); -} - -// END: polyval_w - -/* End auto-generated functions. */ - -/** -* Evaluates the natural logarithm of the gamma function. -* -* ## Method -* -* 1. Argument reduction for \\(0 < x \leq 8\\). Since \\(\Gamma(1+s) = s \Gamma(s)\\), for \\(x \in \[0,8]\\), we may reduce \\(x\\) to a number in \\(\[1.5,2.5]\\) by -* -* ```tex -* \operatorname{lgamma}(1+s) = \ln(s) + \operatorname{lgamma}(s) -* ``` -* -* For example, -* -* ```tex -* \begin{align*} -* \operatorname{lgamma}(7.3) &= \ln(6.3) + \operatorname{lgamma}(6.3) \\ -* &= \ln(6.3 \cdot 5.3) + \operatorname{lgamma}(5.3) \\ -* &= \ln(6.3 \cdot 5.3 \cdot 4.3 \cdot 3.3 \cdot2.3) + \operatorname{lgamma}(2.3) -* \end{align*} -* ``` -* -* 2. Compute a polynomial approximation of \\(\mathrm{lgamma}\\) around its minimum (\\(\mathrm{ymin} = 1.461632144968362245\\)) to maintain monotonicity. On the interval \\(\[\mathrm{ymin} - 0.23, \mathrm{ymin} + 0.27]\\) (i.e., \\(\[1.23164,1.73163]\\)), we let \\(z = x - \mathrm{ymin}\\) and use -* -* ```tex -* \operatorname{lgamma}(x) = -1.214862905358496078218 + z^2 \cdot \operatorname{poly}(z) -* ``` -* -* where \\(\operatorname{poly}(z)\\) is a \\(14\\) degree polynomial. -* -* 3. Compute a rational approximation in the primary interval \\(\[2,3]\\). Let \\( s = x - 2.0 \\). We can thus use the approximation -* -* ```tex -* \operatorname{lgamma}(x) = \frac{s}{2} + s\frac{\operatorname{P}(s)}{\operatorname{Q}(s)} -* ``` -* -* with accuracy -* -* ```tex -* \biggl|\frac{\mathrm{P}}{\mathrm{Q}} - \biggr(\operatorname{lgamma}(x)-\frac{s}{2}\biggl)\biggl| < 2^{-61.71} -* ``` -* -* The algorithms are based on the observation -* -* ```tex -* \operatorname{lgamma}(2+s) = s(1 - \gamma) + \frac{\zeta(2) - 1}{2} s^2 - \frac{\zeta(3) - 1}{3} s^3 + \ldots -* ``` -* -* where \\(\zeta\\) is the zeta function and \\(\gamma = 0.5772156649...\\) is the Euler-Mascheroni constant, which is very close to \\(0.5\\). -* -* 4. For \\(x \geq 8\\), -* -* ```tex -* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr) \ln(x) - x + \frac{\ln(2\pi)}{2} + \frac{1}{12x} - \frac{1}{360x^3} + \ldots -* ``` -* -* which can be expressed -* -* ```tex -* \operatorname{lgamma}(x) \approx \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1)-\frac{\ln(2\pi)-1}{2} + \ldots -* ``` -* -* Let \\(z = \frac{1}{x}\\). We can then use the approximation -* -* ```tex -* f(z) = \operatorname{lgamma}(x) - \biggl(x-\frac{1}{2}\biggr)(\ln(x)-1) -* ``` -* -* by -* -* ```tex -* w = w_0 + w_1 z + w_2 z^3 + w_3 z^5 + \ldots + w_6 z^{11} -* ``` -* -* where -* -* ```tex -* |w - f(z)| < 2^{-58.74} -* ``` -* -* 5. For negative \\(x\\), since -* -* ```tex -* -x \Gamma(-x) \Gamma(x) = \frac{\pi}{\sin(\pi x)} -* ``` -* -* where \\(\Gamma\\) is the gamma function, we have -* -* ```tex -* \Gamma(x) = \frac{\pi}{\sin(\pi x)(-x)\Gamma(-x)} -* ``` -* -* Since \\(\Gamma(-x)\\) is positive, -* -* ```tex -* \operatorname{sign}(\Gamma(x)) = \operatorname{sign}(\sin(\pi x)) -* ``` -* -* for \\(x < 0\\). Hence, for \\(x < 0\\), -* -* ```tex -* \mathrm{signgam} = \operatorname{sign}(\sin(\pi x)) -* ``` -* -* and -* -* ```tex -* \begin{align*} -* \operatorname{lgamma}(x) &= \ln(|\Gamma(x)|) \\ -* &= \ln\biggl(\frac{\pi}{|x \sin(\pi x)|}\biggr) - \operatorname{lgamma}(-x) -* \end{align*} -* ``` -* -* -* -* Note that one should avoid computing \\(\pi (-x)\\) directly in the computation of \\(\sin(\pi (-x))\\). -* -* -* -* ## Special Cases -* -* ```tex -* \begin{align*} -* \operatorname{lgamma}(2+s) &\approx s (1-\gamma) & \mathrm{for\ tiny\ s} \\ -* \operatorname{lgamma}(x) &\approx -\ln(x) & \mathrm{for\ tiny\ x} \\ -* \operatorname{lgamma}(1) &= 0 & \\ -* \operatorname{lgamma}(2) &= 0 & \\ -* \operatorname{lgamma}(0) &= \infty & \\ -* \operatorname{lgamma}(\infty) &= \infty & \\ -* \operatorname{lgamma}(-\mathrm{integer}) &= \pm \infty -* \end{align*} -* ``` -* -* @param x input value -* @return function value -* -* @example -* double out = stdlib_base_gammaln( 1.0 ); -* // returns 0.0 -*/ -double stdlib_base_gammaln( const double x ) { - uint8_t isNegative; - int32_t flg; - double nadj; - double xc; - double p3; - double p2; - double p1; - double p; - double q; - double t; - double w; - double y; - double z; - double r; - - // Special cases: NaN, +-infinity - if ( stdlib_base_is_nan( x ) || stdlib_base_is_infinite( x ) ) { - return x; - } - - // Special case: 0 - if ( x == 0.0 ) { - return STDLIB_CONSTANT_FLOAT64_PINF; - } - xc = x; - if ( xc < 0.0 ) { - isNegative = 1; - xc = -xc; - } else { - isNegative = 0; - } - - // If |x| < 2**-56, return -ln(|x|) - if ( xc < TINY ) { - return -stdlib_base_ln( xc ); - } - if ( isNegative ) { - // If |x| >= 2**52, must be -integer - if ( xc >= TWO52 ) { - return STDLIB_CONSTANT_FLOAT64_PINF; - } - t = stdlib_base_sinpi( xc ); - if ( t == 0.0 ) { - return STDLIB_CONSTANT_FLOAT64_PINF; - } - nadj = stdlib_base_ln( STDLIB_CONSTANT_FLOAT64_PI / stdlib_base_abs( t * xc ) ); - } - - // If x equals 1 or 2, return 0 - if ( xc == 1.0 || xc == 2.0 ) { - return 0.0; - } - - // If x < 2, use lgamma(x) = lgamma(x+1) - log(x) - if ( xc < 2.0 ) { - if ( xc <= 0.9 ) { - r = -stdlib_base_ln( xc ); - if ( xc >= ( YMIN - 1.0 + 0.27 ) ) { // 0.7316 <= x <= 0.9 - y = 1.0 - xc; - flg = 0; - } else if ( xc >= ( YMIN - 1.0 - 0.27 ) ) { // 0.2316 <= x < 0.7316 - y = xc - ( TC - 1.0 ); - flg = 1; - } else { // 0 < x < 0.2316 - y = xc; - flg = 2; - } - } else { - r = 0.0; - if ( xc >= ( YMIN + 0.27 ) ) { // 1.7316 <= x < 2 - y = 2.0 - xc; - flg = 0; - } else if ( xc >= ( YMIN - 0.27 ) ) { // 1.2316 <= x < 1.7316 - y = xc - TC; - flg = 1; - } else { // 0.9 < x < 1.2316 - y = xc - 1.0; - flg = 2; - } - } - switch ( flg ) { - case 0: - z = y * y; - p1 = A1C + ( z * polyval_a1( z ) ); - p2 = z * ( A2C + ( z * polyval_a2( z ) ) ); - p = ( y * p1 ) + p2; - r += ( p - ( 0.5 * y ) ); - break; - case 1: - z = y * y; - w = z * y; - p1 = T1C + ( w * polyval_t1( w ) ); - p2 = T2C + ( w * polyval_t2( w ) ); - p3 = T3C + ( w * polyval_t3( w ) ); - p = ( z * p1 ) - ( TT - ( w * ( p2 + ( y * p3 ) ) ) ); - r += ( TF + p ); - break; - case 2: - p1 = y * ( UC + ( y * polyval_u( y ) ) ); - p2 = VC + ( y * polyval_v( y ) ); - r += ( -0.5 * y ) + ( p1 / p2 ); - break; - } - } else if ( xc < 8.0 ) { // 2 <= x < 8 - flg = stdlib_base_trunc( xc ); - y = xc - flg; - p = y * ( SC + ( y * polyval_s( y ) ) ); - q = RC + ( y * polyval_r( y ) ); - r = ( 0.5 * y ) + ( p / q ); - z = 1.0; // gammaln(1+s) = ln(s) + gammaln(s) - switch ( flg ) { - case 7: - z *= y + 6.0; - - /* Falls through */ - case 6: - z *= y + 5.0; - - /* Falls through */ - case 5: - z *= y + 4.0; - - /* Falls through */ - case 4: - z *= y + 3.0; - - /* Falls through */ - case 3: - z *= y + 2.0; - r += stdlib_base_ln( z ); - } - } else if ( xc < TWO56 ) { // 8 <= x < 2**56 - t = stdlib_base_ln( xc ); - z = 1.0 / xc; - y = z * z; - w = WC + ( z * polyval_w( y ) ); - r = ( ( xc - 0.5 ) * ( t - 1.0 ) ) + w; - } else { // 2**56 <= x <= Inf - r = xc * ( stdlib_base_ln( xc ) - 1.0 ); - } - if ( isNegative ) { - r = nadj - r; - } - return r; -} diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/DESCRIPTION b/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/DESCRIPTION deleted file mode 100644 index cb3929d04963..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/DESCRIPTION +++ /dev/null @@ -1,9 +0,0 @@ -Package: gammaln-test-fixtures -Title: Test Fixtures -Version: 0.0.0 -Authors@R: person("stdlib", "js", role = c("aut","cre")) -Description: Generates test fixtures. -Depends: R (>=3.4.0) -Imports: - jsonlite -LazyData: true diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data1.json b/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data1.json deleted file mode 100644 index d8f9053e25fd..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data1.json +++ /dev/null @@ -1 +0,0 @@ -[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171] diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data2.json b/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data2.json deleted file mode 100644 index 62a2a599c910..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/data2.json +++ /dev/null @@ -1 +0,0 @@ -[-170.55,-170.208608608609,-169.867217217217,-169.525825825826,-169.184434434434,-168.843043043043,-168.501651651652,-168.16026026026,-167.818868868869,-167.477477477477,-167.136086086086,-166.794694694695,-166.453303303303,-166.111911911912,-165.770520520521,-165.429129129129,-165.087737737738,-164.746346346346,-164.404954954955,-164.063563563564,-163.722172172172,-163.380780780781,-163.039389389389,-162.697997997998,-162.356606606607,-162.015215215215,-161.673823823824,-161.332432432432,-160.991041041041,-160.64964964965,-160.308258258258,-159.966866866867,-159.625475475475,-159.284084084084,-158.942692692693,-158.601301301301,-158.25990990991,-157.918518518519,-157.577127127127,-157.235735735736,-156.894344344344,-156.552952952953,-156.211561561562,-155.87017017017,-155.528778778779,-155.187387387387,-154.845995995996,-154.504604604605,-154.163213213213,-153.821821821822,-153.48043043043,-153.139039039039,-152.797647647648,-152.456256256256,-152.114864864865,-151.773473473473,-151.432082082082,-151.090690690691,-150.749299299299,-150.407907907908,-150.066516516517,-149.725125125125,-149.383733733734,-149.042342342342,-148.700950950951,-148.35955955956,-148.018168168168,-147.676776776777,-147.335385385385,-146.993993993994,-146.652602602603,-146.311211211211,-145.96981981982,-145.628428428428,-145.287037037037,-144.945645645646,-144.604254254254,-144.262862862863,-143.921471471471,-143.58008008008,-143.238688688689,-142.897297297297,-142.555905905906,-142.214514514515,-141.873123123123,-141.531731731732,-141.19034034034,-140.848948948949,-140.507557557558,-140.166166166166,-139.824774774775,-139.483383383383,-139.141991991992,-138.800600600601,-138.459209209209,-138.117817817818,-137.776426426426,-137.435035035035,-137.093643643644,-136.752252252252,-136.410860860861,-136.069469469469,-135.728078078078,-135.386686686687,-135.045295295295,-134.703903903904,-134.362512512513,-134.021121121121,-133.67972972973,-133.338338338338,-132.996946946947,-132.655555555556,-132.314164164164,-131.972772772773,-131.631381381381,-131.28998998999,-130.948598598599,-130.607207207207,-130.265815815816,-129.924424424424,-129.583033033033,-129.241641641642,-128.90025025025,-128.558858858859,-128.217467467467,-127.876076076076,-127.534684684685,-127.193293293293,-126.851901901902,-126.510510510511,-126.169119119119,-125.827727727728,-125.486336336336,-125.144944944945,-124.803553553554,-124.462162162162,-124.120770770771,-123.779379379379,-123.437987987988,-123.096596596597,-122.755205205205,-122.413813813814,-122.072422422422,-121.731031031031,-121.38963963964,-121.048248248248,-120.706856856857,-120.365465465465,-120.024074074074,-119.682682682683,-119.341291291291,-118.9998998999,-118.658508508509,-118.317117117117,-117.975725725726,-117.634334334334,-117.292942942943,-116.951551551552,-116.61016016016,-116.268768768769,-115.927377377377,-115.585985985986,-115.244594594595,-114.903203203203,-114.561811811812,-114.22042042042,-113.879029029029,-113.537637637638,-113.196246246246,-112.854854854855,-112.513463463463,-112.172072072072,-111.830680680681,-111.489289289289,-111.147897897898,-110.806506506507,-110.465115115115,-110.123723723724,-109.782332332332,-109.440940940941,-109.09954954955,-108.758158158158,-108.416766766767,-108.075375375375,-107.733983983984,-107.392592592593,-107.051201201201,-106.70980980981,-106.368418418418,-106.027027027027,-105.685635635636,-105.344244244244,-105.002852852853,-104.661461461461,-104.32007007007,-103.978678678679,-103.637287287287,-103.295895895896,-102.954504504505,-102.613113113113,-102.271721721722,-101.93033033033,-101.588938938939,-101.247547547548,-100.906156156156,-100.564764764765,-100.223373373373,-99.881981981982,-99.5405905905906,-99.1991991991992,-98.8578078078078,-98.5164164164164,-98.175025025025,-97.8336336336336,-97.4922422422423,-97.1508508508509,-96.8094594594595,-96.4680680680681,-96.1266766766767,-95.7852852852853,-95.4438938938939,-95.1025025025025,-94.7611111111111,-94.4197197197197,-94.0783283283283,-93.7369369369369,-93.3955455455456,-93.0541541541542,-92.7127627627628,-92.3713713713714,-92.02997997998,-91.6885885885886,-91.3471971971972,-91.0058058058058,-90.6644144144144,-90.323023023023,-89.9816316316316,-89.6402402402402,-89.2988488488489,-88.9574574574575,-88.6160660660661,-88.2746746746747,-87.9332832832833,-87.5918918918919,-87.2505005005005,-86.9091091091091,-86.5677177177177,-86.2263263263263,-85.8849349349349,-85.5435435435435,-85.2021521521522,-84.8607607607608,-84.5193693693694,-84.177977977978,-83.8365865865866,-83.4951951951952,-83.1538038038038,-82.8124124124124,-82.471021021021,-82.1296296296296,-81.7882382382383,-81.4468468468469,-81.1054554554555,-80.7640640640641,-80.4226726726727,-80.0812812812813,-79.7398898898899,-79.3984984984985,-79.0571071071071,-78.7157157157157,-78.3743243243243,-78.0329329329329,-77.6915415415416,-77.3501501501502,-77.0087587587588,-76.6673673673674,-76.325975975976,-75.9845845845846,-75.6431931931932,-75.3018018018018,-74.9604104104104,-74.619019019019,-74.2776276276276,-73.9362362362362,-73.5948448448449,-73.2534534534535,-72.9120620620621,-72.5706706706707,-72.2292792792793,-71.8878878878879,-71.5464964964965,-71.2051051051051,-70.8637137137137,-70.5223223223223,-70.1809309309309,-69.8395395395395,-69.4981481481482,-69.1567567567568,-68.8153653653654,-68.473973973974,-68.1325825825826,-67.7911911911912,-67.4497997997998,-67.1084084084084,-66.767017017017,-66.4256256256256,-66.0842342342342,-65.7428428428428,-65.4014514514515,-65.0600600600601,-64.7186686686687,-64.3772772772773,-64.0358858858859,-63.6944944944945,-63.3531031031031,-63.0117117117117,-62.6703203203203,-62.3289289289289,-61.9875375375375,-61.6461461461462,-61.3047547547548,-60.9633633633634,-60.621971971972,-60.2805805805806,-59.9391891891892,-59.5977977977978,-59.2564064064064,-58.915015015015,-58.5736236236236,-58.2322322322322,-57.8908408408409,-57.5494494494495,-57.2080580580581,-56.8666666666667,-56.5252752752753,-56.1838838838839,-55.8424924924925,-55.5011011011011,-55.1597097097097,-54.8183183183183,-54.4769269269269,-54.1355355355355,-53.7941441441442,-53.4527527527528,-53.1113613613614,-52.76996996997,-52.4285785785786,-52.0871871871872,-51.7457957957958,-51.4044044044044,-51.063013013013,-50.7216216216216,-50.3802302302302,-50.0388388388388,-49.6974474474475,-49.3560560560561,-49.0146646646647,-48.6732732732733,-48.3318818818819,-47.9904904904905,-47.6490990990991,-47.3077077077077,-46.9663163163163,-46.6249249249249,-46.2835335335335,-45.9421421421421,-45.6007507507508,-45.2593593593594,-44.917967967968,-44.5765765765766,-44.2351851851852,-43.8937937937938,-43.5524024024024,-43.211011011011,-42.8696196196196,-42.5282282282282,-42.1868368368368,-41.8454454454454,-41.5040540540541,-41.1626626626627,-40.8212712712713,-40.4798798798799,-40.1384884884885,-39.7970970970971,-39.4557057057057,-39.1143143143143,-38.7729229229229,-38.4315315315315,-38.0901401401401,-37.7487487487488,-37.4073573573574,-37.065965965966,-36.7245745745746,-36.3831831831832,-36.0417917917918,-35.7004004004004,-35.359009009009,-35.0176176176176,-34.6762262262262,-34.3348348348349,-33.9934434434435,-33.6520520520521,-33.3106606606607,-32.9692692692693,-32.6278778778779,-32.2864864864865,-31.9450950950951,-31.6037037037037,-31.2623123123123,-30.9209209209209,-30.5795295295295,-30.2381381381381,-29.8967467467467,-29.5553553553554,-29.213963963964,-28.8725725725726,-28.5311811811812,-28.1897897897898,-27.8483983983984,-27.507007007007,-27.1656156156156,-26.8242242242242,-26.4828328328328,-26.1414414414415,-25.8000500500501,-25.4586586586587,-25.1172672672673,-24.7758758758759,-24.4344844844845,-24.0930930930931,-23.7517017017017,-23.4103103103103,-23.0689189189189,-22.7275275275275,-22.3861361361361,-22.0447447447447,-21.7033533533534,-21.361961961962,-21.0205705705706,-20.6791791791792,-20.3377877877878,-19.9963963963964,-19.655005005005,-19.3136136136136,-18.9722222222222,-18.6308308308308,-18.2894394394394,-17.9480480480481,-17.6066566566567,-17.2652652652653,-16.9238738738739,-16.5824824824825,-16.2410910910911,-15.8996996996997,-15.5583083083083,-15.2169169169169,-14.8755255255255,-14.5341341341341,-14.1927427427428,-13.8513513513514,-13.50995995996,-13.1685685685686,-12.8271771771772,-12.4857857857858,-12.1443943943944,-11.803003003003,-11.4616116116116,-11.1202202202202,-10.7788288288288,-10.4374374374374,-10.096046046046,-9.75465465465467,-9.41326326326327,-9.07187187187188,-8.73048048048048,-8.38908908908908,-8.04769769769771,-7.70630630630632,-7.36491491491492,-7.02352352352352,-6.68213213213212,-6.34074074074076,-5.99934934934936,-5.65795795795796,-5.31656656656656,-4.97517517517517,-4.6337837837838,-4.2923923923924,-3.951001001001,-3.60960960960961,-3.26821821821821,-2.92682682682684,-2.58543543543544,-2.24404404404405,-1.90265265265265,-1.56126126126125,-1.21986986986988,-0.878478478478485,-0.537087087087087,-0.19569569569569,0.145695695695679,0.487087087087076,0.828478478478473,1.16986986986987,1.51126126126127,1.85265265265264,2.19404404404403,2.53543543543543,2.87682682682683,3.21821821821823,3.55960960960959,3.90100100100099,4.24239239239239,4.58378378378379,4.92517517517518,5.26656656656655,5.60795795795795,5.94934934934935,6.29074074074074,6.63213213213214,6.97352352352351,7.31491491491491,7.65630630630631,7.9976976976977,8.3390890890891,8.68048048048047,9.02187187187187,9.36326326326326,9.70465465465466,10.046046046046,10.3874374374374,10.7288288288288,11.0702202202202,11.4116116116116,11.753003003003,12.0943943943944,12.4357857857858,12.7771771771772,13.1185685685686,13.4599599599599,13.8013513513513,14.1427427427427,14.4841341341341,14.8255255255255,15.1669169169169,15.5083083083083,15.8496996996997,16.1910910910911,16.5324824824825,16.8738738738739,17.2152652652653,17.5566566566567,17.8980480480481,18.2394394394395,18.5808308308308,18.9222222222222,19.2636136136136,19.605005005005,19.9463963963964,20.2877877877878,20.6291791791792,20.9705705705706,21.311961961962,21.6533533533533,21.9947447447447,22.3361361361361,22.6775275275275,23.0189189189189,23.3603103103103,23.7017017017017,24.0430930930931,24.3844844844845,24.7258758758759,25.0672672672673,25.4086586586587,25.75005005005,26.0914414414414,26.4328328328328,26.7742242242242,27.1156156156156,27.457007007007,27.7983983983984,28.1397897897898,28.4811811811812,28.8225725725726,29.163963963964,29.5053553553554,29.8467467467467,30.1881381381381,30.5295295295295,30.8709209209209,31.2123123123123,31.5537037037037,31.8950950950951,32.2364864864865,32.5778778778779,32.9192692692693,33.2606606606606,33.602052052052,33.9434434434434,34.2848348348348,34.6262262262262,34.9676176176176,35.309009009009,35.6504004004004,35.9917917917918,36.3331831831832,36.6745745745746,37.015965965966,37.3573573573574,37.6987487487488,38.0401401401402,38.3815315315315,38.7229229229229,39.0643143143143,39.4057057057057,39.7470970970971,40.0884884884885,40.4298798798799,40.7712712712713,41.1126626626627,41.454054054054,41.7954454454454,42.1368368368368,42.4782282282282,42.8196196196196,43.161011011011,43.5024024024024,43.8437937937938,44.1851851851852,44.5265765765766,44.867967967968,45.2093593593594,45.5507507507508,45.8921421421421,46.2335335335335,46.5749249249249,46.9163163163163,47.2577077077077,47.5990990990991,47.9404904904905,48.2818818818819,48.6232732732733,48.9646646646647,49.3060560560561,49.6474474474474,49.9888388388388,50.3302302302302,50.6716216216216,51.013013013013,51.3544044044044,51.6957957957958,52.0371871871872,52.3785785785786,52.71996996997,53.0613613613613,53.4027527527527,53.7441441441441,54.0855355355355,54.4269269269269,54.7683183183183,55.1097097097097,55.4511011011011,55.7924924924925,56.1338838838839,56.4752752752753,56.8166666666667,57.1580580580581,57.4994494494495,57.8408408408408,58.1822322322322,58.5236236236236,58.865015015015,59.2064064064064,59.5477977977978,59.8891891891892,60.2305805805806,60.571971971972,60.9133633633634,61.2547547547547,61.5961461461461,61.9375375375375,62.2789289289289,62.6203203203203,62.9617117117117,63.3031031031031,63.6444944944945,63.9858858858859,64.3272772772773,64.6686686686687,65.0100600600601,65.3514514514515,65.6928428428429,66.0342342342342,66.3756256256256,66.717017017017,67.0584084084084,67.3997997997998,67.7411911911912,68.0825825825826,68.423973973974,68.7653653653654,69.1067567567568,69.4481481481481,69.7895395395395,70.1309309309309,70.4723223223223,70.8137137137137,71.1551051051051,71.4964964964965,71.8378878878879,72.1792792792793,72.5206706706707,72.8620620620621,73.2034534534534,73.5448448448448,73.8862362362362,74.2276276276276,74.569019019019,74.9104104104104,75.2518018018018,75.5931931931932,75.9345845845846,76.275975975976,76.6173673673674,76.9587587587588,77.3001501501502,77.6415415415415,77.9829329329329,78.3243243243243,78.6657157157157,79.0071071071071,79.3484984984985,79.6898898898899,80.0312812812813,80.3726726726727,80.7140640640641,81.0554554554554,81.3968468468468,81.7382382382382,82.0796296296296,82.421021021021,82.7624124124124,83.1038038038038,83.4451951951952,83.7865865865866,84.127977977978,84.4693693693694,84.8107607607608,85.1521521521522,85.4935435435435,85.8349349349349,86.1763263263263,86.5177177177177,86.8591091091091,87.2005005005005,87.5418918918919,87.8832832832833,88.2246746746747,88.5660660660661,88.9074574574574,89.2488488488489,89.5902402402402,89.9316316316317,90.273023023023,90.6144144144144,90.9558058058058,91.2971971971972,91.6385885885886,91.97997997998,92.3213713713714,92.6627627627628,93.0041541541542,93.3455455455455,93.6869369369369,94.0283283283283,94.3697197197197,94.7111111111111,95.0525025025025,95.3938938938939,95.7352852852853,96.0766766766767,96.4180680680681,96.7594594594594,97.1008508508509,97.4422422422422,97.7836336336337,98.125025025025,98.4664164164164,98.8078078078078,99.1491991991992,99.4905905905906,99.831981981982,100.173373373373,100.514764764765,100.856156156156,101.197547547548,101.538938938939,101.88033033033,102.221721721722,102.563113113113,102.904504504505,103.245895895896,103.587287287287,103.928678678679,104.27007007007,104.611461461461,104.952852852853,105.294244244244,105.635635635636,105.977027027027,106.318418418418,106.65980980981,107.001201201201,107.342592592593,107.683983983984,108.025375375375,108.366766766767,108.708158158158,109.04954954955,109.390940940941,109.732332332332,110.073723723724,110.415115115115,110.756506506507,111.097897897898,111.439289289289,111.780680680681,112.122072072072,112.463463463463,112.804854854855,113.146246246246,113.487637637638,113.829029029029,114.17042042042,114.511811811812,114.853203203203,115.194594594595,115.535985985986,115.877377377377,116.218768768769,116.56016016016,116.901551551552,117.242942942943,117.584334334334,117.925725725726,118.267117117117,118.608508508509,118.9498998999,119.291291291291,119.632682682683,119.974074074074,120.315465465465,120.656856856857,120.998248248248,121.33963963964,121.681031031031,122.022422422422,122.363813813814,122.705205205205,123.046596596597,123.387987987988,123.729379379379,124.070770770771,124.412162162162,124.753553553554,125.094944944945,125.436336336336,125.777727727728,126.119119119119,126.460510510511,126.801901901902,127.143293293293,127.484684684685,127.826076076076,128.167467467467,128.508858858859,128.85025025025,129.191641641642,129.533033033033,129.874424424424,130.215815815816,130.557207207207,130.898598598599,131.23998998999,131.581381381381,131.922772772773,132.264164164164,132.605555555556,132.946946946947,133.288338338338,133.62972972973,133.971121121121,134.312512512513,134.653903903904,134.995295295295,135.336686686687,135.678078078078,136.019469469469,136.360860860861,136.702252252252,137.043643643644,137.385035035035,137.726426426426,138.067817817818,138.409209209209,138.750600600601,139.091991991992,139.433383383383,139.774774774775,140.116166166166,140.457557557558,140.798948948949,141.14034034034,141.481731731732,141.823123123123,142.164514514515,142.505905905906,142.847297297297,143.188688688689,143.53008008008,143.871471471471,144.212862862863,144.554254254254,144.895645645646,145.237037037037,145.578428428428,145.91981981982,146.261211211211,146.602602602603,146.943993993994,147.285385385385,147.626776776777,147.968168168168,148.30955955956,148.650950950951,148.992342342342,149.333733733734,149.675125125125,150.016516516517,150.357907907908,150.699299299299,151.040690690691,151.382082082082,151.723473473473,152.064864864865,152.406256256256,152.747647647648,153.089039039039,153.43043043043,153.771821821822,154.113213213213,154.454604604605,154.795995995996,155.137387387387,155.478778778779,155.82017017017,156.161561561562,156.502952952953,156.844344344344,157.185735735736,157.527127127127,157.868518518518,158.20990990991,158.551301301301,158.892692692693,159.234084084084,159.575475475475,159.916866866867,160.258258258258,160.59964964965,160.941041041041,161.282432432432,161.623823823824,161.965215215215,162.306606606607,162.647997997998,162.989389389389,163.330780780781,163.672172172172,164.013563563564,164.354954954955,164.696346346346,165.037737737738,165.379129129129,165.720520520521,166.061911911912,166.403303303303,166.744694694695,167.086086086086,167.427477477478,167.768868868869,168.11026026026,168.451651651652,168.793043043043,169.134434434434,169.475825825826,169.817217217217,170.158608608609,170.5] diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected1.json b/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected1.json deleted file mode 100644 index 9b55cb0a67d0..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected1.json +++ /dev/null @@ -1 +0,0 @@ -[0,0,0.693147180559945,1.79175946922805,3.17805383034795,4.78749174278205,6.5792512120101,8.52516136106541,10.6046029027453,12.8018274800815,15.1044125730755,17.5023078458739,19.9872144956619,22.5521638531234,25.1912211827387,27.8992713838409,30.6718601060807,33.5050734501369,36.3954452080331,39.3398841871995,42.3356164607535,45.3801388984769,48.4711813518352,51.6066755677644,54.7847293981123,58.0036052229805,61.261701761002,64.5575386270063,67.8897431371815,71.257038967168,74.6582363488302,78.0922235533153,81.557959456115,85.0544670175815,88.5808275421977,92.1361756036871,95.7196945421432,99.3306124547874,102.968198614514,106.631760260643,110.320639714757,114.034211781462,117.771881399745,121.533081515439,125.317271149357,129.123933639127,132.952575035616,136.802722637326,140.673923648234,144.565743946345,148.477766951773,152.409592584497,156.360836303079,160.331128216631,164.320112263195,168.327445448428,172.352797139163,176.395848406997,180.456291417544,184.533828861449,188.628173423672,192.739047287845,196.86618167289,201.009316399281,205.168199482641,209.342586752537,213.532241494563,217.736934113954,221.95644181913,226.190548323728,230.439043565777,234.701723442818,238.978389561834,243.268849002983,247.572914096187,251.890402209723,256.22113555001,260.564940971863,264.921649798553,269.29109765102,273.673124285694,278.067573440366,282.47429268763,286.893133295427,291.32395009427,295.766601350761,300.220948647014,304.686856765669,309.164193580147,313.652829949879,318.152639620209,322.663499126726,327.185287703775,331.717887196928,336.261181979198,340.815058870799,345.379407062267,349.95411804077,354.539085519441,359.134205369575,363.739375555563,368.354496072405,372.979468885689,377.614197873919,382.25858877306,386.912549123218,391.57598821733,396.248817051791,400.930948278916,405.622296161145,410.322776526937,415.03230672825,419.750805599545,424.478193418257,429.214391866652,433.959323995015,438.712914186121,443.475088120919,448.245772745385,453.024896238496,457.812387981278,462.608178526875,467.412199571608,472.224383926981,477.044665492586,481.872979229888,486.709261136839,491.553448223298,496.405478487218,501.265290891579,506.132825342035,511.008022665236,515.890824587823,520.781173716044,525.679013515995,530.584288294434,535.49694318017,540.416924105998,545.344177791155,550.278651724286,555.220294146895,560.169054037273,565.124881094874,570.087725725134,575.05753902471,580.034272767131,585.017879388839,590.008311975618,595.005524249382,600.009470555327,605.020105849424,610.037385686239,615.061266207085,620.091704128477,625.128656730891,630.17208184781,635.22193785506,640.278183660408,645.340778693435,650.409682895655,655.484856710889,660.566261075874,665.653857411106,670.747607611913,675.847474039737,680.953419513638,686.065407301994,691.183401114411,696.307365093814,701.437263808737,706.573062245787] diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected2.json b/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected2.json deleted file mode 100644 index d2109d782c61..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/expected2.json +++ /dev/null @@ -1 +0,0 @@ -[-708.24313562762,-706.0052418387,-703.842565120593,-702.98904108446,-700.636983917122,-698.739058277586,-697.735304275731,-695.255519170722,-693.615717940444,-692.482000714991,-689.855232541798,-688.478582438882,-687.229139316134,-684.427143592678,-683.33166117758,-681.976661044856,-678.955594527905,-678.177748458703,-676.724434285623,-673.409475796886,-673.018864738297,-671.472246443799,-667.711560506726,-667.856512702183,-666.219790871918,-661.545473722192,-662.691833996347,-660.966647602287,-655.805476160054,-657.525709284142,-655.712255442213,-651.907572323237,-652.358824276659,-650.455871491627,-647.254292760232,-647.191714408489,-645.196511605176,-642.40970975862,-642.024795560589,-639.932860813943,-637.47766150581,-636.858385300828,-634.663134310212,-632.496541359493,-631.692717404632,-629.384852982469,-627.484855244878,-626.527951374964,-624.094462373561,-622.452956337526,-621.364178008316,-618.7866433314,-617.407225691611,-616.201421587167,-613.452957164236,-612.351873583682,-611.03963892037,-608.078866748351,-607.28982144065,-605.878715133278,-602.636038486889,-602.223175462698,-600.718455772474,-597.056578694477,-597.153499454225,-595.558574373993,-591.087749622921,-592.081980836536,-590.398674064869,-584.863264478014,-587.009536141921,-585.238220891481,-581.365304531303,-581.936880382986,-580.076505160688,-576.846493487845,-576.864573866965,-574.912584706423,-572.112558065392,-571.793054343546,-569.745199803568,-567.284378282531,-566.722659233828,-564.572641678922,-562.404551983031,-561.653640867878,-559.392541330006,-557.493129557774,-556.586176553371,-554.201513445721,-552.56116879096,-551.520374590576,-548.994517769056,-547.615421080477,-546.456276863777,-543.763618180218,-542.660312475229,-541.39385827113,-538.495297062155,-537.698900715083,-536.333022933641,-533.163676455982,-532.733384124177,-531.273596792162,-527.708720046109,-527.765392531213,-526.215315798843,-521.92432610018,-522.796163229404,-521.157808356184,-514.974603271628,-517.826652261498,-516.10056982666,-512.153021696236,-512.857607327226,-511.042925611208,-507.784805085825,-507.889616853615,-505.9839770737,-503.17265505268,-502.923143639832,-500.92252068885,-498.458666360042,-497.958548120274,-495.856923604014,-493.690294414494,-492.996104348763,-490.784924815715,-488.889314292576,-488.03601063535,-485.703302116622,-484.067555807949,-483.078396022837,-480.607279742633,-479.232171826886,-478.12332328442,-475.489390001886,-474.387821198675,-473.170788745717,-470.337046578101,-469.537708778266,-468.220718910573,-465.126554271377,-464.684132805873,-463.272963542564,-459.804547770728,-459.828795378745,-458.327284463985,-454.200171682456,-454.972989081553,-453.383338804768,-443.81507753966,-450.117714445507,-448.440654646665,-444.410560002097,-445.263756609151,-443.498595760287,-440.213052396502,-440.411736771832,-438.556310052552,-435.736236701945,-435.562147414259,-433.612652710604,-431.149048518017,-430.715376646416,-428.666068376969,-426.50458990605,-425.871724972283,-423.714403835744,-421.826569135389,-421.031416518084,-418.754596226971,-417.127664795626,-416.194605986469,-413.782123001361,-412.415466827708,-411.361382071284,-408.789956031929,-407.694886856614,-406.531767678211,-403.76636418263,-402.969290058012,-401.705716969386,-398.689602494377,-398.241084592632,-396.883108926011,-393.512014267843,-393.512053235304,-392.063736744117,-388.090038065993,-388.783551464715,-387.247291871485,-381.066390617164,-384.056631513508,-382.433340746753,-378.310668452761,-379.332123017067,-377.621291125647,-374.309579058157,-374.610686990127,-372.810342929985,-369.984943995775,-369.892852711187,-367.999415171026,-365.540323307425,-365.179043213921,-363.18703433826,-361.0354277749,-360.469592873519,-358.371157821324,-356.496141885251,-355.764759256615,-353.548881795606,-351.936081447972,-351.064730576317,-348.715929910855,-347.36331520169,-346.36962954223,-343.86569097247,-342.78303195444,-341.679513993797,-338.987225042905,-338.198774295808,-336.994374373824,-334.060540411844,-333.61307405577,-332.31412777759,-329.042903289337,-329.027806860732,-327.63860794423,-323.812313975169,-324.444402548516,-322.967550070566,-317.540768018703,-319.86397626802,-318.300568617913,-314.072205203744,-315.287413377107,-313.637125173067,-310.30141391239,-310.715426101797,-308.976481596642,-306.150494884375,-306.148592189186,-304.317630536216,-301.86875058819,-301.587381616176,-299.65918967136,-297.523685701227,-297.032175053504,-294.9992351731,-293.143647094159,-292.48327638286,-290.33502781995,-288.743291811715,-287.940920691844,-285.662537214021,-284.331218296466,-283.405278594207,-280.975555132023,-279.912924350659,-278.87645730791,-276.263882787428,-275.492154016584,-274.354498586901,-271.509118247128,-271.071583493409,-269.839373282893,-266.672808393715,-266.653200584196,-265.330971953808,-261.650279745395,-262.238528399496,-260.829090468166,-255.865217288529,-257.828764024698,-256.33340887989,-251.98149766121,-253.424867971992,-251.8434608008,-248.487453085667,-249.027623719308,-247.358588782658,-244.538800948562,-244.637678272099,-242.877878275764,-240.447129641815,-240.255570199271,-238.400057433986,-236.289215998862,-235.881749068455,-233.923340006784,-232.096211706117,-231.516588715594,-229.445168411429,-227.883941974607,-227.160395861483,-224.961770625895,-223.661601628179,-222.813414983118,-220.467342226599,-219.435043390793,-218.475829918166,-215.952395341183,-215.208250812871,-214.147762338308,-211.399991005722,-210.984079638673,-209.829266908606,-206.775438147648,-206.764664362855,-205.520322598623,-201.988203845016,-202.551656335578,-201.220819161393,-196.610541809846,-198.346370627036,-196.930537154036,-192.429358776143,-194.149880437333,-192.649118884618,-189.279234714966,-189.963079809503,-188.376026059053,-185.572640227503,-185.786726341493,-184.110477152065,-181.709452453006,-181.621470766892,-179.851352608746,-177.777594175725,-177.467877571617,-175.597046734107,-173.811444181384,-173.32643922845,-171.345226691701,-169.828162606431,-169.197585656294,-167.092419644224,-165.837639844199,-165.081689876838,-162.83325741502,-161.846161301505,-160.979070396188,-158.558970275967,-157.858021167381,-156.889990489866,-154.25400867894,-153.876324992572,-152.814654251451,-149.887049040997,-149.903426010676,-148.753198921418,-145.37929033327,-145.94117909377,-144.705682579808,-140.40029927317,-141.991096757967,-140.67206567494,-135.98140090713,-138.054449259053,-136.652183925703,-133.280081616066,-134.132331123204,-132.645708622123,-129.875188894221,-130.225706634701,-128.652087780257,-126.299092015527,-126.335441606121,-124.670457039996,-122.65329470585,-122.46232586411,-120.699500658412,-118.9759607477,-118.607089197354,-116.73722606475,-115.285841904069,-114.770412483212,-112.780579695569,-111.593709067575,-110.952935045456,-108.824749595558,-107.906448111727,-107.155258835428,-104.861790084725,-104.228832154275,-103.377949674716,-100.87758631866,-100.564392711878,-99.6215354818869,-96.8439709851641,-96.9158897701794,-95.8865010722868,-92.6921279429136,-93.2855843838598,-92.1732787067652,-88.1597007346231,-89.675406240005,-88.4822329875486,-83.5302509925101,-86.0870618316405,-84.8136378220592,-81.4625215717122,-82.5221073564656,-81.1676417613477,-78.4597502819831,-78.9819998070978,-77.5442156283865,-75.2718829632466,-75.4681341304233,-73.9430721178823,-72.017345791969,-71.9818712494432,-70.3635391797867,-68.7389818547371,-68.5245599626133,-66.8043535347322,-65.4576935470957,-65.0975546677353,-63.2633082098164,-62.1856415575574,-61.7022301885998,-59.7366141178073,-58.9308411739321,-58.3399945411384,-56.2176495625198,-55.6991195221764,-55.0123001607198,-52.6942351651302,-52.4950711638699,-51.7206538572202,-49.1417088327388,-49.3225755325301,-48.4666255175119,-45.5004661766306,-46.1851024397446,-45.2518552827463,-41.5586722013471,-43.085907531562,-42.0780585194005,-36.698889711974,-40.028168016727,-38.9470272656553,-35.6726009216095,-37.0150856517153,-35.8606257689586,-33.2820483751482,-34.0499727306093,-32.8207758607365,-30.7024259043216,-31.1363312595611,-29.8294244938489,-28.074782265379,-28.2779328447301,-26.8884792363701,-25.4493139306941,-25.4789058797454,-23.9996844094355,-22.851662505273,-22.7438369009302,-21.1643826490218,-20.2983198543778,-20.0778944216756,-18.3830426800152,-17.8019222403853,-17.4869864439179,-15.6542727933017,-15.3735815428602,-14.9779678957964,-12.9725785931691,-13.024165344369,-12.5589229228908,-10.3225542895131,-10.76519577749,-10.2395621805789,-7.66022270380137,-8.6096751497451,-8.03180305717123,-4.8219483908833,-6.57304994664814,-5.95065429910065,0.759505674965929,-4.67455428662645,-4.01563707750267,-1.04826856867839,-2.93933714342887,-2.25322387181986,-0.0846143622323258,-1.40222292367738,-0.701407433676224,0.923138998038882,-0.115225813466852,0.580618058528916,1.73989489151408,0.834695032013229,1.48766931600594,2.17856435935493,1.27032586274654,1.77912162965342,1.8584665162817,0.598137153881244,0.125493523165651,-0.0760831504355754,-0.120312236894024,-0.0550692787346708,0.0937158523028068,0.309905658902866,0.582529976403065,0.903662550281847,1.26731548682091,1.66880904964184,2.10438693456189,2.57096845033915,3.0659818408901,3.58724813009757,4.13289773529161,4.70130907715801,5.2910623942531,5.90090433673316,6.52972037242922,7.17651296597155,7.8403840980344,8.52052109793887,9.2161850408851,9.9267011551539,10.6514508224792,11.3898648542962,12.1414177994427,12.9056230929679,13.6820288963284,14.4702145101129,15.2697872641303,16.0803798080537,16.9016477401769,17.7332675231603,18.5749346446424,19.4263619877996,20.2872783827425,21.157427314348,22.0365657659753,22.9244631816637,23.8209005320246,24.7256694711937,25.6385715740155,26.5594176441403,27.4880270849819,28.4242273265591,29.3678533021504,30.3187469694665,31.2767568717087,32.2417377344428,33.2135500947113,34.1920599592251,35.1771384888389,36.1686617068336,37.1665102287999,38.1705690121636,39.180727123597,40.1968775227486,41.218916860886,42.2467452931868,43.2802663035422,44.3193865408473,45.3640156658517,46.4140662077321,47.4694534296302,48.5300952024622,49.5959118863771,50.6668262192915,51.7427632119801,52.8236500492482,53.9094159967515,54.9999923130645,56.0953121666353,57.1953105572889,58.2999242419754,59.409091664477,60.5227528888153,61.6408495361182,62.7633247247236,63.8901230133167,65.0211903469105,66.1564740054934,67.2959225551828,68.439485801732,69.5871147462519,70.7387615430155,71.8943794592269,73.0539228366378,74.2173470549107,75.384608496628,76.5556645138563,77.730473396181,78.9089943401302,80.0911874199143,81.2770135594107,82.4664345053279,83.6594128014885,84.8559117641721,86.0558954584651,87.259328675566,88.4661769109987,89.676406343689,90.8899838158608,92.106876813714,93.3270534488454,94.5504824403771,95.7771330977601,97.0069753042201,98.2399795008167,99.4761166710879,100.715358326253,101.957676490947,103.20304368947,104.451432932517,105.702817704373,106.957171950564,108.214470065919,109.474686883052,110.73779766123,112.003778075611,113.272604206851,114.544252531045,115.818699910002,117.095923581836,118.375901151861,119.658610583778,120.944030191135,122.23213862907,123.522914886296,124.816338277347,126.112388435056,127.411045303265,128.712289129756,130.016100459392,131.322460127467,132.631349253251,133.942749233723,135.256641737491,136.573008698885,137.891832312219,139.213095026225,140.536779538632,141.862868790909,143.19134596315,144.522194469101,145.855397951325,147.190940276502,148.52880553085,149.86897801568,151.211442243059,152.556182931597,153.903185002343,155.252433574788,156.603913962975,157.957611671705,159.31351239285,160.671602001747,162.0318665537,163.394292280557,164.758865587382,166.125573049201,167.494401407843,168.865337568843,170.238368598432,171.613481720598,172.990664314214,174.369903910242,175.751188188998,177.134504977484,178.519842246787,179.907188109534,181.296530817407,182.687858758719,184.081160456046,185.476424563907,186.873639866508,188.272795275524,189.673879827946,191.076882683961,192.481793124892,193.888600551179,195.2972944804,196.707864545345,198.120300492122,199.534592178315,200.95072957117,202.368702745831,203.788501883605,205.210117270271,206.633539294419,208.058758445825,209.485765313868,210.914550585967,212.345105046058,213.777419573104,215.21148513963,216.647292810293,218.084833740478,219.524099174921,220.965080446365,222.407768974238,223.85215626336,225.298233902673,226.745993563999,228.195427000821,229.646526047088,231.099282616042,232.553688699068,234.00973636457,235.467417756863,236.926725095086,238.387650672145,239.850186853662,241.314326076954,242.780060850026,244.247383750589,245.716287425085,247.186764587742,248.658808019639,250.132410567791,251.607565144247,253.084264725211,254.562502350172,256.042271121055,257.523564201382,259.006374815453,260.490696247537,261.976521841081,263.46384499793,264.952659177564,266.442957896343,267.934734726771,269.427983296768,270.922697288957,272.418870439965,273.916496539728,275.415569430819,276.916083007778,278.418031216458,279.921408053381,281.426207565106,282.932423847602,284.44005104564,285.949083352186,287.459515007813,288.971340300115,290.484553563133,291.999149176794,293.515121566352,295.032465201846,296.551174597557,298.071244311485,299.592668944824,301.115443141454,302.639561587432,304.165019010498,305.69181017959,307.219929904355,308.749373034684,310.280134460239,311.812209109999,313.345591951807,314.88027799192,316.416262274579,317.953539881571,319.492105931806,321.0319555809,322.57308402076,324.115486479176,325.659158219427,327.204094539881,328.750290773608,330.297742288,331.846444484389,333.39639279768,334.947582695979,336.50000968024,338.053669283902,339.608557072542,341.164668643529,342.721999625682,344.280545678936,345.840302494009,347.401265792079,348.963431324457,350.526794872274,352.091352246169,353.657099285974,355.224031860419,356.792145866824,358.361437230807,359.931901905992,361.503535873723,363.076335142775,364.650295749078,366.225413755442,367.801685251279,369.379106352341,370.957673200451,372.53738196324,374.118228833893,375.70021003089,377.283321797761,378.867560402829,380.452922138973,382.039403323382,383.62700029732,385.215709425888,386.805527097791,388.396449725115,389.98847374309,391.58159560988,393.175811806349,394.771118835855,396.367513224026,397.964991518554,399.563550288982,401.163186126501,402.763895643739,404.365675474569,405.968522273899,407.572432717484,409.177403501728,410.783431343493,412.390512979909,413.998645168187,415.607824685435,417.218048328474,418.829312913659,420.441615276701,422.054952272489,423.669320774919,425.284717676721,426.901139889287,428.518584342507,430.137047984603,431.756527781961,433.377020718976,434.998523797885,436.621034038615,438.244548478625,439.869064172749,441.494578193047,443.121087628654,444.748589585628,446.377081186809,448.006559571665,449.637021896157,451.268465332588,452.900887069472,454.534284311386,456.16865427884,457.803994208136,459.440301351237,461.077572975631,462.715806364206,464.354998815112,465.995147641639,467.636250172087,469.278303749641,470.92130573225,472.565253492499,474.210144417491,475.855975908728,477.502745381989,479.150450267216,480.799088008394,482.448656063442,484.099151904091,485.750573015781,487.402916897545,489.056181061896,490.710363034725,492.36546035519,494.021470575609,495.678391261355,497.336219990753,498.994954354976,500.654591957944,502.315130416221,503.976567358917,505.63890042759,507.302127276144,508.966245570739,510.631252989688,512.297147223369,513.963925974124,515.631586956175,517.300127895523,518.969546529864,520.639840608497,522.311007892232,523.983046153306,525.655953175296,527.329726753026,529.004364692492,530.679864810768,532.356224935927,534.033442906957,535.711516573681,537.39044379667,539.07022244717,540.750850407017,542.43232556856,544.114645834582,545.797809118225,547.481813342912,549.166656442269,550.852336360055,552.538851050082,554.226198476147,555.914376611953,557.603383441045,559.293216956728,560.983875162007,562.675356069508,564.367657701416,566.060778089398,567.754715274546,569.449467307297,571.145032247376,572.841408163725,574.538593134438,576.2365852467,577.935382596715,579.634983289649,581.335385439566,583.03658716936,584.738586610703,586.441381903972,588.144971198197,589.849352650999,591.554524428527,593.260484705402,594.967231664658,596.674763497682,598.383078404159,600.092174592015,601.802050277359,603.512703684426,605.224133045525,606.936336600984,608.649312599089,610.36305929604,612.07757495589,613.792857850495,615.508906259462,617.225718470094,618.943292777344,620.661627483757,622.380720899424,624.100571341931,625.82117713631,627.542536614985,629.264648117731,630.987509991618,632.711120590968,634.435478277305,636.160581419308,637.886428392766,639.613017580529,641.340347372464,643.068416165408,644.797222363126,646.526764376261,648.257040622292,649.988049525496,651.719789516891,653.452259034206,655.18545652183,656.919380430774,658.654029218626,660.389401349509,662.125495294043,663.8623095293,665.599842538765,667.338092812295,669.07705884608,670.816739142603,672.557132210598,674.298236565016,676.040050726981,677.782573223755,679.525802588697,681.26973736123,683.014376086799,684.759717316833,686.505759608714,688.252501525734,689.999941637063,691.748078517712,693.496910748495,695.246436915996,696.996655612536,698.747565436131,700.499164990465,702.251452884853,704.004427734205] diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/runner.R b/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/runner.R deleted file mode 100644 index 337a2d6c7dbc..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/fixtures/r/runner.R +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env Rscript -# -# @license Apache-2.0 -# -# Copyright (c) 2018 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. - -# Set the precision to 16 digits: -options( digits = 16L ); - -#' Generate test fixtures. -#' -#' @examples -#' main(); -main <- function() { - #' Get the script filepath. - #' - #' @return The absolute path of this script - #' - #' @examples - #' filepath <- get_script_path(); - get_script_path <- function() { - args <- commandArgs( trailingOnly = FALSE ); - needle <- "--file="; - match <- grep( needle, args ); - if ( length( match ) > 0 ) { - # Rscript: - filepath <- sub( needle, "", args[match] ); - } else { - ls_vars <- ls( sys.frames()[[1]] ) - if ( "fileName" %in% ls_vars ) { - # Source'd via RStudio: - filepath <- sys.frames()[[1]]$fileName; # nolint - } else { - # Source'd via R console: - filepath <- sys.frames()[[1]]$ofile; - } - } - return( normalizePath( filepath ) ); - } - - #' Convert a data structure to JSON. - #' - #' @param x A data structure to convert - #' @return JSON blob - #' - #' @examples - #' x <- seq( -6.5, 25, 0.5 ); - #' json <- to_json( x ); - to_json <- function( x ) { - return( jsonlite::toJSON( x, digits = 16, auto_unbox = TRUE ) ); - } - - #' Generate an output absolute filepath based on the script directory. - #' - #' @param name An output filename - #' @return An absolute filepath - #' - #' @examples - #' filepath <- get_filepath( "data.json" ); - get_filepath <- function( name ) { - return( paste( source_dir, "/", name, sep = "" ) ); - } - - # Get the directory of this script: - source_dir <- dirname( get_script_path() ); - - # Generate integer test data: - x <- seq( 1, 171, 1 ); - y <- lgamma( x ); - - # Deal with NaNs: - cat( y, sep = ",\n" ); - - # Convert fixture data to JSON: - x <- to_json( x ); - y <- to_json( y ); - - # Write the data to file... - filepath <- get_filepath( "data1.json" ); - write( x, filepath ); - - filepath <- get_filepath( "expected1.json" ); - write( y, filepath ); - - - # Generate decimal test data: - x <- seq( -170.55, 170.5, length.out = 1000 ) - y <- lgamma( x ) - - # Deal with NaNs: - cat( y, sep = ",\n" ); - - # Convert fixture data to JSON: - x <- to_json( x ); - y <- to_json( y ); - - # Write the data to file... - filepath <- get_filepath( "data2.json" ); - write( x, filepath ); - - filepath <- get_filepath( "expected2.json" ); - write( y, filepath ); -} - -main(); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js b/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js deleted file mode 100644 index b709027ea84b..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var ln = require( '@stdlib/math/base/special/ln' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var gammaln = require( './../lib' ); - - -// FIXTURES // - -var data1 = require( './fixtures/r/data1.json' ); -var expected1 = require( './fixtures/r/expected1.json' ); -var data2 = require( './fixtures/r/data2.json' ); -var expected2 = require( './fixtures/r/expected2.json' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof gammaln, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) { - var v = gammaln( NaN ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `infinity` when provided `infinity`', function test( t ) { - var v = gammaln( PINF ); - t.strictEqual( v, PINF, 'returns expected value' ); - - v = gammaln( NINF ); - t.strictEqual( v, NINF, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `+infinity` when provided `0`', function test( t ) { - var v = gammaln( 0.0 ); - t.strictEqual( v, PINF, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `+infinity` for x smaller than `-2^52`', function test( t ) { - var v = gammaln( -pow( 2.0, 53 ) ); - t.strictEqual( v, PINF, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `-ln(x)` for very small x', function test( t ) { - var x; - var v; - - x = 2.0e-90; - v = gammaln( x ); - t.strictEqual( v, -ln( x ), 'returns expected value' ); - - t.end(); -}); - -tape( 'the function evaluates the natural logarithm of the gamma function (positive integers)', function test( t ) { - var expected; - var delta; - var tol; - var x; - var y; - var i; - - x = data1; - expected = expected1; - - for ( i = 0; i < x.length; i++ ) { - y = gammaln( x[ i ] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 21.2 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } - } - t.end(); -}); - -tape( 'the function evaluates the natural logarithm of the gamma function (decimal values)', function test( t ) { - var expected; - var delta; - var tol; - var x; - var y; - var i; - - x = data2; - expected = expected2; - - for ( i = 0; i < x.length; i++ ) { - y = gammaln( x[ i ] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.1e4 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } - } - t.end(); -}); - -tape( 'the function evaluates the natural logarithm of the gamma function for x > 2^58', function test( t ) { - var x; - var v; - - x = pow( 2.0, 59 ); - v = gammaln( x ); - t.strictEqual( v, x * (ln(x)-1.0), 'returns x*(ln(x)-1) for x>2^58' ); - - t.end(); -}); - -tape( 'if provided a positive integer, the function returns the natural logarithm of the factorial of (n-1)', function test( t ) { - t.strictEqual( gammaln( 4.0 ), ln(6.0), 'returns ln(6)' ); - t.strictEqual( gammaln( 5.0 ), ln(24.0), 'returns ln(24)' ); - t.strictEqual( gammaln( 6.0 ), ln(120.0), 'returns ln(120)' ); - t.end(); -}); - -tape( 'returns `+infinity` for `x=-2^51`', function test( t ) { - var v = gammaln( -pow( 2.0, 51 ) ); - t.strictEqual( v, PINF, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js deleted file mode 100644 index bef227c0baa5..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js +++ /dev/null @@ -1,168 +0,0 @@ -/** -* @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 resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var ln = require( '@stdlib/math/base/special/ln' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// FIXTURES // - -var data1 = require( './fixtures/r/data1.json' ); -var expected1 = require( './fixtures/r/expected1.json' ); -var data2 = require( './fixtures/r/data2.json' ); -var expected2 = require( './fixtures/r/expected2.json' ); - - -// VARIABLES // - -var gammaln = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( gammaln instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof gammaln, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { - var v = gammaln( NaN ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `infinity` when provided `infinity`', opts, function test( t ) { - var v = gammaln( PINF ); - t.strictEqual( v, PINF, 'returns expected value' ); - - v = gammaln( NINF ); - t.strictEqual( v, NINF, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `+infinity` when provided `0`', opts, function test( t ) { - var v = gammaln( 0.0 ); - t.strictEqual( v, PINF, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `+infinity` for x smaller than `-2^52`', opts, function test( t ) { - var v = gammaln( -pow( 2.0, 53 ) ); - t.strictEqual( v, PINF, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `-ln(x)` for very small x', opts, function test( t ) { - var x; - var v; - - x = 2.0e-90; - v = gammaln( x ); - t.strictEqual( v, -ln( x ), 'returns expected value' ); - - t.end(); -}); - -tape( 'the function evaluates the natural logarithm of the gamma function (positive integers)', opts, function test( t ) { - var expected; - var delta; - var tol; - var x; - var y; - var i; - - x = data1; - expected = expected1; - - for ( i = 0; i < x.length; i++ ) { - y = gammaln( x[ i ] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 21.2 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } - } - t.end(); -}); - -tape( 'the function evaluates the natural logarithm of the gamma function (decimal values)', opts, function test( t ) { - var expected; - var delta; - var tol; - var x; - var y; - var i; - - x = data2; - expected = expected2; - - for ( i = 0; i < x.length; i++ ) { - y = gammaln( x[ i ] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.1e4 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } - } - t.end(); -}); - -tape( 'the function evaluates the natural logarithm of the gamma function for x > 2^58', opts, function test( t ) { - var x; - var v; - - x = pow( 2.0, 59 ); - v = gammaln( x ); - t.strictEqual( v, x * (ln(x)-1.0), 'returns x*(ln(x)-1) for x>2^58' ); - - t.end(); -}); - -tape( 'if provided a positive integer, the function returns the natural logarithm of the factorial of (n-1)', opts, function test( t ) { - t.strictEqual( gammaln( 4.0 ), ln(6.0), 'returns ln(6)' ); - t.strictEqual( gammaln( 5.0 ), ln(24.0), 'returns ln(24)' ); - t.strictEqual( gammaln( 6.0 ), ln(120.0), 'returns ln(120)' ); - t.end(); -}); - -tape( 'returns `+infinity` for `x=-2^51`', opts, function test( t ) { - var v = gammaln( -pow( 2.0, 51 ) ); - t.strictEqual( v, PINF, 'returns expected value' ); - t.end(); -});