-
Notifications
You must be signed in to change notification settings - Fork 14
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
Refactor sqrt_inv_sqrt
#158
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
==========================================
+ Coverage 81.89% 82.66% +0.77%
==========================================
Files 72 72
Lines 3744 3635 -109
==========================================
- Hits 3066 3005 -61
+ Misses 678 630 -48 ☔ View full report in Codecov by Sentry. |
I have to say that it doesn't sit well with me to use an SVD to perform square roots and inverses of positive semi-definite Hermitian matrices, I think it is safer and more direct (not to mention faster) to use a Hermitian eigendecomposition to ensure the gauge is fixed in the correct way. |
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Co-authored-by: Matt Fishman <[email protected]>
Looks good, thanks! Good to go back and start cleaning up some of this code. |
This PR removes the
sqrt_inv_sqrt
function inapply.jl
in favor of amap_itensor(f::Function, t::ITensors, args...)
added in the fileitensorsextensions.jl
in the new internal moduleITensorsExtensions
(wheresrc/ITensorsExt/utils.jl
is also now moved).map_itensor(f::Function, A::ITensor, ...)
uses the SVD to take a decompositionU, S, V
ofA
and appliesf
over the diagonal elements ofS
. This uses thesqrt_decomp
function fromITensors.jl
(introduced in the PR https://github.com/ITensor/ITensors.jl/pull/1197/files) which correctly handles quantum numbers. The indices of the returnedITensor
match those of the inputA
.The
symmetric_factorize
function has been removed entirely fromapply.jl
as we can just callfactorize_svd(A::ITensor; ortho = "none") from
ITensors.jl` to do the same thing (again this was introduced in PR https://github.com/ITensor/ITensors.jl/pull/1197/files).Tests are included. @mtfishman these appear to show the square root / inverse being correctly taken by the SVD backend and I don't see any phase issues cropping up?
A few other changes in this PR:
src/tensornetworkoperators.jl
andtest/test_tnos.jl
have been removed and archived as they will be significantly refactored down the line.