JuliaDiff / SparseDiffTools.jl

Fast jacobian computation through sparsity exploitation and matrix coloring
MIT License
237 stars 41 forks source link

Initialize result for D1 coloring #122

Closed michel2323 closed 3 years ago

michel2323 commented 3 years ago

Once under a blue moon the 1D coloring returns an invalid color at result[2]. This happens very very rarely. Below is an example we caught in the CI. Rerunning the test fixes the problem. I have no proof, but looking at the code it seems that in the first iteration of the outer for loop (i=2), available is uninitialized, which then could lead to a wrong entry before available is filled at the end of the loop. In that case, this would be the fix.

coloring = [1, 65, 1, 2, 3, 1, 3, 4, 5, 4, 5, 6, 2, 4, 2, 5, 2, 1, 3, 2, 1, 3, 2, 1, 4, 1, 2, 3, 3, 2, 1, 3, 4, 2, 1, 3, 4, 2, 4, 1, 2, 4, 2, 1, 1, 3, 5, 7, 1, 2, 1, 2, 4, 7, 3, 5, 6, 7, 8, 8, 9, 10, 8, 11, 7, 9, 5, 4, 6, 5, 8, 6, 5, 7, 8, 6, 7, 4, 4, 5, 6, 7, 8, 5, 6, 9, 11, 7, 7, 8, 6, 7, 6, 3, 7, 6, 12, 13, 3, 5, 6, 5, 8, 11, 10, 11]
codecov-io commented 3 years ago

Codecov Report

Merging #122 (0e32898) into master (3314809) will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
+ Coverage   80.43%   80.46%   +0.03%     
==========================================
  Files          12       12              
  Lines         557      558       +1     
==========================================
+ Hits          448      449       +1     
  Misses        109      109              
Impacted Files Coverage Δ
src/coloring/greedy_d1_coloring.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3314809...0e32898. Read the comment docs.