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

Tweaks of sum functions #7013

Merged
merged 5 commits into from
May 28, 2014
Merged

Tweaks of sum functions #7013

merged 5 commits into from
May 28, 2014

Conversation

lindahua
Copy link
Contributor

Some internal refactoring. To make handling of summing over empty array or singleton arrays consistent (and more efficient for when the elements are commonly used types).

addzero(x::SumResultNumber) = x

sumzero{T<:AbstractArray}(::Type{T}) = error("Summing over an empty collection of arrays is not allowed.")
addzero{T<:AbstractArray}(a::Type{T}) = a
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be:

addzero(a::AbstractArray) = a

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

lindahua added a commit that referenced this pull request May 28, 2014
@lindahua lindahua merged commit af13164 into JuliaLang:master May 28, 2014
@stevengj
Copy link
Member

We might want to use some of this in #6994 too.

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.

2 participants