From 2a497989daf9a609e6ebcc8f5f28f764cc66b5fe Mon Sep 17 00:00:00 2001 From: Rutam Kathale Date: Mon, 11 Mar 2024 18:17:19 +0530 Subject: [PATCH 1/6] feat: add C implementation for @stdlib/math/base/special/xlogy This commit if applied adds the C implementation to @stdlib/math/base/special/xlogy package --- .../@stdlib/math/base/special/xlogy/README.md | 92 +++++++++- .../xlogy/benchmark/benchmark.native.js | 62 +++++++ .../special/xlogy/benchmark/c/native/Makefile | 146 +++++++++++++++ .../xlogy/benchmark/c/native/benchmark.c | 138 ++++++++++++++ .../math/base/special/xlogy/binding.gyp | 170 ++++++++++++++++++ .../base/special/xlogy/examples/c/Makefile | 146 +++++++++++++++ .../base/special/xlogy/examples/c/example.c | 35 ++++ .../math/base/special/xlogy/include.gypi | 53 ++++++ .../math/base/special/xlogy/include/xlogy.h | 38 ++++ .../math/base/special/xlogy/lib/native.js | 52 ++++++ .../math/base/special/xlogy/manifest.json | 74 ++++++++ .../math/base/special/xlogy/src/Makefile | 70 ++++++++ .../math/base/special/xlogy/src/addon.c | 23 +++ .../math/base/special/xlogy/src/main.c | 42 +++++ .../base/special/xlogy/test/test.native.js | 86 +++++++++ 15 files changed, 1226 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/benchmark/c/native/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/include/xlogy.h create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/xlogy/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/xlogy/README.md b/lib/node_modules/@stdlib/math/base/special/xlogy/README.md index 1e3bda42f463..76fefde4d533 100644 --- a/lib/node_modules/@stdlib/math/base/special/xlogy/README.md +++ b/lib/node_modules/@stdlib/math/base/special/xlogy/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +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. @@ -89,6 +89,96 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/xlogy.h" +``` + +#### stdlib_base_xlogy( x, y ) + +Computes `x * ln(y)` so that the result is `0` if `x = 0`. + +```c +double v = stdlib_base_xlogy( 3.0, 2.0 ); +// returns ~2.079 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **y**: `[in] double` input value. + +```c +double stdlib_base_xlogy( const double x, const double y ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/xlogy.h" +#include +#include + +int main( void ) { + double out; + double x; + double y; + int i; + + for ( i = 0; i < 100; i++ ) { + x = ( (double)rand() / (double)RAND_MAX ) * 100.0; + y = ( (double)rand() / (double)RAND_MAX ) * 5.0; + out = stdlib_base_xlogy( x, y ); + printf( "xlogy(%lf, %lf) = %lf\n", x, y, out ); + } +} +``` + +
+ + + +
+ + +