diff --git a/src/nlp_expr.jl b/src/nlp_expr.jl index 066610bb8ba..5233165629d 100644 --- a/src/nlp_expr.jl +++ b/src/nlp_expr.jl @@ -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 diff --git a/test/test_nlp_expr.jl b/test/test_nlp_expr.jl index afc555f7da4..1bd9e0d2668 100644 --- a/test/test_nlp_expr.jl +++ b/test/test_nlp_expr.jl @@ -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