Skip to content

Commit

Permalink
Function barriers
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVandH committed Jul 6, 2024
1 parent 563e0b6 commit 550a03a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/banded/bidiagonalconjugation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ function copy(data::BidiagonalConjugationData)
return BidiagonalConjugationData(copy(U), copy(C), copy(dv), copy(ev), uplo, datasize)
end

function _compute_column_up!(data::BidiagonalConjugationData, i)
U, C = data.U, data.C
function _compute_column_up!(data::BidiagonalConjugationData, U, C, i)
dv, ev = data.dv, data.ev
if i == 1
dv[i] = C[1, 1] / U[1, 1]
Expand All @@ -51,8 +50,7 @@ function _compute_column_up!(data::BidiagonalConjugationData, i)
return data
end

function _compute_column_lo!(data::BidiagonalConjugationData, i)
U, C = data.U, data.C
function _compute_column_lo!(data::BidiagonalConjugationData, U, C, i)
dv, ev = data.dv, data.ev
uᵢᵢ, uᵢ₊₁ᵢ, uᵢᵢ₊₁, uᵢ₊₁ᵢ₊₁ = U[i, i], U[i+1, i], U[i, i+1], U[i+1, i+1]
cᵢᵢ, cᵢ₊₁ᵢ = C[i, i], C[i+1, i]
Expand All @@ -65,8 +63,14 @@ end
function _compute_columns!(data::BidiagonalConjugationData, i)
ds = data.datasize
up = data.uplo == 'U'
U, C = data.U, data.C # Treat _compute_column_(up/lo) as function barriers and take these out early
return __compute_columns!(data, U, C, i)
end
function __compute_columns!(data::BidiagonalConjugationData, U, C, i)
ds = data.datasize
up = data.uplo == 'U'
for j in (ds+1):i
up ? _compute_column_up!(data, j) : _compute_column_lo!(data, j)
up ? _compute_column_up!(data, U, C, j) : _compute_column_lo!(data, U, C, j)
end
data.datasize = i
return data
Expand Down

0 comments on commit 550a03a

Please sign in to comment.