-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Multiplying JuMP expression with UniformScaling absorbs the matrix #3553
Comments
I don't know what we can or should do here. The answer is to force people to use |
I don't really want to add |
Yes it seems like a rabbit hole. Maybe we could try to convince LinearAlgebra to accept Any instead of Number. I think they thought that they are only implementing * with Number. This is fine but they can still allow Any in the constructor when it's called explicitly. In a Matrix they didn't force the entries to be Number so why do it in UniformScaling ? |
Perhaps open an issue? This will be easier with upgradable stdlibs. |
Closing as too hard to fix. It can't be a common issue, because I don't remember it coming up on Discourse. |
Could this give a better error message? For example, Base.:-(a::Matrix, b::Union{JuMP.GenericVariableRef, JuMP.GenericAffExpr}) = error(
"Subtraction between a Matrix and a JuMP variable is not supported: instead of A - x, " *
"do A .- x for element-wise subtraction, or if you are modifying the diagonal entries of the matrix " *
" do A - x * LinearAlgebra.I(n), where n is the diagonal length."
) |
Yes, I think such error message for |
x * I
cannot be aUniformScaling
since the scaling should be aNumber
but and we cannot create aDiagonal([x, x, ...])
since we don't know yet what is the dimension we'll need.The text was updated successfully, but these errors were encountered: