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
Add modified tsvd! reverse-rule with Lorentzian broadening (#181)
* Add `FullSVDReverseRule` struct for modified `tsvd!` rule from TensorKit which supports Lorentzian broadening
* Per default, broadening is activated with `Defaults.svd_rrule_broadening=1e-13`
* The rrule output verbosity can be controlled through `FullSVDReverseRule` as well
---------
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
* `svd_rrule_min_krylovdim=$(Defaults.svd_rrule_min_krylovdim)` : Minimal Krylov dimension of the reverse-rule algorithm (if it is a Krylov algorithm).
* `svd_rrule_alg=:$(Defaults.svd_rrule_alg)` : Reverse-rule algorithm for the SVD gradient.
33
-
- `:tsvd`: Uses TensorKit's reverse-rule for `tsvd` which doesn't solve any linear problem and instead requires access to the full SVD, see [TensorKit](https://github.com/Jutho/TensorKit.jl/blob/f9cddcf97f8d001888a26f4dce7408d5c6e2228f/ext/TensorKitChainRulesCoreExt/factorizations.jl#L3)
33
+
- `:full`: Uses a modified version of TensorKit's reverse-rule for `tsvd` which doesn't solve any linear problem and instead requires access to the full SVD, see [`FullSVDReverseRule`](@ref).
34
34
- `:gmres`: GMRES iterative linear solver, see the [KrylovKit docs](https://jutho.github.io/KrylovKit.jl/stable/man/algorithms/#KrylovKit.GMRES) for details
35
35
- `:bicgstab`: BiCGStab iterative linear solver, see the [KrylovKit docs](https://jutho.github.io/KrylovKit.jl/stable/man/algorithms/#KrylovKit.BiCGStab) for details
36
36
- `:arnoldi`: Arnoldi Krylov algorithm, see the [KrylovKit docs](https://jutho.github.io/KrylovKit.jl/stable/man/algorithms/#KrylovKit.Arnoldi) for details
37
+
* `svd_rrule_broadening=$(Defaults.svd_rrule_broadening)` : Lorentzian broadening amplitude which smoothens the divergent term in the SVD adjoint in case of (pseudo) degenerate singular values
SVD reverse-rule algorithm which uses a modified version of TensorKit's `tsvd!` reverse-rule
19
+
allowing for Lorentzian broadening and output verbosity control.
20
+
21
+
## Keyword arguments
22
+
23
+
* `broadening::Float64=$(Defaults.svd_rrule_broadening)`: Lorentzian broadening amplitude for smoothing divergent term in SVD derivative in case of (pseudo) degenerate singular values.
24
+
* `verbosity::Int=0`: Suppresses all output if `≤0`, print gauge dependency warnings if `1`, and always print gauge dependency if `≥2`.
Wrapper for a SVD algorithm `fwd_alg` with a defined reverse rule `rrule_alg`.
20
36
If `isnothing(rrule_alg)`, Zygote differentiates the forward call automatically.
21
-
In case of degenerate singular values, one might need a `broadening` scheme which
22
-
removes the divergences from the adjoint.
23
37
24
38
## Keyword arguments
25
39
@@ -28,16 +42,14 @@ removes the divergences from the adjoint.
28
42
- `:svd`: TensorKit's wrapper for LAPACK's `_gesvd`
29
43
- `:iterative`: Iterative SVD only computing the specifed number of singular values and vectors, see ['IterSVD'](@ref)
30
44
* `rrule_alg::Union{Algorithm,NamedTuple}=(; alg::Symbol=$(Defaults.svd_rrule_alg))`: Reverse-rule algorithm for differentiating the SVD. Can be supplied by an `Algorithm` instance directly or as a `NamedTuple` where `alg` is one of the following:
31
-
- `:tsvd`: Uses TensorKit's reverse-rule for `tsvd` which doesn't solve any linear problem and instead requires access to the full SVD, see [TensorKit](https://github.com/Jutho/TensorKit.jl/blob/f9cddcf97f8d001888a26f4dce7408d5c6e2228f/ext/TensorKitChainRulesCoreExt/factorizations.jl#L3)
45
+
- `:full`: Uses a modified version of TensorKit's reverse-rule for `tsvd` which doesn't solve any linear problem and instead requires access to the full SVD, see [`FullSVDReverseRule`](@ref).
32
46
- `:gmres`: GMRES iterative linear solver, see the [KrylovKit docs](https://jutho.github.io/KrylovKit.jl/stable/man/algorithms/#KrylovKit.GMRES) for details
33
47
- `:bicgstab`: BiCGStab iterative linear solver, see the [KrylovKit docs](https://jutho.github.io/KrylovKit.jl/stable/man/algorithms/#KrylovKit.BiCGStab) for details
34
48
- `:arnoldi`: Arnoldi Krylov algorithm, see the [KrylovKit docs](https://jutho.github.io/KrylovKit.jl/stable/man/algorithms/#KrylovKit.Arnoldi) for details
35
-
* `broadening=nothing`: Broadening of singular value differences to stabilize the SVD gradient. Currently not implemented.
36
49
"""
37
-
struct SVDAdjoint{F,R,B}
50
+
struct SVDAdjoint{F,R}
38
51
fwd_alg::F
39
52
rrule_alg::R
40
-
broadening::B
41
53
end# Keep truncation algorithm separate to be able to specify CTMRG dependent information
0 commit comments