Skip to content

Commit c030852

Browse files
add nns to prec
1 parent 3ac6528 commit c030852

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/precs.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
Return callable object constructing a left smoothed aggregation algebraic multigrid preconditioner
55
to be used with the `precs` API of LinearSolve.
66
"""
7-
struct SmoothedAggregationPreconBuilder{Tk}
7+
struct SmoothedAggregationPreconBuilder{Tk,TB<:Union{Nothing,<:AbstractArray}}
88
blocksize::Int
9+
B::TB # near null space basis
910
kwargs::Tk
1011
end
1112

12-
function SmoothedAggregationPreconBuilder(; blocksize = 1, kwargs...)
13-
return SmoothedAggregationPreconBuilder(blocksize, kwargs)
13+
function SmoothedAggregationPreconBuilder(; blocksize = 1,B = nothing, kwargs...)
14+
return SmoothedAggregationPreconBuilder(blocksize,B, kwargs)
1415
end
1516

1617
function (b::SmoothedAggregationPreconBuilder)(A::AbstractSparseMatrixCSC, p)
17-
return (aspreconditioner(smoothed_aggregation(SparseMatrixCSC(A), Val{b.blocksize}; b.kwargs...)), I)
18+
return (aspreconditioner(smoothed_aggregation(SparseMatrixCSC(A),b.B, Val{b.blocksize}; b.kwargs...)), I)
1819
end
1920

2021

src/smoother.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ end
2929
function gs!(A, b, x, start, step, stop)
3030
n = size(A, 1)
3131
z = zero(eltype(A))
32+
@assert size(x,2) == size(b, 2) "x and b must have the same number of columns"
3233
@inbounds for col in 1:size(x, 2)
3334
for i in start:step:stop
3435
rsum = z

0 commit comments

Comments
 (0)