Skip to content

Commit 6b58122

Browse files
author
Pawel Latawiec
committed
Add test with block creation
1 parent fd3deb4 commit 6b58122

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/lalqmr.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ end
5353
#@test norm(A * x - b) / norm(b) ≤ reltol
5454
end
5555

56+
@testset "Block Creation {$T}" for T in (Float32, Float64, ComplexF32, ComplexF64)
57+
# Guaranteed to create blocks during Lanczos process
58+
# This satisfies the condition that in the V-W sequence, the first
59+
# iterates are orthogonal: <Av - v<A, v>, Atv - v<At, v>> under transpose inner product
60+
dl = fill(one(T), n-1)
61+
du = fill(one(T), n-1)
62+
d = fill(one(T), n)
63+
dl[1] = -1
64+
A = Tridiagonal(dl, d, du)
65+
b = fill(zero(T), n)
66+
b[2] = 1.0
67+
68+
reltol = eps(real(T))
69+
70+
x, history = lalqmr(A, b, log = true)
71+
@test norm(A * x - b) / norm(b) reltol
72+
end
73+
5674
@testset "Linear operator defined as a function" begin
5775
A = LinearMap(cumsum!, 100; ismutating=true)
5876
b = rand(100)

0 commit comments

Comments
 (0)