From 2ee08b81467e133ab6ba90f881f9e9b9a5c79dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Fuhrmann?= Date: Mon, 6 Jul 2026 14:02:43 +0200 Subject: [PATCH 1/4] Add an additional product test with explicitely calculated product --- test/test_prod.jl | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/test/test_prod.jl b/test/test_prod.jl index d4e9af7..2f82208 100644 --- a/test/test_prod.jl +++ b/test/test_prod.jl @@ -7,17 +7,15 @@ using LinearAlgebra using Random function main(; n = 100) - seed = 1340 + seed = 1341 Random.seed!(seed) A = fdrand(n, n) sol0 = ones(n^2) b = A * sol0 + # need to reinit random so the shadow residual is the same for all calls Random.seed!(seed) - sol1, hist1 = bicgstabl(A, b, log = true) - @test sol1 ≈ sol0 rtol = 1.0e-5 - @show hist1 IdB = IdentityPreconBuilder() @@ -26,12 +24,35 @@ function main(; n = 100) ProdB2 = ProductPreconBuilder(IluB, IdB) ProdB3 = ProductPreconBuilder(IluB, IluB) + + p1, _ = IluB(A, nothing) + pp, _ = ProdB3(A, nothing) + x0 = rand(n^2) + r0 = A * x0 - b + d0 = ldiv!(p1, r0) + x1 = x0 - d0 + r1 = A * x1 - b + d1 = ldiv!(p1, r1) + x2 = x1 - d1 + + rp0 = A * x0 - b + dp0 = ldiv!(pp, rp0) + y1 = x0 - dp0 + + @test norm(x2 - y1, Inf) ≈ 0 atol = 5.0e-14 + + sol1, hist1 = bicgstabl(A, b, log = true) + @test sol1 ≈ sol0 rtol = 1.0e-5 + @show hist1 + + IdP, _ = IdB(A, 0) Random.seed!(seed) sol2, hist2 = bicgstabl(A, b, Pl = IdP, log = true) @test sol2 ≈ sol0 rtol = 1.0e-5 @show hist2 - @test hist2.iters ≈ hist1.iters atol = 5 + @test hist2.iters ≈ hist1.iters atol = 6 + IluP, _ = IluB(A, 0) Random.seed!(seed) From 3c82dcdb0b1bb560805a072da8162a6971553316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Fuhrmann?= Date: Mon, 6 Jul 2026 14:03:15 +0200 Subject: [PATCH 2/4] Allow for LinearSolve v4 update a couple of ExplicitImports checks --- Project.toml | 6 +++--- ext/ExtendableSparseIncompleteLUExt.jl | 4 ++-- ext/ExtendableSparseLinearSolveExt.jl | 2 +- test/alltests.jl | 22 ++++++++++++++++++++-- test/test_block.jl | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index b7cd762..5e899ce 100644 --- a/Project.toml +++ b/Project.toml @@ -23,7 +23,7 @@ ExtendableSparseLinearSolveExt = "LinearSolve" [compat] AMGCLWrap = "2" -AlgebraicMultigrid = "0.4, 0.5, 0.6, 1" +AlgebraicMultigrid = "0.4, 0.5, 0.6, 1, 2" Aqua = "0.8" BenchmarkTools = "1" ChunkSplitters = "2, 3" @@ -36,9 +36,9 @@ IncompleteLU = "^0.2.1" InteractiveUtils = "1.11.0" IterativeSolvers = "0.9" LinearAlgebra = "1.10" -LinearSolve = "2.36.0, 3.7.1" +LinearSolve = "2.36.0, 3.7.1,4" Metis = "1" -MultiFloats = "1, 2" +MultiFloats = "1, 2, 3" OhMyThreads = "0.6, 0.7, 0.8" Printf = "1.10" Random = "1.10" diff --git a/ext/ExtendableSparseIncompleteLUExt.jl b/ext/ExtendableSparseIncompleteLUExt.jl index 53df7ac..c3bf71e 100644 --- a/ext/ExtendableSparseIncompleteLUExt.jl +++ b/ext/ExtendableSparseIncompleteLUExt.jl @@ -1,8 +1,8 @@ module ExtendableSparseIncompleteLUExt using ExtendableSparse -using IncompleteLU +using IncompleteLU: IncompleteLU using LinearAlgebra: I -using SparseArrays: AbstractSparseMatrixCSC, SparseMatrixCSC, getcolptr, rowvals, nonzeros +using SparseArrays: AbstractSparseMatrixCSC, SparseMatrixCSC import ExtendableSparse: ILUTPreconBuilder diff --git a/ext/ExtendableSparseLinearSolveExt.jl b/ext/ExtendableSparseLinearSolveExt.jl index 66a0efd..58628ec 100644 --- a/ext/ExtendableSparseLinearSolveExt.jl +++ b/ext/ExtendableSparseLinearSolveExt.jl @@ -1,5 +1,5 @@ module ExtendableSparseLinearSolveExt -using LinearSolve +using LinearSolve: LinearSolve, LinearProblem, solve!, init import ExtendableSparse: LinearSolvePreconBuilder import LinearAlgebra using SparseArrays: AbstractSparseMatrixCSC diff --git a/test/alltests.jl b/test/alltests.jl index 99b4e84..2ce179d 100644 --- a/test/alltests.jl +++ b/test/alltests.jl @@ -21,13 +21,31 @@ end @test ExplicitImports.check_no_implicit_imports(ExtendableSparse) === nothing @test ExplicitImports.check_all_explicit_imports_via_owners(ExtendableSparse) === nothing @static if VERSION >= v"1.11.0" - @test ExplicitImports.check_all_explicit_imports_are_public(ExtendableSparse, ignore = (:AbstractSparseMatrixCSC, :getcolptr, :indtype)) === nothing + @test ExplicitImports.check_all_explicit_imports_are_public( + ExtendableSparse, + ignore = ( + :AbstractSparseMatrixCSC, + :getcolptr, + :indtype, + ) + ) === nothing end @test ExplicitImports.check_no_stale_explicit_imports(ExtendableSparse) === nothing @test ExplicitImports.check_all_qualified_accesses_via_owners(ExtendableSparse) === nothing @test ExplicitImports.check_all_qualified_accesses_are_public( ExtendableSparse, - ignore = (:AbstractSparseMatrixCSC, :AbstractTriangular, :getcolptr, :Forward, :USE_GPL_LIBS, :_checkbuffers, :print_array, :sparse!, :indtype) + ignore = ( + :AbstractSparseMatrixCSC, + :AbstractTriangular, + :getcolptr, + :Forward, + :USE_GPL_LIBS, + :_checkbuffers, + :print_array, + :sparse!, + :indtype, + :AbstractFactorization, + ) ) === nothing @test ExplicitImports.check_no_self_qualified_accesses(ExtendableSparse) === nothing end diff --git a/test/test_block.jl b/test/test_block.jl index f147cb3..c43dbec 100644 --- a/test/test_block.jl +++ b/test/test_block.jl @@ -2,7 +2,7 @@ module test_block using Test using ExtendableSparse using ExtendableSparse: BlockPreconditioner, jacobi -using ILUZero, AlgebraicMultigrid +using ILUZero using IterativeSolvers using LinearAlgebra using Sparspak From e821ad7fb85d45e856054c8dd0a4d54ba043d422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Fuhrmann?= Date: Mon, 6 Jul 2026 14:23:53 +0200 Subject: [PATCH 3/4] fix shadow residual in prod test --- test/test_prod.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/test_prod.jl b/test/test_prod.jl index 2f82208..26e287c 100644 --- a/test/test_prod.jl +++ b/test/test_prod.jl @@ -14,10 +14,6 @@ function main(; n = 100) b = A * sol0 - # need to reinit random so the shadow residual is the same for all calls - Random.seed!(seed) - - IdB = IdentityPreconBuilder() IluB = ILUZeroPreconBuilder() ProdB1 = ProductPreconBuilder(IdB, IluB) @@ -41,6 +37,8 @@ function main(; n = 100) @test norm(x2 - y1, Inf) ≈ 0 atol = 5.0e-14 + # need to reinit random so the shadow residual is the same for all calls + Random.seed!(seed) sol1, hist1 = bicgstabl(A, b, log = true) @test sol1 ≈ sol0 rtol = 1.0e-5 @show hist1 From 946e6f437fa5a9a84f165bff78e825ccb0743f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Fuhrmann?= Date: Mon, 6 Jul 2026 14:43:05 +0200 Subject: [PATCH 4/4] update patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5e899ce..4295113 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ExtendableSparse" uuid = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3" -version = "2.3.0" +version = "2.3.1" authors = ["Juergen Fuhrmann ", "Daniel Runge"] [deps]