|
6 | 6 | gauge_atol::Real = default_pullback_gauge_atol(ΔUSVᴴ[1], ΔUSVᴴ[3]) |
7 | 7 | ) |
8 | 8 |
|
9 | | -Adds the pullback from the SVD of `A` to `ΔA` given the output USVᴴ of `svd_compact` or |
| 9 | +Adds the pullback from the SVD of `A` to `ΔA` given the output `USVᴴ` of `svd_compact` or |
10 | 10 | `svd_full` and the cotangent `ΔUSVᴴ` of `svd_compact`, `svd_full` or `svd_trunc`. |
11 | 11 |
|
12 | 12 | In particular, it is assumed that `A ≈ U * S * Vᴴ`, or thus, that no singular values with |
@@ -201,3 +201,29 @@ function svd_trunc_pullback!( |
201 | 201 | ΔA = mul!(ΔA, U, Y' * Ṽᴴ, 1, 1) |
202 | 202 | return ΔA |
203 | 203 | end |
| 204 | + |
| 205 | +""" |
| 206 | + svd_vals_pullback!( |
| 207 | + ΔA, A, USVᴴ, ΔS, [ind]; |
| 208 | + rank_atol::Real = default_pullback_rank_atol(USVᴴ[2]), |
| 209 | + degeneracy_atol::Real = default_pullback_rank_atol(USVᴴ[2]) |
| 210 | + ) |
| 211 | +
|
| 212 | +
|
| 213 | +Adds the pullback from the singular values of `A` to `ΔA`, given the output |
| 214 | +`USVᴴ` of `svd_compact`, and the cotangent `ΔS` of `svd_vals`. |
| 215 | +
|
| 216 | +In particular, it is assumed that `A ≈ U * S * Vᴴ`, or thus, that no singular values with |
| 217 | +magnitude less than `rank_atol` are missing from `S`. For the cotangents, an arbitrary |
| 218 | +number of singular vectors or singular values can be missing, i.e. for a matrix `A` with |
| 219 | +size `(m, n)`, `diagview(ΔS)` can have length `pS`. In those cases, additionally `ind` is required to |
| 220 | +specify which singular vectors and values are present in `ΔS`. |
| 221 | +""" |
| 222 | +function svd_vals_pullback!( |
| 223 | + ΔA, A, USVᴴ, ΔS, ind = Colon(); |
| 224 | + rank_atol::Real = default_pullback_rank_atol(USVᴴ[2]), |
| 225 | + degeneracy_atol::Real = default_pullback_rank_atol(USVᴴ[2]) |
| 226 | + ) |
| 227 | + ΔUSVᴴ = (nothing, diagonal(ΔS), nothing) |
| 228 | + return svd_pullback!(ΔA, A, USVᴴ, ΔUSVᴴ, ind; rank_atol, degeneracy_atol) |
| 229 | +end |
0 commit comments