From e01c8e28e77db58112d6bdcffa2e924f648e09fd Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Tue, 26 Nov 2024 08:41:43 +0530 Subject: [PATCH] feat: add C implementation for `math/base/special/riemann-zeta` PR-URL: https://github.com/stdlib-js/stdlib/pull/2737 Ref: https://github.com/stdlib-js/stdlib/issues/649 Reviewed-by: Athan Reines Reviewed-by: Philipp Burckhardt Signed-off-by: Gunj Joshi Co-authored-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> --- .../math/base/special/riemann-zeta/README.md | 85 ++ .../riemann-zeta/benchmark/benchmark.js | 7 +- .../benchmark/benchmark.native.js | 62 ++ .../riemann-zeta/benchmark/c/native/Makefile | 146 ++++ .../benchmark/c/native/benchmark.c | 136 +++ .../base/special/riemann-zeta/binding.gyp | 170 ++++ .../special/riemann-zeta/examples/c/Makefile | 146 ++++ .../special/riemann-zeta/examples/c/example.c | 31 + .../base/special/riemann-zeta/include.gypi | 53 ++ .../stdlib/math/base/special/riemann_zeta.h | 38 + .../base/special/riemann-zeta/lib/main.js | 6 +- .../base/special/riemann-zeta/lib/native.js | 66 ++ .../special/riemann-zeta/lib/rational_p1q1.js | 4 +- .../special/riemann-zeta/lib/rational_p2q2.js | 4 +- .../special/riemann-zeta/lib/rational_p3q3.js | 4 +- .../special/riemann-zeta/lib/rational_p4q4.js | 4 +- .../special/riemann-zeta/lib/rational_p5q5.js | 4 +- .../special/riemann-zeta/lib/rational_p6q6.js | 4 +- .../base/special/riemann-zeta/manifest.json | 117 +++ .../riemann-zeta/scripts/evalrational.js | 68 ++ .../base/special/riemann-zeta/src/Makefile | 70 ++ .../base/special/riemann-zeta/src/addon.c | 23 + .../math/base/special/riemann-zeta/src/main.c | 813 ++++++++++++++++++ .../base/special/riemann-zeta/test/test.js | 16 +- .../special/riemann-zeta/test/test.native.js | 320 +++++++ 25 files changed, 2371 insertions(+), 26 deletions(-) create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/benchmark/c/native/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/include/stdlib/math/base/special/riemann_zeta.h create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/riemann-zeta/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/riemann-zeta/README.md b/lib/node_modules/@stdlib/math/base/special/riemann-zeta/README.md index 25c5c7cfdb2..f0b1b085027 100644 --- a/lib/node_modules/@stdlib/math/base/special/riemann-zeta/README.md +++ b/lib/node_modules/@stdlib/math/base/special/riemann-zeta/README.md @@ -103,6 +103,91 @@ for ( i = 0; i < s.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/riemann_zeta.h" +``` + +#### stdlib_base_zeta( s ) + +Evaluates the [Riemann zeta][zeta-function] function as a function of a real variable `s` (i.e., `t = 0`). + +```c +double out = stdlib_base_zeta( 1.1 ); +// returns ~10.584 +``` + +The function accepts the following arguments: + +- **s**: `[in] double` input value. + +```c +double stdlib_base_zeta( const double s ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/riemann_zeta.h" +#include + +int main( void ) { + const double s[] = { -50.0, -38.9, -27.8, -16.7, -5.6, 5.6, 16.7, 27.8, 38.9, 50.0 }; + + double v; + int i; + for ( i = 0; i < 1; i++ ) { + v = stdlib_base_zeta( s[ i ] ); + printf( "zeta(%lf) = %lf\n", s[ i ], v ); + } +} +``` + +
+ + + +
+ + +