Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add polish to Bundle Types #225

Merged
merged 2 commits into from
Oct 13, 2023
Merged

Add polish to Bundle Types #225

merged 2 commits into from
Oct 13, 2023

Conversation

oxinabox
Copy link
Member

@oxinabox oxinabox commented Oct 11, 2023

This PR does several things that make basically no user facing change.
It was the follow up to #224 but actually ended up way more involved.

  • Adds the missing ExplictTangentBundle[CanonicalTangentIndex(i)] (which is funny that it was missing as that's the natural way to index an ExplictTangentBundle
  • Moves the getindex main definitions down on to to the tangent types.
  • Defines promotion rules: Explict > Taylor > Uniform
  • Defines conversions. For now only Uniform->Taylor/Explict and Taylor->Explict, though in future we could put the other way around in (but they are not always going to be defined)
  • Defines equality for everything, via defining self equality and then a fallback to promotion (apparently this is the way the julia docs recommend defining equality. I have always just defined it directly)
  • Defines hash for everything, this just uses the hash of the primal for bundles, which I think is actually sufficient. I am making the assumption that we do not end up needing a dict which stores the same primal with different tangents a ton of times. We can revisit that later if it comes up.
  • Deletes ProductTangent, as we were not using it, and I didn't want to implement the above for it. (I think ProductTangent was basically the same as CompositeTangent but less complete, and that's gone now anyway)

@oxinabox oxinabox requested a review from oscardssmith October 11, 2023 09:37
if lastindex(tangent.partials) == exp2(b.i) - 1
return tangent.partials[end]
end
# TODO: should we also allow other indexes if all the partials at that level are equal up regardless of order?
Copy link
Member Author

Choose a reason for hiding this comment

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

the comment wasn't in there before.
But I don't actually see why we don't do this.

We just need to check all things at the indexes j that have count_ones(j) = b.i are equal. And if so return that thing.
if not give error about ambig

@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (e7c8abd) 55.76% compared to head (d5670d2) 56.28%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
+ Coverage   55.76%   56.28%   +0.51%     
==========================================
  Files          28       28              
  Lines        2819     2841      +22     
==========================================
+ Hits         1572     1599      +27     
+ Misses       1247     1242       -5     
Files Coverage Δ
src/stage1/forward.jl 70.00% <ø> (+0.43%) ⬆️
src/tangent.jl 68.55% <88.88%> (+8.25%) ⬆️

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

@oscardssmith oscardssmith merged commit e0ff39b into main Oct 13, 2023
5 of 8 checks passed
@oscardssmith oscardssmith deleted the ox/tangent_type_polish branch October 13, 2023 15:34
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