Skip to content

Commit

Permalink
Merge pull request #9 from saschatimme/error-handling
Browse files Browse the repository at this point in the history
Error handling + Improvements
  • Loading branch information
saschatimme authored Jun 23, 2019
2 parents 64cb21c + 3e1da6a commit 1976153
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MixedSubdivisions"
uuid = "291d046c-3347-11e9-1e74-c3d251d406c6"
authors = ["Sascha Timme <sascha.timme@gmail.com>"]
version = "0.2.0"
version = "0.3.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: off
1 change: 1 addition & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@ normal
indices
MixedCellIterator
mixed_cells
fine_mixed_cells
support
```
52 changes: 30 additions & 22 deletions src/MixedSubdivisions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

2 comments on commit 1976153

@saschatimme
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/1525

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" 1976153747933ae510541fc78ece985b2ad4f61c
git push origin v0.3.0

Please sign in to comment.