From b83526646005117863d9fe958a01422d13420628 Mon Sep 17 00:00:00 2001 From: nHackel Date: Thu, 4 Jul 2024 10:41:35 +0200 Subject: [PATCH] Fix normal op tests --- test/testNormalOp.jl | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/test/testNormalOp.jl b/test/testNormalOp.jl index 425291f..c90ac37 100644 --- a/test/testNormalOp.jl +++ b/test/testNormalOp.jl @@ -1,18 +1,28 @@ -@info "test normal operator" -N = 512 +@testset "Normal Operator" begin + for arrayType in arrayTypes + @testset "$arrayType" begin + N = 512 -Random.seed!(1234) -x = rand(N) -A = rand(N,N) -W = WeightingOp(rand(N)) + Random.seed!(1234) + x = arrayType(rand(N)) + A = arrayType(rand(N,N)) + A_adj = arrayType(collect(adjoint(A))) # LinearOperators can't resolve storage_type otherwise + W = WeightingOp(arrayType(rand(N))) + WA = W*A -y1 = adjoint(A)*W*A*x -y = normalOperator(A,W)*x + y1 = Array(A_adj*W*W*A*x) + y2 = Array(adjoint(WA) * WA * x) + y = Array(normalOperator(A,W)*x) -@test norm(y1 - y) / norm(y) ≈ 0 atol=0.01 + @test norm(y1 - y) / norm(y) ≈ 0 atol=0.01 + @test norm(y2 - y) / norm(y) ≈ 0 atol=0.01 -y1 = adjoint(A)*A*x -y = normalOperator(A)*x -@test norm(y1 - y) / norm(y) ≈ 0 atol=0.01 \ No newline at end of file + y1 = Array(adjoint(A)*A*x) + y = Array(normalOperator(A)*x) + + @test norm(y1 - y) / norm(y) ≈ 0 atol=0.01 + end + end +end \ No newline at end of file