From cc8adc222bb615ea33958a41f3db5731d2bf0b90 Mon Sep 17 00:00:00 2001 From: nHackel Date: Fri, 16 Feb 2024 11:52:50 +0100 Subject: [PATCH] Test scale b with weights for Kaczmarz --- src/Kaczmarz.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Kaczmarz.jl b/src/Kaczmarz.jl index 48c8f8d5..e4f6283a 100644 --- a/src/Kaczmarz.jl +++ b/src/Kaczmarz.jl @@ -129,13 +129,13 @@ function init!(solver::Kaczmarz, b; x0 = 0) if solver.shuffleRows shuffle!(solver.rowIndexCycle) end - solver.u .= b # start vector solver.x .= x0 solver.vl .= 0 weights = solverweights(solver) + solver.u .= b ./(weights) for (i, weight) = enumerate(weights[solver.rowindex]) solver.ɛw[i] = sqrt(λ_) / weight end @@ -174,6 +174,7 @@ function iterate(solver::Kaczmarz, iteration::Int=0) end iterate_row_index(solver::Kaczmarz, A::AbstractLinearSolver, row, index) = iterate_row_index(solver, Matrix(A[row, :]), row, index) +iterate_row_index(solver::Kaczmarz, A::ProdOp{T, <:WeightingOp, matT}, row, index) where {T, matT} = iterate_row_index(solver, A.B, row, index) function iterate_row_index(solver::Kaczmarz, A, row, index) solver.τl = dot_with_matrix_row(A,solver.x,row) solver.αl = solver.denom[index]*(solver.u[row]-solver.τl-solver.ɛw[index]*solver.vl[row]) @@ -220,7 +221,7 @@ function initkaczmarz(A,λ) for (i, weight) in enumerate(weights) s² = rownorm²(A,i)*weight^2 if s²>0 - push!(denom,1/(s²+(λ/weight))) + push!(denom,1/(s²+(λ/weight^2))) push!(rowindex,i) end end