Skip to content

Add Base.get(p, inc) and incident* functions without tol#103

Open
oyamad wants to merge 1 commit intoJuliaPolyhedra:masterfrom
oyamad:get
Open

Add Base.get(p, inc) and incident* functions without tol#103
oyamad wants to merge 1 commit intoJuliaPolyhedra:masterfrom
oyamad:get

Conversation

@oyamad
Copy link
Member

@oyamad oyamad commented Feb 8, 2026

Address #21
(Yet to add tests)

  • Add tests.

@blegat I propose to implement Base.get(p, inc) (and incident* functions) without tol, rather than overwriting Base.get(p, inc; tol) (the implementation here does not use tol).

using Polyhedra, CDDLib, LinearAlgebra
n = 3
pts = vcat(zeros(1, n), Matrix(I, n, n))
p = polyhedron(vrep(pts), CDDLib.Library())
hrep(p)
p
Polyhedron CDDLib.Polyhedron{Float64}:
4-element iterator of HalfSpace{Float64, Vector{Float64}}:
 HalfSpace([1.0, 1.0, 1.0], 1.0)
 HalfSpace([-1.0, -0.0, -0.0], 0.0)
 HalfSpace([-0.0, -1.0, -0.0], 0.0)
 HalfSpace([-0.0, -0.0, -1.0], 0.0):
4-element iterator of Vector{Float64}:
 [0.0, 0.0, 0.0]
 [1.0, 0.0, 0.0]
 [0.0, 1.0, 0.0]
 [0.0, 0.0, 1.0]
T = Polyhedra.coefficient_type(p)
i = 1
idx = Polyhedra.Index{T,Vector{T}}(i)
display(incidenthalfspaces(p, idx))  # Version implemented in this PR
display(incidenthalfspaces(p, idx, tol=0))  # Version in Polyhedra.jl
3-element Vector{HalfSpace{Float64, Vector{Float64}}}:
 HalfSpace([-1.0, -0.0, -0.0], 0.0)
 HalfSpace([-0.0, -1.0, -0.0], 0.0)
 HalfSpace([-0.0, -0.0, -1.0], 0.0)
3-element Vector{HalfSpace{Float64, Vector{Float64}}}:
 HalfSpace([-1.0, -0.0, -0.0], 0.0)
 HalfSpace([-0.0, -1.0, -0.0], 0.0)
 HalfSpace([-0.0, -0.0, -1.0], 0.0)

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.71%. Comparing base (b41604e) to head (ce1ffcc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
+ Coverage   87.48%   87.71%   +0.22%     
==========================================
  Files          12       13       +1     
  Lines         975      993      +18     
==========================================
+ Hits          853      871      +18     
  Misses        122      122              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant