From 501db1bb1515184b32a7b32816fd6b7dbedcba7c Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:10:44 -0800 Subject: [PATCH 01/24] docs: update related packages sections PR-URL: https://github.com/stdlib-js/stdlib/pull/4784 Reviewed-by: Athan Reines --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../blas/ext/base/sapxsumkbn/README.md | 2 +- .../@stdlib/constants/float32/pi/README.md | 18 ++ .../stats/base/dists/planck/mode/README.md | 89 +++++++++ .../dists/planck/mode/benchmark/benchmark.js | 12 +- .../planck/mode/benchmark/benchmark.native.js | 67 +++++++ .../dists/planck/mode/benchmark/c/Makefile | 146 +++++++++++++++ .../dists/planck/mode/benchmark/c/benchmark.c | 140 +++++++++++++++ .../stats/base/dists/planck/mode/binding.gyp | 170 ++++++++++++++++++ .../dists/planck/mode/examples/c/Makefile | 146 +++++++++++++++ .../dists/planck/mode/examples/c/example.c | 38 ++++ .../stats/base/dists/planck/mode/include.gypi | 53 ++++++ .../stdlib/stats/base/dists/planck/mode.h | 38 ++++ .../base/dists/planck/mode/lib/native.js | 58 ++++++ .../base/dists/planck/mode/manifest.json | 85 +++++++++ .../stats/base/dists/planck/mode/package.json | 3 + .../stats/base/dists/planck/mode/src/Makefile | 70 ++++++++ .../stats/base/dists/planck/mode/src/addon.c | 23 +++ .../stats/base/dists/planck/mode/src/main.c | 37 ++++ .../dists/planck/mode/test/test.native.js | 77 ++++++++ 19 files changed, 1268 insertions(+), 4 deletions(-) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/binding.gyp create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/include.gypi create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/include/stdlib/stats/base/dists/planck/mode.h create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/lib/native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/manifest.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/addon.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/main.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/planck/mode/test/test.native.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/sapxsumkbn/README.md b/lib/node_modules/@stdlib/blas/ext/base/sapxsumkbn/README.md index 5be0312c484c..acb3b06bdcc1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/sapxsumkbn/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/sapxsumkbn/README.md @@ -166,7 +166,7 @@ console.log( v ); ## See Also - [`@stdlib/blas/ext/base/dapxsumkbn`][@stdlib/blas/ext/base/dapxsumkbn]: add a constant to each double-precision floating-point strided array element and compute the sum using an improved Kahan–Babuška algorithm. -- [`@stdlib/blas/ext/base/gapxsumkbn`][@stdlib/blas/ext/base/gapxsumkbn]: add a constant to each strided array element and compute the sum using an improved Kahan–Babuška algorithm. +- [`@stdlib/blas/ext/base/gapxsumkbn`][@stdlib/blas/ext/base/gapxsumkbn]: add a scalar constant to each strided array element and compute the sum using an improved Kahan–Babuška algorithm. - [`@stdlib/blas/ext/base/sapxsum`][@stdlib/blas/ext/base/sapxsum]: add a constant to each single-precision floating-point strided array element and compute the sum. - [`@stdlib/blas/ext/base/ssumkbn`][@stdlib/blas/ext/base/ssumkbn]: calculate the sum of single-precision floating-point strided array elements using an improved Kahan–Babuška algorithm. diff --git a/lib/node_modules/@stdlib/constants/float32/pi/README.md b/lib/node_modules/@stdlib/constants/float32/pi/README.md index d09323920e77..ac7408481fde 100644 --- a/lib/node_modules/@stdlib/constants/float32/pi/README.md +++ b/lib/node_modules/@stdlib/constants/float32/pi/README.md @@ -108,6 +108,14 @@ Macro for the mathematical constant [π][pi]. @@ -118,6 +126,16 @@ Macro for the mathematical constant [π][pi]. [pi]: https://en.wikipedia.org/wiki/Pi + + +[@stdlib/constants/float32/fourth-pi]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/constants/float32/fourth-pi + +[@stdlib/constants/float32/half-pi]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/constants/float32/half-pi + +[@stdlib/constants/float32/two-pi]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/constants/float32/two-pi + + + diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md index 0d62c5c213a4..b79fce122892 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md @@ -118,6 +118,95 @@ for ( i = 0; i < lambda.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/planck/mode.h" +``` + +#### stdlib_base_dists_planck_mode( lambda ) + +Evaluates the mode for an planck distribution. + +```c +double out = stdlib_base_dists_planck_mean( 0.1 ); +// returns ~0 +``` + +The function accepts the following arguments: + +- **lambda**: `[in] double` shape parameter + +```c +double stdlib_base_dists_planck_mode( const double lambda ); +``` +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/planck/mode.h" +#include +#include + +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v * (max - min) ); +} +int main( void ) { + double lambda; + double y; + int i; + for ( i = 0; i < 25; i++ ) { + lambda = random_uniform( 0.1, 10.0 ); + y = stdlib_base_dists_planck_mode( lambda ); + printf( "lambda: %lf, E(X;λ): %lf\n", lambda, y ); + } +} +``` + +
+ + + +
+ + + diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c index 3cc270b4456e..fc8ced98a2b5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c @@ -99,12 +99,12 @@ static double benchmark( void ) { int i; for ( i = 0; i < 100; i++ ) { - lambda[i] = ( random_uniform( 0.0, 10.0 ) + 1.0 ); + lambda[ i ] = random_uniform( 1.0, 10.0 ); } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_dists_planck_mode( lambda[i % 100] ); + y = stdlib_base_dists_planck_mode( lambda[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; From eeab1f8e464bedde2fa7f807fdd81abd1df87752 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 16:51:47 -0700 Subject: [PATCH 12/24] style: add spaces Signed-off-by: Athan --- .../stats/base/dists/planck/mode/benchmark/c/benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c index fc8ced98a2b5..f2e34cb0f19f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c @@ -93,7 +93,7 @@ static double random_uniform( const double min, const double max ) { */ static double benchmark( void ) { double elapsed; - double lambda[100]; + double lambda[ 100 ]; double y; double t; int i; From 5efe34663b0ca7eba0e467f20f07aee26ebfe588 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 16:53:23 -0700 Subject: [PATCH 13/24] docs: fix missing decimal Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/main.c index d55b25d1808a..f87807e81f92 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/main.c @@ -27,7 +27,7 @@ * * @example * double y = stdlib_base_dists_planck_mode( 0.1 ); -* // returns 0 +* // returns 0.0 */ double stdlib_base_dists_planck_mode( const double lambda ) { if ( stdlib_base_is_nan( lambda ) || lambda <= 0.0 ) { From 8f1ea70a18f1d5b2e4f91acdc2021713af0121df Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 16:53:46 -0700 Subject: [PATCH 14/24] style: fix missing decimal Signed-off-by: Athan --- .../stats/base/dists/planck/mode/benchmark/benchmark.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.native.js index 0fc66980e32a..e4242a4c8f3f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.native.js @@ -48,7 +48,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { len = 100; lambda = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - lambda[ i ] = uniform( 0.1, 11 ); + lambda[ i ] = uniform( 0.1, 11.0 ); } b.tic(); From 69d14e15edfd34541017bca6814f00fb3222f9e6 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 16:54:47 -0700 Subject: [PATCH 15/24] style: combine declaration and assignment Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/test/test.native.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/test/test.native.js index f3133c8031b0..a97f9d5b7159 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/test/test.native.js @@ -44,8 +44,7 @@ tape( 'main export is a function', opts, function test( t ) { }); tape( 'if provided `NaN` for `lambda`, the function returns `NaN`', opts, function test( t ) { - var v; - v = mode( NaN ); + var v = mode( NaN ); t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); From da3e1d0d0f47dea1884e77096bcb26dbd0fb90b1 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 16:55:42 -0700 Subject: [PATCH 16/24] style: fix return annotation Signed-off-by: Athan --- lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md index 420d1790f798..cc2f4c73d9f9 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md @@ -150,7 +150,7 @@ Returns the [mode][mode] of a Planck distribution with shape parameter `lambda`. ```c double out = stdlib_base_dists_planck_mode( 0.1 ); -// returns ~0 +// returns 0.0 ``` The function accepts the following arguments: From bbc40facf190bfe5aab098c9ba79145cfcbe02d0 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 16:56:38 -0700 Subject: [PATCH 17/24] docs: fix missing decimals Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md index cc2f4c73d9f9..70a3ee31f3b8 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md @@ -56,10 +56,10 @@ Returns the [mode][mode] of a Planck distribution with shape parameter `lambda`. ```javascript var v = mode( 0.1 ); -// returns 0 +// returns 0.0 v = mode( 1.5 ); -// returns 0 +// returns 0.0 ``` If provided a shape parameter `lambda` is nonpositive or `NaN`, the function returns `NaN`. From e814dccffcc89349d95ebf6b23fe0383ecb7724d Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:04:21 -0700 Subject: [PATCH 18/24] build: fix file path Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/binding.gyp index 9039678e8957..68a1ca11d160 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/binding.gyp @@ -21,7 +21,7 @@ { # List of files to include in this file: 'includes': [ - './include.gypi ', + './include.gypi', ], # Define variables to be used throughout the configuration for all targets: From 9bd48453919a1aade0ac999d9fb96974ac5816a1 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:07:14 -0700 Subject: [PATCH 19/24] build: fix path Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/include.gypi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/include.gypi index 1dcc66259420..ecfaf82a3279 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/include.gypi @@ -24,7 +24,7 @@ # Define variables to be used throughout the configuration for all targets: 'variables': { # Source directory: - 'src_dir': ' ./src', + 'src_dir': './src', # Include directories: 'include_dirs': [ From d05d27a25bbc322b54cfd0a142f551ddbfb51317 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:19:30 -0700 Subject: [PATCH 20/24] docs: fix missing space Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/Makefile index 5007b998f41d..7733b6180cb4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/src/Makefile @@ -7,7 +7,7 @@ # 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 +# 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, From 8684cf9d490984b72a603da1648c5d41f99691f8 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:36:07 -0700 Subject: [PATCH 21/24] docs: remove space Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile index ec0c680b1976..a4bd7b38fd74 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile @@ -13,7 +13,7 @@ # 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 . +# limitations under the License. #/ # VARIABLES # From d2ff484aec0519cb7a3d1c5474e9a1d93be328ce Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:36:29 -0700 Subject: [PATCH 22/24] docs: fix space Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/examples/c/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/Makefile index 7b09359c799c..25ced822f96a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/Makefile @@ -13,7 +13,7 @@ # 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 . +# limitations under the License. #/ # VARIABLES # From 6627e0ed60ae47509729b2eb97681c4d14ed847c Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 20 Jun 2025 17:36:51 -0700 Subject: [PATCH 23/24] docs: remove space Signed-off-by: Athan --- .../@stdlib/stats/base/dists/planck/mode/lib/native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/lib/native.js index 260e9c035575..ebca4d8f99f4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/lib/native.js @@ -13,7 +13,7 @@ * 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 . +* limitations under the License. */ 'use strict'; From 05afdf3cd52e7ee2a804fe1f27976c355999f572 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 21 Jun 2025 14:01:51 -0500 Subject: [PATCH 24/24] style: add empty line Signed-off-by: Philipp Burckhardt --- lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md index 70a3ee31f3b8..fd6b13d147d4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md @@ -188,6 +188,7 @@ static double random_uniform( const double min, const double max ) { double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); return min + ( v * (max - min) ); } + int main( void ) { double lambda; double y;