Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Jun 25, 2024
1 parent 487e356 commit bc1396a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/sd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ function build_constraint(error_fn::Function, ::AbstractMatrix, ::Zeros)
"Unsupported matrix in vector-valued set. Did you mean to use the " *
"broadcasting syntax `.==` for element-wise equality? Alternatively, " *
"this syntax is supported in the special case that the matrices are " *
"`LinearAlgebra.Symmetric` or `LinearAlgebra.Hermitian`.",
"`Array`, `LinearAlgebra.Symmetric`, or `LinearAlgebra.Hermitian`.",
)
end

Expand Down Expand Up @@ -694,11 +694,7 @@ function build_constraint(
)
end

function build_constraint(
error_fn::Function,
f::Union{Array,LinearAlgebra.Symmetric},
set::Zeros,
)
function build_constraint(error_fn::Function, f::Array, set::Zeros)
s = shape(f)
x = vectorize(f, s)
return VectorConstraint(x, moi_set(set, length(x)), s)
Expand Down
7 changes: 4 additions & 3 deletions test/test_macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1977,15 +1977,16 @@ function test_matrix_in_vector_set()
),
@constraint(model, X <= A),
)
B = Containers.DenseAxisArray(A, 2:3, 2:3)
@test_throws_runtime(
ErrorException(
"In `@constraint(model, X == A)`: " *
"In `@constraint(model, X == B)`: " *
"Unsupported matrix in vector-valued set. Did you mean to use the " *
"broadcasting syntax `.==` for element-wise equality? Alternatively, " *
"this syntax is supported in the special case that the matrices are " *
"`LinearAlgebra.Symmetric` or `LinearAlgebra.Hermitian`.",
"`Array`, `LinearAlgebra.Symmetric`, or `LinearAlgebra.Hermitian`.",
),
@constraint(model, X == A),
@constraint(model, X == B),
)
return
end
Expand Down

0 comments on commit bc1396a

Please sign in to comment.