-
Notifications
You must be signed in to change notification settings - Fork 6
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
Make MCSE for constant arrays always return a NaN #128
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #128 +/- ##
==========================================
+ Coverage 96.68% 96.70% +0.01%
==========================================
Files 10 10
Lines 875 880 +5
==========================================
+ Hits 846 851 +5
Misses 29 29 ☔ View full report in Codecov by Sentry. |
Pull Request Test Coverage Report for Build 11894022521Details
💛 - Coveralls |
#129 should be merged first |
src/mcse.jl
Outdated
@@ -133,6 +133,10 @@ function _mcse_sbm(f, x, batch_size) | |||
any(x -> x === missing, x) && return missing | |||
n = length(x) | |||
i1 = firstindex(x) | |||
if all(==(first(x)), x) |
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.
if all(==(first(x)), x) | |
if allequal(x) |
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.
Since allequal
was introduced in Julia v1.8, we would need to either drop support for Julia v1.6-1.7 or add Compat to use it.
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 think we should use allequal
at least on newer Julia versions since there's no reason to avoid the specialized implementations for ranges or other special types. I assume if we don't use allequal
right away, then it's very likely we'll never switch to the better/native approach even when support for older Julia versions is dropped.
I'd be fine with dropping support for 1.6 and 1.7 now that 1.10 is the new LTS (I'd even be fine with dropping support for < 1.10). Alternatively, to avoid adding a Compat dependency, we could also add our own custom, less-optimized function
if VERSION < v"1.8"
_allequal(x) = isempty(x) || all(isequal(first(x)), x)
else
const _allequal = allequal
end
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'm okay with bumping support to v1.8. I see no problem with supporting v1.8 and v1.9 until it becomes at all cumbersome to do so.
Co-authored-by: David Widmann <[email protected]>
Fixes #122