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

Commit

Permalink
Trac #27366: use new parameter-options in .volume
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Feb 26, 2019
1 parent 9bedce6 commit 2075a6b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5048,9 +5048,13 @@ def volume(self, measure='ambient', engine='auto', **kwds):
from sage.rings.infinity import infinity
return infinity
# use an orthogonal transformation, which preserves volume up to a factor provided by the transformation matrix
A, b = self.affine_hull(orthogonal=True, as_affine_map=True)
Adet = (A.matrix().transpose() * A.matrix()).det()
return self.affine_hull(orthogonal=True).volume(measure='ambient', engine=engine, **kwds) / sqrt(Adet)
affine_hull = self.affine_hull(
orthogonal=True, as_polyhedron=True, as_affine_map=True)
polyhedron = affine_hull['polyhedron']
A = affine_hull['linear_transformation'].matrix()
b = affine_hull['shift']
Adet = (A.transpose() * A).det()
return polyhedron.volume(measure='ambient', engine=engine, **kwds) / sqrt(Adet)
elif measure == 'induced_rational':
if self.dim() < self.ambient_dim() and engine != 'latte':
raise TypeError("The induced rational measure can only be computed with the engine set to `auto` or `latte`")
Expand Down

0 comments on commit 2075a6b

Please sign in to comment.