@@ -77,7 +77,8 @@ mutable struct LookAheadLanczosDecomp{OpT, OptT, VecT, MatT, ElT, ElRT}
77
77
# Eq. 3.14
78
78
E:: BlockDiagonal{ElT, Matrix{ElT}}
79
79
# Defined after Eq. 5.1
80
- F:: Matrix{ElT}
80
+ Flastcol:: Vector{ElT} # size n
81
+ Flastrow:: Vector{ElT} # size n-1
81
82
F̃lastcol:: Vector{ElT}
82
83
# Eq. 5.1
83
84
G:: Vector{ElT}
@@ -184,7 +185,8 @@ function LookAheadLanczosDecomp(
184
185
G = Vector {elT} ()
185
186
H = Vector {elT} ()
186
187
187
- F = Matrix {elT} (undef, 0 , 0 )
188
+ Flastcol = Vector {elT} ()
189
+ Flastrow = Vector {elT} ()
188
190
F̃lastcol = Vector {elT} ()
189
191
190
192
U = UpperTriangular (Matrix {elT} (undef, 0 , 0 ))
@@ -222,7 +224,7 @@ function LookAheadLanczosDecomp(
222
224
qtAp, w̃tṽ, wtv,
223
225
normp, normq, ρ, ξ,
224
226
γ,
225
- D, E, F , F̃lastcol, G, H,
227
+ D, E, Flastcol, Flastrow , F̃lastcol, G, H,
226
228
U, L,
227
229
n, k, l, kstar, lstar, mk, nl,
228
230
false , false , nA, nA,
@@ -438,9 +440,9 @@ function _update_D!(ld)
438
440
if isone (ld. n) || _VW_block_size (ld) == 1
439
441
_start_new_block! (ld. D, ld. wtv)
440
442
else
441
- D_lastcol = (ld. F[:, end ] - (ld. D * ld. L[1 : end - 1 , end ])) / ld. ρ
442
- D_lastrow = transpose (D_lastcol * ld. γ[end ] ./ ld. γ[1 : end - 1 ])
443
- _grow_last_block! (ld. D, D_lastcol, D_lastrow , ld. wtv)
443
+ Dlastcol = (ld. Flastcol - (ld. D * ld. L[1 : end - 1 , end ])) / ld. ρ
444
+ Dlastrow = transpose (Dlastcol * ld. γ[end ] ./ ld. γ[1 : end - 1 ])
445
+ _grow_last_block! (ld. D, Dlastcol, Dlastrow , ld. wtv)
444
446
end
445
447
return ld
446
448
end
@@ -464,13 +466,8 @@ function _update_Flastrow!(ld)
464
466
# F_{n} = D_{n}L[1:n, 1:n] + l[n+1, n]D_{n}[1:n, n+1][0 ... 0 1]
465
467
# TODO : block
466
468
if ! isone (ld. n) # We only need to do this if we are constructing a block
467
- Flastrow = ld. D[end : end , :] * ld. L
468
- ld. F̃lastcol = reshape (Flastrow, :) .* ld. γ[1 : end - 1 ] ./ ld. γ[end ]
469
- # we are not able to fill in the last column yet, so we fill with zero
470
- ld. F = [
471
- ld. F fill (0.0 , size (ld. F, 1 ))
472
- Flastrow 0.0
473
- ]
469
+ ld. Flastrow = reshape (ld. D[end : end , :] * ld. L, :)
470
+ ld. F̃lastcol = ld. Flastrow .* ld. γ[1 : end - 1 ] ./ ld. γ[end ]
474
471
end
475
472
end
476
473
@@ -603,7 +600,7 @@ function _update_E!(ld)
603
600
_start_new_block! (ld. E, ld. qtAp)
604
601
else
605
602
ΓUtinvΓ = ld. γ .* transpose (ld. U) ./ transpose (ld. γ)
606
- Elastrow = (ΓUtinvΓ[end , end ] \ ld. F[n : n , 1 : n - 1 ] - ΓUtinvΓ[end : end , 1 : end - 1 ]* ld. E)
603
+ Elastrow = (ΓUtinvΓ[end , end ] \ reshape ( ld. Flastrow , 1 , :) - ΓUtinvΓ[end : end , 1 : end - 1 ]* ld. E)
607
604
Elastcol = (transpose (Elastrow) .* ld. γ[1 : n- 1 ] ./ ld. γ[n])
608
605
_grow_last_block! (ld. E, Elastcol, Elastrow, ld. qtAp)
609
606
end
@@ -624,9 +621,9 @@ function _update_Flastcol!(ld)
624
621
ΓUtinvΓ = ld. γ .* transpose (ld. U) ./ transpose (ld. γ)
625
622
# length n, ld.F_lastrow of length n-1
626
623
if isone (n)
627
- ld. F = fill (ΓUtinvΓ[end , end ] * ld. E[end , end ], 1 , 1 )
624
+ ld. Flastcol = fill (ΓUtinvΓ[end , end ] * ld. E[end , end ], 1 )
628
625
else
629
- ld. F[:, end ] . = ΓUtinvΓ * ld. E[:, end ]
626
+ ld. Flastcol = ΓUtinvΓ * ld. E[:, end ]
630
627
end
631
628
return ld
632
629
end
@@ -638,10 +635,10 @@ function _update_L!(ld, innerv)
638
635
for i = lstar: l- 1
639
636
block_start = nl[i]
640
637
block_end = nl[i+ 1 ]- 1
641
- Llastcol[block_start: block_end] .= blocks (ld. D)[i] \ ld. F [block_start: block_end, end ]
638
+ Llastcol[block_start: block_end] .= blocks (ld. D)[i] \ ld. Flastcol [block_start: block_end]
642
639
end
643
640
if ! innerv
644
- Llastcol[nl[l]: end ] .= blocks (ld. D)[end ] \ ld. F [nl[l]: end , end ]
641
+ Llastcol[nl[l]: end ] .= blocks (ld. D)[end ] \ ld. Flastcol [nl[l]: end ]
645
642
end
646
643
if isone (n)
647
644
ld. L = UpperHessenberg (
0 commit comments