Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed interiorVector to work for cones with no rays, and added a test #3602

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions M2/Macaulay2/packages/Polyhedra/core/cone/methods.m2
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@ minFace (Matrix,Cone) := (v,C) -> (
-- OUTPUT : 'p', a point given as a matrix
interiorVector = method(TypicalValue => Matrix)
interiorVector Cone := C -> (
if dim C == 0 then map(ZZ^(ambDim C),ZZ^1,0)
Rm := rays C;
if numColumns Rm == 0 then map(ZZ^(ambDim C),ZZ^1,0)
else (
Rm := rays C;
ones := matrix toList(numColumns Rm:{1});
-- Take the sum of the rays
iv := Rm * ones;
transpose matrix apply(entries transpose iv, w -> (g := abs gcd w; apply(w, e -> e//g)))));


-- INPUT : '(p,C)', where 'p' is a point given by a matrix and 'C' is a Cone
-- OUTPUT : 'true' or 'false'
inInterior (Matrix,Cone) := (p,C) -> (
Expand Down
6 changes: 6 additions & 0 deletions M2/Macaulay2/packages/Polyhedra/tests/core/cone_basics.m2
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ TEST ///
P = convexHull transpose matrix {{0,0},{2,0},{2,3},{-1,4}}
assert(isSimplicial P)
///

--Test for interiorVector for cone without rays
TEST ///
C = coneFromVData(map(ZZ^(4),ZZ^1,0), matrix{{1},{1},{1},{1}})
assert(interiorVector C==matrix{{0},{0},{0},{0}})
///
Loading