Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Standard library changes
Custom array types may specialize this function to return an appropriate result ([#55252]).
* The matrix multiplication `A * B` calls `matprod_dest(A, B, T::Type)` to generate the destination.
This function is now public ([#55537]).
* Now `exp(log(A))` for matrix `A` correctly returns `A`, up to numerical precision ([#56311]).

#### Logging

Expand Down
5 changes: 5 additions & 0 deletions stdlib/LinearAlgebra/src/triangular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,11 @@ end
# SIAM J. Sci. Comput., 34(4), (2012) C153–C169. doi: 10.1137/110852553
# Algorithm 5.1
Base.@propagate_inbounds function _sqrt_pow_diag_block_2x2!(A, A0, s)
if iszero(s)
A[1,1] -= 1
A[2,2] -= 1
return
end
_sqrt_real_2x2!(A, A0)
if isone(s)
A[1,1] -= 1
Expand Down
10 changes: 10 additions & 0 deletions stdlib/LinearAlgebra/test/triangular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1386,4 +1386,14 @@ end
end
end

@testset "log_quasitriu with internal scaling s=0 (issue #54833)" begin
M = [0.9949357359852791 -0.015567763143324862 -0.09091193493947397 -0.03994428739762443 0.07338356301650806;
0.011813655598647289 0.9968988574699793 -0.06204555000202496 0.04694097614450692 0.09028834462782365;
0.092737943594701 0.059546719185135925 0.9935850721633324 0.025348893985651405 -0.018530261590167685;
0.0369187299165628 -0.04903571106913449 -0.025962938675946543 0.9977767446862031 0.12901494726320517;
0.0 0.0 0.0 0.0 1.0]

@test exp(log(M)) ≈ M
end

end # module TestTriangular