Cosmetic changes in documentation
[linpy.git] / doc / reference.rst
index 4dcfbdc..8e36056 100644 (file)
@@ -2,6 +2,7 @@
 Module Reference
 ================
 
 Module Reference
 ================
 
+
 Symbols
 -------
 
 Symbols
 -------
 
@@ -103,7 +104,7 @@ For example, if ``x`` is a :class:`Symbol`, then ``x + 1`` is an instance of :cl
     A linear expression with no symbol, only a constant term, is automatically subclassed as a :class:`Rational` instance.
 
     .. method:: coefficient(symbol)
     A linear expression with no symbol, only a constant term, is automatically subclassed as a :class:`Rational` instance.
 
     .. method:: coefficient(symbol)
-                   __getitem__(symbol)
+                __getitem__(symbol)
 
         Return the coefficient value of the given symbol, or ``0`` if the symbol does not appear in the expression.
 
 
         Return the coefficient value of the given symbol, or ``0`` if the symbol does not appear in the expression.
 
@@ -148,11 +149,11 @@ For example, if ``x`` is a :class:`Symbol`, then ``x + 1`` is an instance of :cl
 
     .. method:: __mul__(value)
 
 
     .. method:: __mul__(value)
 
-        Return the product of the linear expression as a rational.
+        Return the product of the linear expression by a rational.
 
     .. method:: __truediv__(value)
 
 
     .. method:: __truediv__(value)
 
-        Return the quotient of the linear expression as a rational.
+        Return the quotient of the linear expression by a rational.
 
     .. method:: __eq__(expr)
 
 
     .. method:: __eq__(expr)
 
@@ -161,9 +162,9 @@ For example, if ``x`` is a :class:`Symbol`, then ``x + 1`` is an instance of :cl
     As explained below, it is possible to create polyhedra from linear expressions using comparison methods.
 
     .. method:: __lt__(expr)
     As explained below, it is possible to create polyhedra from linear expressions using comparison methods.
 
     .. method:: __lt__(expr)
-                   __le__(expr)
-                   __ge__(expr)
-                   __gt__(expr)
+                __le__(expr)
+                __ge__(expr)
+                __gt__(expr)
 
         Create a new :class:`Polyhedron` instance whose unique constraint is the comparison between two linear expressions.
         As an alternative, functions :func:`Lt`, :func:`Le`, :func:`Ge` and :func:`Gt` can be used.
 
         Create a new :class:`Polyhedron` instance whose unique constraint is the comparison between two linear expressions.
         As an alternative, functions :func:`Lt`, :func:`Le`, :func:`Ge` and :func:`Gt` can be used.
@@ -172,13 +173,12 @@ For example, if ``x`` is a :class:`Symbol`, then ``x + 1`` is an instance of :cl
         >>> x < y
         Le(x - y + 1, 0)
 
         >>> x < y
         Le(x - y + 1, 0)
 
-
     .. method:: scaleint()
 
         Return the expression multiplied by its lowest common denominator to make all values integer.
 
     .. method:: subs(symbol, expression)
     .. method:: scaleint()
 
         Return the expression multiplied by its lowest common denominator to make all values integer.
 
     .. method:: subs(symbol, expression)
-                   subs(pairs)
+                subs(pairs)
 
         Substitute the given symbol by an expression and return the resulting expression.
         Raise :exc:`TypeError` if the resulting expression is not linear.
 
         Substitute the given symbol by an expression and return the resulting expression.
         Raise :exc:`TypeError` if the resulting expression is not linear.
@@ -203,7 +203,7 @@ For example, if ``x`` is a :class:`Symbol`, then ``x + 1`` is an instance of :cl
     .. classmethod:: fromsympy(expr)
 
         Create a linear expression from a :mod:`sympy` expression.
     .. classmethod:: fromsympy(expr)
 
         Create a linear expression from a :mod:`sympy` expression.
-        Raise :exc:`ValueError` is the :mod:`sympy` expression is not linear.
+        Raise :exc:`TypeError` is the :mod:`sympy` expression is not linear.
 
     .. method:: tosympy()
 
 
     .. method:: tosympy()
 
@@ -227,6 +227,7 @@ They are implemented by the :class:`Rational` class, that inherits from both :cl
 
     See the documentation of :class:`fractions.Fraction` for more information and examples.
 
 
     See the documentation of :class:`fractions.Fraction` for more information and examples.
 
+
 Polyhedra
 ---------
 
 Polyhedra
 ---------
 
@@ -278,9 +279,19 @@ This space can be unbounded.
         The tuple of constraints, i.e., equalities and inequalities.
         This is semantically equivalent to: ``equalities + inequalities``.
 
         The tuple of constraints, i.e., equalities and inequalities.
         This is semantically equivalent to: ``equalities + inequalities``.
 
+    .. method:: convex_union(polyhedron[, ...])
+
+        Return the convex union of two or more polyhedra.
+
+    .. method:: asinequalities()
+
+        Express the polyhedron using inequalities, given as a list of expressions greater or equal to 0.
+
     .. method:: widen(polyhedron)
 
     .. method:: widen(polyhedron)
 
-        Compute the standard widening of two polyhedra, à la Halbwachs.
+        Compute the *standard widening* of two polyhedra, à la Halbwachs.
+
+        In its current implementation, this method is slow and should not be used on large polyhedra.
 
 
 .. data:: Empty
 
 
 .. data:: Empty
@@ -291,6 +302,7 @@ This space can be unbounded.
 
     The universe polyhedron, whose set of constraints is always satisfiable, i.e. is empty.
 
 
     The universe polyhedron, whose set of constraints is always satisfiable, i.e. is empty.
 
+
 Domains
 -------
 
 Domains
 -------
 
@@ -329,7 +341,7 @@ Unlike polyhedra, domains allow exact computation of union and complementary ope
 
     .. attribute:: symbols
 
 
     .. attribute:: symbols
 
-        The tuple of symbols present in the domain expression, sorted according to :meth:`Symbol.sortkey`.
+        The tuple of symbols present in the domain equations, sorted according to :meth:`Symbol.sortkey`.
 
     .. attribute:: dimension
 
 
     .. attribute:: dimension
 
@@ -435,7 +447,7 @@ Unlike polyhedra, domains allow exact computation of union and complementary ope
 
     .. method:: __contains__(point)
 
 
     .. method:: __contains__(point)
 
-        Return ``True`` if the :class:`Point` is contained within the domain.
+        Return ``True`` if the point is contained within the domain.
 
     .. method:: faces()
 
 
     .. method:: faces()
 
@@ -493,7 +505,7 @@ The following functions create :class:`Polyhedron` or :class:`Domain` instances
 .. function:: Ne(expr1, expr2[, expr3, ...])
 
     Create the domain such that ``expr1 != expr2 != expr3 ...``.
 .. function:: Ne(expr1, expr2[, expr3, ...])
 
     Create the domain such that ``expr1 != expr2 != expr3 ...``.
-    The result is a :class:`Domain`, not a :class:`Polyhedron`.
+    The result is a :class:`Domain` object, not a :class:`Polyhedron`.
 
 .. function:: Ge(expr1, expr2[, expr3, ...])
 
 
 .. function:: Ge(expr1, expr2[, expr3, ...])
 
@@ -505,14 +517,14 @@ The following functions create :class:`Polyhedron` or :class:`Domain` instances
 
 The following functions combine :class:`Polyhedron` or :class:`Domain` instances using logic operators:
 
 
 The following functions combine :class:`Polyhedron` or :class:`Domain` instances using logic operators:
 
-.. function:: Or(domain1, domain2[, ...])
-
-    Create the union domain of the domains given in arguments.
-
 .. function:: And(domain1, domain2[, ...])
 
     Create the intersection domain of the domains given in arguments.
 
 .. function:: And(domain1, domain2[, ...])
 
     Create the intersection domain of the domains given in arguments.
 
+.. function:: Or(domain1, domain2[, ...])
+
+    Create the union domain of the domains given in arguments.
+
 .. function:: Not(domain)
 
     Create the complementary domain of the domain given in argument.
 .. function:: Not(domain)
 
     Create the complementary domain of the domain given in argument.
@@ -567,7 +579,7 @@ Geometric Objects
         The dimension of the point, i.e. the number of symbols present in it.
 
     .. method:: coordinate(symbol)
         The dimension of the point, i.e. the number of symbols present in it.
 
     .. method:: coordinate(symbol)
-                   __getitem__(symbol)
+                __getitem__(symbol)
 
         Return the coordinate value of the given symbol.
         Raise :exc:`KeyError` if the symbol is not involved in the point.
 
         Return the coordinate value of the given symbol.
         Raise :exc:`KeyError` if the symbol is not involved in the point.
@@ -590,10 +602,10 @@ Geometric Objects
 
     .. method:: __add__(vector)
 
 
     .. method:: __add__(vector)
 
-        Translate the point by a :class:`Vector` instance and return the resulting point.
+        Translate the point by a :class:`Vector` object and return the resulting point.
 
     .. method:: __sub__(point)
 
     .. method:: __sub__(point)
-                   __sub__(vector)
+                __sub__(vector)
 
         The first version substracts a point from another and returns the resulting vector.
         The second version translates the point by the opposite vector of *vector* and returns the resulting point.
 
         The first version substracts a point from another and returns the resulting vector.
         The second version translates the point by the opposite vector of *vector* and returns the resulting point.
@@ -604,9 +616,10 @@ Geometric Objects
 
 
 .. class:: Vector(coordinates)
 
 
 .. class:: Vector(coordinates)
+           Vector(point1, point2)
 
 
-    Create a point from a dictionary or a sequence that maps the symbols to their coordinates, similar to :meth:`Point`.
-    Coordinates must be rational numbers.
+    The first version creates a vector from a dictionary or a sequence that maps the symbols to their coordinates, similarly to :meth:`Point`.
+    The second version creates a vector between two points.
 
     :class:`Vector` instances are hashable and should be treated as immutable.
 
 
     :class:`Vector` instances are hashable and should be treated as immutable.
 
@@ -619,7 +632,7 @@ Geometric Objects
         The dimension of the point, i.e. the number of symbols present in it.
 
     .. method:: coordinate(symbol)
         The dimension of the point, i.e. the number of symbols present in it.
 
     .. method:: coordinate(symbol)
-                   __getitem__(symbol)
+                __getitem__(symbol)
 
         Return the coordinate value of the given symbol.
         Raise :exc:`KeyError` if the symbol is not involved in the point.
 
         Return the coordinate value of the given symbol.
         Raise :exc:`KeyError` if the symbol is not involved in the point.
@@ -641,13 +654,13 @@ Geometric Objects
         Return ``True`` if not all coordinates are ``0``.
 
     .. method:: __add__(point)
         Return ``True`` if not all coordinates are ``0``.
 
     .. method:: __add__(point)
-                   __add__(vector)
+                __add__(vector)
 
         The first version translates the point *point* to the vector and returns the resulting point.
         The second version adds vector *vector* to the vector and returns the resulting vector.
 
     .. method:: __sub__(point)
 
         The first version translates the point *point* to the vector and returns the resulting point.
         The second version adds vector *vector* to the vector and returns the resulting vector.
 
     .. method:: __sub__(point)
-                   __sub__(vector)
+                __sub__(vector)
 
         The first version substracts a point from a vector and returns the resulting point.
         The second version returns the difference vector between two vectors.
 
         The first version substracts a point from a vector and returns the resulting point.
         The second version returns the difference vector between two vectors.
@@ -656,6 +669,18 @@ Geometric Objects
 
         Return the opposite vector.
 
 
         Return the opposite vector.
 
+    .. method:: __mul__(value)
+
+        Multiply the vector by a scalar value and return the resulting vector.
+
+    .. method:: __truediv__(value)
+
+        Divide the vector by a scalar value and return the resulting vector.
+
+    .. method:: __eq__(vector)
+
+        Test whether two vectors are equal.
+
     .. method:: angle(vector)
 
         Retrieve the angle required to rotate the vector into the vector passed in argument.
     .. method:: angle(vector)
 
         Retrieve the angle required to rotate the vector into the vector passed in argument.
@@ -664,31 +689,19 @@ Geometric Objects
     .. method:: cross(vector)
 
         Compute the cross product of two 3D vectors.
     .. method:: cross(vector)
 
         Compute the cross product of two 3D vectors.
-        If either one of the vectors is not tridimensional, a :exc:`ValueError` exception is raised.
+        If either one of the vectors is not three-dimensional, a :exc:`ValueError` exception is raised.
 
     .. method:: dot(vector)
 
         Compute the dot product of two vectors.
 
 
     .. method:: dot(vector)
 
         Compute the dot product of two vectors.
 
-    .. method:: __eq__(vector)
-
-        Test whether two vectors are equal.
-
-    .. method:: __mul__(value)
-
-        Multiply the vector by a scalar value and return the resulting vector.
-
-    .. method:: __truediv__(value)
-
-        Divide the vector by a scalar value and return the resulting vector.
-
     .. method:: norm()
 
         Return the norm of the vector.
 
     .. method:: norm2()
 
     .. method:: norm()
 
         Return the norm of the vector.
 
     .. method:: norm2()
 
-        Return the square norm of the vector.
+        Return the squared norm of the vector.
 
     .. method:: asunit()
 
 
     .. method:: asunit()