Skip to content

Commit 3efb338

Browse files
amontoisongdalle
andauthored
Update result.jl (#109)
* Update result.jl close #108 * Format * Test on empty matrices too * Fix --------- Co-authored-by: Guillaume Dalle <22795598+gdalle@users.noreply.github.com>
1 parent 1bbe0a5 commit 3efb338

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/result.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function TreeSetColoringResult(
279279
reverse_bfs_orders = [Tuple{Int,Int}[] for i in 1:ntrees]
280280

281281
# nvmax is the number of vertices of the biggest tree in the forest
282-
nvmax = mapreduce(length, max, vertices_by_tree)
282+
nvmax = mapreduce(length, max, vertices_by_tree; init=0)
283283

284284
# Create a queue with a fixed size nvmax
285285
queue = Vector{Int}(undef, nvmax)

test/random.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ using Test
1212
rng = StableRNG(63)
1313

1414
asymmetric_params = vcat(
15-
[(10, 20, p) for p in (0.1:0.1:0.5)],
16-
[(20, 10, p) for p in (0.1:0.1:0.5)],
15+
[(10, 20, p) for p in (0.0:0.1:0.5)],
16+
[(20, 10, p) for p in (0.0:0.1:0.5)],
1717
[(100, 200, p) for p in (0.01:0.01:0.05)],
1818
[(200, 100, p) for p in (0.01:0.01:0.05)],
1919
)
2020

2121
symmetric_params = vcat(
22-
[(10, p) for p in (0.1:0.1:0.5)], #
22+
[(10, p) for p in (0.0:0.1:0.5)], #
2323
[(100, p) for p in (0.01:0.01:0.05)],
2424
)
2525

test/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function test_coloring_decompression(
9898
end
9999

100100
@testset "Linear system decompression" begin
101-
if structure == :symmetric
101+
if structure == :symmetric && count(!iszero, A) > 0 # sparse factorization cannot handle empty matrices
102102
linresult = LinearSystemColoringResult(sparse(A), color, Float64)
103103
@test decompress(float.(B), linresult) A0
104104
@test decompress!(respectful_similar(float.(A)), float.(B), linresult) A0

0 commit comments

Comments
 (0)