From: Dani Date: Mon, 11 Aug 2014 18:10:14 +0000 (+0200) Subject: Update Docs X-Git-Tag: 1.0~79 X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/commitdiff_plain/148dae3a90146e4b1c5a32d1803a0a2ff66f9deb?ds=inline;hp=0f40fdb54d0fc6505342d008deaa1e9c4c9dbcee Update Docs --- diff --git a/doc/domain.rst b/doc/domain.rst index edf8934..b85b2d0 100644 --- a/doc/domain.rst +++ b/doc/domain.rst @@ -3,22 +3,14 @@ Domains Module .. py:class :: Domain - .. py:method:: symbols + .. attribute:: symbols Returns a tuple of the symbols that exsist in a domain. - .. py:method:: dimension + .. attribute:: dimension Returns the number of variables that exist in a domain. - .. py:method:: disjoint - - Returns a domain as disjoint. - - .. py:method:: involves_vars(self, dims) - - Returns ``True`` if a domain depends on the given dimensions. - .. py:method:: isempty(self) Return ``True`` is a domain is empty. @@ -69,7 +61,7 @@ Domains Module Test whether every element in *other* is in a domain. .. py:method:: complement(self) - ¬self + ~self Return the complement of a domain. @@ -77,9 +69,9 @@ Domains Module Return a new domain without any redundant constraints. - .. py:method:: project(self, dims) + .. py:method:: project(self, variables) - Return a new domain with the given dimensions removed. + Return a new domain with the given variables removed. .. py:method:: aspolyhedron(self) @@ -90,16 +82,19 @@ Domains Module Return a single sample subset of a domain. .. py:method:: intersection(self, other) + __or__ self | other Return a new domain with the elements that are common between *self* and *other*. .. py:method:: union(self, other) + __and__ self & other Return a new domain with all the elements from *self* and *other*. .. py:method:: difference(self, other) + __sub__ self - other Return a new domain with the elements in a domain that are not in *other* . @@ -118,7 +113,7 @@ Domains Module Return a new set containing the lexicographic maximum of the elements in the set. -A 2D or 3D domain can be plotted using the :meth:`plot` function. The points, verticies, and faces of a domain can be inspected using the following functions. +A 2D or 3D domain can be plotted using the :meth:`plot` method. The points, vertices, and faces of a domain can be inspected using the following functions. .. py:method:: points(self) @@ -134,4 +129,4 @@ A 2D or 3D domain can be plotted using the :meth:`plot` function. The points, ve .. py:method:: plot(self, plot=None, **kwargs) - Return a plot of the given domain. + Return a plot of the given domain or add a plot to a plot instance. diff --git a/doc/examples.rst b/doc/examples.rst index ea044b8..ee254bc 100644 --- a/doc/examples.rst +++ b/doc/examples.rst @@ -21,7 +21,8 @@ Basic Examples False >>> # 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 - 1, 0), Ge(-x + 3, 0), Ge(y - 1, 0), Ge(-y + 3, 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 @@ -30,7 +31,8 @@ Basic Examples 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(y, 0), Ge(-y + 3, 0), Ge(-x + 3, 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: diff --git a/doc/geometry.rst b/doc/geometry.rst index 0058ee9..838ec6e 100644 --- a/doc/geometry.rst +++ b/doc/geometry.rst @@ -13,19 +13,19 @@ This class represents points in space. .. py:method:: __eq__(self, other) - Compares two Points for equality. + Compare two Points for equality. .. py:method:: __add__(self, other) - Adds a Point to a Vector and returns the result as a Point. + Add a Point to a Vector and return the result as a Point. .. py:method:: __sub__(self, other) - Returns the difference between two Points as a Vector. + Return the difference between two Points as a Vector. .. py:method:: aspolyhedon(self) - Returns a Point as a polyhedron. + Return a Point as a polyhedron corresponding to the Point, assuming the Point has integer coordinates. .. py:class:: Vector @@ -34,11 +34,11 @@ This class represents displacements in space. .. py:method:: __eq__(self, other) - Compares two Vectors for equality. + Compare two Vectors for equality. .. py:method:: __add__(self, other) - Adds either a Point or Vector to a Vector. The resulting sum is returned as the same structure *other* is. + Add either a Point or Vector to a Vector. The resulting sum is returned as the same structure *other* is. .. py:method:: __sub__(self, other) @@ -46,11 +46,11 @@ This class represents displacements in space. .. py:method:: __mul__(self, other) - Multiples a Vector by a scalar value and returns the result as a Vector. + Multiply a Vector by a scalar value and returns the result as a Vector. .. py:method:: __neg__(self) - Negates a Vector. + Negate a Vector. .. py:method:: norm(self) @@ -67,7 +67,7 @@ This class represents displacements in space. .. py:method:: cross(self, other) - Calculate the cross product of two Vector3D structures. + Calculate the cross product of two Vector3D structures. If the vectors are not tridimensional, a _____ error is raised. .. py:method:: dot(self, other) diff --git a/doc/linexpr.rst b/doc/linexpr.rst index 2aab652..b5d8069 100644 --- a/doc/linexpr.rst +++ b/doc/linexpr.rst @@ -1,7 +1,7 @@ Linear Expression Module ======================== -This class implements linear expressions. +This class implements linear expressions. A linear expression is…. .. py:class:: Expression @@ -14,21 +14,21 @@ This class implements linear expressions. Return a list of the coefficients of an expression - .. py:method:: constant(self) + .. attribute:: constant Return the constant value of an expression. - .. py:method:: symbols(self) + .. attribute:: symbols Return a list of symbols in an expression. - .. py:method:: dimension(self) + .. attribute:: dimension - Return the number of vriables in an expression. + Return the number of variables in an expression. .. py:method:: __sub__(self, other) - Return the difference between two expressions. + Return the difference between *self* and *other*. .. py:method:: subs(self, symbol, expression=None) diff --git a/doc/modules.rst b/doc/modules.rst index fd8158f..bf383c7 100644 --- a/doc/modules.rst +++ b/doc/modules.rst @@ -3,7 +3,9 @@ LinPy Module Reference ====================== -There are four main LinPy modules: +There are four main LinPy modules, all of them can be inherited at once with the LinPy package: + + >>> from linpy import * .. toctree:: :maxdepth: 2 diff --git a/doc/polyhedra.rst b/doc/polyhedra.rst index 1cb9396..1f2756b 100644 --- a/doc/polyhedra.rst +++ b/doc/polyhedra.rst @@ -5,17 +5,17 @@ Polyhedron class allows users to build and inspect polyherons. .. py:class:: Polyhedron - .. attribute:: equalities(self) + .. py:property:: equalities - Return a list of the equalities in a polyhedron. + Returns a list of the equalities in a polyhedron. - .. attribute:: inequalities(self) + .. py:property:: inequalities - Return a list of the inequalities in a polyhedron. + Returns a list of the inequalities in a polyhedron. - .. py:method:: constraints(self) + .. py:property:: constraints - Return ta list of the constraints of a polyhedron. + Returns a list of the constraints of a polyhedron. .. py:method:: disjoint(self) @@ -27,30 +27,30 @@ Polyhedron class allows users to build and inspect polyherons. .. py:method:: subs(self, symbol, expression=None) - Subsitutes an expression into a polyhedron and returns the result. + Substitutes an expression into a polyhedron and returns the result. -To create a polyhedron, the user can use the following 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 constraints. .. py:function:: Eq(left, right) - Create a constraint by setting *left* equal to *right*. + Returns a Polyhedron instance with a single constraint as *left* equal to *right*. .. py:function:: Ne(left, right) - Create a constraint by setting *left* not equal to *right*. + Returns a Polyhedron instance with a single constraint as *left* not equal to *right*. .. py:function:: Lt(left, right) - Create a constraint by setting *left* less than *right*. + Returns a Polyhedron instance with a single constraint as *left* less than *right*. .. py:function:: Le(left, right) - Create a constraint by setting *left* less than or equal to *right*. + Returns a Polyhedron instance with a single constraint as *left* less than or equal to *right*. .. py:function:: Gt(left, right) - Create a constraint by setting *left* greater than *right*. + Returns a Polyhedron instance with a single constraint as *left* greater than *right*. .. py:function:: Ge(left, right) - Create a constraint by setting *left* greater than or equal to *right*. + Returns a Polyhedron instance with a single constraint as *left* greater than or equal to *right*.