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

Remove special-cased matmul in addToExpression... #576

Merged
merged 3 commits into from
Sep 5, 2015
Merged

Conversation

joehuchette
Copy link
Contributor

...and fix some bugs it revealed.

@@ -501,13 +501,45 @@ for op in [:+, :-, :*, :/]; @eval begin
end
end; end

# Special-case sparse matrix scalar multiplicaiton
for op in [:*, :/]; @eval begin
function $op{T<:JuMPTypes}(lhs::Number,rhs::Array{T})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Whats the intuition for these things not working for SparseMatrices?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

m = Model()
@defVar(m, x)
A = SparseMatrixCSC(3, 3, [1:4;], [1:3;], [x,x,x])
B = 3A

You want B to be sparse as well, which similar gives you, but then eachindex does iteration over all elements, not just nonzeros.

joehuchette added a commit that referenced this pull request Sep 5, 2015
Remove special-cased matmul in addToExpression...
@joehuchette joehuchette merged commit 49b351c into master Sep 5, 2015
@mlubin mlubin deleted the moar-matrices branch February 6, 2017 16:20
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.

2 participants