rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
table), we are likely to get some random-looking string ::
table), we are likely to get some random-looking string::
def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``string`` -- a string EXAMPLE:: sage: from sage.coding.source_coding.huffman import frequency_table sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a'...
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
... precisely what we deserved :-) INPUT: One among the following: - ``string`` -- a string from which the Huffman encoding should be created - ``frequencies`` -- a dictionary associating its frequency or its number of occurrences to each letter of the alphabet.
This does not look like our original string. Instead of using frequency, we can assign weights to each alphabetic symbol:: sage: from sage.coding.source_coding.huffman import Huffman sage: T = {"a":45, "b":13, "c":12, "d":16, "e":9, "f":5} sage: H = Huffman(table=T) sage: L = ["deaf", "bead", "fab", "bee"] sage: E = ...
def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``string`` -- a string EXAMPLE:: sage: from sage.coding.source_coding.huffman import frequency_table sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a'...
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman INPUT: One among the following: - ``string`` -- a string from which the Huffman encoding should be created - ``frequencies`` -- a dictionary associating its frequency or its number of occurrences to each letter of the alphabet. EXA...
def __init__(self, string=None, table=None): r""" Constructor for Huffman. See the docstring of this class for full documentation. EXAMPLES:: sage: from sage.coding.source_coding.huffman import Huffman sage: str = "Sage is my most favorite general purpose computer algebra system" sage: h = Huffman(str) TESTS: If b...
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
ValueError: Exactly one of `string` or `frequencies` parameters must be defined """
ValueError: Exactly one of 'string' and 'table' cannot be None. """ if (string is not None) and (table is not None): raise ValueError( "Exactly one of 'string' and 'table' cannot be None.")
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
if sum([string is not None, frequencies is not None]) != 1: raise ValueError("Exactly one of `string` or `frequencies` parameters must be defined")
self._tree = None self._index = None
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
elif frequencies is not None: self._build_code(frequencies) def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
elif table is not None: self._build_code(table) def _build_code_from_tree(self, tree, d, prefix): r""" Builds the Huffman code corresponding to a given tree and prefix.
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
EXAMPLE::
EXAMPLES::
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
sage: h._build_code_from_tree(h._tree, d) """
sage: h._build_code_from_tree(h._tree, d, prefix="") """
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
self._build_code_from_tree(tree[0], d, prefix=prefix+'0') self._build_code_from_tree(tree[1], d, prefix=prefix+'1')
self._build_code_from_tree(tree[0], d, prefix="".join([prefix, "0"])) self._build_code_from_tree(tree[1], d, prefix="".join([prefix, "1"]))
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
Returns a Huffman code for each one of the given elements. INPUT: - ``dic`` (dictionary) -- associates to each letter of the alphabet a frequency or a number of occurrences.
Constructs a Huffman code corresponding to an alphabet with the given weight table. INPUT: - ``dic`` -- a dictionary that associates to each symbol of an alphabet a numeric value. If we consider the frequency of each alphabetic symbol, then ``dic`` is considered as the frequency table of the alphabet with each numeri...
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
index = dic.items()
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
for i,(e,w) in enumerate(index): heappush(heap, (w, i) ) while len(heap)>=2: (w1, i1) = heappop(heap) (w2, i2) = heappop(heap) heappush(heap, (w1+w2,[i1,i2]))
for i, (s, w) in enumerate(dic.items()): heappush(heap, (w, i)) for i in range(1, len(dic)): weight_a, node_a = heappop(heap) weight_b, node_b = heappop(heap) heappush(heap, (weight_a + weight_b, [node_a, node_b]))
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
self._build_code_from_tree(self._tree, d) self._index = dict([(i,e) for i,(e,w) in enumerate(index)]) self._character_to_code = dict([(e,d[i]) for i,(e,w) in enumerate(index)])
self._build_code_from_tree(self._tree, d, prefix="") self._index = dict((i, s) for i, (s, w) in enumerate(dic.items())) self._character_to_code = dict( (s, d[i]) for i, (s, w) in enumerate(dic.items()))
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
Returns an encoding of the given string based on the current encoding table INPUT: - ``string`` (string) EXAMPLE: This is how a string is encoded then decoded ::
Encode the given string based on the current encoding table. INPUT: - ``string`` -- a string of symbols over an alphabet. OUTPUT: - A Huffman encoding of ``string``. EXAMPLES: This is how a string is encoded and then decoded::
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
return join(map(lambda x:self._character_to_code[x],string), '')
return "".join(map(lambda x: self._character_to_code[x], string))
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
Returns a decoded version of the given string corresponding to the current encoding table. INPUT: - ``string`` (string) EXAMPLE: This is how a string is encoded then decoded ::
Decode the given string using the current encoding table. INPUT: - ``string`` -- a string of Huffman encodings. OUTPUT: - The Huffman decoding of ``string``. EXAMPLES: This is how a string is encoded and then decoded::
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
not, an exception is raised ::
not, an exception is raised::
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
ValueError: The given string does not only contain 0 and 1 """
ValueError: Input must be a binary string. """
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
if i == '0':
if i == "0":
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
elif i == '1':
elif i == "1":
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
raise ValueError('The given string does not only contain 0 and 1') if not isinstance(tree,list):
raise ValueError("Input must be a binary string.") if not isinstance(tree, list):
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
return join(chars, '')
return "".join(chars)
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
Returns the current encoding table
Returns the current encoding table. INPUT: - None.
def encoding_table(self): r""" Returns the current encoding table
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
A dictionary associating its code to each trained letter of the alphabet EXAMPLE:: sage: from sage.coding.source_coding.huffman import Huffman sage: str = "Sage is my most favorite general purpose computer algebra system" sage: h = Huffman(str) sage: h.encoding_table() {'S': '00000', 'a': '1101', ' ': '101', 'c': '11...
- A dictionary associating an alphabetic symbol to a Huffman encoding. EXAMPLES:: sage: from sage.coding.source_coding.huffman import Huffman sage: str = "Sage is my most favorite general purpose computer algebra system" sage: h = Huffman(str) sage: T = sorted(h.encoding_table().items()) sage: for symbol, code in T: ...
def encoding_table(self): r""" Returns the current encoding table
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
Returns the Huffman tree corresponding to the current encoding
Returns the Huffman tree corresponding to the current encoding. INPUT: - None.
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
A tree EXAMPLE::
- The binary tree representing a Huffman code. EXAMPLES::
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
"""
<BLANKLINE> """
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root'
def _generate_edges(self, tree, parent="", bit=""): """ Generate the edges of the given Huffman tree. INPUT: - ``tree`` -- a Huffman binary tree. - ``parent`` -- (default: empty string) a parent vertex with exactly two children. - ``bit`` -- (default: empty string) the bit signifying either the left or right branch...
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
u = father
u = parent s = "".join([parent, bit])
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
left = self._generate_edges(tree[0], parent=s, bit="0") right = self._generate_edges(tree[1], parent=s, bit="1") L = [(u, s)] if s != "" else [] return left + right + L
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
return [(u, self.decode(father+id)+' : '+(father+id))]
return [(u, "".join([self.decode(s), ": ", s]))]
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
08cf8218c91d92b4dcb4602a7135f1d9d706af1e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/08cf8218c91d92b4dcb4602a7135f1d9d706af1e/huffman.py
\log(n)` time (and in linear time if all weights are equal). On the other hand, if one is given a large (possibly
\log(n)` time (and in linear time if all weights are equal) where `n = V + E`. On the other hand, if one is given a large (possibly
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
ab8938ee4489ea4b0bde5a6b5927cff64d96a7b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ab8938ee4489ea4b0bde5a6b5927cff64d96a7b6/generic_graph.py
sage: st = g.steiner_tree(g.vertices()[:5]) sage: st.is_tree()
sage: st = g.steiner_tree(g.vertices()[:5]) sage: st.is_tree()
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
ab8938ee4489ea4b0bde5a6b5927cff64d96a7b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ab8938ee4489ea4b0bde5a6b5927cff64d96a7b6/generic_graph.py
sage: all([v in st for v in g.vertices()[:5] ])
sage: all([v in st for v in g.vertices()[:5] ])
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
ab8938ee4489ea4b0bde5a6b5927cff64d96a7b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ab8938ee4489ea4b0bde5a6b5927cff64d96a7b6/generic_graph.py
if len(xi) != n:
if len(yi) != n:
def cnf(self, xi=None, yi=None, format=None): """ Return a representation of this S-Box in conjunctive normal form.
09cf0daf0656159c5e2e166b299baee34935d15f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/09cf0daf0656159c5e2e166b299baee34935d15f/sbox.py
x = self.to_bits(e)
x = self.to_bits(e, m)
def cnf(self, xi=None, yi=None, format=None): """ Return a representation of this S-Box in conjunctive normal form.
09cf0daf0656159c5e2e166b299baee34935d15f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/09cf0daf0656159c5e2e166b299baee34935d15f/sbox.py
For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter. INPUT: - P = (a,b) a non-Weierstrass point on self - prec: desired precision of the local co...
For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter. INPUT: - P = (a,b) a non-Weierstrass point on self - prec: desired precision of the local coordinates - name: gen of the power series ring (default: '...
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
is the local parameter at P
is the local parameter at P
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
sage: R.<x> = QQ['x'] sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) sage: P = H(1,6) sage: x,y = H.local_coordinates_at_nonweierstrass(P,prec=5) ...
sage: R.<x> = QQ['x'] sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) sage: P = H(1,6) sage: x,y = H.local_coordinates_at_nonweierstrass(P,prec=5) sage: x 1 + t + O(t^5) sage: y 6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5) sage: Q = H(-2,12) sage: x,y = H.local_coordinates_at_nonweierstrass(Q,prec=5) sage: x -2 ...
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
if d == 0: raise TypeError, "P = %s is a Weierstrass point. Use local_coordinates_at_weierstrass instead!"%P
if d == 0: raise TypeError, "P = %s is a Weierstrass point. Use local_coordinates_at_weierstrass instead!"%P
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter. INPUT:
For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter. INPUT:
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
sage: R.<x> = QQ['x'] sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) sage: A = H(4,0) sage: x,y = H.local_coordinates_at_weierstrass(A,prec =5) sage: x
sage: R.<x> = QQ['x'] sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) sage: A = H(4,0) sage: x,y = H.local_coordinates_at_weierstrass(A,prec =5) sage: x
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
if P[1] != 0: raise TypeError, "P = %s is not a finite Weierstrass point. Use local_coordinates_at_nonweierstrass instead!"%P
if P[1] != 0: raise TypeError, "P = %s is not a finite Weierstrass point. Use local_coordinates_at_nonweierstrass instead!"%P
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
sage: R.<x> = QQ['x']
sage: R.<x> = QQ['x']
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
If P is not infinity, calls the appropriate local_coordinates function. INPUT:
If P is not infinity, calls the appropriate local_coordinates function. INPUT:
def local_coord(self, P, prec = 20, name = 't'): """ If P is not infinity, calls the appropriate local_coordinates function.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
(x(t),y(t)) such that y(t)^2 = f(x(t)) and t
(x(t),y(t)) such that y(t)^2 = f(x(t)), where t
def local_coord(self, P, prec = 20, name = 't'): """ If P is not infinity, calls the appropriate local_coordinates function.
ef7503ddc882a8693dd4b8a170c060074f3ef89b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ef7503ddc882a8693dd4b8a170c060074f3ef89b/hyperelliptic_generic.py
Returns a list of the immediate super categories of self.
Returns a list of the immediate super categories of ``self``.
def super_categories(self): """ Returns a list of the immediate super categories of self.
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
- often uses self.one().
- often uses ``self.one()``.
def one(self): r""" Returns the one of the monoid, that is the unique neutral element for `*`.
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
Backward compatibility alias for :meth:`self.one()`.
Backward compatibility alias for :meth:`one`.
def one_element(self): r""" Backward compatibility alias for :meth:`self.one()`.
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
Returns the product of the elements in `args`, as an element of `self`. EXAMPLES:
Returns the product of the elements in ``args``, as an element of ``self``. EXAMPLES::
def prod(self, args): r""" n-ary product
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
def prod(self, args): r""" n-ary product
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
Returns whether self is the one of the monoid
Returns whether ``self`` is the one of the monoid
def is_one(self): r""" Returns whether self is the one of the monoid
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
- n: a non negative integer
- ``n``: a non negative integer
def __pow__(self, n): r""" INPUTS: - n: a non negative integer
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
A naive implementation of __pow__
A naive implementation of ``__pow__``
def _pow_naive(self, n): r""" A naive implementation of __pow__
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
- n: a non negative integer
- ``n``: a non negative integer
def _pow_naive(self, n): r""" A naive implementation of __pow__
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
faster du to size explotion).
faster due to size explosion).
def _pow_naive(self, n): r""" A naive implementation of __pow__
f7adc4547fa59894ffbc320f0b3a2c47db617853 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f7adc4547fa59894ffbc320f0b3a2c47db617853/monoids.py
'Sphere center 1.0 2.0 3.0 Rad 0.015 texture84'
'Sphere center 1.0 2.0 3.0 Rad 0.015 texture85'
def tachyon_repr(self, render_params): """ Returns representation of the point suitable for plotting using the Tachyon ray tracer.
87327e7c8fd18e4438140ec95ad093425fb8d221 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/87327e7c8fd18e4438140ec95ad093425fb8d221/shapes2.py
['g obj_1', 'usemtl texture86']
['g obj_1', 'usemtl texture87']
def obj_repr(self, render_params): """ Returns complete representation of the point as a sphere.
87327e7c8fd18e4438140ec95ad093425fb8d221 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/87327e7c8fd18e4438140ec95ad093425fb8d221/shapes2.py
'FCylinder base 1.0 0.0 0.0 apex 0.999950000417 0.00999983333417 0.0001 rad 0.005 texture126'
'FCylinder base 1.0 0.0 0.0 apex 0.999950000417 0.00999983333417 0.0001 rad 0.005 texture127'
def tachyon_repr(self, render_params): """ Returns representation of the line suitable for plotting using the Tachyon ray tracer.
87327e7c8fd18e4438140ec95ad093425fb8d221 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/87327e7c8fd18e4438140ec95ad093425fb8d221/shapes2.py
linewidths = options['linewidths']
linewidths = options.get('linewidths',None)
def _render_on_subplot(self, subplot): """ TESTS:
267857a0698745b43920a2cd088b4c002a62b836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/267857a0698745b43920a2cd088b4c002a62b836/contour_plot.py
linestyles = options['linestyles']
linestyles = options.get('linestyles',None)
def _render_on_subplot(self, subplot): """ TESTS:
267857a0698745b43920a2cd088b4c002a62b836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/267857a0698745b43920a2cd088b4c002a62b836/contour_plot.py
@suboptions('label', fontsize=9, colors=None, inline=None, inline_spacing=3, fmt="%1.2f")
@suboptions('label', fontsize=9, colors='blue', inline=None, inline_spacing=3, fmt="%1.2f")
def _render_on_subplot(self, subplot): """ TESTS:
267857a0698745b43920a2cd088b4c002a62b836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/267857a0698745b43920a2cd088b4c002a62b836/contour_plot.py
If fill is True (the default), then we may have to color the labels so that we can see them::
We can change the color of the labels if so desired::
def contour_plot(f, xrange, yrange, **options): r""" ``contour_plot`` takes a function of two variables, `f(x,y)` and plots contour lines of the function over the specified ``xrange`` and ``yrange`` as demonstrated below. ``contour_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a function of two variab...
267857a0698745b43920a2cd088b4c002a62b836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/267857a0698745b43920a2cd088b4c002a62b836/contour_plot.py
g.add_primitive(ContourPlot(xy_data_array, xrange,yrange, dict(contours=[-1e307, 0, 1e307], cmap=cmap, fill=True, labels=False, **options)))
g.add_primitive(ContourPlot(xy_data_array, xrange,yrange, dict(contours=[-1e307, 0, 1e307], cmap=cmap, fill=True, labels=False, **options)))
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth,**options): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax),...
267857a0698745b43920a2cd088b4c002a62b836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/267857a0698745b43920a2cd088b4c002a62b836/contour_plot.py
g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, dict( linestyles=linestyles, linewidths=linewidths, contours=[0], cmap=[bordercol], fill=False, labels=False, **options)))
g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, dict(linestyles=linestyles, linewidths=linewidths, contours=[0], cmap=[bordercol], fill=False, labels=False, **options)))
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth,**options): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax),...
267857a0698745b43920a2cd088b4c002a62b836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/267857a0698745b43920a2cd088b4c002a62b836/contour_plot.py
gens = [ "()" ]
k = max(self.entries()) gens = [range(1,k+1)]
def row_stabilizer(self): """ Return the PermutationGroup corresponding to the row stabilizer of self.
607f3bf91afb925b159d15574764be8ff24b5e0a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/607f3bf91afb925b159d15574764be8ff24b5e0a/tableau.py
A map from '(' to open_symbol and ')' to close_symbol and otherwise an error is raised.
A map from ``'('`` to ``open_symbol`` and ``')'`` to ``close_symbol`` and otherwise an error is raised. The values of the constants ``open_symbol`` and ``close_symbol`` are subject to change. This is the inverse map of :func:`replace_symbols`. INPUT: - ``x`` -- either an opening or closing parenthesis. OUTPUT: - If...
def replace_parens(x): r""" A map from '(' to open_symbol and ')' to close_symbol and otherwise an error is raised. EXAMPLES:: sage: from sage.combinat.dyck_word import replace_parens sage: replace_parens('(') 1 sage: replace_parens(')') 0 sage: replace_parens(1) Traceback (most recent call last): ... ValueError """ ...
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
A map from open_symbol to '(' and close_symbol to ')' and otherwise an error is raised.
A map from ``open_symbol`` to ``'('`` and ``close_symbol`` to ``')'`` and otherwise an error is raised. The values of the constants ``open_symbol`` and ``close_symbol`` are subject to change. This is the inverse map of :func:`replace_parens`. INPUT: - ``x`` -- either ``open_symbol`` or ``close_symbol``. OUTPUT: - I...
def replace_symbols(x): r""" A map from open_symbol to '(' and close_symbol to ')' and otherwise an error is raised. EXAMPLES:: sage: from sage.combinat.dyck_word import replace_symbols sage: replace_symbols(1) '(' sage: replace_symbols(0) ')' sage: replace_symbols(3) Traceback (most recent call last): ... ValueError...
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete
Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete.
def DyckWord(dw=None, noncrossing_partition=None): r""" Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete EXAMPLES:: sage: dw = DyckWord([1, 0, 1, 0]); dw [1, 0, 1, 0] sage: print dw ()() sage: print dw.height() 1 sage: dw.to_noncrossing_partition() [[1], [2]] :: sage: Dyck...
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
TODO: In functions where a Dyck word is necessary, an error should be raised (e.g. a_statistic, b_statistic)?
TODO: In functions where a Dyck word is necessary, an error should be raised (e.g. ``a_statistic``, ``b_statistic``)?
def DyckWord(dw=None, noncrossing_partition=None): r""" Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete EXAMPLES:: sage: dw = DyckWord([1, 0, 1, 0]); dw [1, 0, 1, 0] sage: print dw ()() sage: print dw.height() 1 sage: dw.to_noncrossing_partition() [[1], [2]] :: sage: Dyck...
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
report the position for the parenthesis that matches the one at position ``pos``
Report the position for the parenthesis that matches the one at position ``pos``.
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
- ``pos`` - the index of the parenthesis in the list
- ``pos`` - the index of the parenthesis in the list.
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
integer representing the index of the matching parenthesis. If no parenthesis matches nothing is returned
Integer representing the index of the matching parenthesis. If no parenthesis matches, return ``None``.
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
Bijection of Biane from Dyck words to non crossing partitions
Bijection of Biane from Dyck words to non-crossing partitions.
def to_noncrossing_partition(self): r""" Bijection of Biane from Dyck words to non crossing partitions Thanks to Mathieu Dutour for describing the bijection.
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
Returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list. The standard tableau will be rectangular iff ``self`` is a complete Dyck word.
def to_tableau(self): r""" returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
TODO: better name? to_standard_tableau? and should *actually* return a Tableau object?
TODO: better name? ``to_standard_tableau``? and should *actually* return a Tableau object?
def to_tableau(self): r""" returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
Returns the a-statistic for the Dyck word correspond to the area of the Dyck path.
Returns the a-statistic for the Dyck word corresponding to the area of the Dyck path.
def a_statistic(self): """ Returns the a-statistic for the Dyck word correspond to the area of the Dyck path.
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
def b_statistic(self): r""" Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
$(0, 0), (j_1, j_1), (j_2, j_2), ... , (j_r-1, j_r-1), (j_r, j_r) = (n, n).$
.. MATH:: (0, 0), (j_1, j_1), (j_2, j_2), \dots , (j_r-1, j_r-1), (j_r, j_r) = (n, n).
def b_statistic(self): r""" Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
Returns a list of all the Dyck words with ``k1`` opening and ``k2`` closing parentheses.
Returns a list of all the Dyck words with ``k1`` opening and ``k2`` closing parentheses.
def list(self): """ Returns a list of all the Dyck words with ``k1`` opening and ``k2`` closing parentheses.
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
Returns an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses.
Returns an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses.
def __iter__(self): r""" Returns an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses.
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
converts a non-crossing partition to a Dyck word
Converts a non-crossing partition to a Dyck word.
def from_noncrossing_partition(ncp): r""" converts a non-crossing partition to a Dyck word TESTS:: sage: DyckWord(noncrossing_partition=[[1,2]]) # indirect doctest [1, 1, 0, 0] sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] :: sage: dws = DyckWords(5).list() sage: ncps = map( lambda x: x.to_noncrossin...
7e1334f768dfbfef3881c254af52ae022484f92b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7e1334f768dfbfef3881c254af52ae022484f92b/dyck_word.py
This is called "massaging" in [CB07]_.
This is called "massaging" in [CBJ07]_.
def eliminate_linear_variables(self, maxlength=3, skip=lambda lm,tail: False): """ Return a new system where "linear variables" are eliminated.
71b8ab98c7e082f651a26f77147d1a3febc1b513 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/71b8ab98c7e082f651a26f77147d1a3febc1b513/mpolynomialsystem.py
return HeckeModuleElement.__mul__(self, other)
return element.HeckeModuleElement.__mul__(self, other)
def __mul__(self, other): r""" Calculate the product self * other.
3e9710c9379eb051cee450f01fed94d93593b590 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3e9710c9379eb051cee450f01fed94d93593b590/element.py
def order(self, *gens, **kwds):
def order(self, *args, **kwds):
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field.
65d29c8a95ea9faea3800f96c664e08c7f675ca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/65d29c8a95ea9faea3800f96c664e08c7f675ca2/number_field.py
"""
sage: K.<a> = NumberField(x^3 - 2) sage: ZZ[a] Order in Number Field in a0 with defining polynomial x^3 - 2 TESTS: We verify that trac sage: K.<a> = NumberField(x^4 + 4*x^2 + 2) sage: B = K.integral_basis() sage: K.order(*B) Order in Number Field in a with defining polynomial x^4 + 4*x^2 + 2 sage: K.order(B) Order ...
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field.
65d29c8a95ea9faea3800f96c664e08c7f675ca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/65d29c8a95ea9faea3800f96c664e08c7f675ca2/number_field.py
-0.530637530952518 + 1.11851787964371*I
0.530637530952518 - 1.11851787964371*I
def __init__(self): r""" The inverse of the hyperbolic secant function.
76b69b5c65d8bfde141c23aa1ee93d46e12acda4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/76b69b5c65d8bfde141c23aa1ee93d46e12acda4/hyperbolic.py
""" return Vobj.evaluated_on(self)
If you pass a vector, it is assumed to be the coordinate vector of a point:: sage: ineq.eval( vector(ZZ, [3,2]) ) -4 """ try: return Vobj.evaluated_on(self) except AttributeError: return self.A() * Vobj + self.b()
def eval(self, Vobj): r""" Evaluates the left hand side `A\vec{x}+b` on the given vertex/ray/line.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
is_inequality.__doc__ = Hrepresentation.is_inequality.__doc__
def is_inequality(self): """ Returns True since this is, by construction, an inequality.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
"""
If you pass a vector, it is assumed to be the coordinate vector of a point:: sage: P = Polyhedron(vertices=[[1,1],[1,-1],[-1,1],[-1,-1]]) sage: p = vector(ZZ, [1,0] ) sage: [ ieq.interior_contains(p) for ieq in P.inequality_generator() ] [True, True, True, False] """ try: if Vobj.is_vector(): return self.polyhedron()...
def interior_contains(self, Vobj): """ Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
is_equation.__doc__ = Hrepresentation.is_equation.__doc__
def is_equation(self): """ Tests if this object is an equation. By construction, it must be.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
is_vertex.__doc__ = Vrepresentation.is_vertex.__doc__
def is_vertex(self): """ Tests if this object is a vertex. By construction it always is.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
is_ray.__doc__ = Vrepresentation.is_ray.__doc__
def is_ray(self): """ Tests if this object is a ray. Always True by construction.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
is_line.__doc__ = Vrepresentation.is_line.__doc__
def is_line(self): """ Tests if the object is a line. By construction it must be.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py
Returns the identity projection.
Returns the identity projection of the polyhedron.
def identity(self): """ Returns the identity projection.
346f358354c345210a872f113663df4917187850 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/346f358354c345210a872f113663df4917187850/polyhedra.py