From 999a17c77d111967b02577f3e46739c6c94ea857 Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Thu, 15 Jan 2026 11:05:26 +0530 Subject: [PATCH 01/23] feat: add stats/base/dists/halfnormal/skewness --- 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: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../base/dists/halfnormal/skewness/README.md | 235 ++++++++++++++++++ .../skewness/benchmark/benchmark.js | 52 ++++ .../skewness/benchmark/benchmark.native.js | 67 +++++ .../halfnormal/skewness/benchmark/c/Makefile | 146 +++++++++++ .../skewness/benchmark/c/benchmark.c | 138 ++++++++++ .../dists/halfnormal/skewness/binding.gyp | 170 +++++++++++++ .../dists/halfnormal/skewness/docs/repl.txt | 32 +++ .../halfnormal/skewness/docs/types/index.d.ts | 52 ++++ .../halfnormal/skewness/docs/types/test.ts | 42 ++++ .../halfnormal/skewness/examples/c/Makefile | 146 +++++++++++ .../halfnormal/skewness/examples/c/example.c | 38 +++ .../halfnormal/skewness/examples/index.js | 30 +++ .../dists/halfnormal/skewness/include.gypi | 53 ++++ .../stats/base/dists/halfnormal/skewness.h | 38 +++ .../dists/halfnormal/skewness/lib/index.js | 43 ++++ .../dists/halfnormal/skewness/lib/main.js | 63 +++++ .../dists/halfnormal/skewness/lib/native.js | 58 +++++ .../dists/halfnormal/skewness/manifest.json | 76 ++++++ .../dists/halfnormal/skewness/package.json | 69 +++++ .../dists/halfnormal/skewness/src/Makefile | 70 ++++++ .../dists/halfnormal/skewness/src/addon.c | 22 ++ .../base/dists/halfnormal/skewness/src/main.c | 40 +++ .../dists/halfnormal/skewness/tests/test.js | 77 ++++++ .../halfnormal/skewness/tests/test.native.js | 86 +++++++ 24 files changed, 1843 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/binding.gyp create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/index.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/include.gypi create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/include/stdlib/stats/base/dists/halfnormal/skewness.h create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/manifest.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/package.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/Makefile create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/addon.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.native.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md new file mode 100644 index 000000000000..179d9f1d13d3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md @@ -0,0 +1,235 @@ + + +# Skewness + +> [Half-normal][half-normal-distribution] distribution [skewness][skewness]. + + + +
+ +The [skewness][skewness] for a [halfnormal][half-normal-distribution] random variable is + + + +```math +\mathop{\mathrm{skew}}\left( X \right) = 0 +``` + + + + + +
+ + + + + +
+ +## Usage + +```javascript +var skewness = require( '@stdlib/stats/base/dists/halfnormal/skewness' ); +``` + +#### skewness( sigma ) + +Returns the [skewness][skewness] for a [half-normal][half-normal-distribution] distribution with scale parameter `sigma`. + +```javascript +var y = skewness( 1.0 ); +// returns 0.995271746431156 + +y = skewness( 5.0 ); +// returns 0.995271746431156 +``` + +If provided `NaN` as any argument, the function returns `NaN`. + +```javascript +var y = skewness( NaN ); +// returns NaN +``` + +If provided `sigma <= 0`, the function returns `NaN`. + +```javascript +var y = skewness( 0.0 ); +// returns NaN + +y = skewness( -1.0 ); +// returns NaN +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var skewness = require( '@stdlib/stats/base/dists/halfnormal/skewness' ); + +var opts = { + 'dtype': 'float64' +}; +var sigma = uniform( 10, 0.0, 20.0, opts ); + +logEachMap( 'σ: %0.4f, skew(X;σ): %0.4f', sigma, skewness ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/halfnormal/skewness.h" +``` + +#### stdlib_base_dists_normal_skewness( sigma ) + +Returns the skewness for a [half-normal][half-normal-distribution] distribution with scale parameter`sigma`. + +```c +double out = stdlib_base_dists_normal_skewness( 1.0 ); +// returns 0.995271746431156 +``` + +The function accepts the following arguments: + +- **sigma**: `[in] double` scale parameter. +- **return**: `[out] double` skewness. + +```c +double stdlib_base_dists_halfnormal_skewness( const double sigma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/halfnormal/skewness.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 sigma; + double y; + int i; + + for ( i = 0; i < 10; i++ ) { + sigma = random_uniform( 0.1, 20.0 ); + y = stdlib_base_dists_halfnormal_skewness( sigma ); + printf( "σ: %.4f, skew(X;σ): %.4f\n", sigma, y ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.js new file mode 100644 index 000000000000..b4a205858f4a --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 bench = require( '@stdlib/bench' ); +var randu = require( '@stdlib/random/base/randu' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var pkg = require( './../package.json' ).name; +var skewness = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var sigma; + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + sigma = ( randu()*20.0 ) + EPS; + y = skewness( sigma ); + 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/halfnormal/skewness/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.native.js new file mode 100644 index 000000000000..c506a5e7a597 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/benchmark.native.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 uniform = require( '@stdlib/random/base/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var skewness = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( skewness instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var sigma; + var len; + var y; + var i; + + len = 100; + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = skewness( sigma[ 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/halfnormal/skewness/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/Makefile new file mode 100644 index 000000000000..979768abbcec --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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/halfnormal/skewness/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c new file mode 100644 index 000000000000..0bfa4d91c9c5 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c @@ -0,0 +1,138 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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/halfnormal/skewness.h" +#include +#include +#include +#include +#include + +#define NAME "normal-skewness" +#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 sigma[ 100 ]; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + sigma[ i ] = random_uniform( 0.1, 10.0 ); + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_dists_halfnormal_skewness( sigma[ 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/halfnormal/skewness/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/binding.gyp new file mode 100644 index 000000000000..0d6508a12e99 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt new file mode 100644 index 000000000000..1cbbb8b7c1b8 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt @@ -0,0 +1,32 @@ + +{{alias}}( σ ) + Returns the skewness of a half-normal distribution with scale paramter `σ`. + + If provided `NaN` as any argument, the function returns `NaN`. + + If provided `σ <= 0`, the function returns `NaN`. + + Parameters + ---------- + σ: number + Standard deviation. + + Returns + ------- + out: number + Skewness. + + Examples + -------- + > var y = {{alias}}( 1.0 ) + 0.995271746431156 + > y = {{alias}}( 3.0 ) + 0.995271746431156 + > y = {{alias}}( NaN ) + NaN + > y = {{alias}}( 0.0 ) + NaN + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts new file mode 100644 index 000000000000..714b84819bd5 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts @@ -0,0 +1,52 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +// TypeScript Version: 4.1 + +/** +* Returns the skewness for a half-normal distribution with scale parameter`sigma`. +* +* ## Notes +* +* - If provided `sigma <= 0`, the function returns `NaN`. +* +* @param sigma - scale parameter +* @returns skewness +* +* @example +* var y = skewness( 1.0 ); +* // returns 0.995271746431156 +* +* @example +* var y = skewness( 5.0 ); +* // returns 0.995271746431156 +* +* @example +* var y = skewness( NaN ); +* // returns NaN +* +* @example +* var y = skewness( 0.0 ); +* // returns NaN +*/ +declare function skewness( sigma: number ): number; + + +// EXPORTS // + +export = skewness; diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/test.ts new file mode 100644 index 000000000000..7d928fced1f1 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/test.ts @@ -0,0 +1,42 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +import skewness = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + skewness( 2 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a value other than a number... +{ + skewness( true ); // $ExpectError + skewness( false ); // $ExpectError + skewness( '5' ); // $ExpectError + skewness( [] ); // $ExpectError + skewness( {} ); // $ExpectError + skewness( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + skewness(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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/halfnormal/skewness/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/example.c new file mode 100644 index 000000000000..6f8b211a5cc7 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/c/example.c @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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/halfnormal/skewness.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 sigma; + double y; + int i; + + for ( i = 0; i < 10; i++ ) { + sigma = random_uniform( 0.0, 20.0 ); + y = stdlib_base_dists_halfnormal_skewness( sigma ); + printf( "σ: %.4f, skew(X;σ): %.4f\n", sigma, y ); + } +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/index.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/index.js new file mode 100644 index 000000000000..bfbdf19adb04 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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'; + +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var skewness = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; +var sigma = uniform( 10, 0.0, 20.0, opts ); + +logEachMap( 'σ: %0.4f, skew(X;σ): %0.4f', sigma, skewness ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/include.gypi new file mode 100644 index 000000000000..bee8d41a2caf --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 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': [ + '=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "statistics", + "stats", + "distribution", + "dist", + "gaussian", + "normal", + "continuous", + "skewness", + "shape", + "asymmetry", + "univariate" + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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/halfnormal/skewness/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/addon.c new file mode 100644 index 000000000000..eb4097b91bd8 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/addon.c @@ -0,0 +1,22 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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/halfnormal/skewness.h" +#include "stdlib/math/base/napi/unary.h" + +STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_halfnormal_skewness ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c new file mode 100644 index 000000000000..3d480bcb0737 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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/halfnormal/skewness.h" +#include "stdlib/math/base/assert/is_nan.h" + +/** +* Returns the skewness for a half-normal distribution with scale parameter `sigma`. +* +* @param sigma scale parameter +* @return skewness +* +* @example +* double y = stdlib_base_dists_halfnormal_skewness( 1.0 ); +* // returns 0.995271746431156 +*/ +double stdlib_base_dists_halfnormal_skewness( const double sigma ) { + if ( + stdlib_base_is_nan( sigma ) || + sigma <= 0.0 + ) { + return 0.0/0.0; // NaN + } + return 0.995271746431156; +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js new file mode 100644 index 000000000000..81b54322e57e --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js @@ -0,0 +1,77 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var skewness = require( '@stdlib/stats/base/dists/halfnormal/skewness/lib' ); + + +// FIXTURES // + +var data = require( '@stdlib/stats/base/dists/halfnormal/skewness/tests/fixtures/julia/data.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof skewness, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { + var y = skewness( NaN ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided a value less than or equal to 0 for `sigma`, the function returns `NaN`', function test( t ) { + var y; + + y = skewness( 0.0 ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + y = skewness( -1.0 ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + y = skewness( NINF ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the skewness of a half-normal distribution', function test( t ) { + var expected; + var sigma; + var y; + var i; + + expected = data.expected; + sigma = data.sigma; + + for ( i = 0; i < sigma.length; i++ ) { + y = skewness( sigma[i] ); + t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.native.js new file mode 100644 index 000000000000..5ddd233ba22e --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.native.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// VARIABLES // + +var skewness = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( skewness instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof skewness, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) { + var y = skewness( NaN ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided a value less than or equal to 0 for `sigma`, the function returns `NaN`', function test( t ) { + var y; + + y = skewness( 0.0 ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + y = skewness( -1.0 ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + y = skewness( NINF ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the skewness of a half-normal distribution', opts, function test( t ) { + var expected; + var sigma; + var y; + var i; + + expected = data.expected; + sigma = data.sigma; + + for ( i = 0; i < sigma.length; i++ ) { + y = skewness( sigma[i] ); + t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); + } + t.end(); +}); From 39a35d7b056b419ab5a014ca464d59412ae5b53b Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Thu, 15 Jan 2026 11:20:38 +0530 Subject: [PATCH 02/23] fix: updated the return values --- 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: passed - 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: passed - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/stats/base/dists/halfnormal/skewness/README.md | 6 +++--- .../stats/base/dists/halfnormal/skewness/docs/repl.txt | 4 ++-- .../base/dists/halfnormal/skewness/docs/types/index.d.ts | 4 ++-- .../stats/base/dists/halfnormal/skewness/lib/index.js | 4 ++-- .../stats/base/dists/halfnormal/skewness/lib/main.js | 6 +++--- .../stats/base/dists/halfnormal/skewness/lib/native.js | 4 ++-- .../@stdlib/stats/base/dists/halfnormal/skewness/src/main.c | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md index 179d9f1d13d3..c67c621eada1 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md @@ -61,10 +61,10 @@ Returns the [skewness][skewness] for a [half-normal][half-normal-distribution] d ```javascript var y = skewness( 1.0 ); -// returns 0.995271746431156 +// returns 0.995 y = skewness( 5.0 ); -// returns 0.995271746431156 +// returns 0.995 ``` If provided `NaN` as any argument, the function returns `NaN`. @@ -153,7 +153,7 @@ Returns the skewness for a [half-normal][half-normal-distribution] distribution ```c double out = stdlib_base_dists_normal_skewness( 1.0 ); -// returns 0.995271746431156 +// returns 0.995 ``` The function accepts the following arguments: diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt index 1cbbb8b7c1b8..5a96ee38b254 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt @@ -19,9 +19,9 @@ Examples -------- > var y = {{alias}}( 1.0 ) - 0.995271746431156 + 0.995 > y = {{alias}}( 3.0 ) - 0.995271746431156 + 0.995 > y = {{alias}}( NaN ) NaN > y = {{alias}}( 0.0 ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts index 714b84819bd5..68a12752071c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts @@ -30,11 +30,11 @@ * * @example * var y = skewness( 1.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * @example * var y = skewness( 5.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * @example * var y = skewness( NaN ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js index 3422974dd32f..6c4c639ba26d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js @@ -27,10 +27,10 @@ * var skewness = require( '@stdlib/stats/base/dists/halfnormal/skewness' ); * * var y = skewness( 1.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * y = skewness( 5.0 ); -* // returns 0.995271746431156 +* // returns 0.995 */ // MODULES // diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js index ece675f496ca..fe89000cd0d4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js @@ -33,11 +33,11 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); * * @example * var y = skewness( 1.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * @example * var y = skewness( 5.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * @example * var y = skewness( NaN ); @@ -54,7 +54,7 @@ function skewness( sigma ) { ) { return NaN; } - return 0.995271746431156; + return 0.995; } diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js index bc83fcfbf3be..ea6cb1a03612 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js @@ -34,11 +34,11 @@ var addon = require( './../src/addon.node' ); * * @example * var y = skewness( 1.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * @example * var y = skewness( 5.0 ); -* // returns 0.995271746431156 +* // returns 0.995 * * @example * var y = skewness( NaN ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c index 3d480bcb0737..36955ed78c04 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c @@ -27,7 +27,7 @@ * * @example * double y = stdlib_base_dists_halfnormal_skewness( 1.0 ); -* // returns 0.995271746431156 +* // returns 0.995 */ double stdlib_base_dists_halfnormal_skewness( const double sigma ) { if ( @@ -36,5 +36,5 @@ double stdlib_base_dists_halfnormal_skewness( const double sigma ) { ) { return 0.0/0.0; // NaN } - return 0.995271746431156; + return 0.995; } From 1b4d59db198a86d7c5e6f9cba2f15312c7af5099 Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Thu, 15 Jan 2026 11:42:54 +0530 Subject: [PATCH 03/23] fix: updated the data json --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../skewness/test/fixtures/julia/REQUIRE | 3 + .../skewness/test/fixtures/julia/data.json | 32 +++++++++ .../skewness/test/fixtures/julia/runner.jl | 69 +++++++++++++++++++ .../skewness/{tests => test}/test.js | 4 +- .../skewness/{tests => test}/test.native.js | 0 5 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/REQUIRE create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json create mode 100644 lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl rename lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/{tests => test}/test.js (91%) rename lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/{tests => test}/test.native.js (100%) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/REQUIRE b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/REQUIRE new file mode 100644 index 000000000000..98be20b58ed3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/REQUIRE @@ -0,0 +1,3 @@ +Distributions 0.23.8 +julia 1.5 +JSON 0.21 diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json new file mode 100644 index 000000000000..6eb42dd61a85 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json @@ -0,0 +1,32 @@ +{ + "sigma": [ + 18.85019126246455, 6.815489890726541, 2.4528028962506747, 5.52828434540982, + 11.76480827117304, 12.216327775083297, 18.95871415268353, 8.437297087195631, + 19.557257165385046, 11.362719384741425, 11.013395500405874, 16.951338263629626, + 9.047073335857913, 2.577081059735365, 11.83717172838757, 14.785690111153304, + 16.56933028428779, 20.952586004767657, 6.7358177234078624, 16.320670601385043, + 5.82279301905089, 21.333430683837992, 10.500092704309195, 10.170477298914145, + 17.24697141680967, 8.05342552516345, 12.44468319842698, 20.444669282818595, + 9.899379365307912, 20.945698578359757, 10.09022316621611, 5.8542885467509524, + 13.399915292407563, 18.870914589663215, 8.68669540352445, 20.746729831193605, + 6.68085204116103, 12.262974326022668, 9.25157045118463, 20.189685268578533, + 11.716974480444138, 5.362441952744555, 9.925273362418071, 12.96088212770181, + 7.495070839707887, 10.643342368188186, 20.21575020229341, 21.76937424634205, + 6.085479875231921, 7.970382058450792 + ], + "expected": [ + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, + 0.995271746431156, 0.995271746431156 + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl new file mode 100644 index 000000000000..43cab77b728a --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl @@ -0,0 +1,69 @@ +#!/usr/bin/env julia +# +# @license Apache-2.0 +# +# Copyright (c) 2026 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. + +import Distributions: skewness, Halfnormal +import JSON + +""" + gen( sigma, name ) + +Generate fixture data and write to file. + +# Arguments + +* `sigma`: scale parameter +* `name::AbstractString`: output filename + +# Examples + +``` julia +julia> sigma = rand( 1000 ) .* 5.0; +julia> gen( sigma, "data.json" ); +``` +""" +# Get the filename: +file = @__FILE__ + +# Extract the directory in which this file resides: +dir = dirname(file) + +function gen( sigma, name ) + z = Array{Float64}( undef, length(sigma) ); + for i in eachindex(sigma) + z[ i ] = skewness( Halfnormal( sigma[i] ) ); + end + + # Store data to be written to file as a collection: + data = Dict([ + ("sigma", sigma), + ("expected", z) + ]); + + # Based on the script directory, create an output filepath: + filepath = joinpath( dir, name ); + + # Write the data to the output filepath as JSON: + open(filepath, "w") do outfile + write(outfile, JSON.json(data)) + write(outfile, "\n") + end +end + +# Generate fixtures: +sigma = rand( 10 ) .* 5.0; +gen( sigma, "data.json" ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js similarity index 91% rename from lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js rename to lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js index 81b54322e57e..9500feaf55b2 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js @@ -23,12 +23,12 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var skewness = require( '@stdlib/stats/base/dists/halfnormal/skewness/lib' ); +var skewness = require( './../lib' ); // FIXTURES // -var data = require( '@stdlib/stats/base/dists/halfnormal/skewness/tests/fixtures/julia/data.json' ); +var data = require( './fixtures/julia/data.json' ); // TESTS // diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js similarity index 100% rename from lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/tests/test.native.js rename to lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js From a62449ad1cf4cf2a78369575836cb3c275681e89 Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Thu, 15 Jan 2026 15:04:13 +0530 Subject: [PATCH 04/23] fix: updated expected value --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../skewness/test/fixtures/julia/data.json | 23 ++++++++----------- .../halfnormal/skewness/test/test.native.js | 3 ++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json index 6eb42dd61a85..6e1402c7b650 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json @@ -15,18 +15,15 @@ 6.085479875231921, 7.970382058450792 ], "expected": [ - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156, 0.995271746431156, 0.995271746431156, - 0.995271746431156, 0.995271746431156 + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995, + 0.995, 0.995, 0.995, 0.995, 0.995 ] } diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js index 5ddd233ba22e..917ca0af645b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js @@ -54,7 +54,8 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, f t.end(); }); -tape( 'if provided a value less than or equal to 0 for `sigma`, the function returns `NaN`', function test( t ) { +// Use opts to skip this test if native binding is missing +tape( 'if provided a value less than or equal to 0 for `sigma`, the function returns `NaN`', opts, function test( t ) { var y; y = skewness( 0.0 ); From 3b215771fb329136deeb790ea820bb57cf3fac4d Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Thu, 15 Jan 2026 15:12:33 +0530 Subject: [PATCH 05/23] fix: 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/dists/halfnormal/skewness/test/test.native.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js index 917ca0af645b..7718c6dd25bb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js @@ -54,8 +54,7 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, f t.end(); }); -// Use opts to skip this test if native binding is missing -tape( 'if provided a value less than or equal to 0 for `sigma`, the function returns `NaN`', opts, function test( t ) { +tape( 'if provided a nonpositive `sigma`, the function returns `NaN`', opts, function test( t ) { var y; y = skewness( 0.0 ); @@ -70,7 +69,7 @@ tape( 'if provided a value less than or equal to 0 for `sigma`, the function ret t.end(); }); -tape( 'the function returns the skewness of a half-normal distribution', opts, function test( t ) { +tape( 'the function returns the skewness of a normal distribution', opts, function test( t ) { var expected; var sigma; var y; @@ -78,7 +77,6 @@ tape( 'the function returns the skewness of a half-normal distribution', opts, f expected = data.expected; sigma = data.sigma; - for ( i = 0; i < sigma.length; i++ ) { y = skewness( sigma[i] ); t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); From 8902539d84a5ae5f2720ff15156a0e0eeb14edf0 Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Thu, 15 Jan 2026 18:45:12 +0530 Subject: [PATCH 06/23] fix: updated the readme --- 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: 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../stats/base/dists/halfnormal/skewness/README.md | 9 ++++----- .../base/dists/halfnormal/skewness/test/test.native.js | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md index c67c621eada1..f7b60c422b1d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md @@ -28,14 +28,13 @@ limitations under the License. The [skewness][skewness] for a [halfnormal][half-normal-distribution] random variable is - + ```math -\mathop{\mathrm{skew}}\left( X \right) = 0 +\mathop{\mathrm{skew}}\left( X \right) = 0.955 ``` - @@ -152,7 +151,7 @@ logEachMap( 'σ: %0.4f, skew(X;σ): %0.4f', sigma, skewness ); Returns the skewness for a [half-normal][half-normal-distribution] distribution with scale parameter`sigma`. ```c -double out = stdlib_base_dists_normal_skewness( 1.0 ); +double out = stdlib_base_dists_halfnormal_skewness( 1.0 ); // returns 0.995 ``` diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js index 7718c6dd25bb..d60d21ef567b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js @@ -69,7 +69,7 @@ tape( 'if provided a nonpositive `sigma`, the function returns `NaN`', opts, fun t.end(); }); -tape( 'the function returns the skewness of a normal distribution', opts, function test( t ) { +tape( 'the function returns the skewness of a half-normal distribution', opts, function test( t ) { var expected; var sigma; var y; From 9c82c7b614dc1f81162080748c8284b44bb77939 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Thu, 15 Jan 2026 19:00:42 +0530 Subject: [PATCH 07/23] Update package.json Signed-off-by: Lokesh Ranjan --- .../@stdlib/stats/base/dists/halfnormal/skewness/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/package.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/package.json index d7c69b46461e..afe416da98a6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/package.json +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/package.json @@ -59,7 +59,7 @@ "distribution", "dist", "gaussian", - "normal", + "halfnormal", "continuous", "skewness", "shape", From 26233a91cd996a8938bcc82cb7752144754ce698 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Thu, 15 Jan 2026 19:01:08 +0530 Subject: [PATCH 08/23] Update parameter description from 'Standard deviation' to 'scale parameter' Signed-off-by: Lokesh Ranjan --- .../@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt index 5a96ee38b254..37b8518852f3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt @@ -9,7 +9,7 @@ Parameters ---------- σ: number - Standard deviation. + scale parameter. Returns ------- From 94707c5638c06291c9e9998f9a0b811183fdfbe8 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Thu, 15 Jan 2026 19:04:07 +0530 Subject: [PATCH 09/23] Update data.json Signed-off-by: Lokesh Ranjan --- .../skewness/test/fixtures/julia/data.json | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json index 6e1402c7b650..4c0d9d4202f2 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json @@ -1,29 +1 @@ -{ - "sigma": [ - 18.85019126246455, 6.815489890726541, 2.4528028962506747, 5.52828434540982, - 11.76480827117304, 12.216327775083297, 18.95871415268353, 8.437297087195631, - 19.557257165385046, 11.362719384741425, 11.013395500405874, 16.951338263629626, - 9.047073335857913, 2.577081059735365, 11.83717172838757, 14.785690111153304, - 16.56933028428779, 20.952586004767657, 6.7358177234078624, 16.320670601385043, - 5.82279301905089, 21.333430683837992, 10.500092704309195, 10.170477298914145, - 17.24697141680967, 8.05342552516345, 12.44468319842698, 20.444669282818595, - 9.899379365307912, 20.945698578359757, 10.09022316621611, 5.8542885467509524, - 13.399915292407563, 18.870914589663215, 8.68669540352445, 20.746729831193605, - 6.68085204116103, 12.262974326022668, 9.25157045118463, 20.189685268578533, - 11.716974480444138, 5.362441952744555, 9.925273362418071, 12.96088212770181, - 7.495070839707887, 10.643342368188186, 20.21575020229341, 21.76937424634205, - 6.085479875231921, 7.970382058450792 - ], - "expected": [ - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995, - 0.995, 0.995, 0.995, 0.995, 0.995 - ] -} +{"sigma": [ 18.85019126246455, 6.815489890726541, 2.4528028962506747, 5.52828434540982,11.76480827117304, 12.216327775083297, 18.95871415268353, 8.437297087195631,19.557257165385046, 11.362719384741425, 11.013395500405874, 16.951338263629626,9.047073335857913, 2.577081059735365, 11.83717172838757, 14.785690111153304,16.56933028428779, 20.952586004767657, 6.7358177234078624, 16.320670601385043,5.82279301905089, 21.333430683837992, 10.500092704309195, 10.170477298914145,17.24697141680967, 8.05342552516345, 12.44468319842698, 20.444669282818595,9.899379365307912, 20.945698578359757, 10.09022316621611, 5.8542885467509524,13.399915292407563, 18.870914589663215, 8.68669540352445, 20.746729831193605,6.68085204116103, 12.262974326022668, 9.25157045118463, 20.189685268578533,11.716974480444138, 5.362441952744555, 9.925273362418071, 12.96088212770181,7.495070839707887, 10.643342368188186, 20.21575020229341, 21.76937424634205,6.085479875231921, 7.970382058450792],"expected": [0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995]} From 2342e7b8f31784ee19e8aad67d3993f96a323e22 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Thu, 15 Jan 2026 19:09:51 +0530 Subject: [PATCH 10/23] Update runner.jl Signed-off-by: Lokesh Ranjan --- .../halfnormal/skewness/test/fixtures/julia/runner.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl index 43cab77b728a..d954ade8da01 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl @@ -43,9 +43,14 @@ file = @__FILE__ dir = dirname(file) function gen( sigma, name ) - z = Array{Float64}( undef, length(sigma) ); + expected = Array{Float64}( undef, length(sigma) ); + for i in eachindex(sigma) - z[ i ] = skewness( Halfnormal( sigma[i] ) ); + if sigma[i] > 0.0 + expected[i] = 0.955 + else + expected[i] = NaN + end end # Store data to be written to file as a collection: From fbea6baaaf89f35413906306c904b0887af1859d Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Thu, 15 Jan 2026 19:20:08 +0530 Subject: [PATCH 11/23] Update documentation for scale parameter description Signed-off-by: Lokesh Ranjan --- .../@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt index 37b8518852f3..cd9d6f6938cc 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt @@ -9,7 +9,7 @@ Parameters ---------- σ: number - scale parameter. + Scale parameter. Returns ------- From 5f62fb5f31138243de748e28bbff392959125c6c Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Thu, 15 Jan 2026 19:21:08 +0530 Subject: [PATCH 12/23] Remove blank line in runner.jl Remove unnecessary blank line in gen function. Signed-off-by: Lokesh Ranjan --- .../dists/halfnormal/skewness/test/fixtures/julia/runner.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl index d954ade8da01..d428b44cdba7 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl @@ -44,7 +44,7 @@ dir = dirname(file) function gen( sigma, name ) expected = Array{Float64}( undef, length(sigma) ); - + for i in eachindex(sigma) if sigma[i] > 0.0 expected[i] = 0.955 From cbf8f29caee9b588eccd65c20aeecf19b5a9bcd2 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Fri, 16 Jan 2026 14:03:37 +0530 Subject: [PATCH 13/23] Update lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md Co-authored-by: Philipp Burckhardt Signed-off-by: Lokesh Ranjan --- .../@stdlib/stats/base/dists/halfnormal/skewness/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md index f7b60c422b1d..dbf11143cc4e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md @@ -148,7 +148,7 @@ logEachMap( 'σ: %0.4f, skew(X;σ): %0.4f', sigma, skewness ); #### stdlib_base_dists_normal_skewness( sigma ) -Returns the skewness for a [half-normal][half-normal-distribution] distribution with scale parameter`sigma`. +Returns the skewness for a [half-normal][half-normal-distribution] distribution with scale parameter `sigma`. ```c double out = stdlib_base_dists_halfnormal_skewness( 1.0 ); From f88bf49013a0fd205bd5094fa42470de725bd7e8 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Fri, 16 Jan 2026 14:03:52 +0530 Subject: [PATCH 14/23] Update lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c Co-authored-by: Philipp Burckhardt Signed-off-by: Lokesh Ranjan --- .../base/dists/halfnormal/skewness/benchmark/c/benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c index 0bfa4d91c9c5..9d718c46478c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/benchmark/c/benchmark.c @@ -23,7 +23,7 @@ #include #include -#define NAME "normal-skewness" +#define NAME "halfnormal-skewness" #define ITERATIONS 1000000 #define REPEATS 3 From c1b2dd5b6257b8be7c915ef5ef27a64a7a81b839 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Fri, 16 Jan 2026 14:04:08 +0530 Subject: [PATCH 15/23] Update lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts Co-authored-by: Philipp Burckhardt Signed-off-by: Lokesh Ranjan --- .../stats/base/dists/halfnormal/skewness/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts index 68a12752071c..45f1bc8ddf70 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts @@ -19,7 +19,7 @@ // TypeScript Version: 4.1 /** -* Returns the skewness for a half-normal distribution with scale parameter`sigma`. +* Returns the skewness for a half-normal distribution with scale parameter `sigma`. * * ## Notes * From 64d8a03e9105631804ba28c45df70f736e091c37 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Fri, 16 Jan 2026 14:04:20 +0530 Subject: [PATCH 16/23] Update lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt Co-authored-by: Philipp Burckhardt Signed-off-by: Lokesh Ranjan --- .../@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt index cd9d6f6938cc..5b6ff3932f4c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}( σ ) - Returns the skewness of a half-normal distribution with scale paramter `σ`. + Returns the skewness of a half-normal distribution with scale parameter `σ`. If provided `NaN` as any argument, the function returns `NaN`. From 150b4409be73584c59f71d3d06977d5fe1c78ed9 Mon Sep 17 00:00:00 2001 From: Lokesh Ranjan Date: Fri, 16 Jan 2026 14:05:14 +0530 Subject: [PATCH 17/23] Update lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md Co-authored-by: Philipp Burckhardt Signed-off-by: Lokesh Ranjan --- .../@stdlib/stats/base/dists/halfnormal/skewness/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md index dbf11143cc4e..af3f58a9677e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md @@ -31,7 +31,7 @@ The [skewness][skewness] for a [halfnormal][half-normal-distribution] random var ```math -\mathop{\mathrm{skew}}\left( X \right) = 0.955 +\mathop{\mathrm{skew}}\left( X \right) \approx 0.995 ``` @@ -158,7 +158,6 @@ double out = stdlib_base_dists_halfnormal_skewness( 1.0 ); The function accepts the following arguments: - **sigma**: `[in] double` scale parameter. -- **return**: `[out] double` skewness. ```c double stdlib_base_dists_halfnormal_skewness( const double sigma ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl index f75a175fb3bc..c735d84e2d28 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl @@ -47,7 +47,7 @@ function gen( sigma, name ) for i in eachindex(sigma) if sigma[i] > 0.0 - expected[i] = 0.955 + expected[i] = 0.995 else expected[i] = NaN end From 6a68d97eb9bd5ba9a35180a13bb5d3597f6142c2 Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Mon, 26 Jan 2026 00:29:28 +0530 Subject: [PATCH 22/23] fix: updated the expected value --- 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: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/dists/halfnormal/skewness/src/main.c | 2 +- .../skewness/test/fixtures/julia/data.json | 34 ++++++++++++++++++- .../skewness/test/fixtures/julia/runner.jl | 2 +- .../dists/halfnormal/skewness/test/test.js | 19 +++++++---- .../halfnormal/skewness/test/test.native.js | 14 ++++++-- 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c index 36955ed78c04..503bf15ea80c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c @@ -36,5 +36,5 @@ double stdlib_base_dists_halfnormal_skewness( const double sigma ) { ) { return 0.0/0.0; // NaN } - return 0.995; + return 0.9952717; } diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json index 4c0d9d4202f2..85352bf44499 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/data.json @@ -1 +1,33 @@ -{"sigma": [ 18.85019126246455, 6.815489890726541, 2.4528028962506747, 5.52828434540982,11.76480827117304, 12.216327775083297, 18.95871415268353, 8.437297087195631,19.557257165385046, 11.362719384741425, 11.013395500405874, 16.951338263629626,9.047073335857913, 2.577081059735365, 11.83717172838757, 14.785690111153304,16.56933028428779, 20.952586004767657, 6.7358177234078624, 16.320670601385043,5.82279301905089, 21.333430683837992, 10.500092704309195, 10.170477298914145,17.24697141680967, 8.05342552516345, 12.44468319842698, 20.444669282818595,9.899379365307912, 20.945698578359757, 10.09022316621611, 5.8542885467509524,13.399915292407563, 18.870914589663215, 8.68669540352445, 20.746729831193605,6.68085204116103, 12.262974326022668, 9.25157045118463, 20.189685268578533,11.716974480444138, 5.362441952744555, 9.925273362418071, 12.96088212770181,7.495070839707887, 10.643342368188186, 20.21575020229341, 21.76937424634205,6.085479875231921, 7.970382058450792],"expected": [0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995,0.995, 0.995, 0.995, 0.995, 0.995]} +{ + "sigma": [ + 18.85019126246455, 6.815489890726541, 2.4528028962506747, + 5.52828434540982, 11.76480827117304, 12.216327775083297, + 18.95871415268353, 8.437297087195631, 19.557257165385046, + 11.362719384741425, 11.013395500405874, 16.951338263629626, + 9.047073335857913, 2.577081059735365, 11.83717172838757, + 14.785690111153304, 16.56933028428779, 20.952586004767657, + 6.7358177234078624, 16.320670601385043, 5.82279301905089, + 21.333430683837992, 10.500092704309195, 10.170477298914145, + 17.24697141680967, 8.05342552516345, 12.44468319842698, + 20.444669282818595, 9.899379365307912, 20.945698578359757, + 10.09022316621611, 5.8542885467509524, 13.399915292407563, + 18.870914589663215, 8.68669540352445, 20.746729831193605, + 6.68085204116103, 12.262974326022668, 9.25157045118463, + 20.189685268578533, 11.716974480444138, 5.362441952744555, + 9.925273362418071, 12.96088212770181, 7.495070839707887, + 10.643342368188186, 20.21575020229341, 21.76937424634205, + 6.085479875231921, 7.970382058450792 + ], + "expected": [ + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717, + 0.9952717, 0.9952717, 0.9952717, 0.9952717, 0.9952717 + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl index c735d84e2d28..ed5e07053396 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/fixtures/julia/runner.jl @@ -47,7 +47,7 @@ function gen( sigma, name ) for i in eachindex(sigma) if sigma[i] > 0.0 - expected[i] = 0.995 + expected[i] = 0.9952717 else expected[i] = NaN end diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js index 9500feaf55b2..5d307b523482 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.js @@ -23,11 +23,9 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var NINF = require( '@stdlib/constants/float64/ninf' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var EPS = require( '@stdlib/constants/float64/eps' ); var skewness = require( './../lib' ); - - -// FIXTURES // - var data = require( './fixtures/julia/data.json' ); @@ -63,15 +61,22 @@ tape( 'if provided a value less than or equal to 0 for `sigma`, the function ret tape( 'the function returns the skewness of a half-normal distribution', function test( t ) { var expected; var sigma; + var delta; + var tol; var y; var i; expected = data.expected; sigma = data.sigma; - - for ( i = 0; i < sigma.length; i++ ) { + for ( i = 0; i < expected.length; i++ ) { y = skewness( sigma[i] ); - t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); + if ( y === expected[i] ) { + t.strictEqual( y, expected[i], ', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 1.5 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } } t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js index d60d21ef567b..d341375321b0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/test/test.native.js @@ -25,6 +25,8 @@ var tape = require( 'tape' ); var tryRequire = require( '@stdlib/utils/try-require' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var NINF = require( '@stdlib/constants/float64/ninf' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var EPS = require( '@stdlib/constants/float64/eps' ); // FIXTURES // @@ -72,14 +74,22 @@ tape( 'if provided a nonpositive `sigma`, the function returns `NaN`', opts, fun tape( 'the function returns the skewness of a half-normal distribution', opts, function test( t ) { var expected; var sigma; + var delta; + var tol; var y; var i; expected = data.expected; sigma = data.sigma; - for ( i = 0; i < sigma.length; i++ ) { + for ( i = 0; i < expected.length; i++ ) { y = skewness( sigma[i] ); - t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); + if ( y === expected[i] ) { + t.strictEqual( y, expected[i], ', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 1.5 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } } t.end(); }); From f8e0c77fed5390cf35b3f626e9ec02f23e56b996 Mon Sep 17 00:00:00 2001 From: LokeshRanjan Date: Mon, 26 Jan 2026 00:45:21 +0530 Subject: [PATCH 23/23] fix: fix the lint errors --- 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: passed - 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: passed - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/stats/base/dists/halfnormal/skewness/README.md | 6 +++--- .../stats/base/dists/halfnormal/skewness/docs/repl.txt | 4 ++-- .../base/dists/halfnormal/skewness/docs/types/index.d.ts | 4 ++-- .../stats/base/dists/halfnormal/skewness/lib/index.js | 4 ++-- .../stats/base/dists/halfnormal/skewness/lib/main.js | 6 +++--- .../stats/base/dists/halfnormal/skewness/lib/native.js | 4 ++-- .../@stdlib/stats/base/dists/halfnormal/skewness/src/main.c | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md index fc57279319ae..55351368f504 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/README.md @@ -60,10 +60,10 @@ Returns the [skewness][skewness] for a [half-normal][half-normal-distribution] d ```javascript var y = skewness( 1.0 ); -// returns 0.995 +// returns 0.9952717 y = skewness( 5.0 ); -// returns 0.995 +// returns 0.9952717 ``` If provided `NaN` as any argument, the function returns `NaN`. @@ -152,7 +152,7 @@ Returns the skewness for a [half-normal][half-normal-distribution] distribution ```c double out = stdlib_base_dists_halfnormal_skewness( 1.0 ); -// returns 0.995 +// returns 0.9952717 ``` The function accepts the following arguments: diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt index 5b6ff3932f4c..f92703016cee 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/repl.txt @@ -19,9 +19,9 @@ Examples -------- > var y = {{alias}}( 1.0 ) - 0.995 + 0.9952717 > y = {{alias}}( 3.0 ) - 0.995 + 0.9952717 > y = {{alias}}( NaN ) NaN > y = {{alias}}( 0.0 ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts index 45f1bc8ddf70..4620fab84084 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/docs/types/index.d.ts @@ -30,11 +30,11 @@ * * @example * var y = skewness( 1.0 ); -* // returns 0.995 +* // returns 0.9952717 * * @example * var y = skewness( 5.0 ); -* // returns 0.995 +* // returns 0.9952717 * * @example * var y = skewness( NaN ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js index 6c4c639ba26d..186ede43c33b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/index.js @@ -27,10 +27,10 @@ * var skewness = require( '@stdlib/stats/base/dists/halfnormal/skewness' ); * * var y = skewness( 1.0 ); -* // returns 0.995 +* // returns 0.9952717 * * y = skewness( 5.0 ); -* // returns 0.995 +* // returns 0.9952717 */ // MODULES // diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js index fe89000cd0d4..0dd058e2ea97 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/main.js @@ -33,11 +33,11 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); * * @example * var y = skewness( 1.0 ); -* // returns 0.995 +* // returns 0.9952717 * * @example * var y = skewness( 5.0 ); -* // returns 0.995 +* // returns 0.9952717 * * @example * var y = skewness( NaN ); @@ -54,7 +54,7 @@ function skewness( sigma ) { ) { return NaN; } - return 0.995; + return 0.9952717; } diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js index ea6cb1a03612..de7f105efbd3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/lib/native.js @@ -34,11 +34,11 @@ var addon = require( './../src/addon.node' ); * * @example * var y = skewness( 1.0 ); -* // returns 0.995 +* // returns 0.9952717 * * @example * var y = skewness( 5.0 ); -* // returns 0.995 +* // returns 0.9952717 * * @example * var y = skewness( NaN ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c index 503bf15ea80c..6578e2f9fe14 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/skewness/src/main.c @@ -27,7 +27,7 @@ * * @example * double y = stdlib_base_dists_halfnormal_skewness( 1.0 ); -* // returns 0.995 +* // returns 0.9952717 */ double stdlib_base_dists_halfnormal_skewness( const double sigma ) { if (