Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/wald/mean/binding.gyp
Original file line number Diff line number Diff line change
@@ -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 for the add-on:
'link_settings': {
# Define libraries:
'libraries': [
'<@(libraries)',
],

# Define library directories:
'library_dirs': [
'<@(library_dirs)',
],
},

# C flags:
'cflags': [
# Enable commonly used warning options:
'-Wall',

# Set optimization level:
'-O3',
],

# C specific flags:
'cflags_c': [
# Specify the C standard to which a program is expected to conform:
'-std=c99',
],

# C++ specific 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 flags:
'cflags': [
# Generate position-independent code (PIC):
'-fPIC',
],
},
], # end condition (OS!="win")
], # end conditions
}, # end target

# Target to copy the add-on to a standard location:
{
'target_name': 'copy_addon',

# Specify the target type:
'type': 'none',

# Define dependencies:
'dependencies': [
# Require that the add-on be built before moving to a standard location:
'<(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
], # end targets
}
53 changes: 53 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/wald/mean/include.gypi
Original file line number Diff line number Diff line change
@@ -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': [
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
],

# Add-on destination directory:
'addon_output_dir': './src',

# Source files:
'src_files': [
'<(src_dir)/addon.c',
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
],

# Library dependencies:
'libraries': [
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
],

# Library directories:
'library_dirs': [
'<!@(node -e "var arr = require(\'@stdlib/utils/library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
],
}, # end variables
}
Original file line number Diff line number Diff line change
@@ -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.
*/

#ifndef STDLIB_STATS_BASE_DISTS_WALD_MEAN_H
#define STDLIB_STATS_BASE_DISTS_WALD_MEAN_H

/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
#ifdef __cplusplus
extern "C" {
#endif

/**
* Returns the expected value for a Wald distribution with mean `mu` and standard deviation `sigma`.
*/
double stdlib_base_dists_wald_mean( const double mu, const double sigma );

#ifdef __cplusplus
}
#endif

#endif // !STDLIB_STATS_BASE_DISTS_WALD_MEAN_H
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/wald/mean/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @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';

/**
* Wald distribution expected value.
*
* @module @stdlib/stats/base/dists/wald/mean
*
* @example
* var mean = require( '@stdlib/stats/base/dists/wald/mean' );
*
* var y = mean( 0.0, 1.0 );
* // returns NaN
*
* y = mean( 4.0, 2.0 );
* // returns 4.0
*/

// MODULES //

var mean = require( './main.js' );


// EXPORTS //

module.exports = mean;
74 changes: 74 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/wald/mean/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* @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 isnan = require( '@stdlib/math/base/assert/is-nan' );


// MAIN //

/**
* Returns the expected value for a wald distribution with mean `mu` and standard deviation `sigma`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Returns the expected value for a wald distribution with mean `mu` and standard deviation `sigma`.
* Returns the expected value for a Wald distribution with mean `mu` and standard deviation `sigma`.

*
* @param {PositiveNumber} mu - mean
* @param {PositiveNumber} sigma - standard deviation
* @returns {number} expected value
*
* @example
* var y = mean( 0.0, 1.0 );
* // returns NaN
*
* @example
* var y = mean( 1.0, 0.0 );
* // returns NaN
Comment on lines +35 to +45
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First examples should always showcase valid inputs (this is something that should be addressed in various files).

*
* @example
* var y = mean( 5.0, 2.0 );
* // returns 5.0
*
* @example
* var y = mean( NaN, 1.0 );
* // returns NaN
*
* @example
* var y = mean( 0.0, NaN );
* // returns NaN
*
* @example
* var y = mean( 0.0, 0.0 );
* // returns NaN
*/
function mean( mu, sigma ) {
if (
isnan( mu ) ||
isnan( sigma ) ||
sigma <= 0.0 ||
mu <= 0.0
) {
return NaN;
}
return mu;
}


// EXPORTS //

module.exports = mean;
Loading
Loading