From 9d3c48a7ba1c3a62f56cd7d66e4f278e470beb77 Mon Sep 17 00:00:00 2001 From: Sascha Timme Date: Sat, 22 Jun 2019 23:42:24 +0200 Subject: [PATCH 1/4] Catch overflow errors --- src/MixedSubdivisions.jl | 49 +++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/MixedSubdivisions.jl b/src/MixedSubdivisions.jl index 088387c..ee5475b 100644 --- a/src/MixedSubdivisions.jl +++ b/src/MixedSubdivisions.jl @@ -1532,30 +1532,37 @@ function fine_mixed_cells(support::Vector{<:Matrix}, lifting_sampler=gaussian_li p = nothing end - - while true - lifting = map(A -> lifting_sampler(size(A,2))::Vector{Int32}, support) - iter = MixedCellIterator(support, lifting) - - all_valid = true - cells = MixedCell[] - ncells = 0 - mv = 0 - for cell in iter - if !is_fully_mixed_cell(cell, support, lifting) - all_valid = false - break + try + while true + lifting = map(A -> lifting_sampler(size(A,2))::Vector{Int32}, support) + iter = MixedCellIterator(support, lifting) + + all_valid = true + cells = MixedCell[] + ncells = 0 + mv = 0 + for cell in iter + if !is_fully_mixed_cell(cell, support, lifting) + all_valid = false + break + end + ncells += 1 + mv += cell.volume + push!(cells, copy(cell)) + if p !== nothing + ProgressMeter.update!(p, ncells; showvalues=((:mixed_volume, mv),)) + end end - ncells += 1 - mv += cell.volume - push!(cells, copy(cell)) - if p !== nothing - ProgressMeter.update!(p, ncells; showvalues=((:mixed_volume, mv),)) + if all_valid + p !== nothing && ProgressMeter.finish!(p; showvalues=((:mixed_volume, mv),)) + return cells, lifting end end - if all_valid - p !== nothing && ProgressMeter.finish!(p; showvalues=((:mixed_volume, mv),)) - return cells, lifting + catch e + if isa(e, InexactError) || isa(e, SingularException) + return nothing + else + rethrow(e) end end end From 0ccc798502fe1fa83d062b494414ffa27ecfc32f Mon Sep 17 00:00:00 2001 From: Sascha Timme Date: Sat, 22 Jun 2019 23:44:13 +0200 Subject: [PATCH 2/4] Bump version and widen signatures. --- Project.toml | 6 +++--- src/MixedSubdivisions.jl | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 97dd3ae..978bd6d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MixedSubdivisions" uuid = "291d046c-3347-11e9-1e74-c3d251d406c6" authors = ["Sascha Timme "] -version = "0.2.0" +version = "0.3.0" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -11,8 +11,8 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] MultivariatePolynomials = "^0.2.8" -ProgressMeter = "^0.8, ^0.9" -StaticArrays = "^0.10" +ProgressMeter = "^0.8, ^0.9, ^1.0" +StaticArrays = "^0.9, ^0.10, ^0.11" [extras] PolynomialTestSystems = "4c526841-e1e8-562c-bfa9-9f39d642e243" diff --git a/src/MixedSubdivisions.jl b/src/MixedSubdivisions.jl index ee5475b..5a5ddec 100644 --- a/src/MixedSubdivisions.jl +++ b/src/MixedSubdivisions.jl @@ -1520,7 +1520,8 @@ end Compute all (fine) mixed cells of the given `support` induced by a generic lifting. This guarantees that all induce intial forms binomials. -Returns a `Vector` of all mixed cells and the corresponding lifting. +Returns a `Vector` of all mixed cells and the corresponding lifting or `nothing` if the algorithm +wasn't able to compute fine mixed cells. This can happen due to some current technical limitations. """ function fine_mixed_cells(f::Vector{<:MP.AbstractPolynomialLike}, lifting_sampler=gaussian_lifting_sampler; show_progress=true) fine_mixed_cells(support(f), lifting_sampler) From 52031d88825af7b68e468d61a60ae65c2658ddf7 Mon Sep 17 00:00:00 2001 From: Sascha Timme Date: Sat, 22 Jun 2019 23:44:32 +0200 Subject: [PATCH 3/4] Add fine_mixed_cells to docs --- docs/src/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/index.md b/docs/src/index.md index c3cadb9..26fb703 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -127,5 +127,6 @@ normal indices MixedCellIterator mixed_cells +fine_mixed_cells support ``` From 3e1da6a8900b04e1574a6129986d1928b9ade770 Mon Sep 17 00:00:00 2001 From: Sascha Timme Date: Sat, 22 Jun 2019 23:51:46 +0200 Subject: [PATCH 4/4] Disable codecov comments --- codecov.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..db24720 --- /dev/null +++ b/codecov.yml @@ -0,0 +1 @@ +comment: off