From 207f87d3222844766312f3e62760de5afd0e4db5 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 25 Dec 2024 12:00:18 -0800 Subject: [PATCH 01/17] fix: correct include path for binary.h in binding.gyp --- 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: na - task: lint_package_json status: passed - 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: 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 --- --- 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 --- --- .../mode/benchmark/benchmark.native.js | 70 ++++++++ .../dists/arcsine/mode/benchmark/c/Makefile | 146 +++++++++++++++++ .../arcsine/mode/benchmark/c/benchmark.c | 140 ++++++++++++++++ .../stats/base/dists/arcsine/mode/binding.gyp | 150 ++++++++++++++++++ .../dists/arcsine/mode/examples/c/Makefile | 146 +++++++++++++++++ .../dists/arcsine/mode/examples/c/example.c | 52 ++++++ .../base/dists/arcsine/mode/include.gypi | 48 ++++++ .../stdlib/stats/base/dists/arcsine/mode.h | 42 +++++ .../base/dists/arcsine/mode/lib/native.js | 71 +++++++++ .../base/dists/arcsine/mode/manifest.json | 85 ++++++++++ .../base/dists/arcsine/mode/package.json | 3 + .../base/dists/arcsine/mode/src/Makefile | 70 ++++++++ .../stats/base/dists/arcsine/mode/src/addon.c | 23 +++ .../stats/base/dists/arcsine/mode/src/main.c | 63 ++++++++ 14 files changed, 1109 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/manifest.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/addon.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js new file mode 100644 index 00000000000..72977149ff2 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js @@ -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. +*/ + +'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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var mode = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( mode instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var len; + var min; + var max; + var y; + var i; + + len = 100; + min = new Float64Array( len ); + max = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + min[ i ] = ( randu() * 20.0 ) - 20.0; + max[ i ] = min[ i ] + ( randu() * 40.0 ); + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = mode( min[ i % len ], max[ 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/arcsine/mode/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile new file mode 100644 index 00000000000..f69e9da2b4d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c new file mode 100644 index 00000000000..de2da437657 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c @@ -0,0 +1,140 @@ +/** +* @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/arcsine/mode.h" +#include +#include +#include +#include +#include + +#define NAME "arcsine-mode" +#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 a[ 100 ]; + double b[ 100 ]; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + a[ i ] = random_uniform( -20.0, 0.0 ); + b[ i ] = random_uniform( a[ i ], a[ i ]+40.0 ); + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_dists_arcsine_mode( a[ i%100 ], b[ i%100 ] ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + 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/arcsine/mode/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp new file mode 100644 index 00000000000..661f4a8ea6d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp @@ -0,0 +1,150 @@ +# @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)", + "../../../../../math/base/napi/binary/include", + ], + # List of source files: + "sources": [ + "<@(src_files)", + "src/addon.c", + ], + # 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 +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile new file mode 100644 index 00000000000..6aed70daf16 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c new file mode 100644 index 00000000000..52dbf571335 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c @@ -0,0 +1,52 @@ +/** +* @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/arcsine/mode.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 a; + double b; + double m; + int i; + + printf( "Mode of the arcsine distribution:\n" ); + printf( "a\t\tb\t\tMode\n" ); + printf( "----------------------------------------\n" ); + + for ( i = 0; i < 10; i++ ) { + a = random_uniform( -20.0, 0.0 ); + b = random_uniform( a, a + 40.0 ); + m = stdlib_base_dists_arcsine_mode( a, b ); + + if ( isnan( m ) ) { + printf( "a: %lf, b: %lf, Mode: NaN (Invalid Input)\n", a, b ); + } else { + printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m ); + } + } + + return 0; +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi new file mode 100644 index 00000000000..f57256e8ad4 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi @@ -0,0 +1,48 @@ +# @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": [ + " +#include +#include "stdlib/math/base/assert/is_nan.h" + +/** +* Returns the mode of an arcsine distribution. +* +* @param a minimum support +* @param b maximum support +* @return mode of the distribution, or NaN if inputs are invalid +* +* @example +* double v = mode( 0.0, 1.0 ); +* // returns 0.0 +* +* @example +* double v = mode( 4.0, 12.0 ); +* // returns 4.0 +* +* @example +* double v = mode( -4.0, 4.0 ); +* // returns -4.0 +* +* @example +* double v = mode( 1.0, -0.1 ); +* // returns NaN +* +* @example +* double v = mode( 2.0, NAN ); +* // returns NaN +* +* @example +* double v = mode( NAN, 2.0 ); +* // returns NaN +*/ +double stdlib_base_dists_arcsine_mode( const double a, const double b ) { + if ( + stdlib_base_is_nan( a ) || + stdlib_base_is_nan( b ) || + a >= b + ) { + return NAN; + } + return a; +} From eec82799a79f935208100368763dfb7553c73476 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 13:58:14 -0800 Subject: [PATCH 02/17] Updated README.md to include the documentation of the added C API --- 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 --- --- .../stats/base/dists/arcsine/mode/README.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md index a91f37f5b60..900f321b653 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md @@ -131,6 +131,105 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/dists/arcsine/mode.h" +``` + +#### stdlib_base_dists_arcsine_mode( a, b ) + +Returns the mode of an arcsine distribution + +```c +double out = stdlib_base_dists_arcsine_mode( 4.0, 12.0 ); +// returns 4.0 +``` + +The function accepts the following arguments: + +- **a**: `[in] double` minimum support. +- **b**: `[in] double` maximum support. + +```c +double stdlib_base_dists_arcsine_mode( const double a, const double b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/arcsine/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 a; + double b; + double m; + int i; + + for ( i = 0; i < 10; i++ ) { + a = random_uniform( -20.0, 0.0 ); + b = random_uniform( a, a + 40.0 ); + m = stdlib_base_dists_arcsine_mode( a, b ); + + printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m ); + } + + return 0; +} +``` + +
+ + + +
+ + + +
From de7fc558b2006b06540083dcdda099d93c916629 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:01:18 -0800 Subject: [PATCH 03/17] fix: address requested changes in PR for arcsine mode C implementation --- 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 --- --- .../@stdlib/stats/base/dists/arcsine/cdf/manifest.json | 7 ++----- .../stats/base/dists/arcsine/mode/examples/c/example.c | 7 +------ .../@stdlib/stats/base/dists/arcsine/mode/src/main.c | 4 +--- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json index dbc2e6588b6..f1cbd0cea59 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json @@ -38,11 +38,8 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/ternary", - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/asin", - "@stdlib/math/base/special/sqrt", - "@stdlib/constants/float64/pi" + "@stdlib/math/base/napi/binary", + "@stdlib/math/base/assert/is-nan" ] }, { diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c index 52dbf571335..62030810a05 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c @@ -19,7 +19,6 @@ #include "stdlib/stats/base/dists/arcsine/mode.h" #include #include -#include static double random_uniform( const double min, const double max ) { double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); @@ -41,11 +40,7 @@ int main( void ) { b = random_uniform( a, a + 40.0 ); m = stdlib_base_dists_arcsine_mode( a, b ); - if ( isnan( m ) ) { - printf( "a: %lf, b: %lf, Mode: NaN (Invalid Input)\n", a, b ); - } else { - printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m ); - } + printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m ); } return 0; diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c index 6b8b11bf18d..5f3a0b55f12 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c @@ -16,8 +16,6 @@ * limitations under the License. */ -#include -#include #include "stdlib/math/base/assert/is_nan.h" /** @@ -57,7 +55,7 @@ double stdlib_base_dists_arcsine_mode( const double a, const double b ) { stdlib_base_is_nan( b ) || a >= b ) { - return NAN; + return 0.0/0.0; // NaN } return a; } From eb4de3fcbc3d293d9c609dd425f4e263d332e1be Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:17:49 -0800 Subject: [PATCH 04/17] Updated manifest.json to only include required dependencies --- 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 --- --- .../stats/base/dists/arcsine/mode/manifest.json | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/manifest.json index dbc2e6588b6..db80b71a4aa 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/manifest.json @@ -38,11 +38,8 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/ternary", - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/asin", - "@stdlib/math/base/special/sqrt", - "@stdlib/constants/float64/pi" + "@stdlib/math/base/napi/binary", + "@stdlib/math/base/assert/is-nan" ] }, { @@ -57,10 +54,7 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/asin", - "@stdlib/math/base/special/sqrt", - "@stdlib/constants/float64/pi" + "@stdlib/math/base/assert/is-nan" ] }, { @@ -75,10 +69,7 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/asin", - "@stdlib/math/base/special/sqrt", - "@stdlib/constants/float64/pi" + "@stdlib/math/base/assert/is-nan" ] } ] From e9318178886fead8b02831bddd9104800e6142df Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:23:40 -0800 Subject: [PATCH 05/17] Revert manifest.json of arcsine/cdf to previous state --- 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 --- --- .../@stdlib/stats/base/dists/arcsine/cdf/manifest.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json index f1cbd0cea59..661b6fc4f45 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json @@ -38,8 +38,11 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/binary", - "@stdlib/math/base/assert/is-nan" + "@stdlib/math/base/napi/ternary", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/asin", + "@stdlib/math/base/special/sqrt", + "@stdlib/constants/float64/pi" ] }, { From 13281c35f65e6009749010c2944c800148490739 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:27:01 -0800 Subject: [PATCH 06/17] Removed the extra include inside binding.gyp --- 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 --- --- .../@stdlib/stats/base/dists/arcsine/mode/binding.gyp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp index 661f4a8ea6d..28f68dd4b8e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp @@ -54,7 +54,6 @@ "include_dirs": [ # Local include directory: "<@(include_dirs)", - "../../../../../math/base/napi/binary/include", ], # List of source files: "sources": [ From 3a4454496703eea93736f85a0e15dffefa1b0917 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 4 Jan 2025 13:18:17 -0800 Subject: [PATCH 07/17] test(arcsine-mode): add native.js tests --- 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: na - 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: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: 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 --- --- .../dists/arcsine/mode/test/test.native.js | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js new file mode 100644 index 00000000000..fa8cff0fff7 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js @@ -0,0 +1,105 @@ +/** +* @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 tryRequire = require( '@stdlib/utils/try-require' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); + + +// VARIABLES // + +var mode = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( mode instanceof Error ) +}; + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mode, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { + var v = mode( NaN, 0.5 ); + t.equal( isnan( v ), true, 'returns NaN' ); + + v = mode( 10.0, NaN ); + t.equal( isnan( v ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'if provided `a >= b`, the function returns `NaN`', function test( t ) { + var y; + + y = mode( 3.0, 2.0 ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = mode( 2.0, 2.0 ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = mode( NINF, NINF ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = mode( PINF, NINF ); + t.equal( isnan( y ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns the mode of an arcsine distribution', function test( t ) { + var expected; + var delta; + var tol; + var a; + var b; + var i; + var y; + + expected = data.expected; + a = data.a; + b = data.b; + for ( i = 0; i < expected.length; i++ ) { + y = mode( a[i], b[i] ); + if ( y === expected[i] ) { + t.equal( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 1.0 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); From 34be206dd336fe939ad5e1a011601760f7e11803 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sat, 4 Jan 2025 21:22:30 +0000 Subject: [PATCH 08/17] chore: update copyright years --- .../stats/base/dists/arcsine/mode/benchmark/benchmark.native.js | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile | 2 +- .../stats/base/dists/arcsine/mode/benchmark/c/benchmark.c | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/binding.gyp | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/include.gypi | 2 +- .../arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/lib/native.js | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/src/Makefile | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/src/addon.c | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/src/main.c | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/test/test.native.js | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js index 72977149ff2..1e9df03cac0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile index f69e9da2b4d..a4bd7b38fd7 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c index de2da437657..4041486156d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp index 28f68dd4b8e..114dcb77c6a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile index 6aed70daf16..25ced822f96 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c index 62030810a05..3bf42b3c64a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi index f57256e8ad4..235be47d6d3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h index d92cfe614ce..692db66016d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.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/arcsine/mode/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js index acb3149b937..968b27663ac 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/Makefile index bcf18aa4665..7733b6180cb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/addon.c index 34fb27c1550..e3068087b26 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/addon.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c index 5f3a0b55f12..f5c9fdd8443 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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/arcsine/mode/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js index fa8cff0fff7..d8026aa8ebf 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/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 00e8bd9f4450b9fc8c4e4c5ea1ef80d8e1f3c664 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sat, 4 Jan 2025 21:27:07 +0000 Subject: [PATCH 09/17] fix: resolve lint errors --- .../@stdlib/stats/base/dists/arcsine/mode/lib/native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js index 968b27663ac..e9beae90efc 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js @@ -62,7 +62,7 @@ var addon = require( './../src/addon.node' ); * // returns NaN */ function mode( a, b ) { - return addon( a, b ); + return addon( a, b ); } From 6be1d39d2e846f458667b0baebda9e3d8496e344 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 4 Jan 2025 22:26:45 -0800 Subject: [PATCH 10/17] test: update the test.native.js --- 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: na - 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: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: 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 --- --- .../stats/base/dists/arcsine/mode/test/test.native.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js index d8026aa8ebf..e08d8d7506c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/test/test.native.js @@ -51,7 +51,7 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { +tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) { var v = mode( NaN, 0.5 ); t.equal( isnan( v ), true, 'returns NaN' ); @@ -61,7 +61,7 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', functio t.end(); }); -tape( 'if provided `a >= b`, the function returns `NaN`', function test( t ) { +tape( 'if provided `a >= b`, the function returns `NaN`', opts, function test( t ) { var y; y = mode( 3.0, 2.0 ); @@ -79,7 +79,7 @@ tape( 'if provided `a >= b`, the function returns `NaN`', function test( t ) { t.end(); }); -tape( 'the function returns the mode of an arcsine distribution', function test( t ) { +tape( 'the function returns the mode of an arcsine distribution', opts, function test( t ) { var expected; var delta; var tol; From 639c297d7f835c970b14a433a216e522e570eaf1 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Tue, 7 Jan 2025 19:51:33 -0800 Subject: [PATCH 11/17] refactor: fixed the formatting issues --- 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: na - 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: 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: 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 --- --- .../stats/base/dists/arcsine/mode/README.md | 2 +- .../arcsine/mode/benchmark/c/benchmark.c | 18 +- .../stats/base/dists/arcsine/mode/binding.gyp | 267 ++++++++++-------- .../dists/arcsine/mode/examples/c/example.c | 32 +-- .../base/dists/arcsine/mode/include.gypi | 53 ++-- .../stats/base/dists/arcsine/mode/src/main.c | 32 +-- 6 files changed, 201 insertions(+), 203 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md index 900f321b653..cf4407b8fb9 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md @@ -214,7 +214,7 @@ int main( void ) { b = random_uniform( a, a + 40.0 ); m = stdlib_base_dists_arcsine_mode( a, b ); - printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m ); + printf( "a: %lf, b: %lf, mode(X;a,b): %lf\n", a, b, m ); } return 0; diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c index 4041486156d..1c13db9f786 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c @@ -16,12 +16,12 @@ * limitations under the License. */ +#include #include "stdlib/stats/base/dists/arcsine/mode.h" -#include -#include #include +#include +#include #include -#include #define NAME "arcsine-mode" #define ITERATIONS 1000000 @@ -71,7 +71,7 @@ static void print_results( double elapsed ) { static double tic( void ) { struct timeval now; gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; + return (double)now.tv_sec + (double)now.tv_usec / 1.0e6; } /** @@ -83,7 +83,7 @@ static double tic( void ) { */ static double random_uniform( const double min, const double max ) { double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); - return min + ( v*(max-min) ); + return min + ( v * ( max - min ) ); } /** @@ -101,12 +101,12 @@ static double benchmark( void ) { for ( i = 0; i < 100; i++ ) { a[ i ] = random_uniform( -20.0, 0.0 ); - b[ i ] = random_uniform( a[ i ], a[ i ]+40.0 ); + b[ i ] = random_uniform( a[ i ], a[ i ] + 40.0 ); } t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_dists_arcsine_mode( a[ i%100 ], b[ i%100 ] ); + y = stdlib_base_dists_arcsine_mode( a[ i % 100 ], b[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; @@ -126,7 +126,7 @@ int main( void ) { double elapsed; int i; - // Use the current time to seed the random number generator: + // Use the current time to seed the random number generator: srand( time( NULL ) ); print_version(); @@ -134,7 +134,7 @@ int main( void ) { printf( "# c::%s\n", NAME ); elapsed = benchmark(); print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); + printf( "ok %d benchmark finished\n", i + 1 ); } print_summary( REPEATS, REPEATS ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp index 114dcb77c6a..68a1ca11d16 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp @@ -19,131 +19,152 @@ # [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: + # 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"', { - # 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)", - "src/addon.c", - ], - # 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", + # 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', ], - # C++ specific compiler flags: - "cflags_cpp": [ - # Specify the C++ standard to which a program is expected to conform: - "-std=c++11", + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', ], - # 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: + }, + ], # 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': [ { - "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 + '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 } diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c index 3bf42b3c64a..1d152476e5c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c @@ -17,31 +17,27 @@ */ #include "stdlib/stats/base/dists/arcsine/mode.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 ) ); + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v * ( max - min ) ); } int main( void ) { - double a; - double b; - double m; - int i; - - printf( "Mode of the arcsine distribution:\n" ); - printf( "a\t\tb\t\tMode\n" ); - printf( "----------------------------------------\n" ); + double a; + double b; + double m; + int i; - for ( i = 0; i < 10; i++ ) { - a = random_uniform( -20.0, 0.0 ); - b = random_uniform( a, a + 40.0 ); - m = stdlib_base_dists_arcsine_mode( a, b ); + for ( i = 0; i < 10; i++ ) { + a = random_uniform( -20.0, 0.0 ); + b = random_uniform( a, a + 40.0 ); + m = stdlib_base_dists_arcsine_mode( a, b ); - printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m ); - } + printf( "a: %lf, b: %lf, mode(X;a,b): %lf\n", a, b, m ); + } - return 0; + return 0; } diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi index 235be47d6d3..ecfaf82a327 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi @@ -21,28 +21,33 @@ # [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": [ - "= b - ) { - return 0.0/0.0; // NaN - } - return a; + if ( stdlib_base_is_nan( a ) || stdlib_base_is_nan( b ) || a >= b ) { + return 0.0 / 0.0; // NaN + } + return a; } From 0a5ef3afa6503d009ffdc57e1b6b35d268e80796 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 8 Jan 2025 21:14:09 -0800 Subject: [PATCH 12/17] refactor: fixed indentation in comments --- 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - 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: 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: 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 --- --- .../@stdlib/stats/base/dists/arcsine/mode/README.md | 3 --- .../stats/base/dists/arcsine/mode/benchmark/c/benchmark.c | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md index cf4407b8fb9..a65ccfb6d41 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md @@ -213,11 +213,8 @@ int main( void ) { a = random_uniform( -20.0, 0.0 ); b = random_uniform( a, a + 40.0 ); m = stdlib_base_dists_arcsine_mode( a, b ); - printf( "a: %lf, b: %lf, mode(X;a,b): %lf\n", a, b, m ); } - - return 0; } ``` diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c index 1c13db9f786..379790bbbe0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c @@ -126,7 +126,7 @@ int main( void ) { double elapsed; int i; - // Use the current time to seed the random number generator: + // Use the current time to seed the random number generator: srand( time( NULL ) ); print_version(); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c index 1d152476e5c..6231db3a02c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c @@ -35,9 +35,6 @@ int main( void ) { a = random_uniform( -20.0, 0.0 ); b = random_uniform( a, a + 40.0 ); m = stdlib_base_dists_arcsine_mode( a, b ); - printf( "a: %lf, b: %lf, mode(X;a,b): %lf\n", a, b, m ); } - - return 0; } From e67ac801a156a00a66c40d24472c73cb5c741db1 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Fri, 10 Jan 2025 22:33:53 -0800 Subject: [PATCH 13/17] refactor: apply suggestions from previous PRs --- 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - 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: na - 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: 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 --- --- .../@stdlib/stats/base/dists/arcsine/mode/README.md | 2 +- .../stats/base/dists/arcsine/mode/benchmark/c/benchmark.c | 2 +- .../@stdlib/stats/base/dists/arcsine/mode/src/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md index a65ccfb6d41..20d4b13c6e6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/README.md @@ -159,7 +159,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_arcsine_mode( a, b ) -Returns the mode of an arcsine distribution +Returns the [mode][mode] of an [arcsine][arcsine-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support). ```c double out = stdlib_base_dists_arcsine_mode( 4.0, 12.0 ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c index 379790bbbe0..652c44cb671 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c @@ -16,12 +16,12 @@ * limitations under the License. */ -#include #include "stdlib/stats/base/dists/arcsine/mode.h" #include #include #include #include +#include #define NAME "arcsine-mode" #define ITERATIONS 1000000 diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c index 7eca9ee91dd..7106d0cfa1c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c @@ -23,7 +23,7 @@ * * @param a minimum support * @param b maximum support -* @return mode of the distribution, or NaN if inputs are invalid +* @return mode * * @example * double v = mode( -4.0, 4.0 ); From 121f33a769c8eef894c3601a5e2635d4c5c3d037 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Fri, 10 Jan 2025 22:54:44 -0800 Subject: [PATCH 14/17] fix: corrected the example's output --- 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: na - 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: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: 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 --- --- .../@stdlib/stats/base/dists/arcsine/mode/lib/native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js index e9beae90efc..1579a9597dd 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js @@ -51,7 +51,7 @@ var addon = require( './../src/addon.node' ); * * @example * var y = mode( -Infinity, 4.0 ); -* // returns NaN +* // returns -Infinity * * @example * var y = mode( 1.0, NaN ); From c05954f14eaf9b1c49c34ff413d9a96f8964f85f Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Fri, 10 Jan 2025 23:01:42 -0800 Subject: [PATCH 15/17] fix: reverted accidental changes to cdf module --- 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: na - 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: 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 --- --- .../@stdlib/stats/base/dists/arcsine/cdf/manifest.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json index 661b6fc4f45..dbc2e6588b6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/cdf/manifest.json @@ -39,10 +39,10 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/napi/ternary", - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/asin", - "@stdlib/math/base/special/sqrt", - "@stdlib/constants/float64/pi" + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/asin", + "@stdlib/math/base/special/sqrt", + "@stdlib/constants/float64/pi" ] }, { From 7fb5d304ad58dc97876e815ebf198ff9e77530b1 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Mon, 13 Jan 2025 20:55:01 -0800 Subject: [PATCH 16/17] refactor: added include in main.c and fixed the JS benchmark number generation --- 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: na - 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: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: 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: 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/arcsine/mode/benchmark/benchmark.js | 3 ++- .../base/dists/arcsine/mode/benchmark/benchmark.native.js | 5 +++-- .../@stdlib/stats/base/dists/arcsine/mode/src/main.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.js index 8a3d5a7733d..c2fdc91c1e1 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var mode = require( './../lib' ); @@ -38,7 +39,7 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { min = ( randu()*10.0 ); - max = ( randu()*10.0 ) + min; + max = uniform( min, min + 10.0 ); y = mode( min, max ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js index 1e9df03cac0..f6bafaacfde 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js @@ -24,6 +24,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var Float64Array = require( '@stdlib/array/float64' ); var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -50,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { min = new Float64Array( len ); max = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - min[ i ] = ( randu() * 20.0 ) - 20.0; - max[ i ] = min[ i ] + ( randu() * 40.0 ); + min[ i ] = ( randu()*10.0 ); + max[ i ] = uniform( min[ i ], min[ i ] + 10.0 ); } b.tic(); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c index 7106d0cfa1c..ae2fa8465f1 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/main.c @@ -17,6 +17,7 @@ */ #include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/stats/base/dists/arcsine/mode.h" /** * Returns the mode of an arcsine distribution. From 368173d10c2208ed08872f2af2df9587723539a1 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 14 Jan 2025 21:56:27 -0500 Subject: [PATCH 17/17] docs: exclude param and return descriptions from header file comment Signed-off-by: Philipp Burckhardt --- .../mode/include/stdlib/stats/base/dists/arcsine/mode.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h index 692db66016d..aa3636e0541 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h @@ -28,10 +28,6 @@ extern "C" { /** * Returns the mode of an arcsine distribution with minimum support `a` and maximum support `b`. -* -* @param a minimum support -* @param b maximum support -* @return mode of the distribution */ double stdlib_base_dists_arcsine_mode( const double a, const double b );