Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute real matrix logarithm and matrix square root using real arithmetic #39973

Merged
merged 70 commits into from
Mar 20, 2021
Merged
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
b5a1e13
Add failing test
sethaxen Mar 1, 2021
391eab5
Add sylvester methods for small matrices
sethaxen Mar 1, 2021
413290c
Add 2x2 real matrix square root
sethaxen Mar 1, 2021
cc60b10
Add real square root of quasitriangular matrix
sethaxen Mar 1, 2021
063b2e9
Simplify 2x2 real square root
sethaxen Mar 3, 2021
f384944
Rename functions to use quasitriu
sethaxen Mar 3, 2021
359c722
Avoid NaNs when eigenvalues are all zero
sethaxen Mar 3, 2021
5d2c60a
Reuse ranges
sethaxen Mar 3, 2021
7e980ed
Add clarifying comments
sethaxen Mar 3, 2021
2bb972f
Unify real and complex matrix square root
sethaxen Mar 3, 2021
e465ead
Add reference for real sqrt
sethaxen Mar 3, 2021
539b54d
Move quasitriu auxiliary functions to triangular.jl
sethaxen Mar 3, 2021
7c5ec4a
Ensure loops are type-stable and use simd
sethaxen Mar 4, 2021
e1e0484
Remove duplicate computation
sethaxen Mar 4, 2021
56a6cf9
Correctly promote for dimensionful A
sethaxen Mar 7, 2021
6f45ecb
Use simd directive
sethaxen Mar 8, 2021
20a4942
Test that UpperTriangular is returned by sqrt
sethaxen Mar 8, 2021
e39698f
Test sqrt for UnitUpperTriangular
sethaxen Mar 8, 2021
96922de
Test that return type is complex when input type is
sethaxen Mar 8, 2021
f175738
Test that output is complex when input is
sethaxen Mar 8, 2021
a47ccf4
Add failing test
sethaxen Mar 9, 2021
eb589cd
Separate type-stable from type-unstable part
sethaxen Mar 9, 2021
46561e1
Use generic sqrt_quasitriu for sqrt triu
sethaxen Mar 9, 2021
4c0799b
Avoid redundant matmul
sethaxen Mar 9, 2021
a829f81
Clarify comment
sethaxen Mar 9, 2021
c19b557
Return complex output for complex input
sethaxen Mar 9, 2021
0b53d89
Call log_quasitriu
sethaxen Mar 9, 2021
2b61405
Add failing test for log type-inferrability
sethaxen Mar 9, 2021
fd3624b
Realify or complexify as necessary
sethaxen Mar 9, 2021
0ba02c1
Call sqrt_quasitriu directly
sethaxen Mar 9, 2021
075c3bc
Refactor sqrt_diag!
sethaxen Mar 9, 2021
39411d1
Simplify utility function
sethaxen Mar 9, 2021
7141bea
Add comment
sethaxen Mar 9, 2021
435c354
Compute accurate block-diagonal
sethaxen Mar 9, 2021
7e9d0ef
Compute superdiagonal for quasi triu A0
sethaxen Mar 9, 2021
86e502e
Compute accurate block superdiagonal
sethaxen Mar 9, 2021
889fd65
Avoid full LU decomposition in inner loop
sethaxen Mar 9, 2021
3c2f567
Avoid promotion to improve type-stability
sethaxen Mar 9, 2021
2813dd1
Modify return type if necessary
sethaxen Mar 9, 2021
023e131
Clarify comment
sethaxen Mar 9, 2021
de99f00
Add comments
sethaxen Mar 9, 2021
9775592
Call log_quasitriu on quasitriu matrices
sethaxen Mar 9, 2021
e15b92e
Document quasi-triangular algorithm
sethaxen Mar 9, 2021
0ac37df
Remove test
sethaxen Mar 9, 2021
e817a37
Rearrange definition
sethaxen Mar 9, 2021
5946cbe
Add compatibility for unit triangular matrices
sethaxen Mar 9, 2021
2ee1585
Release constraints on tests
sethaxen Mar 9, 2021
37d0344
Merge branch 'master' into reallog
sethaxen Mar 9, 2021
23becc5
Separate copying of A from log computation
sethaxen Mar 10, 2021
ff9d8d7
Revert "Separate copying of A from log computation"
sethaxen Mar 10, 2021
cfa6ea1
Use Givens rotations
sethaxen Mar 10, 2021
e14a819
Compute Schur in-place when possible
sethaxen Mar 10, 2021
5d37a0f
Always allocate a copy
sethaxen Mar 10, 2021
3278edd
Fix block indexing
sethaxen Mar 10, 2021
5b96c72
Compute sqrt in-place
sethaxen Mar 10, 2021
ae6daae
Overwrite AmI
sethaxen Mar 10, 2021
f673914
Reduce allocations in Pade approximation
sethaxen Mar 10, 2021
c96a05b
Use T
sethaxen Mar 11, 2021
9db29fc
Don't unnecessarily unwrap
sethaxen Mar 11, 2021
0c475bc
Test remaining log branches
sethaxen Mar 11, 2021
96b6f3d
Add additional matrix square root tests
sethaxen Mar 11, 2021
d1da048
Separate type-unstable from type-stable part
sethaxen Mar 11, 2021
69e298d
Use Ref instead of a Vector
sethaxen Mar 19, 2021
9785686
Eliminate allocation in checksquare
sethaxen Mar 19, 2021
de1682c
Refactor param choosing code to own function
sethaxen Mar 19, 2021
27d2063
Comment section
sethaxen Mar 19, 2021
def31ba
Use more descriptive variable name
sethaxen Mar 19, 2021
cb941b1
Reuse temporaries
sethaxen Mar 19, 2021
d1d7095
Add reference
sethaxen Mar 19, 2021
de5fdd7
More accurately describe condition
sethaxen Mar 20, 2021
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
Prev Previous commit
Next Next commit
Test that output is complex when input is
sethaxen committed Mar 8, 2021
commit f175738a2fa5c658c26d405466a8199653b4c839
8 changes: 5 additions & 3 deletions stdlib/LinearAlgebra/test/dense.jl
Original file line number Diff line number Diff line change
@@ -150,9 +150,11 @@ end
@test asymsq*asymsq asym
if eltype(a) <: Real # real square root
apos = a * a
apos_sqrt = sqrt(apos)
@test apos_sqrt*apos_sqrt apos
@test eltype(apos_sqrt) <: Real
@test sqrt(apos)^2 apos
@test eltype(sqrt(apos)) <: Real
# test that real but Complex input produces Complex output
@test sqrt(complex(apos)) sqrt(apos)
@test eltype(sqrt(complex(apos))) <: Complex
end
end