@@ -77,7 +77,8 @@ mutable struct LookAheadLanczosDecomp{OpT, OptT, VecT, MatT, ElT, ElRT}
7777 # Eq. 3.14
7878 E:: BlockDiagonal{ElT, Matrix{ElT}}
7979 # Defined after Eq. 5.1
80- F:: Matrix{ElT}
80+ Flastcol:: Vector{ElT} # size n
81+ Flastrow:: Vector{ElT} # size n-1
8182 F̃lastcol:: Vector{ElT}
8283 # Eq. 5.1
8384 G:: Vector{ElT}
@@ -184,7 +185,8 @@ function LookAheadLanczosDecomp(
184185 G = Vector {elT} ()
185186 H = Vector {elT} ()
186187
187- F = Matrix {elT} (undef, 0 , 0 )
188+ Flastcol = Vector {elT} ()
189+ Flastrow = Vector {elT} ()
188190 F̃lastcol = Vector {elT} ()
189191
190192 U = UpperTriangular (Matrix {elT} (undef, 0 , 0 ))
@@ -222,7 +224,7 @@ function LookAheadLanczosDecomp(
222224 qtAp, w̃tṽ, wtv,
223225 normp, normq, ρ, ξ,
224226 γ,
225- D, E, F , F̃lastcol, G, H,
227+ D, E, Flastcol, Flastrow , F̃lastcol, G, H,
226228 U, L,
227229 n, k, l, kstar, lstar, mk, nl,
228230 false , false , nA, nA,
@@ -438,9 +440,9 @@ function _update_D!(ld)
438440 if isone (ld. n) || _VW_block_size (ld) == 1
439441 _start_new_block! (ld. D, ld. wtv)
440442 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)
444446 end
445447 return ld
446448end
@@ -464,13 +466,8 @@ function _update_Flastrow!(ld)
464466 # F_{n} = D_{n}L[1:n, 1:n] + l[n+1, n]D_{n}[1:n, n+1][0 ... 0 1]
465467 # TODO : block
466468 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 ]
474471 end
475472end
476473
@@ -603,7 +600,7 @@ function _update_E!(ld)
603600 _start_new_block! (ld. E, ld. qtAp)
604601 else
605602 Γ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)
607604 Elastcol = (transpose (Elastrow) .* ld. γ[1 : n- 1 ] ./ ld. γ[n])
608605 _grow_last_block! (ld. E, Elastcol, Elastrow, ld. qtAp)
609606 end
@@ -624,9 +621,9 @@ function _update_Flastcol!(ld)
624621 ΓUtinvΓ = ld. γ .* transpose (ld. U) ./ transpose (ld. γ)
625622 # length n, ld.F_lastrow of length n-1
626623 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 )
628625 else
629- ld. F[:, end ] . = ΓUtinvΓ * ld. E[:, end ]
626+ ld. Flastcol = ΓUtinvΓ * ld. E[:, end ]
630627 end
631628 return ld
632629end
@@ -638,10 +635,10 @@ function _update_L!(ld, innerv)
638635 for i = lstar: l- 1
639636 block_start = nl[i]
640637 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]
642639 end
643640 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 ]
645642 end
646643 if isone (n)
647644 ld. L = UpperHessenberg (
0 commit comments