forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compute real matrix logarithm and matrix square root using real arith…
…metic (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
- Loading branch information
1 parent
f0e13fa
commit 59c1ce9
Showing
5 changed files
with
743 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.