Skip to content

Commit b835266

Browse files
committed
Fix normal op tests
1 parent c59fc1e commit b835266

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

test/testNormalOp.jl

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11

2-
@info "test normal operator"
3-
N = 512
2+
@testset "Normal Operator" begin
3+
for arrayType in arrayTypes
4+
@testset "$arrayType" begin
5+
N = 512
46

5-
Random.seed!(1234)
6-
x = rand(N)
7-
A = rand(N,N)
8-
W = WeightingOp(rand(N))
7+
Random.seed!(1234)
8+
x = arrayType(rand(N))
9+
A = arrayType(rand(N,N))
10+
A_adj = arrayType(collect(adjoint(A))) # LinearOperators can't resolve storage_type otherwise
11+
W = WeightingOp(arrayType(rand(N)))
12+
WA = W*A
913

10-
y1 = adjoint(A)*W*A*x
11-
y = normalOperator(A,W)*x
14+
y1 = Array(A_adj*W*W*A*x)
15+
y2 = Array(adjoint(WA) * WA * x)
16+
y = Array(normalOperator(A,W)*x)
1217

13-
@test norm(y1 - y) / norm(y) 0 atol=0.01
18+
@test norm(y1 - y) / norm(y) 0 atol=0.01
19+
@test norm(y2 - y) / norm(y) 0 atol=0.01
1420

15-
y1 = adjoint(A)*A*x
16-
y = normalOperator(A)*x
1721

18-
@test norm(y1 - y) / norm(y) 0 atol=0.01
22+
y1 = Array(adjoint(A)*A*x)
23+
y = Array(normalOperator(A)*x)
24+
25+
@test norm(y1 - y) / norm(y) 0 atol=0.01
26+
end
27+
end
28+
end

0 commit comments

Comments
 (0)