Skip to content

Commit 7e53b95

Browse files
committed
Rename helper to accelerative_smith_iteration! and add reference
1 parent 90af904 commit 7e53b95

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎src/common/pullbacks.jl‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ is_leading_index(ind::AbstractRange, p::Int) = ind == 1:p
3737
is_leading_index(ind::AbstractVector, p::Int) = length(ind) == p && all(ind .== 1:p)
3838

3939
"""
40-
_smith_iteration!(X, Xₙ, G, w, atol, maxiter)
40+
accelerative_smith_iteration!(X, Xₙ, G, w, atol, maxiter)
4141
4242
Solve `X = B + G * X * Diagonal(w)` by summing the Neumann series
4343
`X = Σₖ Gᵏ * B * Diagonal(w)ᵏ` by doubling (Smith's method), i.e. by repeatedly adding
@@ -47,8 +47,10 @@ for at most `maxiter` steps.
4747
On entry, `X` contains `B`, and it is overwritten with the result. `Xₙ` is used as a buffer,
4848
and `G` and `w` are overwritten. It is assumed that `w` is normalized such that
4949
`maximum(abs, w) == 1`, so that squaring it can only shrink it.
50+
51+
Reference: https://doi.org/10.1016/j.aml.2009.01.012.
5052
"""
51-
function _smith_iteration!(X, Xₙ, G, w, atol, maxiter)
53+
function accelerative_smith_iteration!(X, Xₙ, G, w, atol, maxiter)
5254
Gₙ = similar(G)
5355
for k in 1:maxiter
5456
Xₙ = rmul!(mul!(Xₙ, G, X), Diagonal(w))

‎src/pullbacks/eigh.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ function eigh_trunc_pullback!(
158158
dabsmin = minimum(abs, D)
159159
AP ./= dabsmin
160160
D⁻¹ = dabsmin ./ D
161-
X = _smith_iteration!(X₀, similar(X₀), AP, D⁻¹, degeneracy_atol, maxiter)
161+
X = accelerative_smith_iteration!(X₀, similar(X₀), AP, D⁻¹, degeneracy_atol, maxiter)
162162
Z .+= X
163163
# we cannot directly multiply Z * V' into ΔA, because we have to
164164
# take the Hermitian part, and cannot apply project_hermitian! to
165165
# the current contents of ΔA
166166
# TODO: add an `add_project_hermitian!`
167-
# recycle AP's storage, but overwrite it: `_smith_iteration!` may leave a power of AP in it
167+
# recycle AP's storage, but overwrite it: `accelerative_smith_iteration!` may leave a power of AP in it
168168
ΔA′ = project_hermitian!(mul!(AP, Z, V'))
169169
ΔA .+= ΔA′
170170
else

‎src/pullbacks/svd.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ function svd_trunc_pullback!(
255255
if m ≤ n
256256
X = rmul!(AP * Y₀ᴴ', Diagonal(S⁻¹))
257257
X .+= X₀
258-
X = _smith_iteration!(X, X₀, AP * AP', S⁻¹ .^ 2, degeneracy_atol, maxiter) # recycle X₀
258+
X = accelerative_smith_iteration!(X, X₀, AP * AP', S⁻¹ .^ 2, degeneracy_atol, maxiter) # recycle X₀
259259
Yᴴ = lmul!(Diagonal(S⁻¹), X' * AP)
260260
Yᴴ .+= Y₀ᴴ
261261
ΔA = mul!(ΔA, X, Vᴴ, 1, 1)
262262
ΔA = mul!(ΔA, U, Yᴴ, 1, 1)
263263
else
264264
Y = rmul!(AP' * X₀, Diagonal(S⁻¹))
265265
Y .+= Y₀ᴴ'
266-
Y = _smith_iteration!(Y, similar(Y), AP' * AP, S⁻¹ .^ 2, degeneracy_atol, maxiter)
266+
Y = accelerative_smith_iteration!(Y, similar(Y), AP' * AP, S⁻¹ .^ 2, degeneracy_atol, maxiter)
267267
X = rmul!(AP * Y, Diagonal(S⁻¹))
268268
X .+= X₀
269269
ΔA = mul!(ΔA, X, Vᴴ, 1, 1)

0 commit comments

Comments
 (0)