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 000000000000..72977149ff25 --- /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 000000000000..f69e9da2b4d3 --- /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 000000000000..de2da4376578 --- /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 000000000000..661f4a8ea6df --- /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 000000000000..6aed70daf167 --- /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 000000000000..52dbf5713354 --- /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 000000000000..f57256e8ad46 --- /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 76fe5d2241d41bcf02a315647c3f235198e46283 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 25 Dec 2024 15:25:12 -0800 Subject: [PATCH 02/17] [RFC]: Add C implementation for @stdlib/stats/base/dists/arcsine/stdev --- 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 --- --- .../stdev/benchmark/benchmark.native.js | 70 ++++++++ .../dists/arcsine/stdev/benchmark/c/Makefile | 146 +++++++++++++++++ .../arcsine/stdev/benchmark/c/benchmark.c | 140 ++++++++++++++++ .../base/dists/arcsine/stdev/binding.gyp | 150 ++++++++++++++++++ .../dists/arcsine/stdev/examples/c/Makefile | 146 +++++++++++++++++ .../dists/arcsine/stdev/examples/c/example.c | 52 ++++++ .../base/dists/arcsine/stdev/include.gypi | 48 ++++++ .../stdlib/stats/base/dists/arcsine/stdev.h | 42 +++++ .../base/dists/arcsine/stdev/lib/factory.js | 76 +++++++++ .../base/dists/arcsine/stdev/lib/native.js | 71 +++++++++ .../base/dists/arcsine/stdev/manifest.json | 85 ++++++++++ .../base/dists/arcsine/stdev/package.json | 3 + .../base/dists/arcsine/stdev/src/Makefile | 70 ++++++++ .../base/dists/arcsine/stdev/src/addon.c | 23 +++ .../stats/base/dists/arcsine/stdev/src/main.c | 66 ++++++++ 15 files changed, 1188 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js new file mode 100644 index 000000000000..b6731a101334 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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 stdev = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( stdev 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 = stdev( 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/stdev/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c new file mode 100644 index 000000000000..1253092e4845 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev.h" +#include +#include +#include +#include +#include + +#define NAME "arcsine-stdev" +#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_stdev( 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/stdev/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp new file mode 100644 index 000000000000..661f4a8ea6df --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/Makefile new file mode 100644 index 000000000000..6aed70daf167 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c new file mode 100644 index 000000000000..31640a01f890 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev.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 s; + int i; + + printf( "Standard Deviation of the arcsine distribution:\n" ); + printf( "a\t\tb\t\tStandard Deviation\n" ); + printf( "----------------------------------------\n" ); + + for ( i = 0; i < 10; i++ ) { + a = random_uniform( -20.0, 0.0 ); + b = random_uniform( a, a + 40.0 ); + s = stdlib_base_dists_arcsine_stdev( a, b ); + + if ( isnan( s ) ) { + printf( "a: %lf, b: %lf, Standard Deviation: NaN (Invalid Input)\n", a, b ); + } else { + printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s ); + } + } + + return 0; +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi new file mode 100644 index 000000000000..f57256e8ad46 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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": [ + "= b + ) { + return constantFunction( NaN ); + } + return stdev; + + /** + * Calculates the standard deviation of an arcsine distribution. + * + * @private + * @returns {number} Standard deviation + * + * @example + * var y = stdev(); + * // returns + */ + function stdev() { + return SQRT1OVER8 * ( b - a ); + } +} + + +// EXPORTS // + +module.exports = factory; diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js new file mode 100644 index 000000000000..a535951a71ea --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js @@ -0,0 +1,71 @@ +/** +* @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 addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Returns the standard deviation of an arcsine distribution with minimum support `a` and maximum support `b`. +* +* @private +* @param {number} a - minimum support +* @param {number} b - maximum support +* @returns {number} standard deviation +* +* @example +* var y = stdev( 0.0, 1.0 ); +* // returns ~0.354 +* +* @example +* var y = stdev( 4.0, 12.0 ); +* // returns ~2.828 +* +* @example +* var y = stdev( -4.0, 4.0 ); +* // returns ~2.828 +* +* @example +* var y = stdev( +Infinity, 4.0 ); +* // returns NaN +* +* @example +* var y = stdev( -Infinity, 4.0 ); +* // returns NaN +* +* @example +* var y = stdev( 1.0, NaN ); +* // returns NaN +* +* @example +* var y = stdev( NaN, 2.0 ); +* // returns NaN +*/ +function stdev( a, b ) { + return addon( a, b ); +} + + +// EXPORTS // + +module.exports = stdev; diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json new file mode 100644 index 000000000000..dbc2e6588b6e --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json @@ -0,0 +1,85 @@ +{ + "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/ternary", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/asin", + "@stdlib/math/base/special/sqrt", + "@stdlib/constants/float64/pi" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/asin", + "@stdlib/math/base/special/sqrt", + "@stdlib/constants/float64/pi" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/asin", + "@stdlib/math/base/special/sqrt", + "@stdlib/constants/float64/pi" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/package.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/package.json index 616fd102da03..5a875ffd6454 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/package.json +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/arcsine/stdev/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/Makefile new file mode 100644 index 000000000000..bcf18aa46655 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/arcsine/stdev/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c new file mode 100644 index 000000000000..75e10c94b0e2 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/math/base/napi/binary.h" +#include "stdlib/stats/base/dists/arcsine/stdev.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_arcsine_stdev ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c new file mode 100644 index 000000000000..0e3cd06dd0e5 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c @@ -0,0 +1,66 @@ +/** +* @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 +#include +#include "stdlib/math/base/assert/is_nan.h" + +// CONSTANTS +#define SQRT1OVER8 0.35355339059327373 // sqrt(1.0 / 8.0) + +/** +* Returns the standard deviation of an arcsine distribution. +* +* @param a minimum support +* @param b maximum support +* @return standard deviation of the distribution, or NaN if inputs are invalid +* +* @example +* double v = stdlib_base_dists_arcsine_stdev( 0.0, 1.0 ); +* // returns ~0.354 +* +* @example +* double v = stdlib_base_dists_arcsine_stdev( 4.0, 12.0 ); +* // returns ~2.828 +* +* @example +* double v = stdlib_base_dists_arcsine_stdev( -4.0, 4.0 ); +* // returns ~2.828 +* +* @example +* double v = stdlib_base_dists_arcsine_stdev( 1.0, -0.1 ); +* // returns NaN +* +* @example +* double v = stdlib_base_dists_arcsine_stdev( 2.0, NAN ); +* // returns NaN +* +* @example +* double v = stdlib_base_dists_arcsine_stdev( NAN, 2.0 ); +* // returns NaN +*/ +double stdlib_base_dists_arcsine_stdev( const double a, const double b ) { + if ( + stdlib_base_is_nan( a ) || + stdlib_base_is_nan( b ) || + a >= b + ) { + return NAN; + } + return SQRT1OVER8 * ( b - a ); +} From db730d675ec53f9575b4c81a3071d5d096b14a2e Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:48:20 -0800 Subject: [PATCH 03/17] Updated README to include the C API documentation --- .../stats/base/dists/arcsine/stdev/README.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md index 8fa83b0c8201..bc93e3415a98 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md @@ -131,6 +131,104 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/arcsine/stdev.h" +``` + +#### stdlib_base_dists_arcsine_stdev( a, b ) + +Returns the standard deviation of an arcsine distribution. + +```c +double out = stdlib_base_dists_arcsine_stdev( 4.0, 12.0 ); +// returns ~2.828 +``` + +The function accepts the following arguments: + +- **a**: `[in] double` minimum support. +- **b**: `[in] double` maximum support. + +```c +double stdlib_base_dists_arcsine_stdev( const double a, const double b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/arcsine/stdev.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 s; + int i; + + for ( i = 0; i < 10; i++ ) { + a = random_uniform( -20.0, 0.0 ); + b = random_uniform( a, a + 40.0 ); + s = stdlib_base_dists_arcsine_stdev( a, b ); + + printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s ); + } + + return 0; +} +``` + +
+ + + +
+ + +
From edd35ab7bb6a49f9c1b27f36ddcdc1fbf2d60a0d Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:50:02 -0800 Subject: [PATCH 04/17] Removed extra include from binding.gyp --- .../@stdlib/stats/base/dists/arcsine/stdev/binding.gyp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp index 661f4a8ea6df..28f68dd4b8e2 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp @@ -54,7 +54,6 @@ "include_dirs": [ # Local include directory: "<@(include_dirs)", - "../../../../../math/base/napi/binary/include", ], # List of source files: "sources": [ From 25e2bea2cbe70861e5ff0d0a013f97d07740a307 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:50:25 -0800 Subject: [PATCH 05/17] Removed extra includes from manifest.json --- .../base/dists/arcsine/stdev/manifest.json | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json index dbc2e6588b6e..db80b71a4aa4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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 64ce11353d0887248b8855d10713b97bf17a2f93 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 29 Dec 2024 14:50:40 -0800 Subject: [PATCH 06/17] Removed extra includes from the c files --- 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/stdev/benchmark/c/benchmark.c | 1 - .../stats/base/dists/arcsine/stdev/examples/c/example.c | 7 +------ .../@stdlib/stats/base/dists/arcsine/stdev/src/main.c | 4 +--- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c index 1253092e4845..76b3d2d5f73b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c @@ -19,7 +19,6 @@ #include "stdlib/stats/base/dists/arcsine/stdev.h" #include #include -#include #include #include diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c index 31640a01f890..a3f2a901a4ff 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c @@ -19,7 +19,6 @@ #include "stdlib/stats/base/dists/arcsine/stdev.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 ); s = stdlib_base_dists_arcsine_stdev( a, b ); - if ( isnan( s ) ) { - printf( "a: %lf, b: %lf, Standard Deviation: NaN (Invalid Input)\n", a, b ); - } else { - printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s ); - } + printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s ); } return 0; diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c index 0e3cd06dd0e5..9e99195516ce 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c @@ -16,8 +16,6 @@ * limitations under the License. */ -#include -#include #include "stdlib/math/base/assert/is_nan.h" // CONSTANTS @@ -60,7 +58,7 @@ double stdlib_base_dists_arcsine_stdev( const double a, const double b ) { stdlib_base_is_nan( b ) || a >= b ) { - return NAN; + return 0.0 / 0.0; // NaN } return SQRT1OVER8 * ( b - a ); } From 941d7ca8bb2997927f45307838bf36520436fc4d Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Thu, 2 Jan 2025 19:43:23 +0000 Subject: [PATCH 07/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 +- .../base/dists/arcsine/stdev/benchmark/benchmark.native.js | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/Makefile | 2 +- .../stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/binding.gyp | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/examples/c/Makefile | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/include.gypi | 2 +- .../stdev/include/stdlib/stats/base/dists/arcsine/stdev.h | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/lib/native.js | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/src/Makefile | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/src/addon.c | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/src/main.c | 2 +- 25 files changed, 25 insertions(+), 25 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 72977149ff25..1e9df03cac0b 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 f69e9da2b4d3..a4bd7b38fd74 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 de2da4376578..4041486156dd 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 661f4a8ea6df..33aab7df982a 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 6aed70daf167..25ced822f96a 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 52dbf5713354..6621561a29e4 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 f57256e8ad46..235be47d6d3b 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 d92cfe614ce4..692db66016d7 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 acb3149b9378..968b27663ac7 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 bcf18aa46655..7733b6180cb4 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 34fb27c15501..e3068087b26e 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 6b8b11bf18d1..4a27550688c6 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/stdev/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js index b6731a101334..f4b767ca0f5e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/Makefile index f69e9da2b4d3..a4bd7b38fd74 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c index 76b3d2d5f73b..d1aacd18ef4e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp index 28f68dd4b8e2..114dcb77c6aa 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/Makefile index 6aed70daf167..25ced822f96a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c index a3f2a901a4ff..8a51f7ceb643 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi index f57256e8ad46..235be47d6d3b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h index 996b2b31343b..f0da00e4fdeb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.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/stdev/lib/factory.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js index 2d3db92afd19..aca261a29762 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.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/stdev/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js index a535951a71ea..95369760e619 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/Makefile index bcf18aa46655..7733b6180cb4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c index 75e10c94b0e2..6d794ecf0e00 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c index 9e99195516ce..5eb520ece448 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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. From a1616c0e142277be411f540400abdea68ef476db Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 4 Jan 2025 13:42:21 -0800 Subject: [PATCH 08/17] test(arcsine-stdev): 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/stdev/test/test.native.js | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js new file mode 100644 index 000000000000..75b1eb8869d0 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 stdev = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( stdev 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 stdev, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { + var v = stdev( NaN, 0.5 ); + t.equal( isnan( v ), true, 'returns NaN' ); + + v = stdev( 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 = stdev( 3.0, 2.0 ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = stdev( 2.0, 2.0 ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = stdev( NINF, NINF ); + t.equal( isnan( y ), true, 'returns NaN' ); + + y = stdev( PINF, NINF ); + t.equal( isnan( y ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns the standard deviation 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 = stdev( 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 033f4344e5937e71453696d70a3fefbab755ee1f Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 4 Jan 2025 22:19:35 -0800 Subject: [PATCH 09/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 --- --- .../stats/base/dists/arcsine/stdev/test/test.native.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js index 75b1eb8869d0..d4571519c9fb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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 = stdev( 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 = stdev( 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 standard deviation of an arcsine distribution', function test( t ) { +tape( 'the function returns the standard deviation of an arcsine distribution', opts, function test( t ) { var expected; var delta; var tol; From c999b320c48209c1ad85d8c3c202178e63599859 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Tue, 7 Jan 2025 23:57:37 -0800 Subject: [PATCH 10/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/stdev/README.md | 8 +- .../arcsine/stdev/benchmark/c/benchmark.c | 16 +- .../base/dists/arcsine/stdev/binding.gyp | 267 ++++++++++-------- .../dists/arcsine/stdev/examples/c/example.c | 32 +-- .../base/dists/arcsine/stdev/include.gypi | 53 ++-- .../stats/base/dists/arcsine/stdev/src/main.c | 32 +-- 6 files changed, 203 insertions(+), 205 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md index bc93e3415a98..2a8ecc50a530 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md @@ -195,8 +195,8 @@ double stdlib_base_dists_arcsine_stdev( const double a, const double b ); ```c #include "stdlib/stats/base/dists/arcsine/stdev.h" -#include #include +#include static double random_uniform( const double min, const double max ) { double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); @@ -210,11 +210,11 @@ int main( void ) { int i; for ( i = 0; i < 10; i++ ) { - a = random_uniform( -20.0, 0.0 ); - b = random_uniform( a, a + 40.0 ); + a = random_uniform( 0.0, 10.0 ); + b = random_uniform( a, a + 10.0 ); s = stdlib_base_dists_arcsine_stdev( a, b ); - printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s ); + printf( "a: %lf, b: %lf, SD(X;a,b): %lf\n", a, b, s ); } return 0; diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c index d1aacd18ef4e..dc7400a8e729 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c @@ -16,11 +16,11 @@ * limitations under the License. */ +#include #include "stdlib/stats/base/dists/arcsine/stdev.h" -#include #include +#include #include -#include #define NAME "arcsine-stdev" #define ITERATIONS 1000000 @@ -70,7 +70,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; } /** @@ -82,7 +82,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 ) ); } /** @@ -100,12 +100,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_stdev( a[ i%100 ], b[ i%100 ] ); + y = stdlib_base_dists_arcsine_stdev( a[ i % 100 ], b[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; @@ -125,7 +125,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(); @@ -133,7 +133,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/stdev/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp index 114dcb77c6aa..68a1ca11d160 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c index 8a51f7ceb643..4dd7920b6f47 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c @@ -17,31 +17,27 @@ */ #include "stdlib/stats/base/dists/arcsine/stdev.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 s; - int i; - - printf( "Standard Deviation of the arcsine distribution:\n" ); - printf( "a\t\tb\t\tStandard Deviation\n" ); - printf( "----------------------------------------\n" ); + double a; + double b; + double s; + int i; - for ( i = 0; i < 10; i++ ) { - a = random_uniform( -20.0, 0.0 ); - b = random_uniform( a, a + 40.0 ); - s = stdlib_base_dists_arcsine_stdev( a, b ); + for ( i = 0; i < 10; i++ ) { + a = random_uniform( 0.0, 10.0 ); + b = random_uniform( a, a + 10.0 ); + s = stdlib_base_dists_arcsine_stdev( a, b ); - printf( "a: %lf, b: %lf, Standard Deviation: %lf\n", a, b, s ); - } + printf( "a: %lf, b: %lf, SD(X;a,b): %lf\n", a, b, s ); + } - return 0; + return 0; } diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi index 235be47d6d3b..ecfaf82a3279 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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 SQRT1OVER8 * ( b - a ); + if ( stdlib_base_is_nan( a ) || stdlib_base_is_nan( b ) || a >= b ) { + return 0.0 / 0.0; // NaN + } + return SQRT1OVER8 * ( b - a ); } From 1ee94a99b09c4b3aa6618e9c4cbfe50ee15404d2 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 8 Jan 2025 00:07:14 -0800 Subject: [PATCH 11/17] refactor: removing the extra files committed --- 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 --- --- .../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 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include/stdlib/stats/base/dists/arcsine/mode.h delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/lib/native.js delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/manifest.json delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/Makefile delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/src/addon.c delete 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 deleted file mode 100644 index 1e9df03cac0b..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/benchmark.native.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 deleted file mode 100644 index a4bd7b38fd74..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# 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. -# 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 deleted file mode 100644 index 4041486156dd..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/benchmark/c/benchmark.c +++ /dev/null @@ -1,140 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 deleted file mode 100644 index 33aab7df982a..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/binding.gyp +++ /dev/null @@ -1,150 +0,0 @@ -# @license Apache-2.0 -# -# 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. -# 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 deleted file mode 100644 index 25ced822f96a..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# 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. -# 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 deleted file mode 100644 index 6621561a29e4..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/examples/c/example.c +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 deleted file mode 100644 index 235be47d6d3b..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/mode/include.gypi +++ /dev/null @@ -1,48 +0,0 @@ -# @license Apache-2.0 -# -# 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. -# 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 01e1fd563d96e6143965c1640c0f7d246cda26ca Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 8 Jan 2025 21:15:46 -0800 Subject: [PATCH 12/17] refactor: fixed indentation and removed extra lines --- 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/stdev/README.md | 3 --- .../stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c | 2 +- .../stats/base/dists/arcsine/stdev/examples/c/example.c | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md index 2a8ecc50a530..d39e515ae3e1 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md @@ -213,11 +213,8 @@ int main( void ) { a = random_uniform( 0.0, 10.0 ); b = random_uniform( a, a + 10.0 ); s = stdlib_base_dists_arcsine_stdev( a, b ); - printf( "a: %lf, b: %lf, SD(X;a,b): %lf\n", a, b, s ); } - - return 0; } ``` diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c index dc7400a8e729..e34b65f86b48 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c @@ -125,7 +125,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/stdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c index 4dd7920b6f47..16fe8fe0e107 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/examples/c/example.c @@ -35,9 +35,6 @@ int main( void ) { a = random_uniform( 0.0, 10.0 ); b = random_uniform( a, a + 10.0 ); s = stdlib_base_dists_arcsine_stdev( a, b ); - printf( "a: %lf, b: %lf, SD(X;a,b): %lf\n", a, b, s ); } - - return 0; } From 8579ed050f6d285c080c6d6b84ef1f0c2f4a886d Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Fri, 10 Jan 2025 22:46:55 -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: 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: 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/stdev/README.md | 2 +- .../stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js | 4 +--- .../@stdlib/stats/base/dists/arcsine/stdev/lib/native.js | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/src/main.c | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md index d39e515ae3e1..66dae41d9a83 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/README.md @@ -159,7 +159,7 @@ for ( i = 0; i < 10; i++ ) { #### stdlib_base_dists_arcsine_stdev( a, b ) -Returns the standard deviation of an arcsine distribution. +Returns the [standard deviation][stdev] of an [arcsine][arcsine-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support). ```c double out = stdlib_base_dists_arcsine_stdev( 4.0, 12.0 ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c index e34b65f86b48..d86eb678a6f0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/c/benchmark.c @@ -16,11 +16,11 @@ * limitations under the License. */ -#include #include "stdlib/stats/base/dists/arcsine/stdev.h" #include #include #include +#include #define NAME "arcsine-stdev" #define ITERATIONS 1000000 diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js index aca261a29762..6b53cb29eefd 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js @@ -22,8 +22,6 @@ var constantFunction = require( '@stdlib/utils/constant-function' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var sqrt = require( '@stdlib/math/base/special/sqrt' ); -var PI = require( '@stdlib/constants/float64/pi' ); // VARIABLES // @@ -43,7 +41,7 @@ var SQRT1OVER8 = 0.35355339059327373; // sqrt(1.0 / 8.0) * @example * var stdev = factory( 0.0, 10.0 ); * var y = stdev(); -* // returns ~3.535 +* // returns ~3.536 */ function factory( a, b ) { if ( diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js index 95369760e619..9ea05d4286d4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js @@ -62,7 +62,7 @@ var addon = require( './../src/addon.node' ); * // returns NaN */ function stdev( a, b ) { - return addon( a, b ); + return addon( a, b ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c index c350c8d3c2c8..0135b6a4c6a5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c @@ -26,7 +26,7 @@ * * @param a minimum support * @param b maximum support -* @return standard deviation of the distribution, or NaN if inputs are invalid +* @return standard deviation * * @example * double v = stdlib_base_dists_arcsine_stdev( 0.0, 1.0 ); From ac9b78648cc3a7062d1679716bf7d2c8f1daf992 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Fri, 10 Jan 2025 22:56:24 -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/stdev/lib/native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js index 9ea05d4286d4..fbeca18dd9eb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/native.js @@ -51,7 +51,7 @@ var addon = require( './../src/addon.node' ); * * @example * var y = stdev( -Infinity, 4.0 ); -* // returns NaN +* // returns Infinity * * @example * var y = stdev( 1.0, NaN ); From 131c3c70972108e4f2ea23b050eeb941fcdec995 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Mon, 13 Jan 2025 20:52:02 -0800 Subject: [PATCH 15/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/stdev/benchmark/benchmark.js | 3 ++- .../base/dists/arcsine/stdev/benchmark/benchmark.native.js | 5 +++-- .../@stdlib/stats/base/dists/arcsine/stdev/src/main.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.js index 595f68a56f57..7b05232e832f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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 stdev = 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 = stdev( min, max ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js index f4b767ca0f5e..180a3ee46ae0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/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/stdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c index 0135b6a4c6a5..c36de9e15bf2 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c @@ -17,6 +17,7 @@ */ #include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/stats/base/dists/arcsine/stdev.h" // CONSTANTS #define SQRT1OVER8 0.35355339059327373 // sqrt(1.0 / 8.0) From b4177cc7127baba41d61cce88a31990d6e4ee2aa Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Wed, 15 Jan 2025 08:53:34 -0500 Subject: [PATCH 16/17] chore: apply suggestions from code review Signed-off-by: Philipp Burckhardt --- .../stdev/include/stdlib/stats/base/dists/arcsine/stdev.h | 4 ---- .../@stdlib/stats/base/dists/arcsine/stdev/src/addon.c | 2 +- .../@stdlib/stats/base/dists/arcsine/stdev/src/main.c | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h index f0da00e4fdeb..18e612056a2c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/include/stdlib/stats/base/dists/arcsine/stdev.h @@ -28,10 +28,6 @@ extern "C" { /** * Returns the standard deviation of an arcsine distribution with minimum support `a` and maximum support `b`. -* -* @param a minimum support -* @param b maximum support -* @return standard deviation of the distribution */ double stdlib_base_dists_arcsine_stdev( const double a, const double b ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c index 6d794ecf0e00..edd0cdfa7dc0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/addon.c @@ -16,8 +16,8 @@ * limitations under the License. */ -#include "stdlib/math/base/napi/binary.h" #include "stdlib/stats/base/dists/arcsine/stdev.h" +#include "stdlib/math/base/napi/binary.h" // cppcheck-suppress shadowFunction STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_arcsine_stdev ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c index c36de9e15bf2..f06cb2fd387a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/src/main.c @@ -16,10 +16,9 @@ * limitations under the License. */ -#include "stdlib/math/base/assert/is_nan.h" #include "stdlib/stats/base/dists/arcsine/stdev.h" +#include "stdlib/math/base/assert/is_nan.h" -// CONSTANTS #define SQRT1OVER8 0.35355339059327373 // sqrt(1.0 / 8.0) /** From 0414bf4df2e1e4ba404127b12556ad6107aedbe9 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Wed, 15 Jan 2025 08:54:00 -0500 Subject: [PATCH 17/17] chore: remove extraneous factory.js file Signed-off-by: Philipp Burckhardt --- .../base/dists/arcsine/stdev/lib/factory.js | 74 ------------------- 1 file changed, 74 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js b/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js deleted file mode 100644 index 6b53cb29eefd..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/arcsine/stdev/lib/factory.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 constantFunction = require( '@stdlib/utils/constant-function' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); - - -// VARIABLES // - -var SQRT1OVER8 = 0.35355339059327373; // sqrt(1.0 / 8.0) - - -// MAIN // - -/** -* Returns a function for calculating the standard deviation of an arcsine distribution with minimum support `a` and maximum support `b`. -* -* @param {number} a - minimum support -* @param {number} b - maximum support -* @returns {Function} Standard deviation function -* -* @example -* var stdev = factory( 0.0, 10.0 ); -* var y = stdev(); -* // returns ~3.536 -*/ -function factory( a, b ) { - if ( - isnan( a ) || - isnan( b ) || - a >= b - ) { - return constantFunction( NaN ); - } - return stdev; - - /** - * Calculates the standard deviation of an arcsine distribution. - * - * @private - * @returns {number} Standard deviation - * - * @example - * var y = stdev(); - * // returns - */ - function stdev() { - return SQRT1OVER8 * ( b - a ); - } -} - - -// EXPORTS // - -module.exports = factory;