Skip to content

Conditioning: carry the conditioning eltype (BigFloat flows end-to-end)#370

Merged
lrnv merged 1 commit into
lrnv:mainfrom
thisiscam:bigfloat-conditioning
Jun 2, 2026
Merged

Conditioning: carry the conditioning eltype (BigFloat flows end-to-end)#370
lrnv merged 1 commit into
lrnv:mainfrom
thisiscam:bigfloat-conditioning

Conversation

@thisiscam
Copy link
Copy Markdown
Contributor

#368 loosened condition() to accept any <:Real conditioning point, but the ConditionalCopula and DistortionFromCop structs still stored uⱼₛ/den as Float64 — so a BigFloat (or Float32, Double64, …) point is silently downcast to Float64, and the conditional CDF can't carry that precision.

This parametrises both structs on a value type T, inferred from the conditioning eltype:

  • DistortionFromCop{TC,p}DistortionFromCop{TC,p,T} — fields uⱼₛ::NTuple{p,T}, den::T
  • ConditionalCopula{d,D,p,TDs}ConditionalCopula{d,D,p,T,TDs} — same

The algorithms (_assemble, _swap, _partial_cdf, _process_tuples) are already eltype-generic, so the struct fields were the only thing pinning precision. Backward-compatible: Float64 inputs give T=Float64, behaviour byte-identical.

Result: precision flows through den and the conditional CDF end-to-end wherever the parent copula's pdf/cdf support it (e.g. Clayton/Archimedean). It's also what high-precision nested-Archimedean censored likelihoods need.

Adds a test asserting the conditional CDF is BigFloat-typed (not merely accepted — which #368 already covered), for both the single-distortion and ConditionalCopula paths.

🤖 Generated with Claude Code

…d-to-end)

lrnv#368 made condition() ACCEPT non-Float64 values, but ConditionalCopula and DistortionFromCop still stored uⱼₛ/den as Float64, downcasting the precision. Parametrise both structs on a value type T (inferred from the conditioning eltype) so BigFloat (or any Real) flows through den and the conditional CDF. Backward-compatible: Float64 inputs give T=Float64, behaviour unchanged.

Adds a test asserting the conditional CDF is BigFloat-typed (not merely accepted).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.27%. Comparing base (73649fe) to head (c67c576).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
- Coverage   78.28%   78.27%   -0.01%     
==========================================
  Files          84       84              
  Lines        5106     5104       -2     
==========================================
- Hits         3997     3995       -2     
  Misses       1109     1109              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lrnv lrnv merged commit aeb7611 into lrnv:main Jun 2, 2026
5 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