Add Root-Node AMG#130
Conversation
|
Ready for review @Abdelrahman912 |
| for i = 1:n | ||
| splitting[i] == C_NODE && continue | ||
| best_val = zero(Tv) | ||
| best_agg = zero(Ti) | ||
| for j in nzrange(S, i) | ||
| row = S.rowval[j] | ||
| val = S.nzval[j] | ||
| if splitting[row] == C_NODE && val > best_val | ||
| best_val = val | ||
| best_agg = c_map[row] | ||
| end | ||
| end | ||
| aggregate[i] = best_agg | ||
| end |
There was a problem hiding this comment.
Correct me if I am wrong, but as I understand aggregate vector can have nodes wo any aggregate assigned to them, leaving their value zero (i.e., orphan), right?
If that's the case, two hotfixes can be done, we can do second pass but loosening the threshold a bit over these orphan nodes, or just output some warning that some nodes aren't assigned to an aggregate.
| n = size(A, 1) | ||
| D_inv_S = weight(LocalWeighting(), A, omega) |
There was a problem hiding this comment.
In D_inv_S = weight(LocalWeighting(), A, omega) This should be S right ? otherwise it's not used ?
| function (ep::EnergyProlongation)(A, T, S, B, splitting, c_map) | ||
| energy_prolongation_smoother(A, T, S, splitting; | ||
| maxiter=ep.maxiter, omega=ep.omega) | ||
| end |
There was a problem hiding this comment.
B and c_map are never used.
| println("No NNS: final residual at iteration ", length(residuals_wonns), ": ", residuals_wonns[end]) | ||
| println("With NNS: final residual at iteration ", length(residuals_nns), ": ", residuals_nns[end]) | ||
|
|
||
| x_nns, residuals_nns = solve(A, b, RootNodeAMG(); aggregate=StandardAggregation(), log=true, reltol=1e-10, B=B, max_levels=2) |
There was a problem hiding this comment.
you can remove aggregate=StandardAggregation() as root_node_amg doesn't have aggregate as kwargs
| """ | ||
| RootNodePreconBuilder(;blocksize=1, kwargs...) | ||
|
|
||
| Return callable object constructing a left algebraic multigrid preconditioner after Ruge & Stüben |
There was a problem hiding this comment.
copy-pasta here for Ruge & Stüben 😆
This essentially combines RS and SA AMG. Resolves #126 .