Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #27366 output affine_map
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Mar 7, 2019
1 parent 8fa37df commit 294fbe1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6954,8 +6954,8 @@ def affine_hull(self, as_polyhedron=None, as_affine_map=False,
if self.ambient_dim() == self.dim():
result['polyhedron'] = self
if as_affine_map or return_all_data:
result['linear_transformation'] = linear_transformation(matrix(self.base_ring(), self.dim(), self.dim(), self.base_ring().one()))
result['shift'] = self.ambient_space().zero()
result['affine_map'] = (linear_transformation(matrix(self.base_ring(), self.dim(), self.dim(), self.base_ring().one())),
self.ambient_space().zero())

elif orthogonal or orthonormal:
# see TODO
Expand All @@ -6980,11 +6980,12 @@ def affine_hull(self, as_polyhedron=None, as_affine_map=False,
A = M.gram_schmidt(orthonormal=orthonormal)[0]
if as_polyhedron:
result['polyhedron'] = Polyhedron(
[A*vector(A.base_ring(), v) for v in Q.vertices()],
[A*vector(A.base_ring(), v)
for v in self.translation(-v0).vertices()],
base_ring=A.base_ring())
if as_affine_map:
result['linear_transformation'] = linear_transformation(A, side='right')
result['shift'] = -A*vector(A.base_ring(), self.vertices()[0])
L = linear_transformation(A, side='right')
result['affine_map'] = (L, -A*vector(A.base_ring(), self.vertices()[0]))

else:
# translate one vertex to the origin
Expand Down Expand Up @@ -7017,7 +7018,7 @@ def pivot(indexed):
if return_all_data or (as_polyhedron and as_affine_map):
return result
elif as_affine_map:
return result['linear_transformation'], result['shift']
return result['affine_map']
else:
return result['polyhedron']

Expand Down

0 comments on commit 294fbe1

Please sign in to comment.