|
1 | 1 | using Compat, Compat.Test, Compat.LinearAlgebra
|
2 | 2 | using Compat.SparseArrays, Compat.DelimitedFiles, Compat.Random
|
3 |
| -using IterativeSolvers, JLD, AMG |
4 |
| -import AMG: V, coarse_solver, Pinv, Classical |
| 3 | +using IterativeSolvers, JLD, AlgebraicMultigrid |
| 4 | +import AlgebraicMultigrid: V, coarse_solver, Pinv, Classical |
5 | 5 |
|
6 | 6 | include("sa_tests.jl")
|
7 | 7 |
|
8 |
| -@testset "AMG Tests" begin |
| 8 | +@testset "AlgebraicMultigrid Tests" begin |
9 | 9 |
|
10 | 10 | graph = load("test.jld")["G"]
|
11 | 11 | ref_S = load("ref_S_test.jld")["G"]
|
@@ -38,7 +38,7 @@ S = sprand(10,10,0.1); S = S + S'
|
38 | 38 | @test split_nodes(RS(), S) == [0, 1, 1, 0, 0, 0, 0, 0, 1, 1]
|
39 | 39 |
|
40 | 40 | a = load("thing.jld")["G"]
|
41 |
| -S, T = AMG.strength_of_connection(Classical(0.25), a) |
| 41 | +S, T = AlgebraicMultigrid.strength_of_connection(Classical(0.25), a) |
42 | 42 | @test split_nodes(RS(), S) == [0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0,
|
43 | 43 | 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0,
|
44 | 44 | 1, 0]
|
|
50 | 50 | @testset "Interpolation" begin
|
51 | 51 |
|
52 | 52 | # Direct Interpolation
|
53 |
| -using AMG |
| 53 | +using AlgebraicMultigrid |
54 | 54 | A = poisson(5)
|
55 | 55 | A = Float64.(A)
|
56 | 56 | splitting = [1,0,1,0,1]
|
57 |
| -P, R = AMG.direct_interpolation(A, copy(A), splitting) |
| 57 | +P, R = AlgebraicMultigrid.direct_interpolation(A, copy(A), splitting) |
58 | 58 | @test P == [ 1.0 0.0 0.0
|
59 | 59 | 0.5 0.5 0.0
|
60 | 60 | 0.0 1.0 0.0
|
|
74 | 74 | @testset "Multilevel" begin
|
75 | 75 | A = poisson(1000)
|
76 | 76 | A = float.(A) #FIXME
|
77 |
| -ml = AMG.ruge_stuben(A) |
| 77 | +ml = AlgebraicMultigrid.ruge_stuben(A) |
78 | 78 | @test length(ml) == 8
|
79 | 79 | s = [1000, 500, 250, 125, 62, 31, 15]
|
80 | 80 | n = [2998, 1498, 748, 373, 184, 91, 43]
|
|
97 | 97 | @test size(ml.final_A, 1) == 2
|
98 | 98 | @test nnz(ml.final_A) == 4
|
99 | 99 | @static if VERSION < v"0.7-"
|
100 |
| - @test round(AMG.operator_complexity(ml), 3) ≈ 1.142 |
101 |
| - @test round(AMG.grid_complexity(ml), 3) ≈ 1.190 |
| 100 | + @test round(AlgebraicMultigrid.operator_complexity(ml), 3) ≈ 1.142 |
| 101 | + @test round(AlgebraicMultigrid.grid_complexity(ml), 3) ≈ 1.190 |
102 | 102 | else
|
103 |
| - @test round(AMG.operator_complexity(ml), digits=3) ≈ 1.142 |
104 |
| - @test round(AMG.grid_complexity(ml), digits=3) ≈ 1.190 |
| 103 | + @test round(AlgebraicMultigrid.operator_complexity(ml), digits=3) ≈ 1.142 |
| 104 | + @test round(AlgebraicMultigrid.grid_complexity(ml), digits=3) ≈ 1.190 |
105 | 105 | end
|
106 | 106 |
|
107 | 107 | include("gmg.jl")
|
@@ -287,15 +287,15 @@ for sz in [10, 5, 2]
|
287 | 287 | ml = ruge_stuben(a)
|
288 | 288 | @test isempty(ml.levels)
|
289 | 289 | @test size(ml.final_A) == (sz,sz)
|
290 |
| - @test AMG.operator_complexity(ml) == 1 |
291 |
| - @test AMG.grid_complexity(ml) == 1 |
| 290 | + @test AlgebraicMultigrid.operator_complexity(ml) == 1 |
| 291 | + @test AlgebraicMultigrid.grid_complexity(ml) == 1 |
292 | 292 |
|
293 | 293 | a = poisson(sz)
|
294 | 294 | ml = smoothed_aggregation(a)
|
295 | 295 | @test isempty(ml.levels)
|
296 | 296 | @test size(ml.final_A) == (sz,sz)
|
297 |
| - @test AMG.operator_complexity(ml) == 1 |
298 |
| - @test AMG.grid_complexity(ml) == 1 |
| 297 | + @test AlgebraicMultigrid.operator_complexity(ml) == 1 |
| 298 | + @test AlgebraicMultigrid.grid_complexity(ml) == 1 |
299 | 299 | end
|
300 | 300 |
|
301 | 301 | end
|
0 commit comments