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

Add init keyword support for reducec & mapreducec #263

Merged
merged 1 commit into from
Aug 15, 2021

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented Aug 13, 2021

This also makes it possible to omit specifying the init value.

julia> rgb = rand(RGB, 1000, 1000);

julia> @btime reducec.(+, 0.2, rgb); # conventional
  1.746 ms (6 allocations: 7.63 MiB)

julia> @btime reducec.(+, rgb, init=0.2); # with `init`
  1.897 ms (13 allocations: 7.63 MiB)

julia> @btime reducec.(+, rgb); # omitting `init` (=`0.0`)
  1.883 ms (5 allocations: 7.63 MiB)

Closes #247

@kimikage kimikage mentioned this pull request Aug 13, 2021
19 tasks
@codecov
Copy link

codecov bot commented Aug 13, 2021

Codecov Report

Merging #263 (41d50f6) into master (bd4bad2) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #263      +/-   ##
==========================================
+ Coverage   83.80%   83.89%   +0.08%     
==========================================
  Files           8        8              
  Lines         735      739       +4     
==========================================
+ Hits          616      620       +4     
  Misses        119      119              
Impacted Files Coverage Δ
src/operations.jl 98.49% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd4bad2...41d50f6. Read the comment docs.

This also makes it possible to omit specifying the `init` value.
@kimikage
Copy link
Collaborator Author

After sorting out the handling of Number input, let's decide if we want to support multiple iterators. (cf. #207, #247 (comment))
The conventional style (v0) is also available for now.

@kimikage kimikage merged commit 38bb9dc into JuliaGraphics:master Aug 15, 2021
@kimikage kimikage deleted the reduce_init branch August 15, 2021 00:18
@johnnychen94
Copy link
Member

I'm very much in favor of mapc/mapreducec with multiple iterators, it makes color types more like iterator without breaking their atomic/non-broadcastable property.

johnnychen94 added a commit that referenced this pull request May 15, 2022
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.

init keyword for reducec and mapreducec
3 participants