Skip to content

Commit

Permalink
[test] Use Aᴴ instead of Aᵀ
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Sep 7, 2022
1 parent 330304a commit 604c960
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions test/get_div_grad.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Identity matrix.
eye(n::Int; FC=Float64) = sparse(one(FC) * I, n, n)

# Compute the energy norm ‖r‖ₚ = √(rᵀPr) where P is a symmetric and positive definite matrix.
metric(r, P) = sqrt(dot(r, P * r))
# Compute the energy norm ‖r‖ₚ = √(rᴴPr) where P is a symmetric and positive definite matrix.
metric(r, P) = sqrt(real(dot(r, P * r)))

# Based on Lars Ruthotto's initial implementation.
function get_div_grad(n1 :: Int, n2 :: Int, n3 :: Int)
Expand Down
16 changes: 8 additions & 8 deletions test/test_allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@

@testset "CGNE" begin
# CGNE needs:
# - 3 n-vectors: x, p, Aᵀz
# - 3 n-vectors: x, p, Aᴴz
# - 2 m-vectors: r, q
storage_cgne(n, m) = 3 * n + 2 * m
storage_cgne_bytes(n, m) = nbits * storage_cgne(n, m)
Expand All @@ -272,7 +272,7 @@

@testset "CRMR" begin
# CRMR needs:
# - 3 n-vectors: x, p, Aᵀr
# - 3 n-vectors: x, p, Aᴴr
# - 2 m-vectors: r, q
storage_crmr(n, m) = 3 * n + 2 * m
storage_crmr_bytes(n, m) = nbits * storage_crmr(n, m)
Expand All @@ -290,7 +290,7 @@

@testset "LNLQ" begin
# LNLQ needs:
# - 3 n-vectors: x, v, Aᵀu
# - 3 n-vectors: x, v, Aᴴu
# - 4 m-vectors: y, w̄, u, Av
storage_lnlq(n, m) = 3 * n + 4 * m
storage_lnlq_bytes(n, m) = nbits * storage_lnlq(n, m)
Expand All @@ -308,7 +308,7 @@

@testset "CRAIG" begin
# CRAIG needs:
# - 3 n-vectors: x, v, Aᵀu
# - 3 n-vectors: x, v, Aᴴu
# - 4 m-vectors: y, w, u, Av
storage_craig(n, m) = 3 * n + 4 * m
storage_craig_bytes(n, m) = nbits * storage_craig(n, m)
Expand All @@ -326,7 +326,7 @@

@testset "CRAIGMR" begin
# CRAIGMR needs:
# - 4 n-vectors: x, v, Aᵀu, d
# - 4 n-vectors: x, v, Aᴴu, d
# - 5 m-vectors: y, u, w, wbar, Av
storage_craigmr(n, m) = 4 * n + 5 * m
storage_craigmr_bytes(n, m) = nbits * storage_craigmr(n, m)
Expand Down Expand Up @@ -362,7 +362,7 @@

@testset "LSLQ" begin
# LSLQ needs:
# - 4 m-vectors: x_lq, v, Aᵀu, w̄ (= x_cg)
# - 4 m-vectors: x_lq, v, Aᴴu, w̄ (= x_cg)
# - 2 n-vectors: u, Av
storage_lslq(n, m) = 4 * m + 2 * n
storage_lslq_bytes(n, m) = nbits * storage_lslq(n, m)
Expand Down Expand Up @@ -398,7 +398,7 @@

@testset "LSQR" begin
# LSQR needs:
# - 4 m-vectors: x, v, w, Aᵀu
# - 4 m-vectors: x, v, w, Aᴴu
# - 2 n-vectors: u, Av
storage_lsqr(n, m) = 4 * m + 2 * n
storage_lsqr_bytes(n, m) = nbits * storage_lsqr(n, m)
Expand All @@ -416,7 +416,7 @@

@testset "LSMR" begin
# LSMR needs:
# - 5 m-vectors: x, v, h, hbar, Aᵀu
# - 5 m-vectors: x, v, h, hbar, Aᴴu
# - 2 n-vectors: u, Av
storage_lsmr(n, m) = 5 * m + 2 * n
storage_lsmr_bytes(n, m) = nbits * storage_lsmr(n, m)
Expand Down
4 changes: 2 additions & 2 deletions test/test_bicgstab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@
@test(resid bicgstab_tol)
@test(stats.solved)

# Test bᵀc == 0
# Test bᴴc == 0
A, b, c = bc_breakdown(FC=FC)
(x, stats) = bicgstab(A, b, c=c)
@test stats.status == "Breakdown bᵀc = 0"
@test stats.status == "Breakdown bᴴc = 0"

# test callback function
solver = BicgstabSolver(A, b)
Expand Down
4 changes: 2 additions & 2 deletions test/test_bilq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
@test(resid bilq_tol)
@test(stats.solved)

# Test bᵀc == 0
# Test bᴴc == 0
A, b, c = bc_breakdown(FC=FC)
(x, stats) = bilq(A, b, c=c)
@test stats.status == "Breakdown bᵀc = 0"
@test stats.status == "Breakdown bᴴc = 0"


# test callback function
Expand Down
4 changes: 2 additions & 2 deletions test/test_bilqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
@test(resid_dual bilqr_tol)
@test(stats.solved_dual)

# Test bᵀc == 0
# Test bᴴc == 0
A, b, c = bc_breakdown(FC=FC)
(x, t, stats) = bilqr(A, b, c)
@test stats.status == "Breakdown bᵀc = 0"
@test stats.status == "Breakdown bᴴc = 0"

# test callback function
A, b, c = adjoint_pde(FC=FC)
Expand Down
4 changes: 2 additions & 2 deletions test/test_cgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
@test(resid cgs_tol)
@test(stats.solved)

# Test bᵀc == 0
# Test bᴴc == 0
A, b, c = bc_breakdown(FC=FC)
(x, stats) = cgs(A, b, c=c)
@test stats.status == "Breakdown bᵀc = 0"
@test stats.status == "Breakdown bᴴc = 0"

# test callback function
A, b = sparse_laplacian(FC=FC)
Expand Down
4 changes: 2 additions & 2 deletions test/test_qmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
@test(resid qmr_tol)
@test(stats.solved)

# Test bᵀc == 0
# Test bᴴc == 0
A, b, c = bc_breakdown(FC=FC)
(x, stats) = qmr(A, b, c=c)
@test stats.status == "Breakdown bᵀc = 0"
@test stats.status == "Breakdown bᴴc = 0"

# test callback function
solver = QmrSolver(A, b)
Expand Down
16 changes: 8 additions & 8 deletions test/test_solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ function test_solvers(FC)
├──────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 64│
│ p│ Vector{$FC}│ 64│
Aᵀr│ Vector{$FC}│ 64│
Aᴴr│ Vector{$FC}│ 64│
│ r│ Vector{$FC}│ 32│
│ q│ Vector{$FC}│ 32│
│ Nq│ Vector{$FC}│ 0│
Expand Down Expand Up @@ -694,7 +694,7 @@ function test_solvers(FC)
├─────────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 64│
│ Nv│ Vector{$FC}│ 64│
Aᵀu│ Vector{$FC}│ 64│
Aᴴu│ Vector{$FC}│ 64│
│ d│ Vector{$FC}│ 64│
│ y│ Vector{$FC}│ 32│
│ Mu│ Vector{$FC}│ 32│
Expand All @@ -719,7 +719,7 @@ function test_solvers(FC)
├──────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 64│
│ p│ Vector{$FC}│ 64│
Aᵀz│ Vector{$FC}│ 64│
Aᴴz│ Vector{$FC}│ 64│
│ r│ Vector{$FC}│ 32│
│ q│ Vector{$FC}│ 32│
│ s│ Vector{$FC}│ 0│
Expand All @@ -739,7 +739,7 @@ function test_solvers(FC)
├──────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 64│
│ Nv│ Vector{$FC}│ 64│
Aᵀu│ Vector{$FC}│ 64│
Aᴴu│ Vector{$FC}│ 64│
│ y│ Vector{$FC}│ 32│
│ w̄│ Vector{$FC}│ 32│
│ Mu│ Vector{$FC}│ 32│
Expand All @@ -762,7 +762,7 @@ function test_solvers(FC)
├───────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 64│
│ Nv│ Vector{$FC}│ 64│
Aᵀu│ Vector{$FC}│ 64│
Aᴴu│ Vector{$FC}│ 64│
│ y│ Vector{$FC}│ 32│
│ w│ Vector{$FC}│ 32│
│ Mu│ Vector{$FC}│ 32│
Expand All @@ -785,7 +785,7 @@ function test_solvers(FC)
├──────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 32│
│ Nv│ Vector{$FC}│ 32│
Aᵀu│ Vector{$FC}│ 32│
Aᴴu│ Vector{$FC}│ 32│
│ w̄│ Vector{$FC}│ 32│
│ Mu│ Vector{$FC}│ 64│
│ Av│ Vector{$FC}│ 64│
Expand Down Expand Up @@ -826,7 +826,7 @@ function test_solvers(FC)
├──────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 32│
│ Nv│ Vector{$FC}│ 32│
Aᵀu│ Vector{$FC}│ 32│
Aᴴu│ Vector{$FC}│ 32│
│ w│ Vector{$FC}│ 32│
│ Mu│ Vector{$FC}│ 64│
│ Av│ Vector{$FC}│ 64│
Expand Down Expand Up @@ -869,7 +869,7 @@ function test_solvers(FC)
├──────────┼───────────────┼─────────────────┤
│ x│ Vector{$FC}│ 32│
│ Nv│ Vector{$FC}│ 32│
Aᵀu│ Vector{$FC}│ 32│
Aᴴu│ Vector{$FC}│ 32│
│ h│ Vector{$FC}│ 32│
│ hbar│ Vector{$FC}│ 32│
│ Mu│ Vector{$FC}│ 64│
Expand Down
2 changes: 1 addition & 1 deletion test/test_trilqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
@test(resid_dual trilqr_tol)
@test(stats.solved_dual)

# Test consistent Ax = b and inconsistent Aᵀt = c.
# Test consistent Ax = b and inconsistent Aᴴt = c.
A, b, c = rectangular_adjoint(FC=FC)
(x, t, stats) = trilqr(A, b, c)

Expand Down
6 changes: 3 additions & 3 deletions test/test_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ function square_adjoint(n :: Int=100; FC=Float64)
return A, b, c
end

# Adjoint systems with Ax = b underdetermined consistent and Aᵀt = c overdetermined insconsistent.
# Adjoint systems with Ax = b underdetermined consistent and Aᴴt = c overdetermined insconsistent.
function rectangular_adjoint(n :: Int=10, m :: Int=25; FC=Float64)
Aᵀ, c = over_inconsistent(m, n; FC=FC)
A = adjoint(Aᵀ)
Aᴴ, c = over_inconsistent(m, n; FC=FC)
A = adjoint(Aᴴ)
b = A * ones(FC, m)
return A, b, c
end
Expand Down

0 comments on commit 604c960

Please sign in to comment.