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

[WIP] preserve offset when broadcasting IdOffsetRange #105

Closed
wants to merge 1 commit into from

Conversation

johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented Mar 23, 2020

This is a prototype patch to test JuliaImages/ImageFiltering.jl#160

fixes #104

@@ -155,6 +155,14 @@ end
return IdOffsetRange(r.parent[s .- r.offset], r.offset)
end

# offset-preserve broadcasting
Base.broadcasted(::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(-), r::IdOffsetRange{T}, x::Integer) where T =
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
Base.broadcasted(::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(-), r::IdOffsetRange{T}, x::Integer) where T =
Broadcast.broadcasted(::Base.Broadcast.DefaultArrayStyle{1}, ::typeof(-), r::IdOffsetRange{T}, x::Integer) where T =

and similarly below.

@yha
Copy link
Contributor

yha commented Jun 10, 2020

Any update on this? What still needs to be done?

@johnnychen94
Copy link
Member Author

johnnychen94 commented Jun 10, 2020

Sorry! I was planning to find some time to check JuliaImages/ImageFiltering.jl#160 in detail but was filled with my PhD things (near the end of this semester); my experiments didn't go as smoothly as I expected. My limited time in julia was spent on setting up a Pkg mirror in BFSU for the Chinese community.

For this PR itself, it's actually a bug fix so I believe some independent and reasonable tests here would be sufficient.

Since this PR is proposed for JuliaImages/ImageFiltering.jl#160 and since that is basically approved by @jw3126, I think this one is good to go as long as the test there passes (you can check that by temporarily committing a Manifest.toml there with OffsetArrays of this branch).

I'm truly sorry for the unavailability, I'll do a rough check tomorrow night. Feel free to open a new PR for this if you want to polish this by yourself.

@yha
Copy link
Contributor

yha commented Jun 10, 2020

Thanks. I'll open a new PR for this one with an added test.

Since this PR is proposed for JuliaImages/ImageFiltering.jl#160 and since that is basically approved by @jw3126, I think this one is good to go as long as the test there passes (you can check that by temporarily committing a Manifest.toml there with OffsetArrays of this branch).

I already checked the tests there with a locally modified OffsetArrays, but I will repeat with the new PRs branch as you suggested.

@johnnychen94
Copy link
Member Author

closed in favor of #114

@johnnychen94 johnnychen94 deleted the jc/id_broadcast branch June 12, 2020 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests PR needs tests before it can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broadcasting with IdOffsetRange seems wrong
3 participants