rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
Z = sqrt(T[i] / Q[i][i]) L[i] = ZZ(floor(Z - U[i])) x[i] = ZZ(ceil(-Z - U[i]) - 0)
Z = (T[i] / Q[i][i]).sqrt(extend=False) L[i] = ( Z - U[i]).floor() x[i] = (-Z - U[i]).ceil()
def vectors_by_length(self, bound): """ Returns a list of short vectors together with their values. This is a naive algorithm which uses the Cholesky decomposition, but does not use the LLL-reduction algorithm. INPUT: bound -- an integer >= 0 OUTPUT: A list L of length (bound + 1) whose entry L[i] is a list of all v...
0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5/quadratic_form__split_local_covering.py
Z = sqrt(T[i] / Q[i][i]) L[i] = ZZ(floor(Z - U[i])) x[i] = ZZ(ceil(-Z - U[i]) - 0)
Z = (T[i] / Q[i][i]).sqrt(extend=False) L[i] = ( Z - U[i]).floor() x[i] = (-Z - U[i]).ceil()
def vectors_by_length(self, bound): """ Returns a list of short vectors together with their values. This is a naive algorithm which uses the Cholesky decomposition, but does not use the LLL-reduction algorithm. INPUT: bound -- an integer >= 0 OUTPUT: A list L of length (bound + 1) whose entry L[i] is a list of all v...
0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5/quadratic_form__split_local_covering.py
Q_val = ZZ(floor(round(Q_val_double)))
Q_val = Q_val_double.round()
def vectors_by_length(self, bound): """ Returns a list of short vectors together with their values. This is a naive algorithm which uses the Cholesky decomposition, but does not use the LLL-reduction algorithm. INPUT: bound -- an integer >= 0 OUTPUT: A list L of length (bound + 1) whose entry L[i] is a list of all v...
0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5/quadratic_form__split_local_covering.py
if (Q_val <= Theta_Precision):
if (Q_val <= bound):
def vectors_by_length(self, bound): """ Returns a list of short vectors together with their values. This is a naive algorithm which uses the Cholesky decomposition, but does not use the LLL-reduction algorithm. INPUT: bound -- an integer >= 0 OUTPUT: A list L of length (bound + 1) whose entry L[i] is a list of all v...
0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0c66354c12254d8eae6cadb4a5b1df3ff8ce42d5/quadratic_form__split_local_covering.py
The error occurs only when printed::
The error only occurs upon printing::
... def __repr__(self):
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
.. rubric:: Common Usage:
.. rubric:: Common use case:
... def __repr__(self):
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
A priori, since they are mostly called during user interaction, there is no particular need to write fast ``__repr__`` methods, and indeed there are some objects ``x`` whose call ``x.__repr__()`` is quite time expensive. However, there are several use case where it is actually called and when the results is simply disc...
Most of the time, ``__repr__`` methods are only called during user interaction, and therefore need not be fast; and indeed there are objects ``x`` in Sage such ``x.__repr__()`` is time consuming. There are however some uses cases where many format strings are constructed but not actually printed. This includes error h...
... def __repr__(self):
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
I the previous case ``QQ.__repr__()`` has been called. To show this we replace QQ in the format string argument with out broken object::
In the above ``QQ.__repr__()`` has been called, and the result immediately discarded. To demonstrate this we replace ``QQ`` in the format string argument with our broken object::
... def __repr__(self):
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
There is no need to call ``IDontLikeBeingPrinted().__repr__()``, but itx can't be avoided with usual strings. Note that with the usual assert, the call is not performed::
This behavior can induce major performance penalties when testing. Note that this issue does not impact the usual assert:
... def __repr__(self):
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
We now check that :class:`LazyFormat` indeed solve the assertion problem::
We now check that :class:`LazyFormat` indeed solves the assertion problem::
... def __repr__(self):
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
Binds the lazy format with its parameters
Binds the lazy format string with its parameters
def __mod__(self, args): """ Binds the lazy format with its parameters
bb50001c4c80179fbe4cf456aa0de85f5c3dd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bb50001c4c80179fbe4cf456aa0de85f5c3dd693/lazy_format.py
Computes lower and upper bounds on the rank of the Mordell-Weil group, and a list of independent points.
Computes lower and upper bounds on the rank of the Mordell-Weil group, and a list of independent points. Used internally by the :meth:`~rank`, :meth:`~rank_bounds` and :meth:`~gens` methods.
def simon_two_descent(self, verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Computes lower and upper bounds on the rank of the Mordell-Weil group, and a list of independent points.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Uses Denis Simon's GP/PARI scripts from \url{http://www.math.unicaen.fr/~simon/}.
Uses Denis Simon's GP/PARI scripts from http://www.math.unicaen.fr/~simon/.
def simon_two_descent(self, verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Computes lower and upper bounds on the rank of the Mordell-Weil group, and a list of independent points.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Returns the lower and upper bounds using simon_two_descent. The results of simon_two_descent are cached.
Returns the lower and upper bounds using :meth:`~simon_two_descent`. The results of :meth:`~simon_two_descent` are cached.
def rank_bounds(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns the lower and upper bounds using simon_two_descent. The results of simon_two_descent are cached.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
These optional parameters control the Simon two descent algorithm.
The optional parameters control the Simon two descent algorithm; see the documentation of :meth:`~simon_two_descent` for more details.
def rank_bounds(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns the lower and upper bounds using simon_two_descent. The results of simon_two_descent are cached.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
\url{http://www.math.unicaen.fr/~simon/}.
http://www.math.unicaen.fr/~simon/.
def rank_bounds(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns the lower and upper bounds using simon_two_descent. The results of simon_two_descent are cached.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
return this. Otherwise, we return the upper and lower bounds with a warning that these are not the same.
return this. Otherwise, we raise a ValueError with an error message specifying the upper and lower bounds.
def rank(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Return the rank of this elliptic curve, if it can be determined.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Note: For non-quadratic number fields, this code does return, but it takes a long time.
For non-quadratic number fields, this code does return, but it takes a long time.
def rank(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Return the rank of this elliptic curve, if it can be determined.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Here is a curve with two-torsion, so here the algorithm gives bounds on the rank::
Here is a curve with two-torsion, so here the bounds given by the algorithm do not uniquely determine the rank::
def rank(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Return the rank of this elliptic curve, if it can be determined.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
ValueError: There is insufficient data to determine the rank.
ValueError: There is insufficient data to determine the rank - 2-descent gave lower bound 1 and upper bound 2
def rank(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Return the rank of this elliptic curve, if it can be determined.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
\url{http://www.math.unicaen.fr/~simon/}.
http://www.math.unicaen.fr/~simon/.
def rank(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Return the rank of this elliptic curve, if it can be determined.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
raise ValueError, 'There is insufficient data to determine the rank.'
raise ValueError, 'There is insufficient data to determine the rank - 2-descent gave lower bound %s and upper bound %s' % (lower, upper)
def rank(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Return the rank of this elliptic curve, if it can be determined.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Returns some generators of this elliptic curve. Check rank or rank_bound to verify the number of generators.
Returns some generators of this elliptic curve. Check :meth:`~rank` or :meth:`~rank_bounds` to verify the number of generators. .. NOTE:: The optional parameters control the Simon two descent algorithm; see the documentation of :meth:`~simon_two_descent` for more details.
def gens(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns some generators of this elliptic curve. Check rank or rank_bound to verify the number of generators.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Note: For non-quadratic number fields, this code does return, but it takes a long time.
For non-quadratic number fields, this code does return, but it takes a long time.
def gens(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns some generators of this elliptic curve. Check rank or rank_bound to verify the number of generators.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
Here is a curve with two-torsion, so here the algorithm gives bounds on the rank::
Here is a curve with two-torsion, so here the algorithm does not uniquely determine the rank::
def gens(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns some generators of this elliptic curve. Check rank or rank_bound to verify the number of generators.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
\url{http://www.math.unicaen.fr/~simon/}.
http://www.math.unicaen.fr/~simon/.
def gens(self,verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): r""" Returns some generators of this elliptic curve. Check rank or rank_bound to verify the number of generators.
48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/48d8e4e8bbeb4502f0f90ffd33c0a8a99a8e320d/ell_number_field.py
EXAMPLES:
EXAMPLES::
def __call__(self, im_gens, check=True): """ Return the homomorphism defined by images of generators.
fd3e06537bf667519332dcc48fb96d0d379abf0d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/fd3e06537bf667519332dcc48fb96d0d379abf0d/homset.py
'ton_force':'Defined to be the magnitude of the force exerted on one ton of mass (2000 pounds) by a 9.80665 meter/second^2 gravitational field.\nApproximately equal to 8896.4432 newtons.'},
'ton_force':'Defined to be 2000 pounds of force.\nApproximately equal to 8896.4432 newtons.'},
def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun...
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
{'candela':'SI base unit of luminous intensity.\nDefined to be the luminous intensity, in a given direction, of a source that emits monochromatic radiation of frequency 540*10^12 hertz and that has a radiant intensity in that direction of 1\xe2\x81\x84683 watt per steradian.',
{'candela':'SI base unit of luminous intensity.\nDefined to be the luminous intensity, in a given direction, of a source that emits monochromatic radiation of frequency 540*10^12 hertz and that has a radiant intensity in that direction of 1/683 watt per steradian.',
def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun...
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
'solar_mass':'Defined to be the mass of the Sun.\nAbout 332,950 times the size of the Earth or 1,048 times the mass of Jupiter.\nApproximately equal to 1.98892*10^30 kilograms.',
'solar_mass':'Defined to be the mass of the Sun.\nAbout 332,950 times the mass of the Earth or 1,048 times the mass of Jupiter.\nApproximately equal to 1.98892*10^30 kilograms.',
def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun...
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
Collection power of units: cheval_vapeur horsepower watt
Collection of units of power: cheval_vapeur horsepower watt
def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units...
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
Collection all units of units: acceleration ... volume
Collection of units of all units: acceleration ... volume
def __init__(self, data, name=''): """ EXAMPLES::
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
Collection area of units: acre are barn hectare rood section square_chain square_meter township
Collection of units of area: acre are barn hectare rood section square_chain square_meter township
def __getattr__(self, name): """ Return the unit with the given name.
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
'Collection area of units: acre are barn hectare rood section square_chain square_meter township' """ name = self.__name + ' ' if self.__name else '' return "Collection %sof units: %s"%(name, ' '.join(sorted([str(x) for x in self.__data])))
'Collection of units of area: acre are barn hectare rood section square_chain square_meter township' """ name = ' of ' + self.__name if self.__name else '' return "Collection of units{0}: {1}".format(name, ' '.join(sorted([str(x) for x in self.__data])))
def __repr__(self): """ Return string representation of this collection of units.
4a7f8e846ab20476d1219a326ba1d0012a65c6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4a7f8e846ab20476d1219a326ba1d0012a65c6c6/units.py
- ``solution_dict`` - bool (default: False); if True, return a list of dictionaries containing the solutions.
- ``solution_dict`` - bool (default: False); if True or non-zero, return a list of dictionaries containing the solutions. If there are no solutions, return an empty list (rather than a list containing an empty dictionary). Likewise, if there's only a single solution, return a list containing one dictionary with that s...
def solve(f, *args, **kwds): r""" Algebraically solve an equation or system of equations (over the complex numbers) for given variables. Inequalities and systems of inequalities are also supported. INPUT: - ``f`` - equation or system of equations (given by a list or tuple) - ``*args`` - variables to solve for. - ...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
If we ask for a dictionary for the solutions, we get it::
If we ask for dictionaries containing the solutions, we get them::
def solve(f, *args, **kwds): r""" Algebraically solve an equation or system of equations (over the complex numbers) for given variables. Inequalities and systems of inequalities are also supported. INPUT: - ``f`` - equation or system of equations (given by a list or tuple) - ``*args`` - variables to solve for. - ...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
TESTS:: sage: solve([sin(x)==x,y^2==x],x,y) [sin(x) == x, y^2 == x]
def solve(f, *args, **kwds): r""" Algebraically solve an equation or system of equations (over the complex numbers) for given variables. Inequalities and systems of inequalities are also supported. INPUT: - ``f`` - equation or system of equations (given by a list or tuple) - ``*args`` - variables to solve for. - ...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
if 'solution_dict' in kwds and kwds['solution_dict']==True:
if kwds.get('solution_dict', False): if len(sol_list)==0: return []
def solve(f, *args, **kwds): r""" Algebraically solve an equation or system of equations (over the complex numbers) for given variables. Inequalities and systems of inequalities are also supported. INPUT: - ``f`` - equation or system of equations (given by a list or tuple) - ``*args`` - variables to solve for. - ...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
- ``solution_dict`` - (default: False) if True, return a list of dictionaries containing the solutions.
- ``solution_dict`` - bool (default: False); if True or non-zero, return a list of dictionaries containing the solutions. If there are no solutions, return an empty list (rather than a list containing an empty dictionary). Likewise, if there's only a single solution, return a list containing one dictionary with that s...
def solve_mod(eqns, modulus, solution_dict = False): r""" Return all solutions to an equation or list of equations modulo the given integer modulus. Each equation must involve only polynomials in 1 or many variables. By default the solutions are returned as `n`-tuples, where `n` is the number of variables appearing an...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
We solve an simple equation modulo 2::
We solve a simple equation modulo 2::
def solve_mod(eqns, modulus, solution_dict = False): r""" Return all solutions to an equation or list of equations modulo the given integer modulus. Each equation must involve only polynomials in 1 or many variables. By default the solutions are returned as `n`-tuples, where `n` is the number of variables appearing an...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
raise ValueError, "the modulus must be a positive integer"
raise ValueError, "the modulus must be a positive integer"
def solve_mod(eqns, modulus, solution_dict = False): r""" Return all solutions to an equation or list of equations modulo the given integer modulus. Each equation must involve only polynomials in 1 or many variables. By default the solutions are returned as `n`-tuples, where `n` is the number of variables appearing an...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
if solution_dict == True:
if solution_dict:
def solve_mod(eqns, modulus, solution_dict = False): r""" Return all solutions to an equation or list of equations modulo the given integer modulus. Each equation must involve only polynomials in 1 or many variables. By default the solutions are returned as `n`-tuples, where `n` is the number of variables appearing an...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
We solve an simple equation modulo 2::
We solve a simple equation modulo 2::
def solve_mod_enumerate(eqns, modulus): r""" Return all solutions to an equation or list of equations modulo the given integer modulus. Each equation must involve only polynomials in 1 or many variables. The solutions are returned as `n`-tuples, where `n` is the number of variables appearing anywhere in the given equa...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
raise ValueError, "the modulus must be a positive integer"
raise ValueError, "the modulus must be a positive integer"
def solve_mod_enumerate(eqns, modulus): r""" Return all solutions to an equation or list of equations modulo the given integer modulus. Each equation must involve only polynomials in 1 or many variables. The solutions are returned as `n`-tuples, where `n` is the number of variables appearing anywhere in the given equa...
289f5b4d9eb95aca379cac874aa709bc2e2631eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/289f5b4d9eb95aca379cac874aa709bc2e2631eb/relation.py
if P.eval("%s %s %s"%(self.name(), P._equality_symbol(), other.name())) == P._true_symbol(): return 0 elif P.eval("%s %s %s"%(self.name(), P._lessthan_symbol(), other.name())) == P._true_symbol(): return -1 elif P.eval("%s %s %s"%(self.name(), P._greaterthan_symbol(), other.name())) == P._true_symbol(): return 1
try: if P.eval("%s %s %s"%(self.name(), P._equality_symbol(), other.name())) == P._true_symbol(): return 0 except RuntimeError: pass try: if P.eval("%s %s %s"%(self.name(), P._lessthan_symbol(), other.name())) == P._true_symbol(): return -1 except RuntimeError: pass try: if P.eval("%s %s %s"%(self.name(), P._greatertha...
def __cmp__(self, other): P = self.parent() if P.eval("%s %s %s"%(self.name(), P._equality_symbol(), other.name())) == P._true_symbol(): return 0 elif P.eval("%s %s %s"%(self.name(), P._lessthan_symbol(), other.name())) == P._true_symbol(): return -1 elif P.eval("%s %s %s"%(self.name(), P._greaterthan_symbol(), other.n...
e16753162262b81e0a81c9ed8b57412666099e66 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e16753162262b81e0a81c9ed8b57412666099e66/expect.py
I
i
def _sympy_(self): """ Converts pi to sympy pi.
4e119d7b017c7c54cd2088d87fe680a7150a24cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4e119d7b017c7c54cd2088d87fe680a7150a24cf/constants.py
def is_integral_domain(self, proof = True): r""" If this function returns ``True`` then self is definitely an integral domain. If it returns ``False``, then either self is definitely not an integral domain or this function was unable to determine whether or not self is an integral domain. Use ``self.defining_ideal().i...
def is_integral_domain(self, proof=True): r""" With ``proof`` equal to ``True`` (the default), this function may raise a ``NotImplementedError``. When ``proof`` is ``False``, if ``True`` is returned, then self is definitely an integral domain. If the function returns ``False``, then either self is not an integral do...
def is_integral_domain(self, proof = True): r""" If this function returns ``True`` then self is definitely an integral domain. If it returns ``False``, then either self is definitely not an integral domain or this function was unable to determine whether or not self is an integral domain.
cf7d29c96f22167ba655f3c87fa2a710006e923b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/cf7d29c96f22167ba655f3c87fa2a710006e923b/quotient_ring.py
sage: R.<a,b,c> = ZZ['a','b','c'] sage: I = R.ideal(a,b) sage: Q = R.quotient_ring(I)
sage: R.quo(x^2 - y^2).is_integral_domain(proof=False) False sage: R.<a,b,c> = ZZ[] sage: Q = R.quotient_ring([a, b])
def is_integral_domain(self, proof = True): r""" If this function returns ``True`` then self is definitely an integral domain. If it returns ``False``, then either self is definitely not an integral domain or this function was unable to determine whether or not self is an integral domain.
cf7d29c96f22167ba655f3c87fa2a710006e923b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/cf7d29c96f22167ba655f3c87fa2a710006e923b/quotient_ring.py
return self.defining_ideal.is_prime() except AttributeError: return False
return self.defining_ideal().is_prime()
def is_integral_domain(self, proof = True): r""" If this function returns ``True`` then self is definitely an integral domain. If it returns ``False``, then either self is definitely not an integral domain or this function was unable to determine whether or not self is an integral domain.
cf7d29c96f22167ba655f3c87fa2a710006e923b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/cf7d29c96f22167ba655f3c87fa2a710006e923b/quotient_ring.py
assert z.denominator() == 1, "bug in global_integral_model: %s" % ai
assert z.is_integral(), "bug in global_integral_model: %s" % list(ai)
def global_integral_model(self): r""" Return a model of self which is integral at all primes.
259c1e1e019b8a1aa722cf879046ae8eb7ed011e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/259c1e1e019b8a1aa722cf879046ae8eb7ed011e/ell_number_field.py
if os.uname()[0][:6] == 'CYGWIN':
if os.uname()[0][:6] == 'CYGWIN' and package is not None:
def install_package(package=None, force=False): """ Install a package or return a list of all packages that have been installed into this Sage install. You must have an internet connection. Also, you will have to restart Sage for the changes to take affect. It is not needed to provide the version number. INPUT: - ...
e0c4f3e1f24e88862821d03ab48aaa307628bbb8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e0c4f3e1f24e88862821d03ab48aaa307628bbb8/package.py
return
def install_package(package=None, force=False): """ Install a package or return a list of all packages that have been installed into this Sage install. You must have an internet connection. Also, you will have to restart Sage for the changes to take affect. It is not needed to provide the version number. INPUT: - ...
e0c4f3e1f24e88862821d03ab48aaa307628bbb8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e0c4f3e1f24e88862821d03ab48aaa307628bbb8/package.py
return
return []
def upgrade(): """ Download and build the latest version of Sage. You must have an internet connection. Also, you will have to restart Sage for the changes to take affect. This upgrades to the latest version of core packages (optional packages are not automatically upgraded). This will not work on systems that don't...
e0c4f3e1f24e88862821d03ab48aaa307628bbb8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/e0c4f3e1f24e88862821d03ab48aaa307628bbb8/package.py
sage: c._ambient_space_point(c.lattice().dual()([1,1]))
sage: c._ambient_space_point(c.dual_lattice()([1,1]))
def _ambient_space_point(self, data): r""" Try to convert ``data`` to a point of the ambient space of ``self``.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
sage: c.contains(c.lattice().dual()(1,0))
sage: c.contains(c.dual_lattice()(1,0))
def contains(self, *args): r""" Check if a given point is contained in ``self``.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
sage: c.contains(c.lattice().dual()(1,0))
sage: c.contains(c.dual_lattice()(1,0))
def contains(self, *args): r""" Check if a given point is contained in ``self``.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
self._dual = Cone(rays, lattice=self.lattice().dual(), check=False)
self._dual = Cone(rays, lattice=self.dual_lattice(), check=False)
def dual(self): r""" Return the dual cone of ``self``.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
M = self.lattice().dual()
M = self.dual_lattice()
def facet_normals(self): r""" Return normals to facets of ``self``.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
self.lattice().dual().submodule_with_basis(basis)
self.dual_lattice().submodule_with_basis(basis)
def _split_ambient_lattice(self): r""" Compute a decomposition of the ``N``-lattice into `N_\sigma` and its complement `N(\sigma)`.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
self.lattice().dual().submodule_with_basis(basis)
self.dual_lattice().submodule_with_basis(basis)
def _split_ambient_lattice(self): r""" Compute a decomposition of the ``N``-lattice into `N_\sigma` and its complement `N(\sigma)`.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
Let `M=` ``self.lattice().dual()`` be the lattice dual to the
Let `M=` ``self.dual_lattice()`` be the lattice dual to the
def orthogonal_sublattice(self, *args, **kwds): r""" The sublattice (in the dual lattice) orthogonal to the sublattice spanned by the cone.
a3e3306597435e3589001abd0b89714b99258af9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/a3e3306597435e3589001abd0b89714b99258af9/cone.py
integers n -1.
integers n >= 1.
def spherical_bessel_J(n, var, algorithm="maxima"): r""" Returns the spherical Bessel function of the first kind for integers n -1. Reference: AS 10.1.8 page 437 and AS 10.1.15 page 439. EXAMPLES:: sage: spherical_bessel_J(2,x) ((3/x^2 - 1)*sin(x) - 3*cos(x)/x)/x """ if algorithm=="scipy": import scipy.special ans =...
69426fc5c3f874bbd499adc1e1970c6590c5cf4f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/69426fc5c3f874bbd499adc1e1970c6590c5cf4f/special.py
import scipy.special ans = str(scipy.special.sph_jn(int(n),float(var))) ans = ans.replace("(","") ans = ans.replace(")","") ans = ans.replace("j","*I") return sage_eval(ans)
from scipy.special.specfun import sphj return sphj(int(n), float(var))[1][-1]
def spherical_bessel_J(n, var, algorithm="maxima"): r""" Returns the spherical Bessel function of the first kind for integers n -1. Reference: AS 10.1.8 page 437 and AS 10.1.15 page 439. EXAMPLES:: sage: spherical_bessel_J(2,x) ((3/x^2 - 1)*sin(x) - 3*cos(x)/x)/x """ if algorithm=="scipy": import scipy.special ans =...
69426fc5c3f874bbd499adc1e1970c6590c5cf4f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/69426fc5c3f874bbd499adc1e1970c6590c5cf4f/special.py
def __cmp__(self, other):
def __hash__(self): """ TESTS:: sage: P = Poset([[1,2],[3],[3]]) sage: P.__hash__() 6557284140853143473 584755121 sage: P = Poset([[1],[3],[3]]) sage: P.__hash__() 5699294501102840900 278031428 """ if self._hash is None: self._hash = tuple(map(tuple, self.cover_relations())).__hash__() return self._hash def __eq__(se...
def __cmp__(self, other): r""" Define comparison for finite posets.
f00d0ece07dc85deddd28ade34472990975335cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f00d0ece07dc85deddd28ade34472990975335cf/posets.py
Define comparison for finite posets. We compare types, then number of elements, then Hasse
Define equality for finite posets. We test equality of types, then number of elements and elements, then Hasse
def __cmp__(self, other): r""" Define comparison for finite posets.
f00d0ece07dc85deddd28ade34472990975335cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f00d0ece07dc85deddd28ade34472990975335cf/posets.py
sage: Q < P True sage: Q > P False
sage: p1, p2 = Posets(2).list() sage: p2 == p1, p1 != p2 (False, True) sage: [[p1.__eq__(p2) for p1 in Posets(2)] for p2 in Posets(2)] [[True, False], [False, True]] sage: [[p2.__eq__(p1) for p1 in Posets(2)] for p2 in Posets(2)] [[True, False], [False, True]] sage: [[p2 == p1 for p1 in Posets(3)] for p2 in Posets(3)] ...
def __cmp__(self, other): r""" Define comparison for finite posets.
f00d0ece07dc85deddd28ade34472990975335cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f00d0ece07dc85deddd28ade34472990975335cf/posets.py
if len(self._elements) == len(other._elements): return cmp(self._elements, other._elements) and \ cmp(self._hasse_diagram, other._hasse_diagram)
if len(self._elements) == len(other._elements) and self._elements == other._elements: return self._hasse_diagram == other._hasse_diagram
def __cmp__(self, other): r""" Define comparison for finite posets.
f00d0ece07dc85deddd28ade34472990975335cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f00d0ece07dc85deddd28ade34472990975335cf/posets.py
return len(self._elements) - len(other._elements)
return False
def __cmp__(self, other): r""" Define comparison for finite posets.
f00d0ece07dc85deddd28ade34472990975335cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f00d0ece07dc85deddd28ade34472990975335cf/posets.py
return cmp(type(other), type(self))
return False def __ne__(self, other): r""" Return True if ``self`` and ``other`` are two different posets. TESTS:: sage: [[p1.__ne__(p2) for p1 in Posets(2)] for p2 in Posets(2)] [[False, True], [True, False]] sage: P = Poset([[1,2,4],[3],[3]]) sage: Q = Poset([[1,2],[],[1],[4]]) sage: P != Q True sage: P != P Fals...
def __cmp__(self, other): r""" Define comparison for finite posets.
f00d0ece07dc85deddd28ade34472990975335cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f00d0ece07dc85deddd28ade34472990975335cf/posets.py
n = x.parent()(1)
n = parent(x)(1)
def squarefree_part(x): """ Returns the square free part of `x`, i.e., a divisor `z` such that `x = z y^2`, for a perfect square `y^2`. EXAMPLES:: sage: squarefree_part(100) 1 sage: squarefree_part(12) 3 sage: squarefree_part(10) 10 :: sage: x = QQ['x'].0 sage: S = squarefree_part(-9*x*(x-6)^7*(x-3)^2); S -9*x^2 + ...
b6f8e6623d4bd20b3182a0527c1cc9cffef4ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/b6f8e6623d4bd20b3182a0527c1cc9cffef4ecd3/functional.py
- ``scope`` -- namespace (default: global);
- ``scope`` -- namespace (default: global, not just the scope from which this function was called);
def inject_coefficients(self, scope=None, verbose=True): r""" Inject generators of the base field of ``self`` into ``scope``.
bf8155d5074543bbf066ffe38ee5541218f84088 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bf8155d5074543bbf066ffe38ee5541218f84088/toric_variety.py
sage: P1xP1 = ToricVariety(fan) sage: P1xP1.inject_coefficients() The last command does nothing, since ``P1xP1`` is defined over `\QQ`. Let's construct a toric variety over a more complicated field::
def inject_coefficients(self, scope=None, verbose=True): r""" Inject generators of the base field of ``self`` into ``scope``.
bf8155d5074543bbf066ffe38ee5541218f84088 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bf8155d5074543bbf066ffe38ee5541218f84088/toric_variety.py
""" if is_FractionField(self.base_ring()):
We check that we can use names ``a`` and ``b``, Trac sage: a + b a + b sage: a + b in P1xP1.coordinate_ring() True """ if scope is None: depth = 0 while True: scope = sys._getframe(depth).f_globals if (scope["__name__"] == "__main__" and scope["__package__"] is None): break depth += 1 try:
def inject_coefficients(self, scope=None, verbose=True): r""" Inject generators of the base field of ``self`` into ``scope``.
bf8155d5074543bbf066ffe38ee5541218f84088 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bf8155d5074543bbf066ffe38ee5541218f84088/toric_variety.py
Return a list of the edges of the graph as triples (u,v,l) where u and v are vertices and l is a label.
Return a list of edges. Each edge is a triple (u,v,l) where u and v are vertices and l is a label. If the parameter ``labels`` is False then a list of couple (u,v) is returned where u and v are vertices.
def edges(self, labels=True, sort=True, key=None): r""" Return a list of the edges of the graph as triples (u,v,l) where u and v are vertices and l is a label.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
def edge_boundary(self, vertices1, vertices2=None, labels=True):
def edge_boundary(self, vertices1, vertices2=None, labels=True, sort=True):
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
sage: G = graphs.PetersenGraph()
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
""" vertices1 = [v for v in vertices1 if v in self] output = []
sage: G.edge_boundary([2], [0]) [(0, 2, {})] """ vertices1 = set([v for v in vertices1 if v in self])
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
output.extend(self.outgoing_edge_iterator(vertices1,labels=labels))
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
output = [e for e in output if e[1] in vertices2]
vertices2 = set([v for v in vertices2 if v in self]) output = [e for e in self.outgoing_edge_iterator(vertices1,labels=labels) if e[1] in vertices2]
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
output = [e for e in output if e[1] not in vertices1] return output
output = [e for e in self.outgoing_edge_iterator(vertices1,labels=labels) if e[1] not in vertices1]
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
output.extend(self.edge_iterator(vertices1,labels=labels)) output2 = []
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
for e in output: if e[0] in vertices1: if e[1] in vertices2: output2.append(e) elif e[0] in vertices2: output2.append(e)
vertices2 = set([v for v in vertices2 if v in self]) output = [e for e in self.edge_iterator(vertices1,labels=labels) if (e[0] in vertices1 and e[1] in vertices2) or (e[1] in vertices1 and e[0] in vertices2)]
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
for e in output: if e[0] in vertices1: if e[1] not in vertices1: output2.append(e) elif e[0] not in vertices1: output2.append(e) return output2
output = [e for e in self.edge_iterator(vertices1,labels=labels) if e[1] not in vertices1 or e[0] not in vertices1] if sort: output.sort() return output
def edge_boundary(self, vertices1, vertices2=None, labels=True): """ Returns a list of edges `(u,v,l)` with `u` in ``vertices1`` and `v` in ``vertices2``. If ``vertices2`` is ``None``, then it is set to the complement of ``vertices1``.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only.
Returns an iterator over edges. The iterator returned is over the edges incident with any vertex given in the parameter ``vertices``. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only.
def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only...
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
- ``ignore_direction`` - (default False) only applies
- ``ignore_direction`` - bool (default: False) - only applies
def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only...
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
for e in self._backend.iterator_out_edges(vertices, labels): yield e for e in self._backend.iterator_in_edges(vertices, labels): yield e
from itertools import chain return chain(self._backend.iterator_out_edges(vertices, labels), self._backend.iterator_in_edges(vertices, labels))
def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only...
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
for e in self._backend.iterator_out_edges(vertices, labels): yield e
return self._backend.iterator_out_edges(vertices, labels)
def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only...
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
for e in self._backend.iterator_edges(vertices, labels): yield e def edges_incident(self, vertices=None, labels=True): """ Returns a list of edges incident with any vertex given. If vertices
return self._backend.iterator_edges(vertices, labels) def edges_incident(self, vertices=None, labels=True, sort=True): """ Returns incident edges to some vertices. If ``vertices` is a vertex, then it returns the list of edges incident to that vertex. If ``vertices`` is a list of vertices then it returns the list of a...
def edge_iterator(self, vertices=None, labels=True, ignore_direction=False): """ Returns an iterator over the edges incident with any vertex given. If the graph is directed, iterates over edges going out only. If vertices is None, then returns an iterator over all edges. If self is directed, returns outgoing edges only...
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
- ``label`` - if False, each edge is a tuple (u,v) of vertices.
- ``vertices`` - object (default: None) - a vertex, a list of vertices or None. - ``labels`` - bool (default: True) - if False, each edge is a tuple (u,v) of vertices. - ``sort`` - bool (default: True) - if True the returned list is sorted.
def edges_incident(self, vertices=None, labels=True): """ Returns a list of edges incident with any vertex given. If vertices is None, returns a list of all edges in graph. For digraphs, only lists outward edges.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
v = list(self.edge_boundary(vertices, labels=labels)) v.sort() return v
if sort: return sorted(self.edge_iterator(vertices=vertices,labels=labels)) return list(self.edge_iterator(vertices=vertices,labels=labels))
def edges_incident(self, vertices=None, labels=True): """ Returns a list of edges incident with any vertex given. If vertices is None, returns a list of all edges in graph. For digraphs, only lists outward edges.
7b9afb3b66d010e574487a319d86af01cd22bcc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7b9afb3b66d010e574487a319d86af01cd22bcc7/generic_graph.py
Morphism from module over Integer Ring with invariants (2, 0, 0) to module with invariants (0, 0, 0) that sends the generators to [(0, 0, 0), (0, 0, 1), (0, 1, 0)]
Morphism from module over Integer Ring with invariants (2, 0, 0) to module with invariants (0, 0, 0) that sends the generators to [(0, 0, 0), (1, 0, 0), (0, 1, 0)]
def hom(self, im_gens, codomain=None, check=True): """ Homomorphism defined by giving the images of ``self.gens()`` in some fixed fg R-module.
1a5ea206191767a7a1f6717c48ce3305c7ede9c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1a5ea206191767a7a1f6717c48ce3305c7ede9c4/fgp_module.py
(0, 0, 1)
(1, 0, 0)
def hom(self, im_gens, codomain=None, check=True): """ Homomorphism defined by giving the images of ``self.gens()`` in some fixed fg R-module.
1a5ea206191767a7a1f6717c48ce3305c7ede9c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1a5ea206191767a7a1f6717c48ce3305c7ede9c4/fgp_module.py
- is isomorphic to self, - is invariant in the isomorphism class.
- is isomorphic to self, - is invariant in the isomorphism class.
def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the unique graph on \{0,1,...,n-1\} ( n = self.order() ) which - is isomorphic to self, - is invariant in the isomorphism class.
d2573c5378a0c779c03417f986d9bef5d2b03ee3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d2573c5378a0c779c03417f986d9bef5d2b03ee3/generic_graph.py
- ``G_c == H_c`` - ``G_c.adjacency_matrix() == H_c.adjacency_matrix()`` - ``G_c.graph6_string() == H_c.graph6_string()``
- ``G_c == H_c`` - ``G_c.adjacency_matrix() == H_c.adjacency_matrix()`` - ``G_c.graph6_string() == H_c.graph6_string()``
def canonical_label(self, partition=None, certify=False, verbosity=0, edge_labels=False): """ Returns the unique graph on \{0,1,...,n-1\} ( n = self.order() ) which - is isomorphic to self, - is invariant in the isomorphism class.
d2573c5378a0c779c03417f986d9bef5d2b03ee3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d2573c5378a0c779c03417f986d9bef5d2b03ee3/generic_graph.py
def has_good_reduction(self, P=None): r""" Returns True iff this point has good reduction modulo a prime.
1286741bb9006c034d2e71857e2aac3dcfa51d07 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1286741bb9006c034d2e71857e2aac3dcfa51d07/ell_point.py
if F.derivative(v)(xyz).valuation(P) == 0:
c = (F.derivative(v))(xyz) try: val = c.valuation(P) except AttributeError: val = c.constant_coefficient().valuation(P) if val == 0:
def has_good_reduction(self, P=None): r""" Returns True iff this point has good reduction modulo a prime.
1286741bb9006c034d2e71857e2aac3dcfa51d07 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/1286741bb9006c034d2e71857e2aac3dcfa51d07/ell_point.py
- ``s`` (vertex) -- forces the source of the path. Set to ``None`` by default. - ``t`` (vertex) -- forces the destination of the path. Set to ``None`` by default. - ``weighted`` (boolean) -- whether the labels on the edges are to be considered as weights (a label set to ``None`` or ``{}`` being considered as a weight...
- ``s`` (vertex) -- forces the source of the path (the method then returns the longest path starting at ``s``). The argument is set to ``None`` by default, which means that no constraint is set upon the first vertex in the path. - ``t`` (vertex) -- forces the destination of the path (the method then returns the longes...
def longest_path(self, s=None, t=None, weighted=False, algorithm="MILP", solver=None, verbose=0): r""" Returns a longest path of ``self``.
34c1e50f6f1e024964d30bd503da4e0a040658da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/34c1e50f6f1e024964d30bd503da4e0a040658da/generic_graph.py
The length of a path is assumed to be the number of its edges, or the sum of their labels.
The length of a path is assumed to be the number of its edges, or the sum of their labels.
def longest_path(self, s=None, t=None, weighted=False, algorithm="MILP", solver=None, verbose=0): r""" Returns a longest path of ``self``.
34c1e50f6f1e024964d30bd503da4e0a040658da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/34c1e50f6f1e024964d30bd503da4e0a040658da/generic_graph.py
A subgraph of ``self`` corresponding to a (directed if ``self`` is directed) longest path. If ``weighted == True``, a pair ``weight, path`` is returned.
A subgraph of ``self`` corresponding to a (directed if ``self`` is directed) longest path. If ``weighted == True``, a pair ``weight, path`` is returned.
def longest_path(self, s=None, t=None, weighted=False, algorithm="MILP", solver=None, verbose=0): r""" Returns a longest path of ``self``.
34c1e50f6f1e024964d30bd503da4e0a040658da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/34c1e50f6f1e024964d30bd503da4e0a040658da/generic_graph.py
Mixed Integer Linear Programming. (This problem is known to be NP-Hard).
Mixed Integer Linear Programming. (This problem is known to be NP-Hard).
def longest_path(self, s=None, t=None, weighted=False, algorithm="MILP", solver=None, verbose=0): r""" Returns a longest path of ``self``.
34c1e50f6f1e024964d30bd503da4e0a040658da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/34c1e50f6f1e024964d30bd503da4e0a040658da/generic_graph.py