Skip to content

UltimateMortality accepts any AbstractVector - #143

Open
alecloudenback wants to merge 2 commits into
refactor/07-standin-semanticsfrom
refactor/08-vector-constructor
Open

alecloudenback wants to merge 2 commits into
refactor/07-standin-semanticsfrom
refactor/08-vector-constructor

Conversation

@alecloudenback

@alecloudenback alecloudenback commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Updated 2026-09-24 (review fix), one commit added: Anchor UltimateMortality at start_age for any input axes. OffsetArray(v, start_age - 1) shifted relative to v's own axes, so an input already indexed by age was placed at the wrong ages (re-anchoring a table starting at 40 to start_age = 0 gave axes 39:40). It now offsets by start_age - firstindex(v); tests cover plain vectors, views and offset inputs.


UltimateMortality and mortality_vector had the identical body, but the first was typed Array{<:Real,1} and rejected ranges and views (UltimateMortality(0:0.1:1) was a MethodError), while the second accepted anything.

Changes

  • UltimateMortality(v::AbstractVector; start_age=0), element type unconstrained so missing-bearing vectors keep working. No copy is made, and the docstring says so.
  • mortality_vector is a one-line alias of UltimateMortality.

Testing

  • New tests with a range, a view, a vector containing missing, the no-copy guarantee, and alias equality.

Stacked on #142 (base branch refactor/07-standin-semantics). Merge the stack in order; once the base PR is merged and its branch deleted, GitHub retargets this PR to master.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (refactor/07-standin-semantics@1197964). Learn more about missing BASE report.

Additional details and impacted files
@@                       Coverage Diff                        @@
##             refactor/07-standin-semantics     #143   +/-   ##
================================================================
  Coverage                                 ?   91.05%           
================================================================
  Files                                    ?       10           
  Lines                                    ?      380           
  Branches                                 ?        0           
================================================================
  Hits                                     ?      346           
  Misses                                   ?       34           
  Partials                                 ?        0           

☔ View full report in Codecov by Harness.
📢 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.

alecloudenback and others added 2 commits September 24, 2026 16:39
UltimateMortality previously required a Vector of Real and rejected
ranges, views, and vectors containing missing; mortality_vector is now
an alias for it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT
OffsetArray(v, start_age - 1) shifts relative to v's own axes, so a vector
already indexed by age (or any input not starting at 1) was placed at the
wrong ages: re-anchoring a table starting at 40 with start_age = 0 gave
axes 39:40. Offset by start_age - firstindex(v) instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alecloudenback
alecloudenback force-pushed the refactor/08-vector-constructor branch from bcd9510 to b8f54a9 Compare September 24, 2026 22:50
@alecloudenback
alecloudenback force-pushed the refactor/07-standin-semantics branch from 1197964 to 9610214 Compare September 24, 2026 22:50

This branch has not been deployed

No deployments
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.

1 participant