1 | initial version |
In case someone finds it useful, I wrote a function whose input is a cone C
and whose output is a dictionary that maps each face of C
to its dual face of C.dual()
.
def cone_dual_face_dct(C):
d = C.dim()
M = C.lattice().dual()
c = C.face_lattice()
cv = C.dual().face_lattice()
faces = {i+1: list(C.faces(i+1)) for i in xrange(d-1)}
dual_faces = {i+1: list(C.dual().faces(i+1)) for i in xrange(d-1)}
dct = {c.bottom(): cv.top(), c.top(): cv.bottom()}
for i in faces:
for f in faces[i]:
eqs = zero_matrix(f.nrays(), 1).augment(f.rays().matrix())
fd = Polyhedron(eqns=eqs).intersection(C.dual().polyhedron())
fd = Cone(fd, M)
for x in dual_faces[d-i]:
if fd.is_equivalent(x):
dct[f] = x
dual_faces[d-i].remove(x)
break
else:
raise TypeError('Face {} has no match in dual cone!'.format(f))
return dct
I'm sure this could be improved and I would welcome edits.