From 84990ddb27acb0b381935857876a3bb17182a27b Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Tue, 8 Aug 2023 17:44:57 +0200 Subject: [PATCH 1/2] StaticArrays support --- .buildkite/pipeline.yml | 14 ++++++++++++++ src/krylov_utils.jl | 4 ++-- test/test_extensions.jl | 25 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 test/test_extensions.jl diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 92ac58c74..f0b79523f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -69,3 +69,17 @@ steps: Pkg.instantiate() include("test/gpu/metal.jl")' timeout_in_minutes: 30 + + - label: "CPUs -- StaticArrays.jl" + plugins: + - JuliaCI/julia#v1: + version: 1.9 + agents: + queue: "juliaecosystem" + command: | + julia --color=yes --project -e ' + using Pkg + Pkg.add("StaticArrays") + Pkg.instantiate() + include("test/test_extensions.jl")' + timeout_in_minutes: 30 diff --git a/src/krylov_utils.jl b/src/krylov_utils.jl index 137a97386..d794ec684 100644 --- a/src/krylov_utils.jl +++ b/src/krylov_utils.jl @@ -210,9 +210,9 @@ function ktypeof(v::S) where S <: DenseVector end function ktypeof(v::S) where S <: AbstractVector - if S.name.name == :Zeros || S.name.name == :Ones + if S.name.name == :Zeros || S.name.name == :Ones || S.name.name == :SArray || S.name.name == :MArray || S.name.name == :SizedArray T = eltype(S) - return Vector{T} # FillArrays + return Vector{T} # FillArrays, StaticArrays else return S # BlockArrays, PartitionedArrays, etc... end diff --git a/test/test_extensions.jl b/test/test_extensions.jl new file mode 100644 index 000000000..6db9421c2 --- /dev/null +++ b/test/test_extensions.jl @@ -0,0 +1,25 @@ +using LinearAlgebra, SparseArrays, Test +using Krylov, StaticArrays + +@testset "StaticArrays" begin + n = 5 + + for T in (Float32, Float64) + A = rand(T, n, n) + + b = SVector{n}(rand(T, n)) + @test Krylov.ktypeof(b) == Vector{T} + x, stats = gmres(A, b) + @test stats.solved + + b = MVector{n}(rand(T, n)) + @test Krylov.ktypeof(b) == Vector{T} + x, stats = gmres(A, b) + @test stats.solved + + b = SizedVector{n}(rand(T, n)) + @test Krylov.ktypeof(b) == Vector{T} + x, stats = gmres(A, b) + @test stats.solved + end +end From a1bfddac6629b2c963ea2c1cd0f89d1671ada7b8 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Wed, 9 Aug 2023 19:33:16 +0200 Subject: [PATCH 2/2] Support ComponentArrays --- src/krylov_utils.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/krylov_utils.jl b/src/krylov_utils.jl index d794ec684..e1dedba4a 100644 --- a/src/krylov_utils.jl +++ b/src/krylov_utils.jl @@ -210,9 +210,9 @@ function ktypeof(v::S) where S <: DenseVector end function ktypeof(v::S) where S <: AbstractVector - if S.name.name == :Zeros || S.name.name == :Ones || S.name.name == :SArray || S.name.name == :MArray || S.name.name == :SizedArray + if S.name.name == :Zeros || S.name.name == :Ones || S.name.name == :SArray || S.name.name == :MArray || S.name.name == :SizedArray || S.name.name == :FieldArray || S.name.name == :ComponentArray T = eltype(S) - return Vector{T} # FillArrays, StaticArrays + return Vector{T} # FillArrays, StaticArrays, ComponentsArrays else return S # BlockArrays, PartitionedArrays, etc... end