From d7705cc81b74c13aadbb89312c0902d00701b8bd Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 3 Feb 2026 19:01:21 +0530 Subject: [PATCH 1/2] feat: add C implementation for stats/base/dists/kumaraswamy/pdf --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: missing_dependencies - 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 --- --- .../base/dists/kumaraswamy/pdf/README.md | 99 +++++++++- .../pdf/benchmark/benchmark.native.js | 71 ++++++++ .../kumaraswamy/pdf/benchmark/c/Makefile | 146 +++++++++++++++ .../kumaraswamy/pdf/benchmark/c/benchmark.c | 142 +++++++++++++++ .../base/dists/kumaraswamy/pdf/binding.gyp | 170 ++++++++++++++++++ .../dists/kumaraswamy/pdf/examples/c/Makefile | 146 +++++++++++++++ .../kumaraswamy/pdf/examples/c/example.c | 42 +++++ .../base/dists/kumaraswamy/pdf/include.gypi | 53 ++++++ .../stdlib/stats/base/dists/kumaraswamy/pdf.h | 38 ++++ .../base/dists/kumaraswamy/pdf/lib/native.js | 88 +++++++++ .../base/dists/kumaraswamy/pdf/manifest.json | 79 ++++++++ .../base/dists/kumaraswamy/pdf/src/Makefile | 70 ++++++++ .../base/dists/kumaraswamy/pdf/src/addon.c | 22 +++ .../base/dists/kumaraswamy/pdf/src/main.c | 56 ++++++ .../dists/kumaraswamy/pdf/test/test.native.js | 161 +++++++++++++++++ 15 files changed, 1382 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/binding.gyp create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/include.gypi create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/include/stdlib/stats/base/dists/kumaraswamy/pdf.h create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/lib/native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/manifest.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/src/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/src/addon.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/src/main.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/test/test.native.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/README.md index 9913b84c71f8..da4a1ec94720 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/pdf/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2026 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. @@ -160,6 +160,103 @@ logEachMap( 'x: %0.4f, a: %0.4f, b: %0.4f, f(x;a,b): %0.4f', x, a, b, pdf ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/kumaraswamy/pdf.h" +``` + +#### stdlib_base_dists_kumaraswamy_pdf( x, a, b ) + +Evaluates the probability distribution function (PDF) for a Kumaraswamy's double bounded distribution. + +```c +double out = stdlib_base_dists_kumaraswamy_pdf( 0.5, 1.0, 1.0 ); +// returns 1.0 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **a**: `[in] double` first shape parameter. +- **b**: `[in] double` second shape parameter. + +```c +double stdlib_base_dists_kumaraswamy_pdf( const double x, const double a, const double b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/kumaraswamy/pdf.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 x; + double a; + double b; + double y; + int i; + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0, 1.0 ); + a = random_uniform( 0, 5.0 ); + b = random_uniform( 0, 5.0 ); + y = stdlib_base_dists_kumaraswamy_pdf( x, a, b ); + printf( "x: %lf, a: %lf, b: %lf, f(x;a,b): %lf\n", x, a, b, y ); + } +} +``` + +
+ + + +
+ + +