diff --git a/stdlib/LinearAlgebra/src/triangular.jl b/stdlib/LinearAlgebra/src/triangular.jl index 07a28f7f575a02..20353d25ff9d39 100644 --- a/stdlib/LinearAlgebra/src/triangular.jl +++ b/stdlib/LinearAlgebra/src/triangular.jl @@ -1551,7 +1551,7 @@ end # Higham and Lin, "An improved Schur-Padé algorithm for fractional powers of # a matrix and their Fréchet derivatives", SIAM. J. Matrix Anal. & Appl., # 34(3), (2013) 1341–1360. -function powm!(A0::UpperTriangular{<:BlasFloat}, p::Real) +function powm!(A0::UpperTriangular, p::Real) if abs(p) >= 1 throw(ArgumentError("p must be a real number in (-1,1), got $p")) end @@ -1583,7 +1583,7 @@ function powm!(A0::UpperTriangular{<:BlasFloat}, p::Real) end copyto!(Stmp, S) mul!(S, A, c) - ldiv!(Stmp, S.data) + ldiv!(Stmp, S) c = (p - j) / (j4 - 2) for i = 1:n @@ -1591,14 +1591,14 @@ function powm!(A0::UpperTriangular{<:BlasFloat}, p::Real) end copyto!(Stmp, S) mul!(S, A, c) - ldiv!(Stmp, S.data) + ldiv!(Stmp, S) end for i = 1:n S[i, i] = S[i, i] + 1 end copyto!(Stmp, S) mul!(S, A, -p) - ldiv!(Stmp, S.data) + ldiv!(Stmp, S) for i = 1:n @inbounds S[i, i] = S[i, i] + 1 end diff --git a/stdlib/LinearAlgebra/test/dense.jl b/stdlib/LinearAlgebra/test/dense.jl index efeedf93ebd1fc..ad887dd85a0d34 100644 --- a/stdlib/LinearAlgebra/test/dense.jl +++ b/stdlib/LinearAlgebra/test/dense.jl @@ -1067,6 +1067,11 @@ end end end +@testset "BigFloat triangular real power" begin + A = Float64[3 1; 0 3] + @test A^(3/4) ≈ big.(A)^(3/4) +end + @testset "diagonal integer matrix to real power" begin A = Matrix(Diagonal([1, 2, 3])) @test A^2.3 ≈ float(A)^2.3