Skip to content

Commit

Permalink
Fix UnsupportedNonlinearOperator error for LinearAlgebra.norm
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Nov 1, 2024
1 parent 11df2db commit 3c8351e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/nlp_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,10 @@ function LinearAlgebra.logdet(::AbstractMatrix{<:AbstractJuMPScalar})
return throw(MOI.UnsupportedNonlinearOperator(:logdet))
end

function LinearAlgebra.norm(::AbstractArray{<:AbstractJuMPScalar})
return throw(MOI.UnsupportedNonlinearOperator(:norm))
end

function LinearAlgebra.norm(::AbstractArray{<:AbstractJuMPScalar}, ::Real)
return throw(MOI.UnsupportedNonlinearOperator(:norm))
end
Expand Down
1 change: 1 addition & 0 deletions test/test_nlp_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ function test_linear_algebra_errors()
@test_throws MOI.UnsupportedNonlinearOperator LinearAlgebra.qr(x)
y = 2.0 .* x[:, 2] .+ 1.0
@test_throws MOI.UnsupportedNonlinearOperator LinearAlgebra.norm(y)
@test_throws MOI.UnsupportedNonlinearOperator LinearAlgebra.norm(y, 2)
@test_throws MOI.UnsupportedNonlinearOperator LinearAlgebra.nullspace(y)
return
end
Expand Down

0 comments on commit 3c8351e

Please sign in to comment.