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

Make MCSE for constant arrays always return a NaN #128

Merged
merged 11 commits into from
Nov 18, 2024
Merged

Conversation

sethaxen
Copy link
Member

Fixes #122

Copy link

codecov bot commented Nov 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.70%. Comparing base (877214d) to head (b73fae2).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

coveralls commented Nov 17, 2024

Pull Request Test Coverage Report for Build 11894022521

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 96.705%

Totals Coverage Status
Change from base Build 11882481146: 0.02%
Covered Lines: 851
Relevant Lines: 880

💛 - Coveralls

@sethaxen
Copy link
Member Author

#129 should be merged first

src/mcse.jl Outdated Show resolved Hide resolved
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)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if all(==(first(x)), x)
if allequal(x)

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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.

.github/workflows/CI.yml Outdated Show resolved Hide resolved
.github/workflows/CI.yml Outdated Show resolved Hide resolved
@sethaxen sethaxen merged commit 2769ffb into main Nov 18, 2024
13 checks passed
@sethaxen sethaxen deleted the mcse_nan_consistency branch November 18, 2024 15:09
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.

Making MCSE for constant arrays consistent
3 participants