From 0da3f1a47c0af1ff9de3a95f5c8a4e309cf1a6f7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 18 Oct 2024 11:23:08 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 7 +- LICENSE | 119 +++++++++--------- base/special/exp2/benchmark/benchmark.js | 9 +- .../exp2/benchmark/benchmark.native.js | 9 +- base/special/exp2/benchmark/c/benchmark.c | 8 +- .../exp2/benchmark/c/cephes/benchmark.c | 8 +- .../exp2/benchmark/c/native/benchmark.c | 8 +- base/special/ln/benchmark/benchmark.js | 16 ++- base/special/ln/benchmark/benchmark.native.js | 9 +- base/special/ln/benchmark/c/benchmark.c | 8 +- .../special/ln/benchmark/c/cephes/benchmark.c | 8 +- .../special/ln/benchmark/c/native/benchmark.c | 8 +- base/special/ln/manifest.json | 25 +++- 13 files changed, 150 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3a256aa..b9f9a4702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-10-15) +## Unreleased (2024-10-18)
@@ -432,6 +432,11 @@ A total of 5 people contributed to this release. Thank you to the following cont
+- [`325ca07`](https://github.com/stdlib-js/stdlib/commit/325ca074aa79d05fc6aa551d035d600b7bb66f2e) - **bench:** refactor benchmarks _(by Athan Reines)_ +- [`c6fe24f`](https://github.com/stdlib-js/stdlib/commit/c6fe24f012b118f30347d075ce52169c8423fbf5) - **bench:** refactor benchmarks _(by Athan Reines)_ +- [`923a355`](https://github.com/stdlib-js/stdlib/commit/923a3553d58b3dac76c22d895bf0bf7c7c3bc75e) - **bench:** refactor C benchmarks _(by Athan Reines)_ +- [`2b30eb7`](https://github.com/stdlib-js/stdlib/commit/2b30eb7d91ebcad9919546040198fad15c54b2b8) - **bench:** refactor C benchmarks _(by Athan Reines)_ +- [`33494b7`](https://github.com/stdlib-js/stdlib/commit/33494b7c0d3bba12b17fc6f0b6990cdadc9c04aa) - **build:** add WebAssembly configuration _(by Athan Reines)_ - [`6c58a22`](https://github.com/stdlib-js/stdlib/commit/6c58a22b6f7e514fb358c3256b9573357e4baa65) - **bench:** refactor benchmarks _(by Athan Reines)_ - [`870f645`](https://github.com/stdlib-js/stdlib/commit/870f64561a7d90579bd92920c8733a205ed0a55c) - **build:** add WebAssembly configuration _(by Athan Reines)_ - [`2ce25ea`](https://github.com/stdlib-js/stdlib/commit/2ce25ea8e857700287558847d93b108f3ca6b33d) - **build:** add WebAssembly configuration _(by Athan Reines)_ diff --git a/LICENSE b/LICENSE index bab3338f5..347714bb0 100644 --- a/LICENSE +++ b/LICENSE @@ -229,43 +229,43 @@ Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved. +* SLATEC Common Mathematical Library + +Public domain. + * FDLIBM Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. -* Faddeeva - -Copyright (c) 2012 Massachusetts Institute of Technology +* Go -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Copyright (c) 2009 The Go Authors. All rights reserved. -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SpecialFunctions.jl @@ -294,35 +294,42 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* Go +* Faddeeva -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright (c) 2012 Massachusetts Institute of Technology -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ Stephen L. Moshier moshier@na-net.ornl.gov @@ -330,7 +337,3 @@ moshier@na-net.ornl.gov Version 2.0, January 2004 http://www.apache.org/licenses/ -* SLATEC Common Mathematical Library - -Public domain. - diff --git a/base/special/exp2/benchmark/benchmark.js b/base/special/exp2/benchmark/benchmark.js index c143280b5..889e5feff 100644 --- a/base/special/exp2/benchmark/benchmark.js +++ b/base/special/exp2/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( './../../../../base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var exp2 = require( './../lib' ); @@ -34,10 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 10, -1022.0, 1022.0, { + 'dtype': 'generic' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*2044.0 ) - 1022.0; - y = exp2( x ); + y = exp2( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/base/special/exp2/benchmark/benchmark.native.js b/base/special/exp2/benchmark/benchmark.native.js index 7dbe51aed..1e9fd187b 100644 --- a/base/special/exp2/benchmark/benchmark.native.js +++ b/base/special/exp2/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( './../../../../base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,10 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = uniform( 10, -1022.0, 1022.0, { + 'dtype': 'generic' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 2044.0 ) - 1022.0; - y = exp2( x ); + y = exp2( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/base/special/exp2/benchmark/c/benchmark.c b/base/special/exp2/benchmark/c/benchmark.c index f94719314..c42281561 100644 --- a/base/special/exp2/benchmark/c/benchmark.c +++ b/base/special/exp2/benchmark/c/benchmark.c @@ -90,15 +90,17 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 10 ]; double y; double t; int i; + for ( i = 0; i < 10; i++ ) { + x[ i ] = ( 2044.0 * rand_double() ) - 1022.0; + } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2044.0*rand_double() ) - 1022.0; - y = exp2( x ); + y = exp2( x[ i%10 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/exp2/benchmark/c/cephes/benchmark.c b/base/special/exp2/benchmark/c/cephes/benchmark.c index 15a21e7b4..46e978141 100644 --- a/base/special/exp2/benchmark/c/cephes/benchmark.c +++ b/base/special/exp2/benchmark/c/cephes/benchmark.c @@ -95,15 +95,17 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 10 ]; double y; double t; int i; + for ( i = 0; i < 10; i++ ) { + x[ i ] = ( 2044.0 * rand_double() ) - 1022.0; + } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2044.0*rand_double() ) - 1022.0; - y = exp2( x ); + y = exp2( x[ i%10 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/exp2/benchmark/c/native/benchmark.c b/base/special/exp2/benchmark/c/native/benchmark.c index 2af497d9f..dacc50fa2 100644 --- a/base/special/exp2/benchmark/c/native/benchmark.c +++ b/base/special/exp2/benchmark/c/native/benchmark.c @@ -91,15 +91,17 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 10 ]; double y; double t; int i; + for ( i = 0; i < 10; i++ ) { + x[ i ] = ( 2044.0 * rand_double() ) - 1022.0; + } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 2044.0 * rand_double() ) - 1022.0; - y = stdlib_base_exp2( x ); + y = stdlib_base_exp2( x[ i%10 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/ln/benchmark/benchmark.js b/base/special/ln/benchmark/benchmark.js index 048d2fa67..df8ad6366 100644 --- a/base/special/ln/benchmark/benchmark.js +++ b/base/special/ln/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( './../../../../base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var ln = require( './../lib' ); @@ -34,10 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 10, 0.0, 10000.0, { + 'dtype': 'generic' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10000.0 ) - 0.0; - y = ln( x ); + y = ln( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -55,10 +58,13 @@ bench( pkg+'::built-in', function benchmark( b ) { var y; var i; + x = uniform( 10, 0.0, 10000.0, { + 'dtype': 'generic' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10000.0 ) - 0.0; - y = Math.log( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.log( x[ i%x.length ] ); // eslint-disable-line stdlib/no-builtin-math if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/base/special/ln/benchmark/benchmark.native.js b/base/special/ln/benchmark/benchmark.native.js index a264cfb86..15f032d81 100644 --- a/base/special/ln/benchmark/benchmark.native.js +++ b/base/special/ln/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( './../../../../base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,10 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = uniform( 10, 0.0, 10000.0, { + 'dtype': 'generic' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10000.0 ) - 0.0; - y = ln( x ); + y = ln( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/base/special/ln/benchmark/c/benchmark.c b/base/special/ln/benchmark/c/benchmark.c index 0037cee72..ea6547724 100644 --- a/base/special/ln/benchmark/c/benchmark.c +++ b/base/special/ln/benchmark/c/benchmark.c @@ -90,15 +90,17 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 10 ]; double y; double t; int i; + for ( i = 0; i < 10; i++ ) { + x[ i ] = ( 10000.0*rand_double() ) - 0.0; + } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10000.0*rand_double() ) - 0.0; - y = log( x ); + y = log( x[ i%10 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/ln/benchmark/c/cephes/benchmark.c b/base/special/ln/benchmark/c/cephes/benchmark.c index 31049cf75..152f2c585 100644 --- a/base/special/ln/benchmark/c/cephes/benchmark.c +++ b/base/special/ln/benchmark/c/cephes/benchmark.c @@ -95,15 +95,17 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 10 ]; double y; double t; int i; + for ( i = 0; i < 10; i++ ) { + x[ i ] = ( 10000.0*rand_double() ) - 0.0; + } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10000.0*rand_double() ) - 0.0; - y = log( x ); + y = log( x[ i%10 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/ln/benchmark/c/native/benchmark.c b/base/special/ln/benchmark/c/native/benchmark.c index 2976f68c8..62cff627f 100644 --- a/base/special/ln/benchmark/c/native/benchmark.c +++ b/base/special/ln/benchmark/c/native/benchmark.c @@ -91,15 +91,17 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 10 ]; double y; double t; int i; + for ( i = 0; i < 10; i++ ) { + x[ i ] = ( 10000.0*rand_double() ) - 0.0; + } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10000.0*rand_double() ) - 0.0; - y = stdlib_base_ln( x ); + y = stdlib_base_ln( x[ i%10 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/ln/manifest.json b/base/special/ln/manifest.json index 668bf4bb6..dcc9a2c1a 100644 --- a/base/special/ln/manifest.json +++ b/base/special/ln/manifest.json @@ -1,6 +1,7 @@ { "options": { - "task": "build" + "task": "build", + "wasm": false }, "fields": [ { @@ -27,6 +28,7 @@ "confs": [ { "task": "build", + "wasm": false, "src": [ "./src/main.c" ], @@ -46,6 +48,7 @@ }, { "task": "benchmark", + "wasm": false, "src": [ "./src/main.c" ], @@ -64,6 +67,26 @@ }, { "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/number/float64/base/get-high-word", + "@stdlib/number/float64/base/set-high-word", + "@stdlib/math/base/assert/is-nan", + "@stdlib/constants/float64/ninf", + "@stdlib/constants/float64/exponent-bias" + ] + }, + { + "task": "build", + "wasm": true, "src": [ "./src/main.c" ],