Skip to content

feat: add C implementation for stats/base/dists/studentized-range/quantile - #14768

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/studentized-range-quantile-c
Draft

feat: add C implementation for stats/base/dists/studentized-range/quantile#14768
Planeshifter wants to merge 1 commit into
developfrom
philipp/studentized-range-quantile-c

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Aug 29, 2026

Copy link
Copy Markdown
Member

Resolves #10107.

Description

What is the purpose of this pull request?

This pull request:

  • Adds a C implementation for @stdlib/stats/base/dists/studentized-range/quantile
  • Ports the apnorminv (inverse normal approximation) and qtrngo (initial estimate) routines from JS to C
  • Implements the secant-method root-finding procedure that iteratively inverts the CDF
  • Links to the CDF C library (@stdlib/stats/base/dists/studentized-range/cdf) rather than inlining the CDF code

Related 问题

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

This PR depends on #10106 (the CDF C implementation) being merged first, since the quantile links to the CDF C library via manifest.json dependencies.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes

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

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code (Fable 5). The C implementation was ported from the existing JavaScript implementation, with manual review of numerical coefficients, convergence behavior, and edge cases.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Aug 29, 2026
…antile`

- Add src/main.c with the quantile algorithm ported from JS:
  apnorminv (inverse normal), qtrngo (initial estimate),
  and secant-method root-finding iterating the CDF
- Link to the CDF C library instead of inlining the CDF code
- Add public header, native addon, build configuration
- Add manifest.json with CDF dependency
- Add native benchmark, native test, C benchmark, C example
- Add README C API documentation section
- Update package.json with gypfile and native directories
- Update lib/index.js with tryRequire pattern for native addon

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Planeshifter
Planeshifter force-pushed the philipp/studentized-range-quantile-c branch from 995157b to 89cb5e4 比较 August 29, 2026 06:18

Copy link
Copy Markdown
Member Author

⚠️ Issue Reference Review

An automated check found potentially unrelated issue/PR references in this PR:

Reference Assessment Reasoning
#10107 unrelated This PR uses the closing keyword "Resolves #10107", but #10107 is a closed PR titled "chore: fix JavaScript lint errors (issue #10084)" — unrelated to the studentized-range quantile C implementation added here. The PR body's own "Related 问题" section separately (and correctly) references #10106 (the CDF C implementation dependency); #10107 appears to be a mistaken reference, possibly intended to also say #10106.

Why this matters: GitHub automatically closes issues referenced with
closing keywords (Resolves, Closes, Fixes) when the PR is merged. Incorrect
references can accidentally close unrelated issues.

What to do:

  • If the reference is correct, no action needed. This check may produce
    false positives.
  • If the reference is incorrect, please update your PR description.

This assessment was generated by an AI model and is informational only.


Generated by Claude Code

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

Statistics Issue or pull request related to statistical functionality.

项目

None yet

Development

Successfully merging this pull request may close these issues.

2 participants