Skip to content

feat: add implementation for stats/base/dists/halfnormal/logpdf#9708

Merged
Planeshifter merged 5 commits intostdlib-js:developfrom
Om-A-osc:feat/halfnormal-logpdf
Apr 3, 2026
Merged

feat: add implementation for stats/base/dists/halfnormal/logpdf#9708
Planeshifter merged 5 commits intostdlib-js:developfrom
Om-A-osc:feat/halfnormal-logpdf

Conversation

@Om-A-osc
Copy link
Copy Markdown
Contributor


type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:

  • task: lint_filenames
    status: passed
  • task: lint_editorconfig
    status: passed
  • task: lint_markdown
    status: passed
  • task: lint_package_json
    status: passed
  • task: lint_repl_help
    status: passed
  • task: lint_javascript_src
    status: passed
  • task: lint_javascript_cli
    status: na
  • task: lint_javascript_examples
    status: passed
  • task: lint_javascript_tests
    status: passed
  • task: lint_javascript_benchmarks
    status: passed
  • task: lint_python
    status: na
  • task: lint_r
    status: na
  • task: lint_c_src
    status: missing_dependencies
  • task: lint_c_examples
    status: missing_dependencies
  • task: lint_c_benchmarks
    status: missing_dependencies
  • task: lint_c_tests_fixtures
    status: na
  • task: lint_shell
    status: na
  • task: lint_typescript_declarations
    status: passed
  • task: lint_typescript_tests
    status: passed
  • task: lint_license_headers
    status: passed

Progresses #9416.

Description

This pull request adds and validates the half-normal logpdf implementation, including C, JavaScript, and TypeScript bindings, and corrects documentation examples to match the mathematically correct half-normal distribution. The implementation and reference values are aligned with Julia’s Truncated(Normal(0, σ), 0, Inf) ground-truth model.

Related Issues

This pull request has the following related issues:

Questions

No.

Other

The numerical reference values were verified against Julia’s Distributions.jl implementation of a half-normal distribution via a truncated normal model. Documentation examples were updated to reflect these correct reference values.

Checklist

AI Assistance

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

I used AI assistance to verify the mathematical formula for the half-normal log-PDF and to confirm expected numerical values using Julia as a reference.


@stdlib-js/reviewers

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Jan 12, 2026
@Om-A-osc Om-A-osc changed the title feat: add implementation for halfnormal/logpdf feat: add implementation for stats/base/dists/halfnormal/logpdf Jan 12, 2026
@Om-A-osc Om-A-osc changed the title feat: add implementation for stats/base/dists/halfnormal/logpdf feat: add implementation for stats/base/dists/halfnormal/logpdf Jan 12, 2026
@Planeshifter Planeshifter self-requested a review January 12, 2026 19:55
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Thanks for your first contribution to stdlib!

Comment thread lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/examples/c/example.c Outdated
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Jan 13, 2026

Coverage Report

No coverage information available.

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Om-A-osc
Copy link
Copy Markdown
Contributor Author

Hello @Planeshifter, I’ve made the requested changes and addressed the review comments. Please have a look when you have a moment. Thank you!

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Om-A-osc Om-A-osc requested a review from Planeshifter January 14, 2026 14:58
@stdlib-bot stdlib-bot removed the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Jan 22, 2026
@kgryte kgryte added Feature Issue or pull request for adding a new feature. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. labels Jan 25, 2026
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Left another round of feedback.

Comment thread lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/examples/index.js Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/examples/index.js Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/examples/c/example.c Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/examples/c/example.c Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/README.md Outdated
@Planeshifter Planeshifter added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Mar 1, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: passed
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Om-A-osc
Copy link
Copy Markdown
Contributor Author

Om-A-osc commented Mar 1, 2026

@Planeshifter I did the requested changes.

@Om-A-osc Om-A-osc requested a review from Planeshifter March 1, 2026 08:26
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Mar 1, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Let's get this PR in... thanks!

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Apr 3, 2026
@stdlib-bot stdlib-bot removed Needs Review A pull request which needs code review. Needs Changes Pull request which needs changes before being merged. labels Apr 3, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

PR Commit Message

feat: add implementation for `stats/base/dists/halfnormal/logpdf`

PR-URL: https://github.com/stdlib-js/stdlib/pull/9708
Ref: https://github.com/stdlib-js/stdlib/issues/9416

Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com>
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>

Please review the above commit message and make any necessary adjustments.

@Planeshifter Planeshifter merged commit f4a0718 into stdlib-js:develop Apr 3, 2026
32 checks passed
@stdlib-bot stdlib-bot removed the Ready To Merge A pull request which is ready to be merged. label Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Feature Issue or pull request for adding a new feature. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants