Skip to content

Commit

Permalink
Update tests of CRAIG and CRAIGMR
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Apr 14, 2020
1 parent 3610730 commit 9b24b32
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions test/test_craig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function test_craig()

# Test saddle-point systems
A, b, D = saddle_point()
D⁻¹ = PreallocatedLinearOperator(inv(D))
D⁻¹ = inv(D)
(x, y, stats) = craig(A, b, N=D⁻¹)
r = b - A * x
resid = norm(r) / norm(b)
Expand All @@ -114,8 +114,8 @@ function test_craig()

# Test symmetric and quasi-definite systems
A, b, M, N = sqd()
M⁻¹ = PreallocatedLinearOperator(inv(M))
N⁻¹ = PreallocatedLinearOperator(inv(N))
M⁻¹ = inv(M)
N⁻¹ = inv(N)
(x, y, stats) = craig(A, b, M=M⁻¹, N=N⁻¹, sqd=true)
r = b - (A * x + M * y)
resid = norm(r) / norm(b)
Expand Down
6 changes: 3 additions & 3 deletions test/test_craigmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function test_craigmr()

# Test saddle-point systems
A, b, D = saddle_point()
D⁻¹ = PreallocatedLinearOperator(inv(D))
D⁻¹ = inv(D)
(x, y, stats) = craigmr(A, b, N=D⁻¹)
r = b - A * x
resid = norm(r) / norm(b)
Expand All @@ -119,8 +119,8 @@ function test_craigmr()

# Test symmetric and quasi-definite systems
A, b, M, N = sqd()
M⁻¹ = PreallocatedLinearOperator(inv(M))
N⁻¹ = PreallocatedLinearOperator(inv(N))
M⁻¹ = inv(M)
N⁻¹ = inv(N)
(x, y, stats) = craigmr(A, b, M=M⁻¹, N=N⁻¹, sqd=true)
r = b - (A * x + M * y)
resid = norm(r) / norm(b)
Expand Down
6 changes: 3 additions & 3 deletions test/test_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ end
function saddle_point(n :: Int=5)
A = [2^(i/j)*j + (-1)^(i-j) * n*(i-1) for i = 1:n, j = 1:n]
b = ones(n)
D = diagm(0 => [2*i for i = 1:n])
D = diagm(0 => [2.0 * i for i = 1:n])
return A, b, D
end

# Symmetric and quasi-definite systems.
function sqd(n :: Int=5)
A = [2^(i/j)*j + (-1)^(i-j) * n*(i-1) for i = 1:n, j = 1:n]
b = ones(n)
M = diagm(0 => [3*i for i = 1:n])
N = diagm(0 => [5*i for i = 1:n])
M = diagm(0 => [3.0 * i for i = 1:n])
N = diagm(0 => [5.0 * i for i = 1:n])
return A, b, M, N
end

0 comments on commit 9b24b32

Please sign in to comment.