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/codecov.yml b/codecov.yml new file mode 100644 index 0000000..db24720 --- /dev/null +++ b/codecov.yml @@ -0,0 +1 @@ +comment: off 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 ``` diff --git a/src/MixedSubdivisions.jl b/src/MixedSubdivisions.jl index 088387c..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) @@ -1532,30 +1533,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