-
Notifications
You must be signed in to change notification settings - Fork 12
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
Correct adjoint for truncated SVD #15
Merged
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c390bec
Add truncated SVD adjoint with wrapper for KrylovKit iterative SVD, a…
pbrehmer 51507ce
Use KrylovKit.linsolve for truncation linear problem, make loss funct…
pbrehmer d3a31fb
Improve loss function, compare SVD gradient with TensorKit.tsvd gradient
pbrehmer 8ac307e
Update SVD adjoint linear problem to use Tuple and remove reshapes
pbrehmer 80db1c0
Fix ZeroTangent case for linear problem
pbrehmer ae96298
Add SVD wrapper structs and function, utilize tsvd machinery, convert…
pbrehmer 78ab152
Copy ctmrg.jl from master, add svdalg field to CTMRG, use svdwrap in …
pbrehmer dc6ad2b
Merge branch 'master' into svd_adjoint
lkdvos fc6600e
Use KrylovKit implementation of eigsolve instead of eigsolve.jl, dele…
pbrehmer 823f52e
Add IterSVD _tsvd! method and adjoint using KrylovKit.svdsolve adjoint
pbrehmer a615b4a
Add PEPSKit.tsvd wrapper, fix IterSVD adjoint
pbrehmer a815e41
Add TensorKit compat entry for softened tsvd type restrictions
pbrehmer 447bfd8
Add ProjectorAlg and refactor all tests and examples
pbrehmer bbd132d
Update MPSKit compat
lkdvos 0c03cd4
Replace tsvd with tsvd!, add views to IterSVD adjoint
pbrehmer 14f0065
Improve IterSVD allocation, implement CTMRG convenience constructor, …
pbrehmer 9b2c4b7
Fix tests
pbrehmer 0c13d47
Add block-wise dense fallback option
pbrehmer 538652d
Add SVDrrule wrapper, add separate adjoint structs and rrules, update…
pbrehmer 7032ed0
Add IterSVD test for symmetric tensor with fallback
pbrehmer 66a827e
Merge branch 'master' into svd_adjoint
pbrehmer d09561f
Formatting
pbrehmer b3a0726
Fix missing cnext in ctmrg, update README example
pbrehmer 89ae0a4
Rename DenseSVDAdjoint, update svd_wrapper test
pbrehmer 25d198c
Make CRCExt extension backwards compatible with v1.8
pbrehmer 6b818e7
Replace SVDrrule with SVDAdjoint, clean up adjoint algorithms
pbrehmer bb96664
Small cleanup
lkdvos fa7a56a
Update minimal julia version 1.9
lkdvos 6df8efc
Remove duplicate line in left_move
pbrehmer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep this
alg_rrule
separate, maybe re-using thehook_pullback
interface, to decouple the implementation of the forward and backward rulesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in terms of usability, I think the SVD algorithm struct would be the best way to set the SVD adjoint parameters. So if I were to use
hook_pullback
in this case, I would need to store thealg_rrule
andlorentz_broad
settings in theCTMRG
struct, which I also don't like that much.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, that's a very good point.
How about a wrapper then?
In this case, we still at least semantically separate the rrule from the forward pass (which I really like), while also grouping them together, which I also quite like. It also looks to me to be quite flexible.
I think we should probably investigate (not just here, but throughout PEPSKit), if we want to include the truncation algorithm here or as a separate field. My guess would be that it's actually not a bad idea to keep them separate, considering we presumably might want to have varying
truncspace
settings throughout the unit cell, without changing the SVD algorithm.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now added such a wrapper. It leads to the cool thing that you can easily choose the rrule with the corresponding algorithm struct and this decouples the forward SVD algorithm and its reverse rule. I decided to hide the
lorentz_broadening
away inside therrule_alg
since in general Lorentzian broadening might not be needed in every SVD implementation.The only thing I'm unsure about is the naming; maybe something like
SVDWithRrule
,SVDWithAdjoint
,DiffSVD
orDifferentiableSVD
would be more descriptive?