Skip to content

Commit

Permalink
"prefer" -> "do"
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-foster committed Nov 2, 2023
1 parent ca48481 commit fb4b151
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ end
function Base.:+(A::Matrix, x::AbstractJuMPScalar)
return error(
"Addition between a Matrix and a JuMP variable is not supported: instead of `A + x`, " *
"prefer `A .+ x` for element-wise addition, or if you are modifying the diagonal entries of the matrix " *
"do `A .+ x` for element-wise addition, or if you are modifying the diagonal entries of the matrix " *
"do `A + x * LinearAlgebra.I(n)`, where `n` is the diagonal length.",
)
end
Expand All @@ -465,7 +465,7 @@ Base.:+(x::AbstractJuMPScalar, A::Matrix) = A + x
function Base.:-(A::Matrix, x::AbstractJuMPScalar)
return error(
"Subtraction between a Matrix and a JuMP variable is not supported: instead of `A - x`, " *
"prefer `A .- x` for element-wise subtraction, or if you are modifying the diagonal entries of the matrix " *
"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.",
)
end
Expand Down
8 changes: 4 additions & 4 deletions test/test_operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -632,31 +632,31 @@ function test_matrix_abstractscalar_add()
@test_throws(
ErrorException(
"Addition between a Matrix and a JuMP variable is not supported: instead of `A + x`, " *
"prefer `A .+ x` for element-wise addition, or if you are modifying the diagonal entries of the matrix " *
"do `A .+ x` for element-wise addition, or if you are modifying the diagonal entries of the matrix " *
"do `A + x * LinearAlgebra.I(n)`, where `n` is the diagonal length.",
),
A + x
),
@test_throws(
ErrorException(
"Addition between a Matrix and a JuMP variable is not supported: instead of `A + x`, " *
"prefer `A .+ x` for element-wise addition, or if you are modifying the diagonal entries of the matrix " *
"do `A .+ x` for element-wise addition, or if you are modifying the diagonal entries of the matrix " *
"do `A + x * LinearAlgebra.I(n)`, where `n` is the diagonal length.",
),
x + A
),
@test_throws(
ErrorException(
"Subtraction between a Matrix and a JuMP variable is not supported: instead of `A - x`, " *
"prefer `A .- x` for element-wise subtraction, or if you are modifying the diagonal entries of the matrix " *
"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.",
),
A - x
),
@test_throws(
ErrorException(
"Subtraction between a Matrix and a JuMP variable is not supported: instead of `A - x`, " *
"prefer `A .- x` for element-wise subtraction, or if you are modifying the diagonal entries of the matrix " *
"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.",
),
x - A
Expand Down

0 comments on commit fb4b151

Please sign in to comment.