Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests with LinearOperators.jl #863

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,17 @@ steps:
Pkg.instantiate()
include("test/cpu/component_arrays.jl")'
timeout_in_minutes: 30

- label: "CPUs -- LinearOperators.jl"
plugins:
- JuliaCI/julia#v1:
version: "1.10"
agents:
queue: "juliaecosystem"
command: |
julia --color=yes --project -e '
using Pkg
Pkg.add("LinearOperators")
Pkg.instantiate()
include("test/cpu/linear_operators.jl")'
timeout_in_minutes: 30
5 changes: 3 additions & 2 deletions src/block_gmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ kwargs_block_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rto
# Define the blocks D1 and D2
D1 = view(D, 1:p, :)
D2 = view(D, p+1:2p, :)
trans = FC <: AbstractFloat ? 'T' : 'C'

# Coefficients for mul!
α = -one(FC)
Expand Down Expand Up @@ -263,7 +264,7 @@ kwargs_block_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rto
for i = 1 : inner_iter-1
D1 .= R[nr+i]
D2 .= R[nr+i+1]
@kormqr!('L', 'T', H[i], τ[i], D)
@kormqr!('L', trans, H[i], τ[i], D)
R[nr+i] .= D1
R[nr+i+1] .= D2
end
Expand All @@ -276,7 +277,7 @@ kwargs_block_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rto
# Update Zₖ = (Qₖ)ᴴΓE₁ = (Λ₁, ..., Λₖ, Λbarₖ₊₁)
D1 .= Z[inner_iter]
D2 .= zero(FC)
@kormqr!('L', 'T', H[inner_iter], τ[inner_iter], D)
@kormqr!('L', trans, H[inner_iter], τ[inner_iter], D)
Z[inner_iter] .= D1

# Update residual norm estimate.
Expand Down
16 changes: 16 additions & 0 deletions test/cpu/linear_operators.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using LinearAlgebra, SparseArrays, Test
using Krylov, LinearOperators

@testset "LinearOperators" begin
n = 50
p = 5

for T in (Float64, ComplexF64)
A = rand(T, n, n)
B = rand(T, n, p)

opA = LinearOperator(A)
x, stats = block_gmres(opA, B)
@test stats.solved
end
end
Loading