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

NaN leak with selectdim view #39

Closed
michaelsachs opened this issue Jun 12, 2023 · 2 comments
Closed

NaN leak with selectdim view #39

michaelsachs opened this issue Jun 12, 2023 · 2 comments

Comments

@michaelsachs
Copy link

I came across an example where NaNs "leak" into the result of a nanmean operation. This occurs when I average on a view created using selectdim.

# create a matrix and set one element to NaN
a = rand(10,5)
a[3,1] = NaN

When I create a view using the appropriate macro everything looks fine:

av = @view a[:,1:3]
avMean = nanmean(av,dims=2)
avMean[3,1] 
0.8755526000081276

However, when I create the same view using selectdim the NaN ends up in the final vector:

av = selectdim(a,2,[true,true,true,false,false])
avMean = nanmean(av,dims=2)
avMean[3,1]
NaN

I am using Julia 1.9.0 and NaNStatistics v0.6.28.

@brenhinkeller
Copy link
Owner

Thanks for the report! I think the immediate solution will be to just be stricter about what non-Array array types we use @turbo on

@brenhinkeller
Copy link
Owner

Should be fixed in v0.6.29 and onwards

This issue was closed.
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

No branches or pull requests

2 participants