Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SparseMatrixColorings"
uuid = "0a514795-09f3-496d-8182-132a7b665d35"
authors = ["Guillaume Dalle", "Alexis Montoison"]
version = "0.4.15"
version = "0.4.16"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
4 changes: 2 additions & 2 deletions src/order.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function DegreeBuckets(::Type{T}, degrees::Vector{<:Integer}, dmax::Integer) whe
deg_count[d + 1] += 1
end
# bucket limits
bucket_high = cumsum(deg_count)
bucket_high = convert(Vector{T}, cumsum(deg_count))
bucket_low = vcat(zero(T), @view(bucket_high[1:(end - 1)]))
bucket_low .+= 1
# assign each vertex to the correct position inside its degree class
Expand Down Expand Up @@ -253,7 +253,7 @@ function vertices(
if degree_increasing(; degtype, direction)
degrees = zeros(T, nb_vertices(g))
else
degrees = [degree(g, v) for v in vertices(g)]
degrees = T[degree(g, v) for v in vertices(g)]
end
db = DegreeBuckets(T, degrees, maximum_degree(g))
π = T[]
Expand Down
40 changes: 21 additions & 19 deletions test/type_stability.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,25 +178,27 @@ end;
(:nonsymmetric, :bidirectional, :direct),
(:nonsymmetric, :bidirectional, :substitution),
]
result = coloring(
A,
ColoringProblem(; structure, partition),
GreedyColoringAlgorithm(; decompression);
)
if partition in (:column, :bidirectional)
@test eltype(column_colors(result)) == Int32
@test eltype(column_groups(result)[1]) == Int32
end
if partition in (:row, :bidirectional)
@test eltype(row_colors(result)) == Int32
@test eltype(row_groups(result)[1]) == Int32
end
if partition == :bidirectional
Br, Bc = compress(A, result)
@test decompress(Br, Bc, result) isa SparseMatrixCSC{Float32,Int32}
else
B = compress(A, result)
@test decompress(B, result) isa SparseMatrixCSC{Float32,Int32}
for order in (NaturalOrder(), RandomOrder(), LargestFirst(), DynamicLargestFirst())
result = coloring(
A,
ColoringProblem(; structure, partition),
GreedyColoringAlgorithm(order; decompression);
)
if partition in (:column, :bidirectional)
@test eltype(column_colors(result)) == Int32
@test eltype(column_groups(result)[1]) == Int32
end
if partition in (:row, :bidirectional)
@test eltype(row_colors(result)) == Int32
@test eltype(row_groups(result)[1]) == Int32
end
if partition == :bidirectional
Br, Bc = compress(A, result)
@test decompress(Br, Bc, result) isa SparseMatrixCSC{Float32,Int32}
else
B = compress(A, result)
@test decompress(B, result) isa SparseMatrixCSC{Float32,Int32}
end
end
end
end
Loading