From: Danielle Bolan Date: Mon, 11 Aug 2014 15:56:08 +0000 (+0200) Subject: Small changes to docs as recommended X-Git-Tag: 1.0~81 X-Git-Url: https://scm.cri.ensmp.fr/git/linpy.git/commitdiff_plain/35c965895771a3df79744ae54f1eda91f0b62862 Small changes to docs as recommended --- diff --git a/doc/examples.rst b/doc/examples.rst index 13c59fc..1884f49 100644 --- a/doc/examples.rst +++ b/doc/examples.rst @@ -9,27 +9,27 @@ Basic Examples >>> x, y = symbols('x y') >>> # define the constraints of the polyhedron >>> square1 = Le(0, x) & Le(x, 2) & Le(0, y) & Le(y, 2) - >>> print(square1) + >>> square1 And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0)) Binary operations and properties examples: - >>> square2 = Le(2, x) & Le(x, 4) & Le(2, y) & Le(y, 4) + >>> square2 = Le(1, x) & Le(x, 3) & Le(1, y) & Le(y, 3) >>> #test equality >>> square1 == square2 False - >>> # compute the union of two polygons + >>> # compute the union of two polyhedrons >>> square1 | square2 - Or(And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0)), And(Ge(x - 2, 0), Ge(-x + 4, 0), Ge(y - 2, 0), Ge(-y + 4, 0))) + Or(And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0)), And(Ge(x - 1, 0), Ge(-x + 3, 0), Ge(y - 1, 0), Ge(-y + 3, 0))) >>> # check if square1 and square2 are disjoint >>> square1.disjoint(square2) False - >>> # compute the intersection of two polygons + >>> # compute the intersection of two polyhedrons >>> square1 & square2 - And(Eq(y - 2, 0), Eq(x - 2, 0)) - >>> # compute the convex union of two polygons + And(Ge(x - 1, 0), Ge(-x + 2, 0), Ge(y - 1, 0), Ge(-y + 2, 0)) + >>> # compute the convex union of two polyhedrons >>> Polyhedron(square1 | sqaure2) - And(Ge(x, 0), Ge(-x + 4, 0), Ge(y, 0), Ge(-y + 4, 0), Ge(x - y + 2, 0), Ge(-x + y + 2, 0)) + And(Ge(x, 0), Ge(y, 0), Ge(-y + 3, 0), Ge(-x + 3, 0), Ge(x - y + 2, 0), Ge(-x + y + 2, 0)) Unary operation and properties examples: @@ -55,24 +55,31 @@ Plot Examples >>> # define the symbols >>> x, y, z = symbols('x y z') >>> fig = plt.figure() - >>> cham_plot = fig.add_subplot(2, 2, 3, projection='3d') + >>> cham_plot = fig.add_subplot(1, 1, 1, projection='3d', aspect='equal') >>> cham_plot.set_title('Chamfered cube') - >>> cham = Le(0, x) & Le(x, 3) & Le(0, y) & Le(y, 3) & Le(0, z) & Le(z, 3) & Le(z - 2, x) & Le(x, z + 2) & Le(1 - z, x) & Le(x, 5 - z) & Le(z - 2, y) & Le(y, z + 2) & Le(1 - z, y) & Le(y, 5 - z) & Le(y - 2, x) & Le(x, y + 2) & Le(1 - y, x) & Le(x, 5 - y) - >>> cham.plot(cham_plot, facecolors=(1, 0, 0, 0.75)) + >>> cham = Le(0, x) & Le(x, 3) & Le(0, y) & Le(y, 3) & Le(0, z) & \ + Le(z, 3) & Le(z - 2, x) & Le(x, z + 2) & Le(1 - z, x) & \ + Le(x, 5 - z) & Le(z - 2, y) & Le(y, z + 2) & Le(1 - z, y) & \ + Le(y, 5 - z) & Le(y - 2, x) & Le(x, y + 2) & Le(1 - y, x) & Le(x, 5 - y) + >>> cham.plot(cham_plot, facecolor='red', alpha=0.75) >>> pylab.show() - .. figure:: images/cube.jpg + .. figure:: images/cham_cube.jpg :align: center - LinPy can also inspect a polygon's vertices and the integer points included in the polygon. +LinPy can also inspect a polygon's vertices and the integer points included in the polygon. >>> diamond = Ge(y, x - 1) & Le(y, x + 1) & Ge(y, -x - 1) & Le(y, -x + 1) >>> diamond.vertices() - [Point({x: Fraction(0, 1), y: Fraction(1, 1)}), Point({x: Fraction(-1, 1), y: Fraction(0, 1)}), Point({x: Fraction(1, 1), y: Fraction(0, 1)}), Point({x: Fraction(0, 1), y: Fraction(-1, 1)})] + [Point({x: Fraction(0, 1), y: Fraction(1, 1)}), \ + Point({x: Fraction(-1, 1), y: Fraction(0, 1)}), \ + Point({x: Fraction(1, 1), y: Fraction(0, 1)}), \ + Point({x: Fraction(0, 1), y: Fraction(-1, 1)})] >>> diamond.points() - [Point({x: -1, y: 0}), Point({x: 0, y: -1}), Point({x: 0, y: 0}), Point({x: 0, y: 1}), Point({x: 1, y: 0})] + [Point({x: -1, y: 0}), Point({x: 0, y: -1}), Point({x: 0, y: 0}), \ + Point({x: 0, y: 1}), Point({x: 1, y: 0})] - The user also can pass another plot to the :meth:`plot` method. This can be useful to compare two polyhedrons on the same axis. This example illustrates the union of two squares. +The user also can pass another plot to the :meth:`plot` method. This can be useful to compare two polyhedrons on the same axis. This example illustrates the union of two squares. >>> from linpy import * >>> import matplotlib.pyplot as plt diff --git a/doc/images/cham_cube.jpg b/doc/images/cham_cube.jpg new file mode 100644 index 0000000..dd7dfca Binary files /dev/null and b/doc/images/cham_cube.jpg differ diff --git a/doc/images/cube.jpg b/doc/images/cube.jpg deleted file mode 100644 index d10cdaa..0000000 Binary files a/doc/images/cube.jpg and /dev/null differ diff --git a/doc/install.rst b/doc/install.rst index 0ed0654..d1b9f1f 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -2,28 +2,43 @@ Installation ------------ - Source ====== Users can install LinPy by cloning the git repository:: - git clone https://scm.cri.ensmp.fr/git/pypol.git + git clone https://scm.cri.ensmp.fr/git/linpy.git -Install -======= +Then, execute the following to complete installation:: + + python3 setup.py install + +PyPi +==== -…execute `setup.py` + sudo pip install linpy Dependencies ============ -LinPy has several dependencies. Users will first need to install Integer Set Library (isl). The source files of isl are available as a tarball or a git repository. Both are available `here`_ . +LinPy's one mandatory dependency is isl, which can be downloaded from `here`_ or using package manager, e.g for ubuntu:: -To use the LinPy plotting function, users need to install matplotlib using instructions in the following `link`_. + sudo apt-get install libisl­-dev +There are two optional dependencies that will maximize the use of LinPy's +functions; SymPy and matplotlib. SymPy installation instructions can be found on the SymPy `download page`_. Matplotlib install information can be found at this `link`_. + +License +======= + +LinPy is a free software, licensed under the `GPLv3 license`_ . .. _here: http://freshmeat.net/projects/isl/ +.. _download page: http://sympy.org/en/download.html + .. _link: http://matplotlib.org/faq/installing_faq.html + +.. _GPLv3 license: https://www.gnu.org/licenses/gpl-3.0.txt + diff --git a/doc/modules.rst b/doc/modules.rst index 281ab9f..fd8158f 100644 --- a/doc/modules.rst +++ b/doc/modules.rst @@ -8,8 +8,8 @@ There are four main LinPy modules: .. toctree:: :maxdepth: 2 + linexpr.rst polyhedra.rst domain.rst - linexpr.rst geometry.rst diff --git a/doc/polyhedra.rst b/doc/polyhedra.rst index 47462a7..605dded 100644 --- a/doc/polyhedra.rst +++ b/doc/polyhedra.rst @@ -1,11 +1,11 @@ Polyhedra Module ================ -.. py:class:: Polyhedron - - Polyhedron class allows users to build and inspect polyherons. +Polyhedron class allows users to build and inspect polyherons. - .. py:method:: equalities(self) +.. py:class:: Polyhedron + + .. py:property:: equalities(self) Return a list of the equalities in a polyhedron. @@ -29,7 +29,7 @@ Polyhedra Module Subsitutes an expression into a polyhedron and returns the result. -To create a polyhedron, the user must use the folloing functions to define equalities and inequalities as the contraints. +To create a polyhedron, the user can use the following functions to define equalities and inequalities as the contraints. .. py:function:: Eq(left, right)