Skip to content

Commit 1824c69

Browse files
authored
Merge pull request #285 from ranocha/hr/test_project
2 parents b4b501d + 5560ed9 commit 1824c69

24 files changed

+130
-45
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: CompatHelper
2-
32
on:
43
schedule:
54
- cron: '00 00 * * *'
6-
5+
workflow_dispatch:
76
jobs:
87
CompatHelper:
98
runs-on: ubuntu-latest
109
steps:
1110
- uses: julia-actions/setup-julia@latest
1211
with:
13-
version: 1.3
12+
version: 1.5
1413
- name: Pkg.add("CompatHelper")
1514
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
1615
- name: CompatHelper.main()
1716
env:
1817
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
run: julia -e 'using CompatHelper; CompatHelper.main()'
18+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} # optional
19+
run: julia -e 'using CompatHelper; CompatHelper.main(; subdirs=["", "docs", "test"])'

Project.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "IterativeSolvers"
22
uuid = "42fd0dbc-a981-5370-80f2-aaf504508153"
3-
version = "0.8.4"
3+
version = "0.8.5"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -12,10 +12,3 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1212
[compat]
1313
RecipesBase = "0.6, 0.7, 0.8, 1.0"
1414
julia = "1"
15-
16-
[extras]
17-
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
18-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
19-
20-
[targets]
21-
test = ["Test", "LinearMaps"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
## Installing
1616

17-
To install the package, open the package manager in the REPL via ] and run
17+
To install the package, open the package manager in the REPL via `]` and run
1818

1919
```julia
2020
pkg> add IterativeSolvers

docs/src/iterators.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,48 @@ jacobi_iterable(x, A::SparseMatrixCSC, b; maxiter::Int = 10) =
2828

2929
Now if you apply Jacobi iteration multiple times with the same matrix for just a few iterations, it makes sense to initialize the iterable only once and reuse it afterwards:
3030

31-
```julia
32-
A = sprand(10_000, 10_000, 10 / 10_000) + 20I
33-
b1 = rand(10_000)
34-
b2 = rand(10_000)
35-
x = rand(10_000)
36-
37-
my_iterable = IterativeSolvers.jacobi_iterable(x, A, b1, maxiter = 4)
31+
```jldoctest
32+
julia> using LinearAlgebra, SparseArrays, IterativeSolvers
3833
39-
for item in my_iterable
40-
println("Iteration for rhs 1")
41-
end
34+
julia> A = spdiagm(-1 => -ones(3), 0 => 2*ones(4), 1 => -ones(3));
4235
43-
@show norm(b1 - A * x) / norm(b1)
36+
julia> b1 = [1.0, 2, 3, 4];
4437
45-
# Copy the next right-hand side into the iterable
46-
copyto!(my_iterable.b, b2)
38+
julia> b2 = [-1.0, 1, -1, 1];
4739
48-
for item in my_iterable
49-
println("Iteration for rhs 2")
50-
end
40+
julia> x = [0.0, -1, 1, 0];
5141
52-
@show norm(b2 - A * x) / norm(b2)
53-
```
42+
julia> my_iterable = IterativeSolvers.jacobi_iterable(x, A, b1, maxiter = 2);
5443
55-
This would output:
44+
julia> norm(b1 - A * x) / norm(b1)
45+
1.2909944487358056
5646
57-
```
58-
Iteration for rhs 1
59-
Iteration for rhs 1
47+
julia> for item in my_iterable
48+
println("Iteration for rhs 1")
49+
end
6050
Iteration for rhs 1
6151
Iteration for rhs 1
62-
norm(b1 - A * x) / norm(b1) = 0.08388528015119746
63-
Iteration for rhs 2
64-
Iteration for rhs 2
52+
53+
julia> norm(b1 - A * x) / norm(b1)
54+
0.8228507357554791
55+
56+
julia> # Copy the next right-hand side into the iterable
57+
copyto!(my_iterable.b, b2);
58+
59+
julia> norm(b2 - A * x) / norm(b2)
60+
2.6368778887161235
61+
62+
julia> for item in my_iterable
63+
println("Iteration for rhs 2")
64+
end
6565
Iteration for rhs 2
6666
Iteration for rhs 2
67-
norm(b2 - A * x) / norm(b2) = 0.0003681972775644809
67+
68+
julia> norm(b2 - A * x) / norm(b2)
69+
1.610815496107484
6870
```
6971

72+
7073
## Other use cases
7174
Other use cases include:
7275
- computing the (harmonic) Ritz values from the Hessenberg matrix in GMRES;

test/Project.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
4+
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
5+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
6+
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
7+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
8+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
9+
10+
[compat]
11+
Documenter = "0.26"
12+
LinearMaps = "3"
13+
RecipesBase = "1"

test/bicgstabl.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module TestBiCGStabl
2+
13
using IterativeSolvers
24
using Test
35
using Random
@@ -66,3 +68,5 @@ end
6668
end
6769
end
6870
end
71+
72+
end # module

test/cg.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module TestCG
2+
13
using IterativeSolvers
24
using LinearMaps
35
using Test
@@ -120,3 +122,5 @@ end
120122
end
121123

122124
end
125+
126+
end # module

test/chebyshev.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module TestChebyshev
2+
13
using IterativeSolvers
24
using Test
35
using Random
@@ -91,3 +93,5 @@ end
9193
end
9294
end
9395
end
96+
97+
end # module

test/common.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
module TestCommon
2+
3+
using Documenter
14
using LinearAlgebra
25
using IterativeSolvers
36
using Test
@@ -25,3 +28,8 @@ end
2528
end
2629

2730
end
31+
32+
DocMeta.setdocmeta!(IterativeSolvers, :DocTestSetup, :(using IterativeSolvers); recursive=true)
33+
doctest(IterativeSolvers, manual=true)
34+
35+
end # module

test/deprecations.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module TestDeprecations
2+
13
using IterativeSolvers
24
using Test
35

@@ -12,4 +14,6 @@ using Test
1214
@test_deprecated idrs(A, b, tol=1.0, maxiter=1)
1315
@test_deprecated minres(A, b, tol=1.0, maxiter=1)
1416
@test_deprecated qmr(A, b, tol=1.0, maxiter=1)
15-
end
17+
end
18+
19+
end # module

0 commit comments

Comments
 (0)