Skip to content

Commit c72c8bb

Browse files
authored
Merge pull request #33 from ranjanan/int32
Support int32
2 parents ab05ad8 + 600b7e3 commit c72c8bb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/aggregate.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
struct StandardAggregation
22
end
33

4-
function aggregation(::StandardAggregation, S)
4+
function aggregation(::StandardAggregation, S::SparseMatrixCSC{T,R}) where {T,R}
55

66
n = size(S, 1)
7-
x = zeros(Int, n)
8-
y = zeros(Int, n)
7+
x = zeros(R, n)
8+
y = zeros(R, n)
99

1010
next_aggregate = 1
1111

@@ -96,12 +96,12 @@ function aggregation(::StandardAggregation, S)
9696
# Some nodes not aggregated
9797
if minimum(x) == -1
9898
mask = x .!= -1
99-
I = collect(1:n)[mask]
99+
I = collect(R, 1:n)[mask]
100100
J = x[mask] + 1
101101
V = ones(eltype(S), length(J))
102102
AggOp = sparse(J,I,V,N,M)
103103
else
104-
Tp = collect(1:n+1)
104+
Tp = collect(R, 1:n+1)
105105
x .= x .+ 1
106106
Tx = ones(eltype(S), length(x))
107107
AggOp = SparseMatrixCSC(N, M, Tp, x, Tx)

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ end
266266
test_jacobi_prolongator()
267267
end
268268

269+
@testset "Int32 support" begin
270+
a = sparse(Int32.(1:10), Int32.(1:10), rand(10))
271+
@inferred smoothed_aggregation(a)
272+
end
273+
269274
# Issue #24
270275
nodes_not_agg()
271276

0 commit comments

Comments
 (0)