@@ -4348,43 +4348,63 @@ def linear_transformation(self, linear_transf):
43484348
43494349 def _acted_upon_ (self , actor , self_on_left ):
43504350 """
4351- Implement the multiplicative action by scalars or other polyhedra.
4351+ Implement the action by scalars, vectors, matrices or other polyhedra.
43524352
43534353 INPUT:
43544354
4355- - ``actor`` -- A scalar, not necessarily in :meth:`base_ring`,
4356- or a :class:`Polyhedron`
4355+ - ``actor`` -- one of the following:
4356+ - a scalar, not necessarily in :meth:`base_ring`,
4357+ - a :class:`Polyhedron`,
4358+ - a :class:`sage.modules.free_module_element.vector`,
4359+ - a :class:`sage.matrix.constructor.matrix`,
4360+ - ``self_on_right`` -- must be ``False`` for actor a matrix;
4361+ ignored otherwise
43574362
43584363 OUTPUT:
43594364
4360- Multiplication by another polyhedron returns the product
4361- polytope. Multiplication by a scalar returns the polytope
4362- dilated by that scalar, possibly coerced to the bigger base ring.
4365+ - Dilation for a scalar
4366+ - Product for a polyhedron
4367+ - Translation for a vector
4368+ - Linear transformation for a matrix
43634369
4364- EXAMPLES::
4370+ EXAMPLES:
4371+
4372+ ``actor`` is a scalar::
43654373
43664374 sage: p = Polyhedron(vertices = [[t,t^2,t^3] for t in srange(2,6)])
43674375 sage: p._acted_upon_(2, True) == p.dilation(2)
43684376 True
43694377 sage: p*2 == p.dilation(2)
43704378 True
4379+
4380+ ``actor`` is a polyhedron::
4381+
43714382 sage: p*p == p.product(p)
43724383 True
4384+
4385+ ``actor`` is a vector::
4386+
43734387 sage: p + vector(ZZ,[1,2,3]) == p.translation([1,2,3])
43744388 True
4389+
4390+ ``actor`` is a matrix::
4391+
43754392 sage: matrix(ZZ,[[1,2,3]]) * p
43764393 A 1-dimensional polyhedron in ZZ^1 defined as the convex hull of 2 vertices
4377- sage: matrix(ZZ,[[1,2,3]]) * p == p * matrix(ZZ, [[1], [2], [3]])
4378- True
4394+
4395+ A matrix must act from the left::
4396+
4397+ sage: p * matrix(ZZ, [[1,2,3]]*3)
4398+ Traceback (most recent call last):
4399+ ...
4400+ TypeError: unsupported operand parent(s) for *: 'Polyhedra in ZZ^3' and 'Full MatrixSpace of 3 by 3 dense matrices over Integer Ring'
43794401 """
43804402 if is_Polyhedron (actor ):
43814403 return self .product (actor )
43824404 elif is_Vector (actor ):
43834405 return self .translation (actor )
43844406 elif is_Matrix (actor ):
4385- if self_on_left :
4386- return self .linear_transformation (actor .transpose ())
4387- else :
4407+ if not self_on_left :
43884408 return self .linear_transformation (actor )
43894409 else :
43904410 return self .dilation (actor )
0 commit comments