-
Notifications
You must be signed in to change notification settings - Fork 16
Reorganize inverse_eltype calculations. #149
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
Conversation
- remove `robust_eltype`, replace with `_ensure_float`
- remove `Union{}` as a corner case for empty (named)tuples and `Constant`, use `Bool`
- clarify API guarantees (`inverse_eltype` is always `<:Real`)
- remove `_ensure_float` from `inverse!` definition, clarify invariant
(eltype is always the same as `inverse_eltype`)
- incidental: fix various minor code redundancies
- fixes #148 (add tests)
- get rid of `promote_op` - add test for `Any[...]` input - enable tests which now pass (unrelated)
|
@devmotion: I wonder if this addresses your use case in #132. We fall back to julia> b = Bool[]
Bool[]
julia> sum(b)
0
julia> mean(b)
NaN
julia> std(b)
NaNIf this is satisfactory, and you have time, please also review. |
devmotion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worked around this issue for now but IIRC there are still some annoying edge cases. I assume that falling back to a numeric type such as Bool (which is not as invasive as Float64) would generally make it less likely to run into such as issues as in #132. So I'm in favour of this change.
|
As the person using TransformVariables with Unitful: there are at least a couple tests that will be doing inverse transforms with Unitful in a way that resembles my use case, e.g. TransformVariables.jl/test/runtests.jl Lines 86 to 89 in 0d70beb
If you want to be extra careful, you could add an TransformVariables.jl/test/utilities.jl Lines 72 to 76 in 0d70beb
|
Co-authored-by: David Müller-Widmann <devmotion@users.noreply.github.com>
Co-authored-by: David Müller-Widmann <devmotion@users.noreply.github.com>
Co-authored-by: David Müller-Widmann <devmotion@users.noreply.github.com>
|
@Ickaser: thanks for the reminder. I am comitted to maintaining support to |
robust_eltype, replace with_ensure_floatUnion{}as a corner case for empty (named)tuples andConstant, useBoolinverse_eltypeis always<:Real)_ensure_floatfrominverse!definition, clarify invariant (eltype is always the same asinverse_eltype)