From 4efb6c4a473947dc2ea571fdea83224bf5a917da Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Wed, 25 Dec 2024 18:46:22 +0530 Subject: [PATCH 1/9] feat: add C implementation for geometric mgf --- .../stats/base/dists/geometric/mgf/README.md | 90 ++++++++++ .../geometric/mgf/benchmark/benchmark.js | 14 +- .../mgf/benchmark/benchmark.native.js | 72 ++++++++ .../dists/geometric/mgf/benchmark/c/Makefile | 146 +++++++++++++++ .../geometric/mgf/benchmark/c/benchmark.c | 142 +++++++++++++++ .../base/dists/geometric/mgf/binding.gyp | 170 ++++++++++++++++++ .../dists/geometric/mgf/examples/c/Makefile | 146 +++++++++++++++ .../dists/geometric/mgf/examples/c/example.c | 43 +++++ .../base/dists/geometric/mgf/include.gypi | 53 ++++++ .../stdlib/stats/base/dists/geometric/mgf.h | 38 ++++ .../base/dists/geometric/mgf/lib/native.js | 72 ++++++++ .../base/dists/geometric/mgf/manifest.json | 84 +++++++++ .../base/dists/geometric/mgf/package.json | 3 + .../base/dists/geometric/mgf/src/Makefile | 70 ++++++++ .../base/dists/geometric/mgf/src/addon.c | 23 +++ .../stats/base/dists/geometric/mgf/src/main.c | 74 ++++++++ .../dists/geometric/mgf/test/test.native.js | 129 +++++++++++++ 17 files changed, 1366 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/lib/native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md index 76ba4b6fd13f..6d083129b095 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md @@ -151,6 +151,96 @@ for ( i = 0; i < 10; i++ ) {
+ + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/geometric/mgf.h" +``` + +#### stdlib_base_dists_geometric_mgf( t, p ) + +Evaluates evaluating the [moment-generating function][mgf] of a [geometric][geometric-distribution] distribution with parameter `p` (success probability). + +```c +double out = stdlib_base_dists_geometric_mgf( 0.2, 0.5 ); +// returns ~1.569 +``` + +The function accepts the following arguments: + +- **t**: `[in] double` input value. +- **p**: `[in] double` probability of success. + +```c +double stdlib_base_dists_geometric_mgf( const double t, const double p ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/geometric/mgf.h" +#include "stdlib/constants/float64/eps.h" +#include "stdlib/math/base/special/ln.h" +#include +#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 t; + double p; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + t = random_uniform( 0.0, ( -stdlib_base_ln( 1.0 - p ) ) ); + y = stdlib_base_dists_geometric_mgf( t, p ); + printf( "t: %lf, p: %lf, M_X(t;p): %lf\n", t, p, y ); + } +} +``` +
diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js index f57af79f4e59..eda53b01dbb7 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js @@ -21,6 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); var randu = require( '@stdlib/random/base/randu' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var ln = require( '@stdlib/math/base/special/ln' ); @@ -32,16 +33,23 @@ var mgf = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { + var len; var p; var t; var y; var i; + len = 100; + t = new Float64Array( len ); + p = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + p[ i % len ] = ( randu()*1.0 ) + EPS; + t[ i % len ] = randu() * (-ln( 1.0 - p ) ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - p = ( randu()*1.0 ) + EPS; - t = randu() * (-ln( 1.0 - p ) ); - y = mgf( t, p ); + y = mgf( t[ i % len ], p[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js new file mode 100644 index 000000000000..12d3e948931c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* 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, +* 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. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); +var randu = require( '@stdlib/random/base/randu' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var ln = require( '@stdlib/math/base/special/ln' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var mgf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( mgf instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var len; + var p; + var t; + var y; + var i; + + len = 100; + t = new Float64Array( len ); + p = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + p[ i % len ] = ( randu()*1.0 ) + EPS; + t[ i % len ] = randu() * (-ln( 1.0 - p ) ); + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = mgf( t[ i % len ], p[ i % len ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# 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, +# 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c new file mode 100644 index 000000000000..c601ade14e4b --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c @@ -0,0 +1,142 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* 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, +* 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. +*/ + +#include "stdlib/stats/base/dists/geometric/mgf.h" +#include "stdlib/constants/float64/eps.h" +#include "stdlib/math/base/special/ln.h" +#include +#include +#include +#include +#include + +#define NAME "geometric-mgf" +#define ITERATIONS 1000000 +#define REPEATS 3 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param elapsed elapsed time in seconds +*/ +static void print_results( double elapsed ) { + double rate = (double)ITERATIONS / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", ITERATIONS ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [min,max). +* +* @param min minimum value (inclusive) +* @param max maximum value (exclusive) +* @return random number +*/ +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +/** +* Runs a benchmark. +* +* @return elapsed time in seconds +*/ +static double benchmark( void ) { + double elapsed; + double p[ 100 ]; + double t[ 100 ]; + double y; + double tc; + int i; + + for ( i = 0; i < 100; i++ ) { + p[ i ] = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + t[ i ] = random_uniform( 0.0, ( -stdlib_base_ln( 1.0 - p[ i ] ) ) ); + } + + tc = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_dists_geometric_mgf( t[ i % 100 ], p[ i % 100 ] ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - tc; + if ( y != y ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int i; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + for ( i = 0; i < REPEATS; i++ ) { + printf( "# c::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp new file mode 100644 index 000000000000..507cb00291e7 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# 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, +# 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. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile new file mode 100644 index 000000000000..6aed70daf167 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# 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, +# 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c new file mode 100644 index 000000000000..eec57d9355ba --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* 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, +* 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. +*/ + +#include "stdlib/stats/base/dists/geometric/mgf.h" +#include "stdlib/constants/float64/eps.h" +#include "stdlib/math/base/special/ln.h" +#include +#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 t; + double p; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + t = random_uniform( 0.0, ( -stdlib_base_ln( 1.0 - p ) ) ); + y = stdlib_base_dists_geometric_mgf( t, p ); + printf( "t: %lf, p: %lf, M_X(t;p): %lf\n", t, p, y ); + } +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi new file mode 100644 index 000000000000..c6495fc1da3f --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# 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, +# 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. + +# A GYP include file for building a Node.js native add-on. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '= -ln(1-p) +* var y = mgf( 0.8, 0.5 ); +* // returns NaN +* +* @example +* var y = mgf( NaN, 0.0 ); +* // returns NaN +* +* @example +* var y = mgf( 0.0, NaN ); +* // returns NaN +* +* @example +* var y = mgf( -2.0, -1.0 ); +* // returns NaN +* +* @example +* var y = mgf( 0.2, 2.0 ); +* // returns NaN +*/ +function mgf( t, p ) { + return addon( t, p ); +} + + +// EXPORTS // + +module.exports = mgf; diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json new file mode 100644 index 000000000000..cfadcdbd5034 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json @@ -0,0 +1,84 @@ +{ + "options": { + "task": "build", + "wasm": false + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/napi/binary", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/exp", + "@stdlib/math/base/special/ln" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/exp", + "@stdlib/math/base/special/ln", + "@stdlib/constants/float64/eps" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/exp", + "@stdlib/math/base/special/ln", + "@stdlib/constants/float64/eps" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/package.json b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/package.json index 7640d593db49..48a085120756 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/package.json +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/package.json @@ -14,11 +14,14 @@ } ], "main": "./lib", + "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", + "include": "./include", "lib": "./lib", + "src": "./src", "test": "./test" }, "types": "./docs/types", diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile new file mode 100644 index 000000000000..bcf18aa46655 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# 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, +# 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c new file mode 100644 index 000000000000..7347e0ad3273 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* 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, +* 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. +*/ + +#include "stdlib/stats/base/dists/geometric/mgf.h" +#include "stdlib/math/base/napi/binary.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_geometric_mgf ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c new file mode 100644 index 000000000000..db244a0cde17 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* 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, +* 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. +*/ + +#include "stdlib/stats/base/dists/geometric/mgf.h" +#include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/math/base/special/exp.h" +#include "stdlib/math/base/special/ln.h" + +/** +* Evaluates the moment-generating function (MGF) for a geometric distribution with success probability `p` at a value `t`. +* +* @param {number} t - input value +* @param {Probability} p - success probability +* @returns {number} evaluated MGF +* +* @example +* var y = mgf( 0.2, 0.5 ); +* // returns ~1.569 +* +* @example +* var y = mgf( 0.4, 0.5 ); +* // returns ~2.936 +* +* @example +* // Case: t >= -ln(1-p) +* var y = mgf( 0.8, 0.5 ); +* // returns NaN +* +* @example +* var y = mgf( NaN, 0.0 ); +* // returns NaN +* +* @example +* var y = mgf( 0.0, NaN ); +* // returns NaN +* +* @example +* var y = mgf( -2.0, -1.0 ); +* // returns NaN +* +* @example +* var y = mgf( 0.2, 2.0 ); +* // returns NaN +*/ +double stdlib_base_dists_geometric_mgf( const double t, const double p ) { + if ( + stdlib_base_is_nan( t ) || + stdlib_base_is_nan( p ) || + p < 0.0 || + p > 1.0 + ) { + return 0.0/0.0; // NaN + } + double q = 1.0 - p; + if( t >= -stdlib_base_ln( q ) ) { + return 0.0/0.0; // NaN + } + return ( p * stdlib_base_exp( t ) ) / ( 1.0 - ( q * stdlib_base_exp( t ) ) ); +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js new file mode 100644 index 000000000000..2d76abf83998 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js @@ -0,0 +1,129 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* 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, +* 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. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// FIXTURES // + +var smallP = require( './fixtures/julia/small_p.json' ); +var largeP = require( './fixtures/julia/large_p.json' ); + + +// VARIABLES // + +var mgf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( mgf instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mgf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) { + var y = mgf( NaN, 0.5 ); + t.equal( isnan( y ), true, 'returns NaN' ); + y = mgf( 4.0, NaN ); + t.equal( isnan( y ), true, 'returns NaN' ); + t.end(); +}); + +tape( 'if provided a value outside `[0,1]` for success probability `p`, the function returns `NaN`', opts, function test( t ) { + var y; + + y = mgf( 3.0, PINF ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = mgf( 3.0, 2.0 ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = mgf( 3.0, -0.5 ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = mgf( 3.0, NINF ); + t.equal( isnan( y ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function evaluates the mgf for `x` given small parameter `p`', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var p; + var y; + var i; + + expected = smallP.expected; + x = smallP.x; + p = smallP.p; + for ( i = 0; i < x.length; i++ ) { + y = mgf( x[i], p[i] ); + if ( y === expected[i] ) { + t.equal( y, expected[i], 'x: '+x[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 3.0 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. p: '+p[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'the function evaluates the mgf for `x` given large parameter `p`', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var p; + var y; + var i; + + expected = largeP.expected; + x = largeP.x; + p = largeP.p; + for ( i = 0; i < x.length; i++ ) { + y = mgf( x[i], p[i] ); + if ( y === expected[i] ) { + t.equal( y, expected[i], 'x: '+x[i]+', p: '+p[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 2.0 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. p: '+p[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); From dc8577e0e4f16e5cc32904ad91dfd510b9d5fa71 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Wed, 25 Dec 2024 19:30:36 +0530 Subject: [PATCH 2/9] fix: changes in benchmark and test --- .../stats/base/dists/geometric/mgf/benchmark/benchmark.js | 6 +++--- .../base/dists/geometric/mgf/benchmark/benchmark.native.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js index eda53b01dbb7..67fe0d75c583 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js @@ -43,8 +43,8 @@ bench( pkg, function benchmark( b ) { t = new Float64Array( len ); p = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - p[ i % len ] = ( randu()*1.0 ) + EPS; - t[ i % len ] = randu() * (-ln( 1.0 - p ) ); + p[ i ] = ( randu()*1.0 ) + EPS; + t[ i ] = randu() * ( -ln( 1.0 - p[ i ] ) ); } b.tic(); @@ -74,7 +74,7 @@ bench( pkg+':factory', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - t = randu() * (-ln( 1.0 - p ) ); + t = randu() * ( -ln( 1.0 - p ) ); y = mymgf( t ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js index 12d3e948931c..bd197bc5eddf 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js @@ -52,8 +52,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { t = new Float64Array( len ); p = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - p[ i % len ] = ( randu()*1.0 ) + EPS; - t[ i % len ] = randu() * (-ln( 1.0 - p ) ); + p[ i ] = ( randu()*1.0 ) + EPS; + t[ i ] = randu() * ( -ln( 1.0 - p[ i ] ) ); } b.tic(); From c4150597d0b0999b3ae1987ecbc79d81a1473b21 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Thu, 26 Dec 2024 12:02:59 +0530 Subject: [PATCH 3/9] fix: remove eps and changes in examples --- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- 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: passed - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: passed - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../stats/base/dists/geometric/mgf/README.md | 5 +- .../geometric/mgf/benchmark/benchmark.js | 3 +- .../mgf/benchmark/benchmark.native.js | 3 +- .../geometric/mgf/benchmark/c/benchmark.c | 3 +- .../dists/geometric/mgf/examples/c/example.c | 3 +- .../stdlib/stats/base/dists/geometric/mgf.h | 2 +- .../base/dists/geometric/mgf/manifest.json | 6 +-- .../stats/base/dists/geometric/mgf/src/main.c | 51 +++++-------------- 8 files changed, 22 insertions(+), 54 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md index 6d083129b095..0d6c4adaa024 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/README.md @@ -179,7 +179,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_geometric_mgf( t, p ) -Evaluates evaluating the [moment-generating function][mgf] of a [geometric][geometric-distribution] distribution with parameter `p` (success probability). +Evaluates the [moment-generating function][mgf] of a [geometric][geometric-distribution] distribution with parameter `p` (success probability). ```c double out = stdlib_base_dists_geometric_mgf( 0.2, 0.5 ); @@ -215,7 +215,6 @@ double stdlib_base_dists_geometric_mgf( const double t, const double p ); ```c #include "stdlib/stats/base/dists/geometric/mgf.h" -#include "stdlib/constants/float64/eps.h" #include "stdlib/math/base/special/ln.h" #include #include @@ -233,7 +232,7 @@ int main( void ) { int i; for ( i = 0; i < 25; i++ ) { - p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + p = random_uniform( 0.0, 1.0 ); t = random_uniform( 0.0, ( -stdlib_base_ln( 1.0 - p ) ) ); y = stdlib_base_dists_geometric_mgf( t, p ); printf( "t: %lf, p: %lf, M_X(t;p): %lf\n", t, p, y ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js index 67fe0d75c583..f568446eb8b5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js @@ -25,7 +25,6 @@ var Float64Array = require( '@stdlib/array/float64' ); var randu = require( '@stdlib/random/base/randu' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var ln = require( '@stdlib/math/base/special/ln' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; var mgf = require( './../lib' ); @@ -43,7 +42,7 @@ bench( pkg, function benchmark( b ) { t = new Float64Array( len ); p = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - p[ i ] = ( randu()*1.0 ) + EPS; + p[ i ] = ( randu()*1.0 ); t[ i ] = randu() * ( -ln( 1.0 - p[ i ] ) ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js index bd197bc5eddf..f52197c8391b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js @@ -26,7 +26,6 @@ var Float64Array = require( '@stdlib/array/float64' ); var randu = require( '@stdlib/random/base/randu' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var ln = require( '@stdlib/math/base/special/ln' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -52,7 +51,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { t = new Float64Array( len ); p = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - p[ i ] = ( randu()*1.0 ) + EPS; + p[ i ] = ( randu()*1.0 ); t[ i ] = randu() * ( -ln( 1.0 - p[ i ] ) ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c index c601ade14e4b..4cf4c188f5af 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c @@ -17,7 +17,6 @@ */ #include "stdlib/stats/base/dists/geometric/mgf.h" -#include "stdlib/constants/float64/eps.h" #include "stdlib/math/base/special/ln.h" #include #include @@ -102,7 +101,7 @@ static double benchmark( void ) { int i; for ( i = 0; i < 100; i++ ) { - p[ i ] = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + p[ i ] = random_uniform( 0.0, 1.0 ); t[ i ] = random_uniform( 0.0, ( -stdlib_base_ln( 1.0 - p[ i ] ) ) ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c index eec57d9355ba..f33974286dcf 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c @@ -17,7 +17,6 @@ */ #include "stdlib/stats/base/dists/geometric/mgf.h" -#include "stdlib/constants/float64/eps.h" #include "stdlib/math/base/special/ln.h" #include #include @@ -35,7 +34,7 @@ int main( void ) { int i; for ( i = 0; i < 25; i++ ) { - p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS; + p = random_uniform( 0.0, 1.0 ); t = random_uniform( 0.0, ( -stdlib_base_ln( 1.0 - p ) ) ); y = stdlib_base_dists_geometric_mgf( t, p ); printf( "t: %lf, p: %lf, M_X(t;p): %lf\n", t, p, y ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h index 285cebdaa425..fc3d648907a1 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h @@ -27,7 +27,7 @@ extern "C" { #endif /** -* Evaluates the moment-generating function (MGF) for the geometric distribution with probability parameter p. +* Evaluates the moment-generating function (MGF) for the geometric distribution with probability `p` at a value `x`. */ double stdlib_base_dists_geometric_mgf( const double t, const double p ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json index cfadcdbd5034..3521c0073988 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/manifest.json @@ -58,8 +58,7 @@ "dependencies": [ "@stdlib/math/base/assert/is-nan", "@stdlib/math/base/special/exp", - "@stdlib/math/base/special/ln", - "@stdlib/constants/float64/eps" + "@stdlib/math/base/special/ln" ] }, { @@ -76,8 +75,7 @@ "dependencies": [ "@stdlib/math/base/assert/is-nan", "@stdlib/math/base/special/exp", - "@stdlib/math/base/special/ln", - "@stdlib/constants/float64/eps" + "@stdlib/math/base/special/ln" ] } ] diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c index db244a0cde17..7c92dbc4d7e4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c @@ -24,49 +24,24 @@ /** * Evaluates the moment-generating function (MGF) for a geometric distribution with success probability `p` at a value `t`. * -* @param {number} t - input value -* @param {Probability} p - success probability -* @returns {number} evaluated MGF +* @param t input value +* @param p success probability +* @return evaluated MGF * * @example -* var y = mgf( 0.2, 0.5 ); +* double y = stdlib_base_dists_geometric_mgf( 0.2, 0.5 ); * // returns ~1.569 -* -* @example -* var y = mgf( 0.4, 0.5 ); -* // returns ~2.936 -* -* @example -* // Case: t >= -ln(1-p) -* var y = mgf( 0.8, 0.5 ); -* // returns NaN -* -* @example -* var y = mgf( NaN, 0.0 ); -* // returns NaN -* -* @example -* var y = mgf( 0.0, NaN ); -* // returns NaN -* -* @example -* var y = mgf( -2.0, -1.0 ); -* // returns NaN -* -* @example -* var y = mgf( 0.2, 2.0 ); -* // returns NaN */ double stdlib_base_dists_geometric_mgf( const double t, const double p ) { - if ( - stdlib_base_is_nan( t ) || - stdlib_base_is_nan( p ) || - p < 0.0 || - p > 1.0 - ) { - return 0.0/0.0; // NaN - } - double q = 1.0 - p; + if ( + stdlib_base_is_nan( t ) || + stdlib_base_is_nan( p ) || + p < 0.0 || + p > 1.0 + ) { + return 0.0/0.0; // NaN + } + double q = 1.0 - p; if( t >= -stdlib_base_ln( q ) ) { return 0.0/0.0; // NaN } From c0815211fec9cef12c72b17f9dff50dcd5524983 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:26:21 +0000 Subject: [PATCH 4/9] chore: update copyright years --- .../base/dists/geometric/mgf/benchmark/benchmark.native.js | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile | 2 +- .../stats/base/dists/geometric/mgf/benchmark/c/benchmark.c | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/binding.gyp | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/include.gypi | 2 +- .../mgf/include/stdlib/stats/base/dists/geometric/mgf.h | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/lib/native.js | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/src/Makefile | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/src/addon.c | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/src/main.c | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/test/test.native.js | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js index f52197c8391b..6cdce9c6d535 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile index f69e9da2b4d3..a4bd7b38fd74 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c index 4cf4c188f5af..9ec9f0d1fbdc 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/c/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp index 507cb00291e7..009bb9da333a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile index 6aed70daf167..25ced822f96a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c index f33974286dcf..092d36178e97 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi index c6495fc1da3f..f6557ac1ab57 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h index fc3d648907a1..d437b3a53fcf 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include/stdlib/stats/base/dists/geometric/mgf.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/lib/native.js index e46e6a56487f..d53f5be5492c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/lib/native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile index bcf18aa46655..7733b6180cb4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c index 7347e0ad3273..26fc86475fc3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c index 7c92dbc4d7e4..4bfdb67d0212 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js index 2d76abf83998..770c42c9506c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/test/test.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. From 3930c295592e05c05f499b9187c29383dce82b04 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Tue, 11 Feb 2025 02:06:25 +0000 Subject: [PATCH 5/9] fix: resolve lint errors --- .../@stdlib/stats/base/dists/geometric/mgf/include.gypi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi index f6557ac1ab57..ecfaf82a3279 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/include.gypi @@ -50,4 +50,4 @@ ' Date: Mon, 10 Feb 2025 21:21:45 -0500 Subject: [PATCH 6/9] chore: apply suggestions from code review Signed-off-by: Philipp Burckhardt --- .../base/dists/geometric/mgf/benchmark/benchmark.native.js | 2 +- .../@stdlib/stats/base/dists/geometric/mgf/src/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js index 6cdce9c6d535..19190b3fe627 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.native.js @@ -51,7 +51,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { t = new Float64Array( len ); p = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - p[ i ] = ( randu()*1.0 ); + p[ i ] = randu(); t[ i ] = randu() * ( -ln( 1.0 - p[ i ] ) ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c index 4bfdb67d0212..e9d0ddd26b07 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/src/main.c @@ -42,7 +42,7 @@ double stdlib_base_dists_geometric_mgf( const double t, const double p ) { return 0.0/0.0; // NaN } double q = 1.0 - p; - if( t >= -stdlib_base_ln( q ) ) { + if ( t >= -stdlib_base_ln( q ) ) { return 0.0/0.0; // NaN } return ( p * stdlib_base_exp( t ) ) / ( 1.0 - ( q * stdlib_base_exp( t ) ) ); From a372db2e80544886454d5cb0b50644f7f6c9441e Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 10 Feb 2025 21:27:51 -0500 Subject: [PATCH 7/9] chore: add EPS constant import in benchmark.js --- .../stats/base/dists/geometric/mgf/benchmark/benchmark.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js index d0b7eeedd34b..995c7d8749e6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/benchmark/benchmark.js @@ -25,6 +25,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var ln = require( '@stdlib/math/base/special/ln' ); +var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; var mgf = require( './../lib' ); From 908e475fc36d5be5482451627edd029cb1b447e2 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 10 Feb 2025 21:28:37 -0500 Subject: [PATCH 8/9] chore: add newline at end of binding.gyp file From 11a7a11d967abfa249129edc9da7c7d2cbcd389d Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Thu, 13 Feb 2025 09:07:00 -0500 Subject: [PATCH 9/9] chore: add newline at end of binding.gyp file --- .../@stdlib/stats/base/dists/geometric/mgf/binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp index 009bb9da333a..68a1ca11d160 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/geometric/mgf/binding.gyp @@ -167,4 +167,4 @@ ], # end actions }, # end target copy_addon ], # end targets -} \ No newline at end of file +}