.. _sec-zonotope: .. _subsec-zonotope-zonotope: Zonotopes ========= Main author: `Maƫl Godard `_ The following classes represent zonotopes. Zonotope -------- A zonotope is a convex and symmetric polytope. It can be represented as the Minkowski sum of a finite number of line segments, which are called its generators. In Codac, zonotopes are represented by the class :class:`Zonotope`. A zonotope is defined by its center and its generators. The center is a :class:`Vector`, noted :math:`z`, and the generators are stored in a :class:`Matrix`, noted :math:`A`. Each column of the matrix corresponds to a generator. The resulting zonotope is: .. math:: Z = z + A \cdot [-1,1]^m Where :math:`m` is the number of generators (i.e., the number of columns of the matrix :math:`A`). For example, let us consider the following zonotope in :math:`\mathbb{R}^2`: .. math:: Z = \left(\begin{array}{c} 1\\ 2\\ \end{array}\right) + \left(\begin{array}{ccc} 1 & 0 & 2 \\ 0 & 1 & 1 \end{array}\right) \cdot [-1,1]^3 It can be constructed in Codac as follows: .. tabs:: .. code-tab:: py z = Vector([1,2]) A = Matrix([[1,0,2],[0,1,1]]) Z = Zonotope(z, A) .. code-tab:: c++ Vector z({1,2}); Matrix A({{1,0,2},{0,1,1}}); Zonotope Z(z, A); .. code-tab:: matlab z = Vector({1,2}); A = Matrix({{1,0,2},{0,1,1}}); Z = Zonotope(z,A); The resulting zonotope is represented in the figure below: .. figure:: zonotope.png :width: 400px Additional methods are provided to handle zonotopes. - `box()`: gives the bounding box of the zonotope. Returns an :class:`IntervalVector`. - `proj(v)`: Projects the zonotope on a given subspace, defined by the vector of indices `v` (:class:`std::vector\`). Returns a :class:`Zonotope`. .. _subsec-zonotope-parallelepiped: Parallelepiped -------------- A parallelepiped is a special case of zonotope, where the number of generators is equal or less than the dimension of the space. It inherits from the `Zonotope` class, and thus has the same properties and methods. In addition, it defines the following methods: - `vertices()`: gives the vertices of the parallelepiped. Returns a :class:`std::vector\`. - `contains(v)`: checks if the point `v` is contained in the parallelepiped. Returns a :class:`BoolInterval`. **The matrix A must be invertible** - `is_superset(x)`: checks if the parallelepiped is a superset of the :class:`IntervalVector` `x`. Returns a :class:`BoolInterval`. **The matrix A must be invertible**