-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add Wald distribution mean package #9502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Planeshifter
merged 23 commits into
stdlib-js:develop
from
manit2004:feat/wald-distribution-mean-209
Jan 7, 2026
Merged
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
498b3d9
mean package core implemented
manit2004 21c98e8
fix: correct indentation to use tabs instead of spaces
manit2004 e0830f7
requested changed implemented
manit2004 6218210
tests added
manit2004 663a7de
added examples
manit2004 a0496a6
defined EPS due to import error in CI
manit2004 a3ea8f0
linting error fixed
manit2004 8b56e02
linting error fixed
manit2004 5bbc724
added docs
manit2004 f976234
fixed copyright year
manit2004 8768066
linting error fixed
manit2004 5a5139c
suggestions implemented
manit2004 e54875d
benchmark and readme added
manit2004 7dfb31a
copyright year fixed
manit2004 1a9d7b2
chore: revert copyright year changes
Planeshifter d78d7a5
comments resolved
manit2004 f4dee69
linting error fixed
manit2004 e2af1d3
linting error fixed
manit2004 042fd0e
linting error fixed
manit2004 bfd0049
fix: correct indentation on line 34
manit2004 bc5f5c3
chore: clean-up sections
Planeshifter c3abeb3
chore: revert changes
Planeshifter cf2bcb0
docs: update description
Planeshifter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
lib/node_modules/@stdlib/stats/base/dists/normal/mean/docs/types/index.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/node_modules/@stdlib/stats/base/dists/normal/mean/docs/types/test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
lib/node_modules/@stdlib/stats/base/dists/wald/mean/binding.gyp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
40
lib/node_modules/@stdlib/stats/base/dists/wald/mean/docs/repl.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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`. | ||||||||||||||||||||||||||
Planeshifter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Parameters | ||||||||||||||||||||||||||
| ---------- | ||||||||||||||||||||||||||
| μ: number | ||||||||||||||||||||||||||
| Location parameter. | ||||||||||||||||||||||||||
Planeshifter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| λ: 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 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| > 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 |
61 changes: 61 additions & 0 deletions
61
lib/node_modules/@stdlib/stats/base/dists/wald/mean/docs/types/index.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
56 changes: 56 additions & 0 deletions
56
lib/node_modules/@stdlib/stats/base/dists/wald/mean/docs/types/test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.