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

Ignore terms with a zero coefficient when adding to an OrderedDict #1947

Merged
merged 2 commits into from
Apr 19, 2019

Conversation

odow
Copy link
Member

@odow odow commented Apr 18, 2019

This addresses the TODO listed in _add_or_set!.

The answer is not to call drop_zeros, but just to exclude terms with a zero coefficient. Thus, x + 0y will return x, but x + y - y will return x + 0 y.

Closes #1946.

src/aff_expr.jl Outdated Show resolved Hide resolved
@angeris
Copy link

angeris commented Apr 18, 2019

I think this is generally expected behavior (vs. not dropping zeros), especially in the case of sparse matrix multiplication :)

Anyways, thanks again !

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1947 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1947      +/-   ##
==========================================
+ Coverage   91.03%   91.03%   +<.01%     
==========================================
  Files          32       32              
  Lines        3980     3982       +2     
==========================================
+ Hits         3623     3625       +2     
  Misses        357      357
Impacted Files Coverage Δ
src/aff_expr.jl 88.28% <100%> (+0.18%) ⬆️

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 79f279a...eaad57f. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1947 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1947      +/-   ##
==========================================
+ Coverage   91.03%   91.03%   +<.01%     
==========================================
  Files          32       32              
  Lines        3980     3982       +2     
==========================================
+ Hits         3623     3625       +2     
  Misses        357      357
Impacted Files Coverage Δ
src/aff_expr.jl 88.28% <100%> (+0.18%) ⬆️

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 79f279a...eaad57f. Read the comment docs.

@odow odow merged commit fd5ea00 into master Apr 19, 2019
@odow odow deleted the od/perf_iszero branch April 19, 2019 13:16
@blegat blegat added the Backports: 0.19 Change should be backported to release-0.19 label May 10, 2019
mlubin pushed a commit that referenced this pull request May 12, 2019
…1947)

* Ignore terms with a zero coefficient when adding to an `OrderedDict`,
such as that used by `GenericAffExpr`.

* Clarify that 0 coefficients are a no-op
@mlubin mlubin removed the Backports: 0.19 Change should be backported to release-0.19 label May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Extreme performance degradation from v0.18.5 -> v0.19
4 participants