Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
* 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.
Expand Down
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
}
40 changes: 40 additions & 0 deletions lib/node_modules/@stdlib/stats/base/dists/wald/mean/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

{{alias}}( μ, λ )
Returns the expected value of a Wald distribution with mean `μ` and
shape parameter `λ`.

If provided `NaN` as any argument, the function returns `NaN`.

If provided `σ <= 0` or `λ <= 0` the function returns `NaN`.

Parameters
----------
μ: number
Location parameter.

λ: number
Shape parameter.

Returns
-------
out: number
Expected value.

Examples
--------
> y = {{alias}}( 4.0, 2.0 )
4.0
> var y = {{alias}}( 0.0, 1.0 )
NaN
> var y = {{alias}}( 1.0, 0.0 )
NaN
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> y = {{alias}}( 4.0, 2.0 )
4.0
> var y = {{alias}}( 0.0, 1.0 )
NaN
> var y = {{alias}}( 1.0, 0.0 )
NaN
> var y = {{alias}}( 4.0, 2.0 )
4.0
> y = {{alias}}( 0.0, 1.0 )
NaN
> y = {{alias}}( 1.0, 0.0 )
NaN

> y = {{alias}}( NaN, 1.0 )
NaN
> y = {{alias}}( 0.0, NaN )
NaN
> y = {{alias}}( 0.0, 0.0 )
NaN

See Also
--------

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// TypeScript Version: 4.1

/**
* Returns the expected value for a Wald distribution with mean `mu` and shape parameter `lambda`.
*
* ## Notes
*
* - If provided `mu <= 0` or `lambda <= 0`, the function returns `NaN`.
*
* @param mu - mean
* @param lambda - shape parameter
* @returns expected value
*
* @example
* var y = mean( 5.0, 2.0 );
* // returns 5.0
*
* @example
* var y = mean( 0.0, 1.0 );
* // returns NaN
*
* @example
* var y = mean( 1.0, 0.0 );
* // returns NaN
*
* @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
*/
declare function mean( mu: number, lambda: number ): number;


// EXPORTS //

export = mean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import mean = require( './index' );


// TESTS //

// The function returns a number...
{
mean( 5, 2 ); // $ExpectType number
}

// The compiler throws an error if the function is provided values other than two numbers...
{
mean( true, 3 ); // $ExpectError
mean( false, 2 ); // $ExpectError
mean( '5', 1 ); // $ExpectError
mean( [], 1 ); // $ExpectError
mean( {}, 2 ); // $ExpectError
mean( ( x: number ): number => x, 2 ); // $ExpectError

mean( 9, true ); // $ExpectError
mean( 9, false ); // $ExpectError
mean( 5, '5' ); // $ExpectError
mean( 8, [] ); // $ExpectError
mean( 9, {} ); // $ExpectError
mean( 8, ( x: number ): number => x ); // $ExpectError

mean( [], true ); // $ExpectError
mean( {}, false ); // $ExpectError
mean( false, '5' ); // $ExpectError
mean( {}, [] ); // $ExpectError
mean( '5', ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided insufficient arguments...
{
mean(); // $ExpectError
mean( 3 ); // $ExpectError
}
Loading
Loading