|
16 | 16 | -.5 1. -.5 0.;
|
17 | 17 | 0. -.5 1. -.5;
|
18 | 18 | -.5 0. -.5 1.]
|
19 |
| - scaled_lap = [0 -0.5 0 -0.5; |
20 |
| - -0.5 0 -0.5 -0; |
21 |
| - 0 -0.5 0 -0.5; |
| 19 | + scaled_lap = [0 -0.5 0 -0.5; |
| 20 | + -0.5 0 -0.5 -0; |
| 21 | + 0 -0.5 0 -0.5; |
22 | 22 | -0.5 0 -0.5 0]
|
23 | 23 |
|
24 |
| - for T in [Int8, Float64] |
| 24 | + for T in [Int8, Int16, Int32, Int64, Float16, Float32, Float64] |
25 | 25 | @test degree_matrix(adj, T, dir=:out) == T.(deg)
|
26 | 26 | @test degree_matrix(adj, T, dir=:out) == degree_matrix(adj, T, dir=:in)
|
27 | 27 | @test degree_matrix(adj, T, dir=:out) == degree_matrix(adj, T, dir=:both)
|
| 28 | + @test eltype(degree_matrix(adj, T, dir=:out)) == T |
| 29 | + |
28 | 30 | @test laplacian_matrix(adj, T) == T.(lap)
|
| 31 | + @test eltype(laplacian_matrix(adj, T)) == T |
| 32 | + end |
| 33 | + for T in [Float16, Float32, Float64] |
| 34 | + @test normalized_laplacian(adj, T) ≈ T.(norm_lap) |
| 35 | + @test eltype(normalized_laplacian(adj, T)) == T |
| 36 | + |
| 37 | + @test scaled_laplacian(adj, T) ≈ T.(scaled_lap) |
| 38 | + @test eltype(scaled_laplacian(adj, T)) == T |
29 | 39 | end
|
30 |
| - @test normalized_laplacian(adj, Float64) ≈ norm_lap |
31 |
| - @test eltype(normalized_laplacian(adj, Float32)) == Float32 |
32 |
| - @test scaled_laplacian(adj, Float64) ≈ scaled_lap |
33 |
| - @test eltype(scaled_laplacian(adj, Float32)) == Float32 |
34 | 40 | @test neighbors(adj) == [[2,4], [1,3], [2,4], [1,3]]
|
35 | 41 | end
|
36 | 42 |
|
|
52 | 58 | 0 0 7 0;
|
53 | 59 | 0 0 0 4]
|
54 | 60 |
|
55 |
| - for T in [Int8, Float64] |
| 61 | + for T in [Int8, Int16, Int32, Int64, Float16, Float32, Float64] |
56 | 62 | @test degree_matrix(adj, T, dir=:out) == T.(deg_out)
|
57 | 63 | @test degree_matrix(adj, T, dir=:in) == T.(deg_in)
|
58 | 64 | @test degree_matrix(adj, T, dir=:both) == T.(deg_both)
|
| 65 | + @test eltype(degree_matrix(adj, T, dir=:out)) == T |
| 66 | + @test eltype(degree_matrix(adj, T, dir=:in)) == T |
| 67 | + @test eltype(degree_matrix(adj, T, dir=:both)) == T |
59 | 68 | @test_throws DomainError degree_matrix(adj, dir=:other)
|
| 69 | + |
60 | 70 | @test laplacian_matrix(adj, T, dir=:out) == T.(deg_out .- adj)
|
61 | 71 | @test laplacian_matrix(adj, T, dir=:in) == T.(deg_in .- adj)
|
62 | 72 | @test laplacian_matrix(adj, T, dir=:both) == T.(deg_both .- adj)
|
| 73 | + @test eltype(laplacian_matrix(adj, T, dir=:out)) == T |
| 74 | + @test eltype(laplacian_matrix(adj, T, dir=:in)) == T |
| 75 | + @test eltype(laplacian_matrix(adj, T, dir=:both)) == T |
63 | 76 | end
|
64 | 77 | @test neighbors(adj) == [[2,3,4], [1,3], [1,2,4], [1,3]]
|
65 | 78 | end
|
|
0 commit comments