You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compute real matrix logarithm and matrix square root using real arithmetic (JuliaLang#39973)
* Add failing test
* Add sylvester methods for small matrices
* Add 2x2 real matrix square root
* Add real square root of quasitriangular matrix
* Simplify 2x2 real square root
* Rename functions to use quasitriu
* Avoid NaNs when eigenvalues are all zero
* Reuse ranges
* Add clarifying comments
* Unify real and complex matrix square root
* Add reference for real sqrt
* Move quasitriu auxiliary functions to triangular.jl
* Ensure loops are type-stable and use simd
* Remove duplicate computation
* Correctly promote for dimensionful A
* Use simd directive
* Test that UpperTriangular is returned by sqrt
* Test sqrt for UnitUpperTriangular
* Test that return type is complex when input type is
* Test that output is complex when input is
* Add failing test
* Separate type-stable from type-unstable part
* Use generic sqrt_quasitriu for sqrt triu
* Avoid redundant matmul
* Clarify comment
* Return complex output for complex input
* Call log_quasitriu
* Add failing test for log type-inferrability
* Realify or complexify as necessary
* Call sqrt_quasitriu directly
* Refactor sqrt_diag!
* Simplify utility function
* Add comment
* Compute accurate block-diagonal
* Compute superdiagonal for quasi triu A0
* Compute accurate block superdiagonal
* Avoid full LU decomposition in inner loop
* Avoid promotion to improve type-stability
* Modify return type if necessary
* Clarify comment
* Add comments
* Call log_quasitriu on quasitriu matrices
* Document quasi-triangular algorithm
* Remove test
This matrix has eigenvalues to close to zero that its eltype is not stable
* Rearrange definition
* Add compatibility for unit triangular matrices
* Release constraints on tests
* Separate copying of A from log computation
* Revert "Separate copying of A from log computation"
This reverts commit 23becc5.
* Use Givens rotations
* Compute Schur in-place when possible
* Always allocate a copy
* Fix block indexing
* Compute sqrt in-place
* Overwrite AmI
* Reduce allocations in Pade approximation
* Use T
* Don't unnecessarily unwrap
* Test remaining log branches
* Add additional matrix square root tests
* Separate type-unstable from type-stable part
This substantially reduces allocations for some reason
* Use Ref instead of a Vector
* Eliminate allocation in checksquare
* Refactor param choosing code to own function
* Comment section
* Use more descriptive variable name
* Reuse temporaries
* Add reference
* More accurately describe condition
Copy file name to clipboardexpand all lines: stdlib/LinearAlgebra/src/dense.jl
+82-43
Original file line number
Diff line number
Diff line change
@@ -679,7 +679,7 @@ function rcswap!(i::Integer, j::Integer, X::StridedMatrix{<:Number})
679
679
end
680
680
681
681
"""
682
-
log(A{T}::StridedMatrix{T})
682
+
log(A::StridedMatrix)
683
683
684
684
If `A` has no negative real eigenvalue, compute the principal matrix logarithm of `A`, i.e.
685
685
the unique matrix ``X`` such that ``e^X = A`` and ``-\\pi < Im(\\lambda) < \\pi`` for all
@@ -688,9 +688,10 @@ matrix function is returned whenever possible.
688
688
689
689
If `A` is symmetric or Hermitian, its eigendecomposition ([`eigen`](@ref)) is
690
690
used, if `A` is triangular an improved version of the inverse scaling and squaring method is
691
-
employed (see [^AH12] and [^AHR13]). For general matrices, the complex Schur form
692
-
([`schur`](@ref)) is computed and the triangular algorithm is used on the
693
-
triangular factor.
691
+
employed (see [^AH12] and [^AHR13]). If `A` is real with no negative eigenvalues, then
692
+
the real Schur form is computed. Otherwise, the complex Schur form is computed. Then
693
+
the upper (quasi-)triangular algorithm in [^AHR13] is used on the upper (quasi-)triangular
694
+
factor.
694
695
695
696
[^AH12]: Awad H. Al-Mohy and Nicholas J. Higham, "Improved inverse scaling and squaring algorithms for the matrix logarithm", SIAM Journal on Scientific Computing, 34(4), 2012, C153-C169. [doi:10.1137/110852553](https://doi.org/10.1137/110852553)
696
697
@@ -713,27 +714,28 @@ function log(A::StridedMatrix)
0 commit comments