Skip to content

Commit 25c959d

Browse files
add docstring and make ruge stuben fail for B
1 parent 97976ce commit 25c959d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/classical.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ function ruge_stuben(_A::Union{TA, Symmetric{Ti, TA}, Hermitian{Ti, TA}},
99
max_coarse = 10,
1010
coarse_solver = Pinv, kwargs...) where {Ti,Tv,bs,TA<:SparseMatrixCSC{Ti,Tv}}
1111

12+
13+
# fails if near null space `B` is provided
14+
haskey(kwargs, :B) && kwargs[:B] !== nothing && error("near null space `B` is only supported for smoothed aggregation AMG, not Ruge-Stüben AMG.")
15+
1216
if _A isa Symmetric && Ti <: Real || _A isa Hermitian
1317
A = _A.data
1418
symmetric = true

src/multilevel.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ Keyword Arguments
187187
* maxiter::Int64 - maximum number of iterations to execute
188188
* verbose::Bool - display residual at each iteration
189189
* log::Bool - return vector of residuals along with solution
190+
* B::AbstractArray - the **near null space** in SA-AMG, which represents the low energy that cannot be attenuated by relaxtion, and thus needs to be perserved across the coarse grid.
190191
192+
!!! note
193+
`B` can be:
194+
- a `Vector` (e.g., for scalar PDEs),
195+
- a `Matrix` (e.g., for vector PDEs or systems with multiple equations),
196+
If `B` is not provided, it defaults to a vector of ones.
191197
"""
192198
function _solve(ml::MultiLevel, b::AbstractArray, args...; kwargs...)
193199
n = length(ml) == 1 ? size(ml.final_A, 1) : size(ml.levels[1].A, 1)

0 commit comments

Comments
 (0)