diff --git a/stdlib/LinearAlgebra/src/dense.jl b/stdlib/LinearAlgebra/src/dense.jl index a1e8997d68659..e4da87a876835 100644 --- a/stdlib/LinearAlgebra/src/dense.jl +++ b/stdlib/LinearAlgebra/src/dense.jl @@ -1222,6 +1222,8 @@ function factorize(A::StridedMatrix{T}) where T end qrfact(A, Val(true)) end +factorize(A::Adjoint) = adjoint(factorize(parent(A))) +factorize(A::Transpose) = transpose(factorize(parent(A))) ## Moore-Penrose pseudoinverse diff --git a/stdlib/LinearAlgebra/test/dense.jl b/stdlib/LinearAlgebra/test/dense.jl index 0a1dd9ab0ab9e..41fbdcdcb68ad 100644 --- a/stdlib/LinearAlgebra/test/dense.jl +++ b/stdlib/LinearAlgebra/test/dense.jl @@ -847,4 +847,17 @@ end end end +@testset "inverse of Adjoint" begin + A = randn(n, n) + + @test inv(A')*A' ≈ I + @test inv(transpose(A))*transpose(A) ≈ I + + B = complex.(A, randn(n, n)) + B = B + transpose(B) + + @test_broken inv(B')*B' ≈ I + @test_broken inv(transpose(B))*transpose(B) ≈ I +end + end # module TestDense