Conditioning: carry the conditioning eltype (BigFloat flows end-to-end)#370
Merged
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#368 loosened
condition()to accept any<:Realconditioning point, but theConditionalCopulaandDistortionFromCopstructs still storeduⱼₛ/denasFloat64— so aBigFloat(orFloat32,Double64, …) point is silently downcast toFloat64, 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}— fieldsuⱼₛ::NTuple{p,T},den::TConditionalCopula{d,D,p,TDs}→ConditionalCopula{d,D,p,T,TDs}— sameThe algorithms (
_assemble,_swap,_partial_cdf,_process_tuples) are already eltype-generic, so the struct fields were the only thing pinning precision. Backward-compatible:Float64inputs giveT=Float64, behaviour byte-identical.Result: precision flows through
denand the conditional CDF end-to-end wherever the parent copula'spdf/cdfsupport 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 andConditionalCopulapaths.🤖 Generated with Claude Code