Skip to content

Commit

Permalink
Fix Kaczmarz tikhonov test
Browse files Browse the repository at this point in the history
  • Loading branch information
nHackel committed Nov 26, 2024
1 parent 6e5c1db commit 178a581
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/testKaczmarz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ Random.seed!(12345)

# @show A, x, regMatrix
# use regularization matrix
S = createLinearSolver(solver, arrayType(A), iterations=100, reg=[L2Regularization(arrayType(regMatrix))])
S = createLinearSolver(Kaczmarz, arrayType(A), iterations=100, reg=[L2Regularization(arrayType(regMatrix))])
x_matrix = Array(solve!(S, arrayType(b)))

# use standard reconstruction
S = createLinearSolver(solver, arrayType(A * Diagonal(1 ./ sqrt.(regMatrix))), reg = [L2Regularization(1.0)], iterations=100)
S = createLinearSolver(Kaczmarz, arrayType(A * Diagonal(1 ./ sqrt.(regMatrix))), reg = [L2Regularization(1.0)], iterations=100)
x_approx = Array(solve!(S, arrayType(b))) ./ sqrt.(regMatrix)

# test
Expand All @@ -63,10 +63,10 @@ Random.seed!(12345)

# Compare reg. matrix of equal elements to standard reco
λ = rand()
S = createLinearSolver(solver, arrayType(A), iterations=100, reg=[L2Regularization(λ)])
S = createLinearSolver(Kaczmarz, arrayType(A), iterations=100, reg=[L2Regularization(λ)])
x_standard = Array(solve!(S, arrayType(b)))

S = createLinearSolver(solver, arrayType(A), iterations=100, reg=[L2Regularization(fill(λ, N))])
S = createLinearSolver(Kaczmarz, arrayType(A), iterations=100, reg=[L2Regularization(fill(λ, N))])
x_matrix = Array(solve!(S, arrayType(b)))
@test isapprox(x_standard, x_matrix)
end
Expand Down

0 comments on commit 178a581

Please sign in to comment.