Skip to content

Commit 5e25911

Browse files
committed
Add a couple of tests
1 parent f25bc64 commit 5e25911

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/AMG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module AMG
33
include("strength.jl")
44
export classical
55

6-
include("mg.jl")
6+
include("splitting.jl")
77
export RS
88

99
include("gallery.jl")

src/splitting.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
const F_NODE = 0
2+
const C_NODE = 1
3+
const U_NODE = 2
4+
15
function RS(S::SparseMatrixCSC)
26

37
m,n = size(S)

test/runtests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
using AMG
22
using Base.Test
33

4+
# classical strength of connection
5+
A = poisson(5)
6+
@test full(classical(A, 0.2)) == [ 1.0 0.5 0.0 0.0 0.0
7+
0.5 1.0 0.5 0.0 0.0
8+
0.0 0.5 1.0 0.5 0.0
9+
0.0 0.0 0.5 1.0 0.5
10+
0.0 0.0 0.0 0.5 1.0 ]
11+
12+
# Ruge-Stuben splitting
13+
S = poisson(7)
14+
S = S - spdiagm(diag(S)) #FIXME
15+
@test RS(S) == [0, 1, 0, 1, 0, 1, 0]
16+
17+
srand(0)
18+
S = sprand(10,10,0.1); S = S + S'
19+
S = S - spdiagm(diag(S))
20+
@test RS(S) == [0, 1, 1, 0, 0, 0, 0, 0, 1, 1]

0 commit comments

Comments
 (0)