diff --git a/src/lu.jl b/src/lu.jl index 1544bedb..eb98beb8 100644 --- a/src/lu.jl +++ b/src/lu.jl @@ -45,8 +45,11 @@ end @static if VERSION >= v"1.7-DEV" # disambiguation - function lu(A::StaticMatrix{N,N}, pivot::Val{true}) where {N} - Base.@invoke lu(A::StaticMatrix{N,N} where N, pivot::Union{Val{false},Val{true}}) + for p in (:true, :false) + @eval function lu(A::StaticMatrix{N,N}, pivot::Val{$p}; check = true) where {N} + Base.@invoke lu(A::StaticMatrix{N,N} where N, + pivot::Union{Val{false},Val{true}}; check) + end end end diff --git a/src/qr.jl b/src/qr.jl index d4aeb078..f05efad0 100644 --- a/src/qr.jl +++ b/src/qr.jl @@ -47,6 +47,15 @@ true end end +@static if VERSION >= v"1.7-DEV" + # disambiguation + for p in (:true, :false) + @eval function qr(A::StaticMatrix, pivot::Val{$p}) + Base.@invoke qr(A::StaticMatrix, pivot::Union{Val{false},Val{true}}) + end + end +end + function identity_perm(R::StaticMatrix{N,M,T}) where {N,M,T} return similar_type(R, Int, Size((M,)))(ntuple(x -> x, Val{M}())) end diff --git a/test/lu.jl b/test/lu.jl index 7852a733..bc5f7051 100644 --- a/test/lu.jl +++ b/test/lu.jl @@ -65,3 +65,13 @@ end @test_throws SingularException lu(A) @test !issuccess(lu(A; check = false)) end + +@testset "LU method ambiguity" begin + # Issue #920; just test that methods do not throw an ambiguity error when called + A = @SMatrix [1.0 2.0; 3.0 4.0] + @test isa(lu(A), StaticArrays.LU) + @test isa(lu(A, Val(true)), StaticArrays.LU) + @test isa(lu(A, Val(false)), StaticArrays.LU) + @test isa(lu(A; check=false), StaticArrays.LU) + @test isa(lu(A; check=true), StaticArrays.LU) +end \ No newline at end of file diff --git a/test/qr.jl b/test/qr.jl index a89fba36..f83be439 100644 --- a/test/qr.jl +++ b/test/qr.jl @@ -60,3 +60,11 @@ Random.seed!(42) test_qr(arr) end end + +@testset "QR method ambiguity" begin + # Issue #931; just test that methods do not throw an ambiguity error when called + A = @SMatrix [1.0 2.0 3.0; 4.0 5.0 6.0] + @test isa(qr(A), StaticArrays.QR) + @test isa(qr(A, Val(true)), StaticArrays.QR) + @test isa(qr(A, Val(false)), StaticArrays.QR) +end \ No newline at end of file