@@ -30,26 +30,29 @@ Base.@kwdef struct ILUZeroPreconBuilder
30
30
blocksize:: Int = 1
31
31
end
32
32
33
- function (b:: ILUZeroPreconBuilder )(A0,p)
34
- A= SparseMatrixCSC (size (A0)... , getcolptr (A0), rowvals (A0),nonzeros (A0))
35
- if b. blocksize== 1
36
- (ILUZero. ilu0 (A),LinearAlgebra. I)
37
- else
38
- (ILUZero. ilu0 (pointblock (A,b. blocksize),SVector{b. blocksize,eltype (A)}),LinearAlgebra. I)
39
- end
33
+ struct ILUBlockPrecon{N,NN,Tv,Ti}
34
+ ilu0:: ILUZero.ILU0Precon{SMatrix{N, N, Tv, NN}, Ti, SVector{N, Tv}}
40
35
end
41
36
42
- # Harrr!!! ☠
43
- # We could resolve this piracy by introducing a wrapper type for the block case.
44
37
function LinearAlgebra. ldiv! (Y:: Vector{Tv} ,
45
- A:: ILUZero.ILU0Precon{SMatrix{N, N, Tv, NN}, Ti, SVector{N, Tv} } ,
38
+ A:: ILUBlockPrecon{N,NN, Tv,Ti } ,
46
39
B:: Vector{Tv} ) where {N,NN,Tv,Ti}
47
40
BY= reinterpret (SVector{N,Tv},Y)
48
41
BB= reinterpret (SVector{N,Tv},B)
49
- ldiv! (BY,A,BB)
42
+ ldiv! (BY,A. ilu0 ,BB)
50
43
Y
51
44
end
52
45
46
+ function (b:: ILUZeroPreconBuilder )(A0,p)
47
+ A= SparseMatrixCSC (size (A0)... , getcolptr (A0), rowvals (A0),nonzeros (A0))
48
+ if b. blocksize== 1
49
+ (ILUZero. ilu0 (A),LinearAlgebra. I)
50
+ else
51
+ (ILUBlockPrecon (ILUZero. ilu0 (pointblock (A,b. blocksize),SVector{b. blocksize,eltype (A)})),LinearAlgebra. I)
52
+ end
53
+ end
54
+
55
+
53
56
"""
54
57
ILUTPreconBuilder(; droptol=0.1)
55
58
0 commit comments