diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/README.md new file mode 100644 index 000000000000..02e05a9c616b --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/README.md @@ -0,0 +1,245 @@ + + +# Mean + +> [Half-normal][half-normal-distribution] distribution [expected value][mean]. + + + +
+ +The [expected value][mean] for a [half-normal][half-normal-distribution] random variable with scale parameter `σ > 0` is + + + +```math +\mathbb{E}\left[ X \right] = \sigma \sqrt{\frac{2}{\pi}} +``` + + + + + +
+ + + + + +
+ +## Usage + +```javascript +var mean = require( '@stdlib/stats/base/dists/halfnormal/mean' ); +``` + +#### mean( sigma ) + +Returns the [expected value][mean] for a [half-normal][half-normal-distribution] distribution with scale parameter `sigma`. + +```javascript +var y = mean( 1.0 ); +// returns ~0.798 + +y = mean( 4.0 ); +// returns ~3.1915382432114616 + +y = mean( 0.5 ); +// returns ~0.399 +``` + +If provided `NaN` as any argument, the function returns `NaN`. + +```javascript +var y = mean( NaN ); +// returns NaN +``` + +If provided `sigma <= 0`, the function returns `NaN`. + +```javascript +var y = mean( 0.0 ); +// returns NaN + +y = mean( -1.0 ); +// returns NaN +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var mean = require( '@stdlib/stats/base/dists/halfnormal/mean' ); + +var opts = { + 'dtype': 'float64' +}; +var sigma = uniform( 10, 0.0, 20.0, opts ); + +logEachMap( 'σ: %0.4f, E(X;σ): %0.4f', sigma, mean ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/halfnormal/mean.h" +``` + +#### stdlib_base_dists_halfnormal_mean( sigma ) + +Returns the expected value for a [half-normal][half-normal-distribution] distribution with scale parameter `sigma`. + +- **sigma**: `[in] double` scale parameter. +- **return**: `[out] double` expected value. + +```c +double stdlib_base_dists_halfnormal_mean( const double sigma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/halfnormal/mean.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_mean( sigma ); + printf( "σ: %.4f, E(X;σ): %.4f\n", sigma, y ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/benchmark/benchmark.js new file mode 100644 index 000000000000..5474332bdc83 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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 mean = 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 = mean( 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/mean/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/benchmark/benchmark.native.js new file mode 100644 index 000000000000..ed5fb12aea7c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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 mean = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( mean 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 = mean( 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/mean/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/benchmark/c/Makefile new file mode 100644 index 000000000000..979768abbcec --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/benchmark/c/benchmark.c new file mode 100644 index 000000000000..ada37444a578 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean.h" +#include +#include +#include +#include +#include + +#define NAME "halfnormal-mean" +#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_mean( 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/mean/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/binding.gyp new file mode 100644 index 000000000000..0d6508a12e99 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/docs/repl.txt new file mode 100644 index 000000000000..1891939904fc --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/docs/repl.txt @@ -0,0 +1,34 @@ + +{{alias}}( σ ) + Returns the expected value of a half-normal distribution with scale + parameter `σ`. + + If provided `NaN` as any argument, the function returns `NaN`. + + If provided `σ <= 0`, the function returns `NaN`. + + Parameters + ---------- + σ: number + Scale parameter. + + Returns + ------- + out: number + Expected value. + + Examples + -------- + > var y = {{alias}}( 1.0 ) + ~0.7978845608 + > y = {{alias}}( 5.0 ) + ~3.989422804 + > y = {{alias}}( NaN ) + NaN + > y = {{alias}}( 0.0 ) + NaN + + See Also + -------- + + diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/docs/types/index.d.ts new file mode 100644 index 000000000000..259cb56cfe3f --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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 expected value for a half-normal distribution with scale parameter `sigma`. +* +* ## Notes +* +* - If provided `sigma <= 0`, the function returns `NaN`. +* +* @param sigma - scale parameter +* @returns expected value +* +* @example +* var y = mean( 1.0 ); +* // returns ~0.7978845608 +* +* @example +* var y = mean( 5.0 ); +* // returns ~3.989422804 +* +* @example +* var y = mean( NaN ); +* // returns NaN +* +* @example +* var y = mean( 0.0 ); +* // returns NaN +*/ +declare function mean( sigma: number ): number; + + +// EXPORTS // + +export = mean; diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/docs/types/test.ts new file mode 100644 index 000000000000..983e9dd613ae --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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 mean = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + mean( 2 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a value other than a number... +{ + mean( true ); // $ExpectError + mean( false ); // $ExpectError + mean( '5' ); // $ExpectError + mean( [] ); // $ExpectError + mean( {} ); // $ExpectError + mean( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + mean(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/examples/c/example.c new file mode 100644 index 000000000000..a9c4549bacfd --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean.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_mean( sigma ); + printf( "σ: %.4f, Mean(X;σ): %.4f\n", sigma, y ); + } +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/examples/index.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/examples/index.js new file mode 100644 index 000000000000..2bccabbcf700 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/examples/index.js @@ -0,0 +1,32 @@ +/** +* @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 mean = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; + +// Generate positive standard deviations: +var sigma = uniform( 10, 0.1, 20.0, opts ); + +logEachMap( 'σ: %0.4f, E(X;σ): %0.4f', sigma, mean ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/include.gypi new file mode 100644 index 000000000000..bee8d41a2caf --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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", + "parameter", + "continuous", + "mean", + "average", + "avg", + "expected", + "halfnormal", + "univariate" + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/addon.c new file mode 100644 index 000000000000..ed1f499e0b30 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/addon.c @@ -0,0 +1,23 @@ +/** +* @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/mean.h" +#include "stdlib/math/base/napi/unary.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_halfnormal_mean ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/main.c new file mode 100644 index 000000000000..9465c5f648ca --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/src/main.c @@ -0,0 +1,39 @@ +/** +* @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/mean.h" +#include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/math/base/special/sqrt.h" +#include "stdlib/constants/float64/pi.h" + +/** +* Returns the expected value for a half-normal distribution with scale parameter `sigma`. +* +* @param sigma scale parameter +* @return expected value +* +* @example +* double y = stdlib_base_dists_halfnormal_mean( 1.0 ); +* // returns ~0.798 +*/ +double stdlib_base_dists_halfnormal_mean( const double sigma ) { + if ( stdlib_base_is_nan( sigma ) || sigma <= 0.0 ) { + return 0.0 / 0.0; // NaN + } + return sigma * stdlib_base_sqrt( 2.0 / STDLIB_CONSTANT_FLOAT64_PI ); +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/REQUIRE b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/REQUIRE new file mode 100644 index 000000000000..98be20b58ed3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/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/mean/test/fixtures/julia/data.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/data.json new file mode 100644 index 000000000000..644eb442d203 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/data.json @@ -0,0 +1 @@ +{"sigma":[2.5248505344245187,4.112922422743908,1.1242363073145156,3.029303436301139,0.1320223169938345,0.9695910326096924,2.840143472348298,3.2568885546747746,4.9275077949895705,4.142174645476118,4.077455465083622,1.5235728277902327,4.9263374536004205,4.107568959819103,1.769884306236359,1.2276697320823833,3.399043449028879,4.892483187669928,3.484928755525311,3.8504728060187823,2.456314635013456,0.3026535180234097,2.7329702091466124,4.536734416075971,4.281448079289118,3.0614454011326804,1.7760543564326463,2.58044082381032,1.0064809127357621,3.121054257313138,4.530815696823287,3.3541547569968193,1.4087378916219944,0.6419449479371231,0.9637242734329909,2.2729183655297076,0.4212317447747965,3.8456333660746838,0.041428423791495805,4.297242275758549,1.9114293610778517,0.6917795477816474,0.18540543156843226,2.6576369937772357,0.6548800479734573,1.8621243280095485,2.5159035158720777,0.22490112147887042,2.40451378220188,4.394269634180762,1.4655980525614964,2.2775973118331216,4.91816207670074,3.899364831198934,4.169720965094306,1.5293458352755784,2.715012413745242,0.1765892177267503,3.457044225155361,0.7900540795267935,4.4616967309243885,4.901210453177681,3.289898784088229,4.819181573187784,1.6172764778849913,4.257618988465824,3.703665822653861,3.922271905319348,1.0791212926170197,2.3497298750199014,4.107127616574507,1.0339926497754441,0.5529664226708864,1.2345580621464025,3.564822917565882,3.6170770511886294,4.294323134357643,1.858472356853778,2.1904151855317955,2.5529813722804113,1.9212822945541663,0.41942742642796405,3.895837505553488,1.92762292816731,1.468417299293393,3.3109916981282463,1.6545549695861894,1.6411906819014577,1.2391693918652924,3.0689757641422073,2.594286574081966,3.8726057534428766,3.2328663876355614,1.9181162426477305,3.8208641442715403,1.2296062369279075,1.809226240786106,4.6970889036244925,0.010987713763653817,3.6673380855251576,2.07008207447404,0.851576019454649,1.0926447125409744,1.4282529897650675,1.0540327431662622,0.8094853463686208,1.047555455179114,1.8335293564102089,0.4752365785470114,3.6532493877123806,0.8704411293285896,1.258612960314975,4.40283334059271,0.8460775698814654,4.771919659756362,4.998278723795197,0.4956339666323356,2.340007430965045,4.730082388401863,4.498095446434797,0.8628484444265988,0.9462505060233034,1.0559890973897539,2.5885979375982595,4.239104091369712,0.6057920039903997,4.493559878184017,3.475509257211547,4.2471177004885305,1.7054077397002092,2.933841226033989,1.1318455646328247,1.3288686688175138,4.725901602472647,1.1561170006997856,3.8896389175885377,4.977228720024904,2.144618907005815,3.1202836716936098,1.194206764116329,4.17558201296817,4.070221144795807,3.3080359575118514,3.527172046119707,4.5692352313002536,1.6159731112155418,4.844747293806751,4.983207466373833,4.089463248423645,4.994827778522419,3.5735547615147323,0.001225766666712591,3.8313147309432876,1.4870978405588864,3.712211995585216,0.40697363392756425,1.0665863566663936,0.11894613202857063,3.8985322290148243,3.9196038856174598,3.642457579254765,2.509691697135458,1.0146938009048752,1.3714628378506593,4.518066349350009,1.6211459590659332,3.731408556347584,2.589411013344363,3.0361290577809674,2.995390224804448,1.9731626751921172,3.810257669272261,0.5381296652534323,1.1640115886599456,4.340093647638319,1.0806349540915483,0.6354227402181284,1.2711001984741832,3.1845379049657203,3.498546859209981,4.300115919501478,1.0173065195328346,0.7086305718122654,4.175307160022581,4.824584227760626,0.7952086567177108,2.8734200197148834,1.6429369638056452,2.9357775971021933,3.7397868374732757,0.5411226066592184,4.607079897258253,1.2372793179498225,0.37905664422727137,2.8416687183096085,2.873022342584608,0.8728069313813147,3.702682186452297,0.5534132370174449,4.754458467900262,1.0420351730207078,0.14947496808389915,0.5293345042878672,3.9758722236451876,1.9849488224673195,0.6831403197471786,3.7509952673284666,2.847300490628528,0.3307391190291814,1.4845700638526553,1.215449205137813,4.357705430684159,4.437563276469278,1.071774738371557,1.1100764685447189,4.583720282856159,2.1969242356449974,3.182025817098256,2.9075053910561084,2.872582140239156,2.009449355490551,2.2477309343247853,1.6097558074287917,4.525862731026241,2.9612925540201074,0.4396531619913846,2.1218188938635487,3.058851414397013,1.0198457831114576,3.7258590609337854,0.866867843776698,3.0889558377326383,3.0882812681736955,3.3824387598392396,2.686515008005566,2.1660058995011737,0.008871123216074861,4.385312006309345,2.111430946739941,4.2095696073203275,4.280475630770216,2.8929969875002506,4.326331185543635,0.252055379282502,3.2734809313643383,4.540006671275425,1.3242122312971694,0.9852001445339337,0.09226966788540791,0.08630550644220802,4.313026836028499,4.345614550194276,0.9345703115352022,3.734957509465305,2.5658140365564686,4.724164545963169,1.3898780419429257,4.880143664937375,1.73088372858113,4.294589137966721,1.652680946335134,0.14110584994100672,4.820710007293197,1.8793171195407394,2.7979564146149065,2.859948409932904,3.7859184331388556,2.542809453787886,0.21415749573484133,3.530874381624841,4.905827793636809,4.455881571480408,2.1492439784473785,4.019376689543405,1.9270260807665085,2.1977443902169984,3.706062423947094,2.6176303923716437,0.5318350069859185,4.7381666351636795,1.4406435192464957,3.466704191825896,3.691359474690788,3.6843448675325434,3.726377839005934,1.6251996229567645,4.720027739661434,3.159953875462738,3.266630585478688,4.688962977333309,4.944016465800699,0.8198988066420565,0.41306463431252716,3.826813650970362,2.1974964040027793,0.30421576081069546,0.9071027215276706,0.5609825666372958,1.4615740801197847,4.881686747887494,4.276306696053637,0.1704966266817809,1.9123251124215768,0.3626415366106672,1.0200678391409128,1.910034395966178,1.7522402775435608,1.6289623165947615,2.6355447030349093,0.6162243545010915,0.7493935618325065,2.5711098924648206,2.686606348324885,4.200137150177512,3.92528966202127,1.39750311628841,2.789494567772211,3.575951038021076,4.726063701550956,4.672496232216891,4.440488521215752,1.857081714678669,1.0140411532054912,0.2949639233144563,2.3216107278887903,4.766361138683392,4.444547071460011,3.221734156094528,3.6081930715554735,1.735088159857186,4.906257500503956,0.8590795592209033,4.590496271363993,0.18210465928417463,4.944753465486823,1.7975534293557844,2.8308932687542896,0.07683416630122675,0.8685444754916738,0.19020488774151578,2.727411623335347,0.22778945082899849,3.502026444458819,3.886066050178794,4.928941227046578,1.6309739163773473,2.8141708243489183,2.0174948652404714,0.37711803639690844,1.0789285897729801,4.617261206239781,1.6932805269971434,2.6044286325125614,1.999964346935268,3.823635449500982,4.309186120211953,3.7734756645234198,3.9917100166682746,0.09640451021398155,2.5783125586402567,1.208376948661753,4.030674269467089,3.0692381917835174,2.205206203958108,2.858417352012275,4.551155759395995,2.2819023749508043,0.33027271460178087,2.617494009972678,1.348425164183515,2.427687723599044,2.4127418108997514,2.7214778273140707,0.6096404179678083,0.5602501012134903,0.4460004581883509,1.045774015667282,4.409335233390137,1.1252473273553325,0.08475580295043694,3.3129919881090544,1.1723307359620931,4.465961990577843,1.302269633965048,4.566804918471274,2.4835447248213716,1.184725373414427,3.430960875671676,0.9344688461669248,2.6764281026512022,4.347037495559155,2.402362935440868,3.440261823458081,2.6552378905290586,4.3991651119938755,1.4200016637853912,0.03168735859923166,0.7577797260208569,2.662892078300346,0.8995863944575516,2.4416377855954097,4.971619222841993,1.5906468709853194,1.7805095949699616,2.407993279835133,0.6683383374676727,4.0416067663935635,2.2249607973981913,4.907108888897559,4.157236966328944,3.8245342133507005,1.9997699554489168,0.057054135945415196,3.2904797985361927,2.2672622275759324,4.017872296751948,0.061149041665374826,1.9165608331860662,3.9701935575969296,4.612385780561709,2.6593753751080222,3.7366816385953774,2.389492542311516,4.663581506256481,2.7321328620397525,3.947756127087889,0.07711921683746514,3.1627014404335956,3.8920822252305802,0.900789684787896,4.2466005616920075,1.3166895840231714,3.0484238363394462,4.357179063595274,1.506670066797256,0.5432739599024267,0.5656327541148493,4.859902310723017,4.128974694378868,0.8892324515619671,0.46422233507983746,4.372552093249119,0.02782176469199371,2.0595916962562333,3.763891392140269,1.8824811113484852,3.3703737166286674,1.4753370693289876,4.321499259938934,4.821304119317435,4.022467181786968,3.395427576551422,1.8776490878033298,1.7721471426985613,2.5683609148257123,1.3974570759578215,4.094453168043763,1.1976180445704516,3.46352803006695,4.891180092022343,4.370966691884947,4.646117350021986,0.3331101179172019,4.884643906070173,0.6328523557200677,3.7047493583292264,3.012537471969715,4.437319912049192,3.2572562209027516,2.1032373204593684,4.117416440731615,1.7390349124156397,4.553597704892826,0.9390566133855122,1.5840044946314662,3.88226175250323,3.296357313079285,2.2304801891059975,4.6484819100926655,2.6303671764215384,4.8989931898127725,0.5991191324595718,4.949735620848671,4.948325418572159,0.46862396740745105,2.620890779247313,4.862918110850175,4.594223076789483,0.06234116795087452,3.2709470166763333,1.6777331078284208,4.023689434346204,4.269200455553477,2.857368574290884,3.464093519460964,4.520070047376647,0.11134114824007224,1.5462014062295937,2.0711616873517014,2.003871156020616,4.742186319139188,0.9868500201280866,2.740492193055515,4.65591163847974,3.517767104560494,1.9167184992795234,0.00948619963600239,1.5631622032603265,4.071089882406831,0.8350785823880624,3.4401747665164133,0.347614341202222,0.22235046411743398,2.151618443303576,2.977515435829159,2.2014314993913775,0.796393938466956,2.50603827813182,4.898407193430251,1.657952058796341,2.8526056679478042,0.25846215932584626,3.680274673822346,0.620558651781698,2.306660635522801,0.1405253917787319,1.2817962770007778,2.5923314434024465,0.7761531830817708,1.0125763405560932,3.842491373640529,1.811743731860721,3.051820927544841,2.081051716650703,0.39416677725776283,2.509627575563998,1.9741159226987692,4.765588858412249,1.1860902937748452,1.4632671156029748,4.998567904684289,2.1809209988226295,1.694045684709487,2.5787863279300876,4.8266748125445265,4.528937848659101,1.9101311119495767,0.4452781085200136,3.568070254747551,1.6862629681033652,1.0849885309850382,2.063502415058698,1.6326371167637115,0.32612774373964093,4.9499620146133685,3.0935281892349433,1.1628663970863073,1.8120902132474277,1.4968574276085822,3.239092033336886,3.9019309773392186,0.09636300175214774,3.9826403549632388,4.811885807354148,1.6332296959142596,4.9693486773186235,3.074554839483232,3.39291535933301,1.2682023653539094,0.8628667259750283,2.3068384198301124,4.592011851398848,3.254386705096523,4.511652668069544,0.5493401271173348,1.4234842827457324,4.630539956926044,2.9631928952437865,1.8709163583732247,3.1389028701600985,2.0987036107765373,4.587469037605245,1.7630765332698344,3.6979826284548247,0.35919744261698805,3.3513221762725287,0.042120662070216364,0.8464526962094782,3.3499034978938425,3.684983917544179,3.3108212660192367,3.071786451889438,0.7699831135388785,1.5129473320162612,1.3574274121607577,0.2156525297222589,3.318981516604616,1.4414197967424998,0.40314624851498226,0.9406842463891252,3.687624842968851,2.160395740601481,3.981133279101439,3.2381516501458596,3.1987940324228044,2.045103739176717,4.167190829772688,4.6215444978859885,1.6180571156614765,4.471603898981684,3.674920919279292,4.964006793036279,3.39921119361248,3.354459950921147,1.8125489025471098,4.378188605422942,4.8995775870156875,2.4560850684404345,2.742212841723519,1.2982238521780602,3.107814960067233,0.7699622655076876,1.6998644687231224,4.2852383505564235,0.16713587376459615,2.171899348299883,4.75145438416294,4.738329203681258,1.3703967325579203,4.001162955159344,3.6340838425131428,1.8106805712125844,4.175604014197154,1.1829306737770877,3.2015877066314156,0.2435077016498044,1.8029505472307332,3.1647248053972405,2.6752655594114594,3.4920475399054207,3.391848114878544,2.9919566597920437,4.199832279616166,1.1640568529002544,3.803669999975553,1.6774521564274858,4.751491552424325,1.6126971983018086,1.7401048701185817,0.7586385443657556,0.45801544879165934,4.541852710415565,4.174536299903381,1.9012029320425845,4.372353062716626,3.108146445383173,0.13858936851053716,0.6918097947562041,4.476635626517332,0.7712296588371004,0.8720248389872298,0.24899344462995798,2.729691997390109,3.9653723058419263,0.006329679867322913,4.500128444063669,0.2192142963167576,2.3680618402686986,2.6368314344520707,3.1477697596310588,0.050253691049356175,3.059670074006143,4.356595031894745,2.4925728150711777,1.230572801103838,2.2545032932976956,4.18531869138061,2.8841436163183145,2.0307977609946666,2.0833714465905655,4.392916974249407,0.6024631080394421,1.8812979420364384,3.8759556906406996,3.6042537052371055,3.7831465401128117,4.765951170237639,0.6106346738097834,4.682814374131393,2.2851571159838087,3.9754244785838244,2.002513100750414,1.1813803661803361,3.3104966663995987,2.1083832015556907,2.0283290187224874,0.6393335241855519,4.392575459887888,0.7449643480577894,2.5790521003046214,0.0016935159621794815,4.7289515757956275,0.7410858519491009,0.9483575800924443,2.0832798349279225,3.0218120727714344,2.373589273961281,0.6634967953006404,0.9916421531716324,1.000097782723091,2.730240349894034,1.0370629028611873,3.079006964071542,2.946018649259928,0.8534566733523807,0.6644198292005193,2.4772777276308515,1.1997307972684845,4.2115159132763464,0.08730204488275994,0.7766602297083119,3.411834840972107,0.032218704265172815,1.8515388058057973,1.6079409871258195,3.0811885666160994,2.2803157649136434,3.6325476570297273,3.5001003767836942,4.233741264501434,4.220281335345775,4.258431009974211,1.9304535812820482,3.3032012883183826,4.2519015537326545,2.6549332892231767,4.820321670937476,2.3984795129236653,3.6385424940761233,4.835810397490109,0.9033933561614582,3.1303886077530363,0.27278265773922616,0.22886349261906858,4.8287703536757425,2.4740799594864793,3.9428655504192496,2.715887511744043,1.5172631270779091,3.409803978576675,4.113695701000611,0.61731247953832,2.671150872527846,2.998478995686548,3.3781273558481812,2.637192892059606,0.6859991233096463,3.689016457266858,0.537326829396581,4.970745566023797,1.9530820162022984,2.0148504965353844,1.8329755076355503,2.979991079325769,0.1975748079401135,2.7742708192138306,3.6131307380458493,3.040204411448315,1.6138382817558123,4.630102011966057,4.485923624685422,0.23154259698242974,3.900743750530775,1.6292519625198714,2.155732134122151,1.4494009361135358,1.5492095979571596,4.5143421942587505,4.99976936565996,4.913598238926054,1.3665722255939827,4.285675809960102,0.579990217868448,4.05904496529297,1.0874003868382165,0.8611213165045201,1.4456858065615856,2.1506284788916274,4.510330515359884,3.32988154477011,0.3193741089500629,2.538273282745382,0.42589747824300306,1.309915672251774,1.591202648076579,0.6582820878667978,2.884679141773895,2.4216892854845,2.5514136757435057,0.2277671118205027,0.6631889802555629,2.365189329443856,4.437318384680763,4.589276805637504,0.5709715035532342,1.2021811314353488,1.8369999660231617,3.45875616591095,2.067980466382165,3.6688598810714423,1.9807746810809768,4.726856600590713,2.879870164451812,1.6468792018986333,4.502139895068163,3.0380859173307555,1.1521123105633135,1.0949697382215424,4.9067767740970405,4.686458709124469,0.6644891789410085,0.4342035165589919,1.0886393226754587,1.6883698703181098,1.8453950238757528,3.0400341711110674,1.6489409181876953,1.9307985817696611,1.2928237790964536,2.0656800276599485,1.7888993906882784,3.0494910153891013,1.3026976413501423,4.718762082612126,1.4807804199121426,0.6806273576821037,0.8688093568276073,4.066474259904157,2.701912585271349,2.6017462967746727,0.5598981821659793,3.9447786311290596,2.4401487710204686,3.8527737573124163,4.514551240264156,0.3208079777258105,2.8103946079917774,2.9643588100394,2.2757446903914995,4.228561702390431,2.1895146847818965,0.2962085963059985,0.4378048386121858,4.822735861223468,0.4927070512787929,3.308419501160136,3.822415766467338,3.6634324527153166,2.371799656505333,0.9214962568261742,1.022873101195183,2.294856026574294,4.80921185192125,4.337058159855627,1.56996467834492,0.1960064260101696,3.032781211370317,3.8298952145594227,3.4097396729170093,4.910650955564276,3.756934034884286,3.258915202411294,0.05570444521043327,0.3779635846042695,1.7181747257704667,3.381202567878274,4.125145339810413,2.1515609594772562,0.04338517377925899,2.1709983876399175,4.530504686928968,1.747656685575623,0.3038984456619037,4.716726917310011,2.782638775055695,0.7658968214837236,0.45494814537971384,4.879123726719455,1.564382680538468,4.125478909257046,3.421455902266511,4.829195230792694,0.20408166467595856,2.352941363561796,1.9874660128793853,0.24301165816646264,1.167939851880984,3.5934657893278077,1.1095662441818228,4.04262209992769,3.5889637441003783,2.2666147428672847,4.890276775204947,1.8113743638464515,1.0762315723049358,3.517550355960533,1.294263147225293,0.2472032817369807,2.908806658101169,3.3314507241127873,1.5783557012862204,2.60565482624848,2.570529760456488,3.727194402296048,3.2678969141376153,3.3408314186435355,2.004528776548123,3.941584836513312,0.18831819237769554,1.236995216283641,3.9640041504735763,1.0355470050607851,0.4799892858156307,2.37256981232852,3.4165693685782395,3.6038261553527047,4.899159817636855,2.8871570392179184,4.48052337289597,0.5897283733764003,2.276454069992964,4.385137653083296,4.199202889798902,3.451205760986036,4.819007784250798,0.4407028026965487,0.7450892493284345,4.91763246251181,0.35492814982137466,0.17503488402727196,3.1776464453208506,0.4522205985918104,0.24925617766103358,4.2382942685588425,0.8982757615055376,4.776494743647753,4.197625787095236,2.3017943654212796,3.641005538205798,4.928684365506839,0.428813052041197,0.20187995478435083,3.3420494285244358,2.0184277847670455,4.568799762638339,1.9891791725093038,0.7006401759187125,0.5314585633598884,0.16174524670441837,3.433997565543871,4.271763765556197,1.9203304813756583,1.7167589985962473,4.914091704500872,1.5974846217056067,0.8749170669381373,0.10635721693343703,3.6294312435954494,0.7592604003291498,3.2350865814927303,0.8381432239079806,3.3622706039627683,2.7301590358310746,4.594685215469134,4.040822963849512,3.2809337245200156,2.6285279099382337,3.5848127939454044,3.9119955078228075,2.1214622895978543,2.6821769696331192,0.520052857811279,0.4621920543590924,2.956431374260982,3.2664150982811884,4.260840492550658,1.4187395191518197,1.8911986779179473,3.678149184000809,2.721338362401494,2.3738553228062513,4.406454430506523,2.078413390412128,3.1842936339911656,3.1962293515007634,3.0052963067131184,1.3587896712969978,0.36265528116090295,2.547481302096597,1.1134045774804884],"expected":[2.014539259752187,3.28163730088728,0.8970107923002775,2.417034441811745,0.1053385684108023,0.7736217152121811,2.266106627051747,2.5986210940305616,3.931582392857949,3.304977197774477,3.253338762951489,1.2156352365525895,3.930648595532678,3.277365855472748,1.4121633623532814,0.9795387249935238,2.7120442894782637,3.903636799429423,2.780570849531589,3.072232803713673,1.959855523751362,0.24148256930355033,2.18059473501226,3.6197903470500203,3.4161013203438695,2.4426800193047007,1.4170863501442779,2.058893893383681,0.8030555810146407,2.4902410053382065,3.6150678923385766,2.676228295151249,1.1240102139431696,0.5121979628444298,0.7689407186431425,1.8135264718214374,0.33609430567586324,3.068371489299344,0.03305509972163261,3.428703265857116,1.5250999762693034,0.5519602206541646,0.1479321313374443,2.1204875255533975,0.5225186794558614,1.4857602516142294,2.0074005717839776,0.17944513253524041,1.9185244230565837,3.506119897117685,1.1693780584815645,1.8172597308377572,3.924125588525678,3.111242995751301,3.32695598090477,1.2202414300945463,2.1662664873154496,0.14089781042842972,2.7583222132641674,0.6303719522537478,3.559918936589186,3.9106001498360867,2.6249594464281176,3.845150572952197,1.2903999322540713,3.3970884566779938,2.955097778268759,3.1295201965251462,0.8610142186127512,1.874813189335626,3.27701371451187,0.8250067712394713,0.4412033712914918,0.985034817201319,2.844317167922043,2.886009934377763,3.426374128002532,1.4828464002125428,1.7476984582839636,2.0369844209598527,1.5329614797686726,0.3346546679241522,3.1084285970778756,1.5380205734343075,1.1716274919220386,2.6417891568829894,1.320143865232475,1.3094807064226996,0.9887141259887926,2.448688379687243,2.0699412037581597,3.089892340748419,2.579454177832946,1.530435335833827,3.048608509639514,0.9810838323116875,1.4435536845226413,3.7477347169204407,0.008766927170540525,2.9261124376848615,1.651686526817604,0.679459358272825,0.8718043465793285,1.1395810094540804,0.8409964523530525,0.6458758600636824,0.8358283242722331,1.46294476525852,0.37918392875143864,2.91487128321823,0.694511538179092,1.004227849061708,3.512952746247027,0.6750722302500287,3.8074410219112638,3.9880494243056375,0.39545868978542315,1.8670558013309864,3.774059709031389,3.5889609097279966,0.6884534521207524,0.7549986694078926,0.842557397183438,2.0654023285357903,3.3823157061401523,0.48335208704176774,3.5853420498462323,2.773055177256528,3.3887096411323667,1.3607185053805089,2.3408666180994695,0.9030821012337326,1.0602837941841503,3.770723924486446,0.9224479053400745,3.103482839441863,3.9712539512924785,1.7111583147058558,2.4896261669696083,0.9528391394947683,3.331632420513453,3.2475666104859386,2.63943081707943,2.8142761188943664,3.645722245730982,1.2893599961114526,3.8655490667198706,3.9760243006972456,3.262919587887959,3.985295968352312,2.8512841713961707,0.000978020298516768,3.0569468713962333,1.1865324073852166,2.9619166377046384,0.32471797916464074,0.8510127867470938,0.09490528231281571,3.110578675323309,3.1273914247970915,2.9062606658667565,2.0024442575195227,0.8096085176843765,1.0942690240359247,3.6048953848293372,1.2934873315466622,2.9772332771574463,2.0660510691203697,2.4224804998083846,2.389975613951293,1.5743560344882694,3.0401457669930476,0.4293653516157278,0.9287468751873863,3.4628937138892066,0.8622219457335596,0.5069939940030946,1.0141912235960087,2.540893627663651,2.791436524209,3.430996101832847,0.8116931655393473,0.5654053925619128,3.3314131195916765,3.849461267623219,0.6344847098118472,2.2926574704323706,1.3108740377928605,2.342411618678775,2.9839181783137017,0.4317533733547922,3.6759179204076116,0.987206065192863,0.3024434440986844,2.2673235972557033,2.2923401699899393,0.696399175110877,2.954312950130084,0.44155987756015613,3.793509006516065,0.8314237763667653,0.11926376926064419,0.4223478284715274,3.1722870629714524,1.5837600194305022,0.5450671139882066,2.9928612114460003,2.2718171014389266,0.263891636726925,1.1845155333781578,0.9697881552195757,3.4769458836696914,3.540663225880614,0.8551525164051957,0.8857128755623989,3.6572796447298725,1.7528919288747795,2.538889271538821,2.3198536619747663,2.291988939334874,1.6033086164611792,1.7934298093367456,1.2843993054101834,3.6111159973989295,2.362769608873129,0.35079247006108694,1.6929665362335393,2.4406103173373843,0.8137192047445396,2.9728054204465297,0.6916604688058976,2.464630171928753,2.4640919432924853,2.69879566433692,2.1435288472528273,1.7282226658199094,0.007078132251085993,3.498972744137664,1.6846781536051763,3.3587505973058702,3.415325418684462,2.3082776307756503,3.4519128578652234,0.20111109559681875,2.6118598952181897,3.622401228952671,1.0565684945783245,0.7860759846243772,0.07362054343617495,0.06886183110251003,3.441297522795571,3.4672987568003015,0.7456792225586619,2.980064932057089,2.047223405659685,3.769337953916291,1.1089622310651779,3.8937912847534433,1.381045403579781,3.4265863681753337,1.3186486110138724,0.11258617910689518,3.8463700869271107,1.499478114534069,2.2324462250205745,2.281908680978168,3.0207258662604684,2.0288684042409217,0.1708729594270354,2.817230155232825,3.9142842545003957,3.555279110650227,1.7148485878016897,3.2069986046376147,1.5375443581080526,1.753546317545251,2.95700998943903,2.088566875961681,0.4243429409685484,3.780510004708363,1.1494672216274846,2.7660297515284578,2.9452787332291552,2.9396818864774947,2.9732193454607803,1.2967216873798404,3.766037260037105,2.521278410080899,2.60639410999987,3.7412511657904832,3.9447544064175255,0.6541845992403907,0.3295778943316469,3.0533555291788974,1.7533484531736336,0.2427290587037513,0.7237632565691894,0.44759932879946296,1.1661673929972265,3.8950224868153818,3.4119990900391084,0.13603662609836284,1.52581468243678,0.28934608316747845,0.8138963798220752,1.5239869551438403,1.398085464268935,1.2997238825406294,2.102860427857327,0.4916758984471326,0.5979295529512244,2.0514488873251957,2.143601726283391,3.351224585381183,3.131928018005869,1.1150461601604138,2.2256946480689095,2.853196123423997,3.770853260838349,3.728112604095417,3.542997233500395,1.4817368282914218,0.8090877801613945,0.23534716040644504,1.8523773559767682,3.8030059637662434,3.5462354880795326,2.5705719421590727,2.8789215441899807,1.3844000543819026,3.914627110975363,0.6854463168036896,3.662686101344451,0.14529849609310913,3.9453424470884,1.4342401285012245,2.2587260324198044,0.06130479503390863,0.6929982273654293,0.15176154331819763,2.1761596252135536,0.18174968593022137,2.794212831557045,3.100632103697833,3.9327261061651955,1.3013289069496692,2.2453834522098743,1.6097280044744295,0.3008966588413863,0.8608604639886692,3.684041429652736,1.3510423895991601,2.0780333955946926,1.5957406745758358,3.050819691295358,3.4382330749431174,3.0107979732885695,3.1849237935017647,0.07691967029149803,2.0571957834631935,0.9641453109672895,3.2160127692331586,2.4488977666505725,1.7594999835248692,2.280687073501604,3.6312969142311045,1.820694674232638,0.26351949983521206,2.0884580585511814,1.0758876199000955,1.9370145531103313,1.9250894401204584,2.1714251409812237,0.48642267713792003,0.4470149059464866,0.3558568796994891,0.8344069411897381,3.5181405061260893,0.8978174695815075,0.06762534661260358,2.6433851573758047,0.9353845943788146,3.5633221214144926,1.0390608349431105,3.643783136646818,1.9815819919983733,0.9452740842387808,2.7375107114171096,0.7455982649078572,2.135480661204301,3.4684341029378043,1.9168082956333194,2.7449317940567157,2.118573318111905,3.5100259232825217,1.132997403848745,0.025282854198950856,0.604620743881467,2.1246804763601013,0.7177660952459968,1.9481450921994743,3.966778220096367,1.2691525800485737,1.4206411161878956,1.9213006604975065,0.5332568408581113,3.2247356397418176,1.7752618686356492,3.915306420629866,3.316995191032806,3.0515368010948563,1.5955855726101247,0.04552261420079458,2.625423028885751,1.8090135266743492,3.205798272855928,0.04878987625269371,1.5291942986386382,3.167756143005592,3.6801514027768607,2.12187455317802,2.981440588070804,1.906539207663946,3.7209996818878177,2.1799266286836634,3.1498536636183414,0.06153223245582182,2.523470649750949,3.1054323168867404,0.718726182022742,3.388297024070829,1.0505662904620356,2.4322903137986853,3.4765259034961558,1.2021487845213523,0.4334699048923812,0.45130964159264164,3.877641020736065,3.2944451605906284,0.7095048440661754,0.3703958339400567,3.4887918065097234,0.02219855650203207,1.6433164160006333,3.003150830327524,1.5020026147479761,2.6891691526337853,1.1771486695977458,3.448057539026284,3.846844119738637,3.209464460684035,2.7091592406546687,1.4981472177638606,1.4139688446300944,2.049255520508959,1.1150094252914629,3.2669009677124983,0.9555609475016813,2.763495541098382,3.902597079530966,3.487526839238574,3.707065301260865,0.2657834201333574,3.897381957673193,0.504943123896765,2.955962314655212,2.40365713772473,3.540469049167179,2.5989144492373932,1.6781405856989187,3.285223008455642,1.3875491073136021,3.6332453048413482,0.7492587735401256,1.263852730508792,3.0975967133178024,2.630112606995579,1.779665706064331,3.7089519472343513,2.0987293593093725,3.908831029629993,0.4780279058710992,3.94931763193114,3.9481924533071022,0.37390782841659037,2.091168288312022,3.8800472810959916,3.6656596618545656,0.04974105541042118,2.609838123810239,1.338637343884106,3.2104396771304513,3.406329130458679,2.2798502699499914,2.7639467363551637,3.606494104549303,0.08883738316281677,1.2336902299222723,1.6525479332643338,1.5988578572270395,3.7837172484917283,0.7873923948881973,2.186596409839781,3.7148800128053567,2.8067720612290175,1.5293200979803698,0.007568892230260069,1.247222988012005,3.2482597628131633,0.6662963079445786,2.7448623326670485,0.2773561159589123,0.17741000240665208,1.7167431366506187,2.375713595800301,1.7564882050294828,0.6354304278197714,1.9995292509023763,3.9083634721636926,1.322854350264925,2.2760500205142984,0.20622296647786306,2.9364343417566516,0.4951341673292584,1.8404489080953685,0.1121230405010241,1.0227254595135136,2.0683812351746194,0.6192806415989447,0.8079190287639711,3.0658645420459725,1.4455623517830358,2.4350008004231087,1.6604390349478955,0.31449958595539096,2.00239309590764,1.575116615956451,3.802389773261286,0.946363133121084,1.1675182398701553,3.9882801572723228,1.7401231932913404,1.3516528971244184,2.057573796664932,3.8511293129453423,3.6135695862808412,1.524064123333777,0.3552805280516217,2.8469081681230177,1.3454431877032897,0.8656955975211433,1.6464367181547612,1.3026559488594704,0.26021229157933284,3.9494982680206543,2.4682783805990063,0.9278331445116188,1.4458388039320946,1.1943194312119805,2.5844215244190614,3.113290484137398,0.07688655133065815,3.177687250455612,3.839329394034306,1.3031287586147464,3.96496658687867,2.4531398377654026,2.707154781322715,1.011879087289559,0.6884680386859919,1.8405907594493254,3.6638953592549224,2.5966249068786236,3.5997780075577444,0.43831000605640497,1.1357761317483606,3.694636339812056,2.36428586179576,1.4927752768995166,2.5044821379605438,1.6745232087398252,3.6602707182664043,1.4067315454098404,2.9505632453613035,0.28659809374396794,2.6739682227241097,0.033607425956620494,0.6753715377555007,2.672836281149011,2.94019177461536,2.6416531717345455,2.4509309840459967,0.614357638371591,1.2071573175236616,1.0830703745736563,0.17206582396347142,2.648164109688902,1.150086601456445,0.3216641674356995,0.7505574367843616,2.9422989282379373,1.7237464066501937,3.1764847778935232,2.583671207189703,2.552268371658496,1.6317566987293126,3.324937224994909,3.687459001926661,1.2910227910835084,3.5678237130233814,2.9321626636644202,3.960704379884192,2.7121781302916776,2.676471804671521,1.4462047850425164,3.4932890925499938,3.9092973111355747,1.9596723561270717,2.1879692888465474,1.0358327681188957,2.479677574469819,0.6143410040493806,1.3562956150515446,3.4191255192693073,0.13335513323306797,1.7329249576262817,3.791112094482697,3.7806397156186113,1.093418395082658,3.1924661471780085,2.8995793906043885,1.4447140723162344,3.331649974954378,0.9438421211068693,2.55449740117746,0.19429103558296937,1.4385464055264794,2.525085061416311,2.1345530859020445,2.786250817680163,2.706303243449894,2.387236025439383,3.3509813338672414,0.9287829908258852,3.0348895673695293,1.338413177098964,3.7911417504646074,1.2867461957750501,1.3884028100454917,0.6053059817793961,0.3654434552000604,3.623874155081227,3.330798062204028,1.5169404664299175,3.4886330031207184,2.4799420614855405,0.1105783174259764,0.5519843542481744,3.571838450738242,0.6153522376193835,0.6957751556645153,0.19866802521136662,2.1779791004647038,3.1639093406665313,0.005050353840961682,3.590583007148222,0.17490770253840532,1.8894399813768157,2.10388709098898,2.5115568921717686,0.04009664421163844,2.441263513200062,3.476059913619284,1.9887853658222285,0.9818550389446876,1.7988333700014456,3.3394011658922413,2.3012136625985264,1.620342179610672,1.6622899116521437,3.5050406306424406,0.48069601235797954,1.5010585822210782,3.0925652039182214,2.875778384625208,3.0185142156107907,3.802678856272961,0.48721597852372,3.7363452902251715,1.8232915818522837,3.171929814099815,1.5977742858942283,0.9426051546109259,2.641394178709594,1.6822464047774015,1.6183724082670987,0.5101143481513372,3.5047681416060916,0.5943955516638822,2.0577858523392605,0.0013512302396962177,3.7731574511117127,0.5913009594996257,0.7566798712761281,1.6622168161209314,2.411057198512032,1.893850235380989,0.5293938491125602,0.7912159638569557,0.797962580127933,2.1784166224614627,0.8274564787743431,2.4566921192371862,2.3505827960818086,0.6809599029820389,0.5301303236103713,1.9765816516974624,0.9572466802602363,3.3603035247787765,0.06965695373847296,0.619685206273869,2.7222503436209435,0.02570680670225482,1.4773142268798205,1.2829512883098104,2.458432786225297,1.8194287425799724,2.8983536919246418,2.7926760518960014,3.3780367893796948,3.367297319716894,3.3977363561025755,1.5402791078515456,2.6355733091733717,3.392526603777,2.1183302814327414,3.8460602393444825,1.9137097727637693,2.90313687984849,3.8584184551273255,0.7208036112131117,2.4976887394393246,0.21764907106490083,0.18260664729217535,3.852801312860467,1.9740302018660405,3.145951548001011,2.1669647144978827,1.2106008237709396,2.7206299498705135,3.282254287669508,0.49254409661456033,2.131270040765071,2.3924400965499784,2.695355661657071,2.1041754924334173,0.5473481092130679,2.943409275800909,0.42872478128068725,3.9660811428096876,1.5583339867095456,1.6076181035115704,1.4625028578722004,2.3776888735242983,0.15764188885900796,2.2135478541366327,2.8828612320490454,2.425732161579373,1.2876566486455874,3.694286910290001,3.5792492010773262,0.18474426330048083,3.1123432141967697,1.299954986552374,1.7200253870426763,1.1564546293382105,1.236090419657632,3.601923938979987,3.989238784435218,3.9204841728272477,1.0903668800234492,3.4194745613734803,0.4627652402539248,3.2386493094118634,0.8676199800692763,0.6870754034171942,1.153490384827327,1.7159532593305806,3.5987230823236827,2.6568610738744662,0.2548236706514274,2.0252490634009463,0.3398170223749664,1.0451614908433968,1.2695960260089376,0.5252331145619932,2.3016409500914508,1.932228491949805,2.0357335800970313,0.1817318619802389,0.52914824824051,1.887148049338935,3.540467830503491,3.6617131084688572,0.455569347343524,0.9592017640607851,1.465713911085269,2.759688144362061,1.6500096861682383,2.927326654855941,1.5804295364637309,3.771485902740446,2.29780394133291,1.3140194887022645,3.59218791284952,2.42404184783082,0.9192526249093839,0.8736594486733239,3.9150414313581177,3.7392530488505407,0.5301856566976032,0.34644428210873096,0.8686085078456373,1.3471242524515559,1.4724121981328984,2.4255963294426572,1.315664500298063,1.5405543784140814,1.0315241331798746,1.6481742016287089,1.4273352046598307,2.433141799486017,1.039402335427587,3.7650274118181906,1.1814918349870824,0.5430620603546001,0.6932095720938154,3.2445770288797857,2.155814336426965,2.075893201322541,0.44673411517182515,3.1474779655629384,1.9469570304593184,3.0740686972260227,3.6020907335601975,0.25596773240981374,2.2423704674802605,2.3652161272103913,1.8157815527924746,3.373904096739606,1.7469799626386278,0.23634026576964487,0.34931772137345324,3.847986484500516,0.39312334921405456,2.63973684063479,3.04984652503374,2.9229961935657243,1.8924223272431446,0.7352476361592365,0.8161346551041835,1.8310301928690396,3.837195886278122,3.4604717450528906,1.2526505778572483,0.1563905011316635,2.4198093048453875,3.0558142611897408,2.720578641377494,3.918132580936574,2.9975996623889856,2.6002381249697164,0.04444571680149383,0.3015713087014542,1.3709050864539525,2.6978093258570772,3.291389777702619,1.7166972711931023,0.03461636032622005,1.7322060950258045,3.6148197423456425,1.3944282870046973,0.2424758778456215,3.763403584844951,2.2202245169083366,0.6110972490298514,0.36299610116437114,3.892977491796392,1.2481967879890448,3.2916559276140425,2.729926839886287,3.8531403157523205,0.16283360938789485,1.877375586460399,1.5857684467968904,0.1938952501461241,0.9318811757622226,2.86717087307794,0.8853057754206987,3.2255457586927623,2.8635787606989376,1.808496908621963,3.9018763369888525,1.4452676387471957,0.858708555390701,2.8065991208675327,1.0326725827871872,0.19723968187773785,2.3208919228595017,2.6581130978451193,1.2593456455114547,2.0790117566451354,2.0509860089525196,2.9738708687028805,2.6074044940857304,2.6655978091808112,1.599382562492804,3.144929686148658,0.1502561782164671,0.9869793848597185,3.162817710621345,0.8262469673236472,0.38297604050308554,1.8930368226838779,2.7260279501005718,2.875437249173472,3.9089639793982283,2.30361802620529,3.574940423550074,0.4705351641844174,1.8163475558242315,3.498833630390474,3.35047915344932,2.753663792844662,3.8450119094425372,0.3516299621741276,0.5944952084593546,3.923703017541149,0.28319169093680113,0.13965763156728037,2.5353950384116133,0.36081983369343557,0.19887765584047476,3.381669561022374,0.7167203614487053,3.8110914107125824,3.3492208075512644,1.8365661863126679,2.9051021047321335,3.932521160308373,0.34214331369442674,0.1610768990580141,2.6665696404596866,1.6104723665611547,3.6453747920089272,1.587135350415793,0.5590299790437443,0.42404258241132636,0.12905403512870597,2.7399336393820803,3.408374355934401,1.5322020427287721,1.3697754995993339,3.9208779013906825,1.2746083157789097,0.6980828196928669,0.08486078132115048,2.895867153760353,0.6058021510516314,2.58122563623357,0.6687415380977167,2.6827038041432183,2.1783517432260515,3.666028395172009,3.2241102557932004,2.617806363811962,2.097261836979141,2.860266781657622,3.1213208176219833,1.6926820071956252,2.1400675934112816,0.41494214604902735,0.3687759042988785,2.3588909485960357,2.6062221760919346,3.3996588450498466,1.1319903581321182,1.5089582265215211,2.9347384462439035,2.171313864080705,1.8940625116468102,3.5158419579825373,1.658333955175775,2.5406987276244015,2.5502220523474137,2.39787952376427,1.084157300106275,0.28935704973190673,2.032595999876855,0.8883683222989194]} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/runner.jl new file mode 100644 index 000000000000..24dfce7448d1 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/fixtures/julia/runner.jl @@ -0,0 +1,57 @@ +#!/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 JSON + +""" + gen( sigma, name ) + +Generate fixture data for the mean of a half-normal distribution +and write to file. + +# Arguments + +* `sigma::AbstractVector{<:Real}`: scale parameter (σ > 0) +* `name::AbstractString`: output filename +""" +function gen( sigma, name ) + c = sqrt( 2.0 / π ) + + expected = Array{Float64}( undef, length(sigma) ) + for i in eachindex( sigma ) + if sigma[i] > 0.0 + expected[i] = sigma[i] * c + else + expected[i] = NaN + end + end + + data = Dict( + "sigma" => sigma, + "expected" => expected + ) + + open( name, "w" ) do io + write( io, JSON.json( data ) ) + write( io, "\n" ) + end +end + +# Generate fixtures: +sigma = rand( 1000 ) .* 5.0 +gen( sigma, "data.json" ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/test.js new file mode 100644 index 000000000000..081dcb48fe84 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/test.js @@ -0,0 +1,91 @@ +/** +* @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 abs = require( '@stdlib/math/base/special/abs' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var mean = require( './../lib' ); + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mean, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for `sigma`, the function returns `NaN`', function test( t ) { + var y = mean( 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 = mean( 0.0 ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + y = mean( -1.0 ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + y = mean( NINF ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the expected value of a half-normal distribution', function test( t ) { + var expected; + var delta; + var sigma; + var tol; + var y; + var i; + + // Test cases (sigma, expected) + sigma = data.sigma; + expected = data.expected; + + for ( i = 0; i < sigma.length; i++ ) { + y = mean( sigma[i] ); + delta = abs( y - expected[i] ); + tol = 1.0 * EPS * abs( expected[i] ); + + if ( expected[i] !== null ) { + if ( y === expected[i] || delta <= tol ) { + t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); + } else { + t.ok( delta <= tol, 'within tolerance. σ: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/test.native.js new file mode 100644 index 000000000000..47398620042c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/mean/test/test.native.js @@ -0,0 +1,95 @@ +/** +* @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 abs = require( '@stdlib/math/base/special/abs' ); +var EPS = require( '@stdlib/constants/float64/eps' ); + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// VARIABLES // + +var mean = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( mean instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mean, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { + var y = mean( NaN ); + t.strictEqual( isnan( y ), true, 'returns NaN' ); + t.end(); +}); + +tape( 'if provided a nonpositive `sigma`, the function returns `NaN`', opts, function test( t ) { + var y; + + y = mean( 0.0 ); + t.strictEqual( isnan( y ), true, 'returns NaN' ); + + y = mean( -1.0 ); + t.strictEqual( isnan( y ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns the expected value of a half-normal distribution', opts, function test( t ) { + var expected; + var delta; + var sigma; + var tol; + var y; + var i; + + expected = data.expected; + sigma = data.sigma; + + for ( i = 0; i < sigma.length; i++ ) { + y = mean( sigma[i] ); + delta = abs( y - expected[i] ); + tol = 1.0 * EPS * abs( expected[i] ); + + if ( expected[i] !== null ) { + if ( y === expected[i] || delta <= tol ) { + t.strictEqual( y, expected[i], 'sigma: '+sigma[i] ); + } else { + t.ok( delta <= tol, 'within tolerance. σ: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + } + t.end(); +});