Skip to content

Von Mises Distribution - #818

Merged
NAThompson merged 9 commits into
boostorg:developfrom
mborland:von_mises
Sep 26, 2026
Merged

NAThompson merged 9 commits into
boostorg:developfrom
mborland:von_mises

Conversation

@mborland

@mborland mborland commented Aug 15, 2022 •

Copy link
Copy Markdown
Member

#330 looked very close to completion so this is my attempt to foster it. Also see #296

@mborland

Copy link
Copy Markdown
Member Author

@NAThompson This should be good for review. The only major outstanding change from the last cut at this was removing all the double precision magic numbers which I have. I would have just made the edits on the linked PR, but since the guy deleted his account I can't access the branch.

Comment thread doc/distributions/von_mises.qbk Outdated

[h4 Member Functions]

von_mises_distribution(RealType mean = 0, RealType concentration = 1); ;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@jzmaddock : IIRC we now use Real instead of RealType? Obviously a nitpick.

Comment thread doc/distributions/von_mises.qbk Outdated
All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.

The domain of the random variable is O <= x <= 2[pi].

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe use “≤” (U+2264) which I think is \u2264 in .qbk?

{
*result = policies::raise_domain_error<RealType>(
function,
"Angle parameter is %1%, but must be between -pi and +pi!", angle, pol);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If the CDF is periodic, is it sensible to restrict the angle like this?

Comment thread doc/distributions/von_mises.qbk Outdated

[h4 Accuracy]

The CDF of this distribution is not analytic so an approximation is made.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does the approximation mean that multiprecision types should be rejected?

Comment thread test/test_von_mises.cpp Outdated
// Check symmetry of PDF and CDF
test_symmetry(0.0F);
test_symmetry(0.0);
test_symmetry(0.0L);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Might we test the quadrature of the pdf = 1?

@NAThompson

Copy link
Copy Markdown
Collaborator

@mborland : I've approved, but with the caveat that I don't know much about this. We'll probably want a second review from @jzmaddock .

mborland and others added 6 commits September 25, 2026 21:01
The cdf integrates a positive integrand (Gauss-Legendre to double, tanh-sinh beyond); moments avoid the I0 - I1 cancellation; drop the per-precision tables; tests use math_unit_test.hpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NAThompson and others added 3 commits September 25, 2026 23:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tration sd

Solve from the median for p >= 1/4; cut the cdf integral at a fixed number of e-folds; form moments as ratios so they cannot underflow; raise overflow for sd at k = 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NAThompson
NAThompson merged commit 50793de into boostorg:develop Sep 26, 2026
41 of 42 checks passed
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