diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/README.md b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/README.md new file mode 100644 index 000000000000..652754241455 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/README.md @@ -0,0 +1,254 @@ + + +# Variance + +> [Half-normal][half-normal-distribution] distribution [variance][variance]. + + + +
+ +The [variance][variance] for a [half-normal][half-normal-distribution] random variable with scale parameter `σ > 0` is + + + +```math +\mathop{\mathrm{Var}}\left[ X \right] = \sigma^{2} \left(1 - \frac{2}{\pi}\right) +``` + + + + + +
+ + + + + +
+ +## Usage + +```javascript +var variance = require( '@stdlib/stats/base/dists/halfnormal/variance' ); +``` + +#### variance( sigma ) + +Returns the [variance][variance] for a [half-normal][half-normal-distribution] distribution with scale parameter `sigma`. + +```javascript +var y = variance( 1.0 ); +// returns ~0.3633802276 + +y = variance( 4.0 ); +// returns ~5.814083642118698 + +y = variance( 0.5 ); +// returns ~0.091 +``` + +If provided `NaN` as any argument, the function returns `NaN`. + +```javascript +var y = variance( NaN ); +// returns NaN +``` + +If provided `sigma <= 0`, the function returns `NaN`. + +```javascript +var y = variance( 0.0 ); +// returns NaN + +y = variance( -1.0 ); +// returns NaN +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var variance = require( '@stdlib/stats/base/dists/halfnormal/variance' ); + +var opts = { + 'dtype': 'float64' +}; +var sigma = uniform( 10, 0.0, 20.0, opts ); + +logEachMap( 'σ: %lf, Var(X;σ): %lf', sigma, variance ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/halfnormal/variance.h" +``` + +#### stdlib_base_dists_halfnormal_variance( sigma ) + +Returns the variance for a [half-normal][half-normal-distribution] distribution with scale parameter `sigma`. + +```c +double out = stdlib_base_dists_halfnormal_variance( 1.0 ); +// returns ~0.3633802276 +``` + +The function accepts the following arguments: + +- **sigma**: `[in] double` scale parameter. +- **return**: `[out] double` variance. + +```c +double stdlib_base_dists_halfnormal_variance( const double sigma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/halfnormal/variance.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_variance( sigma ); + printf( "σ: %lf, Var(X;σ): %lf\n", sigma, y ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/benchmark/benchmark.js new file mode 100644 index 000000000000..71ce596970a1 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/benchmark/benchmark.js @@ -0,0 +1,59 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +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 variance = require( './../lib' ); + + +// MAIN // + +bench( pkg, 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 ] = ( randu() * 20.0 ) + EPS; + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = variance( 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/variance/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/benchmark/benchmark.native.js new file mode 100644 index 000000000000..68fd3c78f660 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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 variance = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( variance 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 = variance( 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/variance/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/benchmark/c/Makefile new file mode 100644 index 000000000000..979768abbcec --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/benchmark/c/benchmark.c new file mode 100644 index 000000000000..d36b7906a4c8 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance.h" +#include +#include +#include +#include +#include + +#define NAME "halfnormal-variance" +#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_variance( 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/variance/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/binding.gyp new file mode 100644 index 000000000000..0d6508a12e99 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/docs/repl.txt new file mode 100644 index 000000000000..5e31c5605fd3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/docs/repl.txt @@ -0,0 +1,33 @@ + +{{alias}}( σ ) + Returns the variance 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 + Variance. + + Examples + -------- + > var y = {{alias}}( 1.0 ) + ~0.3633802276 + > y = {{alias}}( 5.0 ) + ~9.0845056908 + > y = {{alias}}( NaN ) + NaN + > y = {{alias}}( 0.0 ) + NaN + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/docs/types/index.d.ts new file mode 100644 index 000000000000..43aa994c78a2 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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 variance for a half-normal distribution with scale parameter `sigma`. +* +* ## Notes +* +* - If provided `sigma <= 0`, the function returns `NaN`. +* +* @param sigma - scale parameter +* @returns variance +* +* @example +* var y = variance( 1.0 ); +* // returns ~0.3633802276 +* +* @example +* var y = variance( 5.0 ); +* // returns ~9.0845056908 +* +* @example +* var y = variance( NaN ); +* // returns NaN +* +* @example +* var y = variance( 0.0 ); +* // returns NaN +*/ +declare function variance( sigma: number ): number; + + +// EXPORTS // + +export = variance; diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/docs/types/test.ts new file mode 100644 index 000000000000..bd3d947eae4f --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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 variance = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + variance( 2 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a value other than a number... +{ + variance( true ); // $ExpectError + variance( false ); // $ExpectError + variance( '5' ); // $ExpectError + variance( [] ); // $ExpectError + variance( {} ); // $ExpectError + variance( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + variance(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/examples/c/example.c new file mode 100644 index 000000000000..a040b9a8c8de --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance.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_variance( sigma ); + printf( "σ: %lf, Var(X;σ): %lf\n", sigma, y ); + } +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/examples/index.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/examples/index.js new file mode 100644 index 000000000000..9687b4f4ecfe --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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 variance = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; +var sigma = uniform( 10, 0.0, 20.0, opts ); + +logEachMap( 'σ: %lf, Var(X;σ): %lf', sigma, variance ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/include.gypi new file mode 100644 index 000000000000..bee8d41a2caf --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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", + "variance", + "spread", + "dispersion", + "halfnormal", + "univariate" + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/src/addon.c new file mode 100644 index 000000000000..9ec7c0184b16 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance.h" +#include "stdlib/math/base/napi/unary.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_halfnormal_variance ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/src/main.c new file mode 100644 index 000000000000..57efe491909d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/src/main.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/variance.h" +#include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/constants/float64/pi.h" + +/** +* Returns the variance for a half-normal distribution with scale parameter `sigma`. +* +* @param sigma scale parameter +* @return variance +* +* @example +* double y = stdlib_base_dists_halfnormal_variance( 1.0 ); +* // returns ~0.3633802276 +*/ +double stdlib_base_dists_halfnormal_variance( const double sigma ) { + if ( stdlib_base_is_nan( sigma ) || sigma <= 0.0 ) { + return 0.0 / 0.0; // NaN + } + return ( sigma * sigma ) * ( 1.0 - ( 2.0 / STDLIB_CONSTANT_FLOAT64_PI ) ); +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/fixtures/julia/REQUIRE b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/fixtures/julia/REQUIRE new file mode 100644 index 000000000000..98be20b58ed3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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/variance/test/fixtures/julia/data.json b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/fixtures/julia/data.json new file mode 100644 index 000000000000..e92f982df512 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/fixtures/julia/data.json @@ -0,0 +1 @@ +{"sigma":[4.040054583119639,4.230149176866918,1.672254186577431,1.0790881485505661,1.4956938489483367,4.555168823905735,0.4013641053687089,2.153933812059833,0.041415975893375756,0.4302459655514268,3.021717275284326,4.146796795977907,2.051165158921506,0.6797203507121669,2.3575087817976237,1.536787401315169,4.59164102809945,0.3361095494255917,4.911396288876712,4.0586455914366955,0.42068049819773967,2.659083964093165,1.7411209776612735,2.391494064719604,3.3702755591190563,3.796339652293309,3.895724605341988,1.2298472705025913,1.5070748154794904,4.325757358141819,1.4466554351849936,2.678436264242125,3.667684188101278,1.043622235968008,1.6592969698687106,3.2692039502538006,3.350931244671798,0.6496289287525375,0.6650986432561823,1.9150786421971526,2.671358251045861,1.3695944762956165,3.307083304925973,0.018682082247378773,0.2038985520454467,0.9843530635528569,3.2358287555801803,4.37943761044158,4.953168604515161,0.6363170209451435,2.7576237520592803,1.1873593503317215,4.027285274778139,4.699804070907558,2.3932375459573003,3.458536426506613,3.6358270678939504,2.584338356651528,1.1451971270611871,3.6433790474630507,0.3588516563095956,1.0158135159224306,3.5664878040251073,0.3724415276746629,1.2070796898365244,0.9843990838230426,1.9773983561173936,3.2125688814947924,1.0663019286408293,0.6713472322051184,1.106530272665892,2.3786965178389567,3.2767988082678823,0.27983934634706387,4.631344679903007,3.5440076426514895,3.8839993114946387,0.5371495082841077,3.3508896641046784,3.0412129532180443,4.8996425099120415,1.8226373588608364,0.16881672290500582,4.5515792989021655,1.5516833998652229,1.9747973845625133,4.433174988125275,1.8087287380240307,4.128113282355519,0.7410532357127725,2.4839611620034017,0.30587442293082023,2.629276379604106,0.9603386234387518,2.313737721472137,3.8118425662483575,1.9818278504293163,2.197679046299077,4.19641651599324,3.7892041414971063,4.323469273104745,4.93241068785974,4.842672660664827,0.20851106233661265,0.8080686783685614,3.778309042700334,1.4779960802753038,3.7860557952084424,0.30667768651932437,3.7904102566351385,0.5069010946832958,4.10615730804056,4.080510984057714,3.04022330087923,4.256557824039103,1.792140545160263,2.968888402804632,2.3579374519112135,2.7721532789235366,4.312020938794141,4.96622434358488,2.2934499339871035,0.9206274410045212,0.24216220328423133,3.0928754585313367,2.002619996869538,4.109614028090052,0.988820464539581,4.988591690320959,4.6669421920955605,0.1989265261186446,4.663493774428763,3.7567269352631802,1.9398987365056297,1.6048980877206858,1.2711816824452464,0.5734929623967167,0.731164847300172,2.52508645024807,3.9176742929358372,1.3913370032098626,0.3147295189299798,1.2105674010110978,0.09934172503563488,1.7671121412551898,4.283459728555863,4.970399613697518,0.5121136773438006,4.965652378110323,1.2318851363776968,4.485706202315526,0.27207228490370716,4.135084609195732,3.260552841854785,0.31744165956840986,4.998336033002736,2.6981768530219385,1.6428095405934,2.464888110399372,0.41253490523649405,1.0505274717624173,1.2484498908995034,4.1881013898280415,2.4428605360760693,3.712950865471576,0.22881177694250965,4.862939308871342,3.6017111879568926,2.5706483863805936,1.9417018723424229,1.1389148939522746,4.627889468157242,1.893640930815839,4.124788642358212,4.872035238270694,4.322943089039516,3.368908944656379,2.954711511993928,1.6803261390704898,1.2438248068490376,4.194215929827933,4.640354025963612,3.1592367376784853,2.086891232919884,0.7068870835995544,0.05702906859210766,2.5084135870454416,4.695220294122022,0.4295964245632422,1.3056294524418761,2.2274040254264,0.38817149406101537,4.870856234108873,4.728015555045518,3.0548259895297614,0.2119000763148976,4.38534969232326,4.787860232648202,2.2125586859462603,4.496885086811966,3.1912745005310796,0.8275669911446693,1.6776879676130174,1.4501949141280457,1.1521047931306627,4.19767160754649,0.25551950214430186,4.948975392595477,4.854511364417228,2.8242492130053702,3.620097695474746,3.7599443676718862,1.8147408198323767,2.4064078803084814,3.6947593119318727,2.3386306289917713,1.8209781538406982,3.0050630103385583,0.4330183173259422,2.082947395368597,4.137224469271085,2.1737750767786235,3.906012585104123,2.25252813428571,3.311033460974502,0.12007684580292277,3.0490230760006805,3.0999187696675294,4.167133932243586,2.671170101044738,3.7977693097521295,1.5256307486379295,4.546624031500567,3.370978533200581,3.6021824824039186,2.3638071869297432,2.0226266737859993,2.414097283877332,0.5987979535894339,1.4751025292885689,3.954539289586019,1.7487202743052443,1.6432049851956014,1.8361998130502784,2.529790520351792,4.706876019694714,1.2268575237480084,2.4691446452719896,2.787755304552007,3.287233413152027,3.17039742976099,3.9050657515712865,0.7956019987563062,2.049878089957703,4.583948308779035,4.431858136353561,4.336346276681777,3.9165518646721993,1.1092581121663891,0.03623298691005028,4.744459114455392,2.225763771063478,3.0212806893824373,0.06997171418620496,4.420473544763116,0.12136905598248149,1.5975756637625933,3.5674973461775195,2.282492963754659,1.9155652368351346,2.8045888030781505,2.829838320021478,2.2456548347112957,0.6097993499791199,3.31141172710572,3.4650344862658167,0.5496902658156028,3.435578880739674,1.497146697872001,0.02163805279334796,2.8311414359551423,2.734125765008012,4.079371148308846,3.8514900898780624,2.986041881125962,0.6776643266257065,0.4878064688163303,0.3624867295256884,2.078359526541147,2.754289810151161,3.6119629892598204,4.844460094766961,2.6316300595726183,0.7091185121305948,2.8303632894461934,2.5424699377825193,4.856968224970105,0.2203768390538785,4.661217923652229,0.9250825262801543,0.18090934209890552,2.8896628141519414,0.48946981823414726,0.978360088358044,4.905520384733707,3.6049927487578284,2.98863032699533,4.016241404352878,2.646733765649516,2.16669753818548,2.3414055114640595,1.5101047021503144,1.8144761638232594,0.7324625615140129,1.8954244142168197,0.8114836994401392,4.9670326009475465,4.929316039209338,2.5415066565810784,3.6393959119409374,0.2353851495464221,4.9607511125900805,3.7397476660046247,4.300354447175562,4.3815048760601245,0.5529805977454322,3.4822879234040087,3.0496238779461238,1.710920725261647,2.581531445900356,3.9444475571524102,4.829605665267366,3.7793394832134455,4.883371029439348,2.7077825194665066,0.3310798178514829,0.6304406692724074,1.5479886122476327,1.4597339889871197,0.7072927590706479,3.780533935668306,0.2267431637853029,0.8055110202359228,3.1753792443799145,1.9445289471111922,1.5436281135052365,0.031858034585388606,2.476392882434558,3.4853367563509305,4.675542607911293,3.1247732991913524,2.8208582187980764,3.7551064196757276,3.2100413615249836,4.980815204646837,0.4419274793328537,0.10422640022837881,1.018772012583507,0.9221781822539921,1.0724239548846897,0.7780871873653605,3.5581307085210323,3.9386879172912206,4.028297109296301,0.03279256445402945,1.159762615798977,1.3763979320567898,1.1128042789776997,4.622240977353861,3.7466640566614973,3.1366090683991747,1.6252930333119364,2.25480818711832,1.5854106468205926,3.6579038250676934,4.013324273515568,2.4025615991185267,2.84668726257791,3.5828583505053286,2.9130446077490784,1.826513126521942,1.6957476545989136,4.528566778590484,1.2084050998188511,2.06282605128614,1.1305836370880373,4.734573265286058,0.9942681564913358,0.13388332471598485,0.28959143898689643,3.4883964947387196,2.1098084060038436,1.6081479469135491,0.19829078755067175,4.072797748649563,2.25288903883387,2.8059568020931325,3.8500886799017078,3.016054779359317,4.245717225906068,3.471961799645771,4.777108620430503,2.6813374741200926,1.1817779202529999,3.621081518296955,3.987638090617075,1.257945374884844,4.443532090916612,1.3230610775479457,1.1174509022149541,1.9095010127007195,4.5582207413816835,0.8688788293972777,4.889941532931678,1.6565207751477322,3.4778304469812076,4.872153031603902,3.9749234752919707,1.250521626559757,0.8747915205460383,2.206187814087931,1.4818918141390403,0.9825740874170147,4.498978911445316,1.2883258716786328,1.3673600784256945,2.993394973272128,2.423942425352865,0.4367036140386732,3.0303982798854707,4.832064014866076,3.7647756167613955,4.070268111547993,4.57861813558004,4.5193259491601685,1.6010715387450691,3.886642392875465,2.32902112612104,2.7330672651289207,2.310624433183046,2.269548806210007,0.21012402549137832,3.805335320751493,4.251218218726556,4.298315878995388,1.560772842732192,1.906201136397487,1.9796027034962438,1.3899357641422272,4.480665444617415,2.284387559394947,2.7329847109555745,0.34276848826800543,1.8365751074747223,3.672796114122896,4.7135085459397805,2.90723567566004,1.7371981321957597,0.3516278258278388,2.2239109392865872,3.737309456306769,2.769331067464011,3.088620400240647,3.4417259006769143,1.667566728226455,0.6555643236026165,1.8584557789812401,3.3439567397667878,4.543754904022527,4.931682444025885,4.503223997511439,3.2406863817067273,0.19987008769645986,0.6789620891525522,4.979730100473409,1.6671722235398656,3.8982208738848936,2.97264211152779,1.0933653031673525,4.798353359926585,1.074619483396368,4.98432409690164,3.153342287597814,0.729885056444115,3.838456111204338,0.6726677353954885,3.8839267216128843,3.624743845927909,4.005832798839352,4.479623983888955,1.1664388188002761,3.1471943895990555,0.7485287129336499,1.5414457835752138,0.39978631584727753,4.9501638906611864,0.6186198557560818,1.9731047980409144,2.5742591581705137,1.4594696227105997,1.8554243169200642,4.419217948368424,2.936839218779945,3.017425357805296,1.3294778147367552,3.3633882079069313,3.3164938992272304,1.9226511191302331,2.4026717384996505,1.3666585085304135,0.11336234538633638,3.3677323156656986,1.0192019065361668,2.4220689179530357,2.584615028489164,4.996951650951057,4.780387567027011,0.1158598013626716,0.05686887648499617,4.597936714982444,4.860597356826666,4.802315630137552,1.2510966598193285,0.41188137937933245,2.6266345379465568,4.464234860754187,3.7293983715027634,2.313316123817542,0.6415317941223125,1.5741985187465124,3.7261868704687613,4.247928746599473,1.8456449773548644,3.5617607718959112,4.2489206985868915,3.553306579566817,4.925556623018364,3.0205084184530637,2.5823127694234635,3.7087280029106955,2.5186630795491487,4.576074101650852,1.853543994216997,2.9520464940822286,4.511265871874005,2.419249766362884,3.208124401411749,2.977024704421667,3.211698725213286,4.967440389857718,1.3026736953846334,4.262654789594567,0.8710929520351762,0.7979555697494578,2.8996943536225044,0.7964104437963154,1.9697467519349159,4.898124153870629,4.023948546549143,3.356676947318524,3.3330364638124483,0.33549109074101524,3.298419781075798,2.3344790052828497,3.46223214038186,0.1955612288087416,1.8291723104745512,0.4374016354508331,4.60473975281864,0.5966270131023332,2.6291315259026726,2.8954355541436376,3.9417749610176105,2.135936190686828,2.576298087460058,1.7844263096764164,1.9074435495414255,2.379706529106392,0.5534864662609351,0.9062243960284377,3.961364640031984,3.3874550311341096,4.997725004145582,2.537925324563857,0.490980143633723,2.855451853869868,2.131944800503636,1.250429800075703,2.3188589298499696,2.7576050635396605,4.939912993623016,1.381162669964155,0.7671350524574638,2.546482181915675,0.8965568611690866,3.722350576788748,4.5291992032606245,0.4700172374101069,3.7494800491014773,2.6560481576439576,4.817053542378462,3.216149241361518,3.6676106988009396,1.8730577597709526,3.8701550020215834,4.9165969598432895,0.3317813865641117,2.1753732311222707,2.716210395913123,0.477860061424355,2.1461001752621507,1.1358581400254475,0.009922197780678488,0.3517396795243627,4.4889813912913015,2.0496225853567305,2.0102920435549283,3.7300850447243494,0.8757757860992199,4.1681478783788455,2.256765332773907,2.7860379723076987,1.4054856281922872,4.892924796871289,2.7135811707135775,0.9668281351298086,0.4280148094243613,4.382952252270423,1.0418766800387047,0.08983838615104822,2.781304972910708,0.16029804814344184,4.6170551467925005,3.4886615359681423,0.9244186909258773,3.2151054917656596,3.381836686237403,1.097398180293624,4.5882276037475265,1.4401681048467658,0.986035421144808,2.9830912103648206,1.0795118834363615,3.180388814167488,3.7356612979679014,1.741600195123394,4.30595263407456,0.3955295209581694,0.4630269012168642,4.771585530323889,3.44477976693003,1.0756415914698008,2.5978754417585552,4.079926931088139,4.85171298484196,1.9070389359802413,4.273581304390347,2.4975511319797707,0.9595464780948199,0.1726547151479646,1.8766702836181763,1.8397906782688633,1.664452453755851,1.5439793533088637,0.5385577171646833,0.7554112419272335,4.150023974775609,0.8705457118849902,3.152260894821406,4.01063505583701,2.7598365736037707,3.649407101914837,0.21397144256276812,2.7854845416925613,0.8906093381994917,0.8183301114229502,4.118987527166899,4.754496783205704,1.272969897699681,4.879535803214525,3.710932592065494,3.3709491396162146,0.9485314618250529,3.0121768058323766,0.5492850860978116,0.6859169210336363,4.626800863605216,1.3341825085465986,3.238462215764755,1.6808097964688051,0.7831703181203653,4.327212072816385,2.988130063262479,0.3726906169049943,0.24917248448872276,0.3599192503649745,2.5859977966960264,2.85629444700147,4.546357441148488,1.8676478450895035,4.1180622176828265,2.4590127588225688,3.368884489460711,0.06522452202396001,3.575815691377076,1.4351845379534767,4.578527390895541,4.361397259652725,1.2675825853306477,0.3851685793182935,0.0844105287089314,0.33952593270657916,1.398465709882124,4.09922482782723,2.196515139677076,0.2478295745998227,3.3293993167985563,4.369958495974105,1.2296918651717625,0.41966191997107605,2.303716562992707,4.932669000434588,0.08158577018542279,3.560966052150618,0.4138338215153753,1.7685751769958558,2.567469944686546,0.3910975354583385,4.747462007077044,3.7086689670886166,1.3581801559450457,0.7028708674162676,1.6057474015123185,1.480992937828895,1.1876127139741532,2.7136909362545487,0.2786389978511289,2.108665945969453,1.7299642886885513,1.1733480090576776,3.943025896731463,2.5909521546453917,4.751371341583519,2.9807425650989607,2.372980707684163,4.716424570593065,3.1936628203379276,4.943857808561748,4.274028773702579,0.6631536872533306,2.3173687934536558,0.26179683191830616,2.4404912360637847,4.4482131153646325,1.628991632566681,1.167346378153843,0.6955256658750297,3.617588495717107,2.215875663514665,2.847782435122576,0.9366953639150638,4.872530900739318,0.8737112389310253,1.2762950456787692,0.6229586879751947,0.601257971530666,1.4784757215787458,0.9477860291758744,2.7653503475530123,4.36923423991231,2.634893255052164,3.199288229907214,0.47493211179294226,0.8931408708924649,4.666232208466116,3.245780658108992,1.873053884202155,0.3448974096882962,2.2504767952087805,1.3604844609338218,0.9329177612005723,3.6211470549103977,0.2543425175362096,3.1370086293950656,3.1514790870526537,4.686721046567123,3.8578765146021765,0.2220642132226791,3.52157351174683,0.20776752105657215,0.5625173749218271,2.942381737957933,3.395000511159531,0.2601074935352088,3.692448501330747,3.288760833123019,0.9906069357885777,0.4092540478221818,2.2979893497854897,0.9665729237945947,0.09461644685841153,4.956980433493644,4.234087336013664,2.5708749791728347,1.6991782377482663,0.6464482867485039,3.4876183011619717,4.313339556009951,2.034642427779806,0.8692988506012089,2.7750034560777137,3.7707787238859503,2.1830397596624356,2.1803451555933644,4.2120857593991,0.9737299399061433,1.5737617259584435,4.6391249713030005,4.252861236842672,0.7161039400236807,0.5549352349179004,4.8484870316236925,4.743191453012894,2.031437325292474,3.0634289467523574,1.2702214579803446,3.3013252374571147,4.948694296537948,3.1314255034825904,0.9025713725662771,1.0864839723924147,4.178831911375487,3.183149591595664,0.3304331359523921,0.8449882878584908,3.384758646792441,4.0012704857015615,1.890457733535011,2.3502191060688067,2.103968443761946,2.699288452748972,2.1466530388997,3.1860783021860346,2.1616765312014916,4.713427903949868,2.18333399280255,3.3752686704429387,1.2027578139525086,4.760352117390023,1.890282042145418,4.855847320407993,0.7132080388319162,0.7625184611170005,3.8741749352677575,1.4326173139767535,2.433705620345968,4.312543462094861,0.4091523378872691,4.3891940776527765,1.2944058379115786,3.8737486226947278,1.3834708136742058,2.9685838842068217,1.868120698593128,4.332879374230182,4.180280637762554,4.7752879744935,2.3805090804523497,2.4318051187939678,2.2129903711035492,1.6535743507744098,0.10756396016280978,1.4818895206369642,4.722955431427862,4.546747661745534,3.383323049326396,2.3095176137721656,1.3522654134215055,1.6103683205041563,1.3115953659300335,3.743625467757676,3.3649221610575184,0.4855690590652173,2.882589014015069,2.338845252056881,0.6987617607463303,2.8618024669559547,4.743260891866843,3.303529806598304,3.1628662069345763,1.4972090849960358,2.066884871527492,1.7271526469748877,2.456182796320489,4.0222289514362535,1.3052379657493889,3.000151730718397,1.9724633203252229,4.808888584255988,3.9257737021856522,0.11263121632116069,0.8887808350555088,4.846202324301051,0.6637683886496326,2.299576512746564,1.3598825460584392,3.9827597933502155,1.67782444209982,1.084668039946051,1.924143174444618,2.4143191775714317,0.5260214749585557,4.294048449843569,2.4512024029017176,4.79366986751526,4.549524580605288,4.9890433583131895,4.718380965374626,4.667587507979913,0.3224217468927326,2.9713994601206437,4.622070414750285,4.057408421065118,3.4000125226883364,2.541494341384883,1.3769170724346669,0.0474955585235437,2.5158770855036776,1.049477479311323,2.846074588948447,2.537402415631881,4.509912612745992,4.850393810754458,0.12799238786531886,2.645555564333825,1.222327101821434,4.269344018008403,2.2895882986636233,2.762362955658139,2.5606902929327724,4.317533712364143,0.3818409756513813,2.662815744859568,3.063562833446651,2.9695475882791342,3.5099217456900176,4.749018495969505,4.462028370427168,2.166185344384186,0.48309633941302943,4.403150839383636,4.466177071276702,1.5395242285127848,0.26690317792131824,1.4305571784815836,1.9245159189153789,0.09303419320355666,2.472815380669238,1.3821536467696567,3.271867069854845,0.3925649390969399,2.7216165250535465,1.263069779318378,0.5903294404029241,3.1629840791028463,4.91404213466219,0.41252235420056904,2.204465234654519,1.5157467203087753,4.340398139756867,1.9242799070262322,0.8281826047064383,3.6387601478893434,3.9019678003958314,1.531136624505884,3.9760226152118117,4.42501240283182,3.315685040616343,1.2510796033407794,2.581657656477339,2.4218547942040174,1.3448006065870877,0.7422041583449984,0.23010711017604657,3.978203696372269,2.3907511324576065,2.438507630756787,3.8681673915417063,3.526733804258905,4.4933595404064866,1.8391622701282528,4.356562229908501,4.8103965098336845,2.5962107348529684,0.40735656970857015,0.6905591415789702,2.7407351523592878,2.595838728483875,2.686863724200527,1.6429382864970832],"expected":[5.93110698657354,6.502384682126512,1.016168846926415,0.4231312862708386,0.8129179398614472,7.539980931403282,0.05853806372861997,1.6858774444388895,0.0006232999485063751,0.06726589202893146,3.317943203977208,6.248658656512351,1.5288418223764442,0.1678888438051742,2.019611946475489,0.8582007221127087,7.661206143924325,0.04105092957972361,8.765390082859453,5.985818604623249,0.06430815528327237,2.5693625786868495,1.101587980889885,2.0782601363095576,4.127547829427759,5.237106610963405,5.5149018722205145,0.5496214276177471,0.8253362446267717,6.799635036563287,0.7604864821106955,2.6068973191953755,4.888157138089852,0.3957746197470769,1.0004825835979203,3.883696848776601,4.080302172269688,0.15335290426924497,0.160743498562433,1.3327065075113518,2.5931375939556456,0.6816246445299088,3.9742168683812014,0.0001268270386697193,0.01510739470717256,0.35209761812956475,3.804804554749244,6.969441549409174,8.915126617397618,0.1471324183871078,2.763320855881684,0.5123015217031558,5.893673608569834,8.026399992822459,2.081291486796606,4.346563222511173,4.8036098834947305,2.4269455873370043,0.47656461450729204,4.82358577248433,0.046794111206242044,0.37496373517079,4.622136630866562,0.0504054494260885,0.5294600274678968,0.3521305412887286,1.420854575620429,3.7503015479144217,0.4131632472405682,0.1637780508426794,0.44492610991843895,2.05607695890065,3.9017626461873447,0.028456327342933175,7.794270973410887,4.564052087461483,5.48175449174903,0.10484594963720303,4.080200910731733,3.3608950866691227,8.72348624456458,1.2071516387496222,0.010356004333426108,7.528102431448241,0.874918340747817,1.4171191908735636,7.1415263215980165,1.1887982867002267,6.192478476201568,0.19955384880011104,2.242078917192914,0.033997549803871915,2.512081773235801,0.33512751365286375,1.9453132583419743,5.279966943356932,1.4272273091091179,1.7550513489966648,6.399093676964937,5.2174380276274,6.7924436815238005,8.840559529886603,8.521803595047396,0.01579863241610549,0.23727820012667478,5.187477762539003,0.7937940828050223,5.208771575805517,0.034176347703809,5.220760008848474,0.09337008428755704,6.1267824439114005,6.050487877206764,3.358708080002988,6.583826349330518,1.167092890140687,3.202941740228154,2.0203464726833147,2.7925166562322916,6.756519193133552,8.962186175979385,1.911348237807593,0.30798468708970156,0.021309536881276188,3.476051143893547,1.4573316251463444,6.137102304836616,0.3553007993439292,9.043097442895496,7.914548331738178,0.014379596171765993,7.902856485620767,5.128384159142707,1.3674750554952346,0.9359576790286182,0.5871871526541074,0.1195136412390242,0.19426380878132302,2.316934708784368,5.577222186237888,0.7034382240544167,0.0359945085638672,0.5325240694514177,0.0035861189171196555,1.1347221023229803,6.667310317315392,8.97726212721491,0.09530025058171226,8.960121925342456,0.5514443901073042,7.3117771016277135,0.026898613856048883,6.213411158915464,3.863169632777405,0.036617537461410866,9.078460169870226,2.645465591222082,0.9806989839098673,2.2077795819451214,0.0618418814958581,0.40102931496583943,0.5663742813250708,6.37375941643926,2.168496072433942,5.009561318685061,0.019024709776912826,8.593280567007477,4.713885859612069,2.401301257719739,1.3700183730264288,0.4713503538266149,7.782645489840371,1.3030364280066393,6.182508075739938,8.625457392397932,6.790790445238979,4.12420114585738,3.1724257121858734,1.0260025950865974,0.5621856047254952,6.3923841119109035,7.824624829586031,3.6268169327040956,1.5825626866199671,0.18157722937053752,0.001181826843112202,2.286438801703479,8.010751134301614,0.06706294312680514,0.6194427429306257,1.8028487496347148,0.0547530820953059,8.62128327657483,8.123049243555766,3.391050412700292,0.01631636901539968,6.988271236993973,8.329985023763387,1.7788973581806136,7.348266054550153,3.7007488831774977,0.24886717171949982,1.0227834034834242,0.7642123434291586,0.4823310933502478,6.402922014519478,0.023725173543554773,8.900038420535584,8.56352040424654,2.8984600944876235,4.762136882826402,5.137172285326564,1.1967143779398772,2.104261817517498,4.960593014525955,1.9873966768344629,1.2049548217120158,3.2814701507032833,0.06813555984992252,1.5765868383954578,6.21984356451267,1.7170798935489922,5.544068264354577,1.8437487579754068,3.9837165701299,0.005239379242653965,3.3781794456755385,3.491900981465695,6.310099545777541,2.5927723253443715,5.24105182083613,0.8457853512863006,7.511719786227529,4.129269861764822,4.7151195918392705,2.030417697357804,1.4865952924682,2.1177311632323326,0.13029324712346507,0.790689020055573,5.68267844499504,1.1112249476813651,0.9811711735162433,1.2251835872993984,2.325575343941113,8.050573339146537,0.5469524270318683,2.2154112507840122,2.824038377940932,3.9266516781618725,3.652487237713353,5.541380780174984,0.23001333962699383,1.5269237832602434,7.635556865755573,7.1372842445943245,6.83296511036787,5.574026854219347,0.4471224945084141,0.00047705622456574567,8.179649783863145,1.8001945012971616,3.3169845023862203,0.0017791244153709572,7.100662719549779,0.005352753456551056,0.9274364597400112,4.624753716605042,1.8931289091237282,1.3333838376346199,2.8582465260966803,2.9099433821843097,1.8325140009927812,0.13512484438654804,3.9846268545774253,4.362911618114164,0.10979874731351007,4.2890503188646365,0.8144979698420638,0.00017013655891725272,2.912624006480464,2.716428432952579,6.047108104831885,5.390373543752237,3.2400602192455072,0.16687471660036424,0.08646819694361163,0.04774693698603306,1.5696493537661107,2.7566432356050727,4.740758973666235,8.528095564183566,2.516581325307761,0.1827254074305723,2.9110231421052797,2.3489455283205984,8.57219056603732,0.017647906399108258,7.895144956755807,0.3109726883169868,0.011892777153512507,3.0342798363690995,0.0870588903787279,0.34782336138745307,8.744429126218057,4.722479524788307,3.2456799364718476,5.8613939374100905,2.545551034789725,1.7059169029409311,1.992115732422585,0.828658162015717,1.1963653533813154,0.19495400231777957,1.3054920553430345,0.239287985487071,8.965103620671648,8.829469681591169,2.3471659466654278,4.8130447372253915,0.02013350616791634,8.942442772612472,5.082131430147128,6.720008126795814,6.976022799639426,0.11111714643121222,4.406468258313806,3.3795108995200893,1.0637046725447568,2.4216765248026966,5.65371178573732,8.475876834241701,5.190307661363143,8.665641885067501,2.6643351424665487,0.03983150423431579,0.14442744734255078,0.8707566815353879,0.7742990625588776,0.18178569990721852,5.193588951883195,0.018682272262208862,0.23577853529116533,3.663974952363479,1.3740107098896768,0.8658579560135605,0.00036880708154637487,2.228437134276486,4.414187589434238,7.9437456619585,3.548120187951564,2.8915040788139663,5.123960715991116,3.744402696514402,9.014925682193835,0.07096812102462872,0.003947451196112669,0.3771510350413599,0.30902312410598604,0.41792110665212523,0.21999753791277402,4.600500566094264,5.63721286213835,5.896635490397647,0.0003907617575529787,0.48876432989710644,0.6884134003800626,0.44998585944479813,7.763659135760767,5.10094687609142,3.575049670380904,0.9598970129574633,1.8474832038372702,0.9133659840053602,4.862122067551029,5.8528823756319746,2.0975405010472987,2.9446983220746397,4.664666181595618,3.0835824325118746,1.2122910195850314,1.044921686643983,7.452171572492344,0.5306233920473811,1.546274192518849,0.464479642164927,8.145598046155058,0.3592264889394579,0.006513497786448157,0.030474229263590502,4.4219413238136065,1.6175113221782151,0.9397520761764451,0.01428783308334535,6.027635479874591,1.8443396235095881,2.86103554960042,5.386451555765284,3.3055196483730804,6.55033368567285,4.380373763086189,8.29261542413455,2.6125478194202225,0.5074964817167779,4.764725617147652,5.778202585159264,0.5750225258352243,7.174934397836403,0.6360936781188892,0.4537516252675244,1.3249548484109792,7.55008773936862,0.2743340555343029,8.688976558716227,0.9971375393411525,4.395194545353935,8.62587448037427,5.741413641214156,0.5682555764943901,0.2780804272798982,1.7686677441061411,0.7979841967729656,0.3508261083929035,7.3551105979017315,0.6031325248142189,0.6794024125785202,3.25603708495961,2.135039394225975,0.06930026011420579,3.3370346353471287,8.484507754844364,5.150382536200783,6.0201502100130755,7.61781007818058,7.421789339522758,0.9314998031483753,5.489217754172179,1.9710976880780235,2.714325543158887,1.9400816831829526,1.8717176936869262,0.01604400236096301,5.261955331391288,6.56731865197186,6.713638443608976,0.885198546604134,1.3203794025616151,1.4240241977795776,0.7020220484350694,7.295353293956785,1.8962730172724076,2.7141615695018615,0.04269362890195629,1.225684460412319,4.901792614941916,8.073277680206298,3.0712966876781125,1.0966296909884699,0.04492910457995515,1.7971986134827806,5.075506778509738,2.7868336654139245,3.466493289960048,4.304412192407952,1.0104800308276773,0.1561679517737978,1.255063663526989,4.06333466704147,7.5022423008130055,8.83794920073976,7.368997219135024,3.8162366744543146,0.014516332213166857,0.16751447617101406,9.010998185377694,1.0100019786489123,5.521971718321777,3.2110461276556213,0.4344020523231887,8.366537208059446,0.41963404292098727,9.027631853302514,3.6132958516989833,0.19358434651166967,5.353951727402806,0.1644229693686777,5.481549591510903,4.774368487968977,5.831052195034306,7.291962306143918,0.49440769496436654,3.5992202979311636,0.2036002097035686,0.8634114444503319,0.058078734136615254,8.904313628118896,0.13906217042727576,1.4146910238630974,2.4080518038311265,0.7740186278692988,1.2509725520996757,7.096629531599922,3.1341634013799866,3.3085245695038066,0.6422786439570465,4.110695305617293,3.996867011287695,1.3432667439460166,2.0977328183706576,0.6787054110983961,0.004669807064013879,4.121320802523995,0.3774693970604571,2.1317402512903922,2.4274652587929126,9.073431969783412,8.304003222518647,0.0048778321497421635,0.0011751967703394544,7.6822293994542985,8.58500565190534,8.380360353530008,0.5687783039364787,0.06164610045647912,2.507036135426026,7.241947325661039,5.054041996098981,1.9446043925282652,0.1495538722031163,0.9004928969089679,5.045341358117078,6.55715937402125,1.2378203632776128,4.609892366925857,6.56022211216709,4.588034265757093,8.816006964573702,3.315289007276389,2.423142630644332,4.998172717144481,2.3051619623397532,7.609347008035352,1.2484383175630716,3.1667055202218206,7.395339885501877,2.1267806884972527,3.739931895934338,3.2205212552843734,3.7482702099947653,8.966575734990435,0.6166412592732335,6.602700807414476,0.2757339818259438,0.2313762156555734,3.055383566404185,0.23048102980700474,1.409879768886114,8.718080419260001,5.883911478999791,4.094306817950554,4.036838940069392,0.04089999696822285,3.953421732249098,1.9803467396719303,4.355857464154396,0.013897183998805587,1.2158234896691917,0.06952197444544991,7.704979238747161,0.12935020404326764,2.5118049865713714,3.04641523474167,5.646052934119466,1.6578217814849403,2.411867885633295,1.1570670556222806,1.3221011425157696,2.05782337906147,0.11132054010178483,0.2984233432631455,5.702311449329842,4.169734182079596,9.076240686408989,2.3405556488390666,0.08759698326762141,2.9628589462211035,1.6516316798717907,0.5681721249255585,1.9539342699295141,2.7632834017503862,8.86747335579823,0.6931878726435065,0.21384787901385657,2.3563650687912525,0.2920901888994887,5.034957849097486,7.454253143313846,0.08027658030193977,5.108617500251373,2.563499179851534,8.431876557160336,3.758665515804372,4.887961252277069,1.274863339686348,5.4427452929033295,8.78396323088556,0.04000049154989922,1.719605607887251,2.680946249110409,0.08297796157500201,1.6736370161832168,0.46882361797391364,3.57747866077583e-5,0.04495769324882335,7.322458226587828,1.5265431638079472,1.4685191025211728,5.055903312297109,0.2787065398056313,6.313170663502038,1.850691780938393,2.8205600824461157,0.7178176137391601,8.699581764273372,2.675758580357728,0.3396720816701351,0.06657005022122134,6.980632447432384,0.39445178671909864,0.002932818425064184,2.810984929578915,0.009337223644142122,7.746248344766122,4.422613289451472,0.3105265430477147,3.7562262825920723,4.1559140269267285,0.437612545683489,7.649819701842248,0.7536811779025857,0.3533021865289487,3.2336600227434458,0.42346366076732617,3.675544856585784,5.071031155402715,1.102194455513519,6.737515682800007,0.056848511688008085,0.07790650827320823,8.273451369331463,4.312054248388178,0.4204326796962484,2.4524374622233727,6.048755960530154,8.553650379527854,1.321540304618391,6.636593757267016,2.2666792507841738,0.33457487481202197,0.010832237643500152,1.2797856817007809,1.229980201361858,1.0067092987876463,0.8662520384693059,0.10539640544360583,0.2073615258605519,6.258388279871368,0.2753876460917822,3.6108180223451294,5.845041294113405,2.7677574214336715,4.839560444050883,0.016636919755958768,2.8194396172718124,0.28822774341566154,0.24334271899027815,6.165130108530682,8.214297133886113,0.5888403476076426,8.652035855078488,5.0041166377338095,4.129197850915929,0.3269375274066767,3.2970247916009976,0.10963694044896058,0.17096386445490933,7.778984543779539,0.6468324182211532,3.8110001104107667,1.026593319888279,0.22288135103164816,6.804209122101599,3.2445934454116445,0.05047289439244422,0.022561161675808,0.04707295303963863,2.4300633398548115,2.964607778321874,7.510838915806291,1.2675096510225,6.162360489753377,2.1972671196021056,4.12414127022311,0.001545906072137602,4.646345967306194,0.7484741164839738,7.617508122917497,6.912140947188426,0.5838668533439538,0.053909213528825876,0.0025891340346703233,0.04188969463722928,0.7106650156349659,6.106112050480309,1.7531928656371598,0.022318631181143953,4.028033416494245,6.93930405527111,0.54948253443107,0.06399711834582097,1.9284988408175927,8.841485522321982,0.002418745242096046,4.607835427112096,0.06223192794236353,1.136601808978448,2.3953668190823376,0.055581652038983735,8.190007290399084,4.998013595803399,0.6703105491396374,0.17951980951333066,0.9369485607649642,0.7970164182357886,0.5125201790590849,2.6759750559373208,0.02821272863376135,1.6157600335723576,1.0875157840701717,0.5002821114815966,5.649637091021922,2.439383484230825,8.203501094280629,3.2285701813450167,2.0462076664054742,8.083269879707474,3.7062901672058044,8.881641422495546,6.637983611491723,0.15980474486457857,1.9514238170474845,0.024905201858725964,2.1642917176273686,7.190059182892883,0.9642707645162534,0.4951773519412155,0.17578734791665385,4.755537607029689,1.7842350566672365,2.946964516290038,0.31882915937722234,8.62721252460542,0.27739404731257755,0.5919206066692094,0.1410197000725878,0.13136600337151125,0.7943093726791642,0.32642386148517866,2.7788276662393945,6.9370040716202315,2.5228262670954846,3.719358398709079,0.0819642297637869,0.28986863115517253,7.912140428621642,3.8282441583603637,1.2748580640183198,0.04322561270777702,1.8403921457794337,0.6725869927015301,0.31626272997161436,4.764898088717336,0.023507109160010274,3.5759605530302907,3.609027170885309,7.98177539771635,5.408264674454703,0.01791919285104613,4.506452624883563,0.01568615885512844,0.11498287817494975,3.1460043986118897,4.188330849407404,0.02458481931991165,4.95438995483336,3.9303015799777024,0.35658578092201304,0.06086214576280738,1.9189219727677973,0.3394927804667184,0.003253078643041606,8.928853593760213,6.514497420739229,2.4017246073624356,1.0491538219219638,0.15185492101451253,4.4199686452400115,6.76065211590039,1.5043104955117825,0.2745993490755471,2.798261835496434,5.1668206730610935,1.7317475575972936,1.727475080141511,6.446970791192733,0.3445389613287798,0.8999932467950444,7.820480482846663,6.572395930096051,0.18634314418414802,0.11190407301187355,8.54227934319561,8.175279363060485,1.4995748508624598,3.4101769620484705,0.5863003895361399,3.9603896466914326,8.899027425545825,3.563243169125298,0.296022281743884,0.42895125301097603,6.34557669689807,3.681928834233323,0.03967605436879927,0.2594553745115895,4.163098680732554,5.817777583730546,1.2986593196362206,2.0071415329668425,1.608569153358919,2.6476458075284866,1.6744994290781994,3.68870719279922,1.6980196344264888,8.073001436044805,1.7322144037530638,4.139786930911,0.5256754156411316,8.234541998433265,1.298417946709285,8.568234394896294,0.1848390602729057,0.21128176591322495,5.45405793327836,0.7457988059860614,2.15227312488776,6.758156779159475,0.060831897970775546,7.000529043134351,0.6088386560335677,5.452857674858705,0.6955066641542601,3.202284723072757,1.2681515517454727,6.822043586932109,6.349977255772974,8.286295685259638,2.0592116068840802,2.148912980368696,1.779591575698356,0.9935935119825795,0.004204311241712256,0.7979817267181638,8.10567128131478,7.512128304009944,4.159567990890613,1.9382234791948254,0.6644849871639398,0.942348903393579,0.6251166115318146,5.092676374583868,4.114445721292127,0.08567681298588316,3.0194423836619846,1.9877614721412182,0.17742693636108847,2.976052581001232,8.175518731928744,3.9656807751718204,3.635155011173552,0.8145658526282648,1.5523650826062503,1.0839836649620815,2.1922125663670635,5.878883689303,0.6190713247868396,3.2707528727155237,1.413771310678638,8.40331653760176,5.600306749243845,0.004609765581299682,0.2870454420482327,8.534230642755423,0.16010113989095498,1.921573589629689,0.671991983245051,5.764073645972417,1.0229498104913328,0.4275185663658261,1.3453524119543665,2.1181204870513772,0.10054679738925394,6.700314269600783,2.1833312959854667,8.350212653667233,7.521307146821027,9.04473504437656,8.089977226193366,7.916737232587779,0.03777547604277481,3.2083620662538253,7.763086181866592,5.982169924994117,4.200706374869644,2.347143199733778,0.6889328004491276,0.0008197233210149993,2.300065118982833,0.4002280654354035,2.943430922676095,2.3395912616224224,7.390903742542834,8.548999560342592,0.005952913549181767,2.543285220167762,0.5429204182650411,6.623439821404568,1.9049171264253775,2.772827006502281,2.3827331276356563,6.773806201050416,0.052981756790206294,2.576579369229375,3.4104750510889947,3.204364203301922,4.4766811234752035,8.195378474017623,7.234790292814737,1.7051104620121964,0.08480643086812402,7.045120398571424,7.248250061239469,0.8612601413771683,0.025886228609919546,0.7436553977564704,1.3458737050182237,0.0031451870885890218,2.222003196170335,0.6941829466546955,3.8900268067742756,0.055999520828907766,2.691628753720014,0.5797169264300618,0.12663395698861174,3.635425962620366,8.774836731411312,0.0618381185761189,1.7659068900671966,0.8348617560744573,6.845740461876862,1.345543624382756,0.24923756587816445,4.811363307875442,5.532592135478982,0.8519011065485357,5.744589294516569,7.115251856193999,3.994917659857314,0.5687627954803832,2.4219133211921546,2.1313633536434424,0.6571690251119622,0.2001741804572555,0.019240722201937874,5.750893510189698,2.076969088425033,2.1607749208609253,5.437156224950247,4.519669246137302,7.33674852759522,1.2291401084343296,6.896823891568778,8.408587428136508,2.449295447436401,0.06029908781879559,0.17328582975479448,2.729577519639134,2.4485935874408065,2.623327865358001,0.9808527034023582]} diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/fixtures/julia/runner.jl new file mode 100644 index 000000000000..85cf0a6327f8 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/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 variance 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 = 1.0 - ( 2.0 / π ) + + expected = Array{Float64}( undef, length( sigma ) ) + for i in eachindex( sigma ) + if sigma[ i ] > 0.0 + expected[ i ] = ( sigma[ i ]^2 ) * 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/variance/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/test.js new file mode 100644 index 000000000000..65fecaed2366 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/test.js @@ -0,0 +1,90 @@ +/** +* @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 variance = 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 variance, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for `sigma`, the function returns `NaN`', function test( t ) { + var v = variance( NaN ); + t.strictEqual( isnan( v ), 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 v; + + v = variance( 0.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + v = variance( -1.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + v = variance( NINF ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the variance of a half-normal distribution', function test( t ) { + var expected; + var delta; + var sigma; + var tol; + var v; + var i; + + sigma = data.sigma; + expected = data.expected; + + for ( i = 0; i < sigma.length; i++ ) { + v = variance( sigma[ i ] ); + + if ( expected[ i ] !== null ) { + if ( v === expected[ i ] ) { + t.strictEqual( v, expected[i], ', sigma: '+sigma[i]+', v: '+v+', expected: '+expected[i] ); + } else { + delta = abs( v - expected[ i ] ); + tol = 1.0 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. sigma: '+sigma[i]+'. v: '+v+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/test.native.js new file mode 100644 index 000000000000..26ee1b8910fe --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/halfnormal/variance/test/test.native.js @@ -0,0 +1,99 @@ +/** +* @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 NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// VARIABLES // + +var variance = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( variance instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof variance, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { + var y = variance( 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 = variance( 0.0 ); + t.strictEqual( isnan( y ), true, 'returns NaN' ); + + y = variance( -1.0 ); + t.strictEqual( isnan( y ), true, 'returns NaN' ); + + y = variance( NINF ); + t.strictEqual( isnan( y ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the variance 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 = variance( sigma[ i ] ); + delta = abs( y - expected[ i ] ); + tol = 1.0 * EPS * abs( expected[ i ] ); + + if ( expected[ i ] !== null ) { + if ( y === expected[ i ] ) { + t.strictEqual( y, expected[i], ', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] ); + } else { + t.ok( delta <= tol, 'within tolerance. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + } + t.end(); +});