Skip to content

Comments

Add derivative support for std::beta and introduce digamma function utility#1733

Open
leetcodez wants to merge 1 commit intovgvassilev:masterfrom
leetcodez:clean-beta-pr
Open

Add derivative support for std::beta and introduce digamma function utility#1733
leetcodez wants to merge 1 commit intovgvassilev:masterfrom
leetcodez:clean-beta-pr

Conversation

@leetcodez
Copy link
Contributor

Added a digamma utility to into BuiltInDerivatives.h It handles the math using a standard asymptotic expansion and uses a recurrence shift for smaller values of x to ensure the floating-point results stay accurate.
implemented beta_pushforward and beta_pullback.

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

double f_beta(double x, double y) { return std::beta(x, y); }
Copy link
Owner

Choose a reason for hiding this comment

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

We need to also properly update test/Features/stl-cmath.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done and done

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@leetcodez leetcodez requested a review from vgvassilev February 19, 2026 06:47
namespace std {
template <typename T>
inline T beta(T x, T y) {
return std::tgamma(x) * std::tgamma(y) / std::tgamma(x + y);
Copy link
Owner

Choose a reason for hiding this comment

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

We need to update the description on the top of this file accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the file description!

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Owner

@guitargeek, can you take a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants