rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
Subgroup of Mordell Weil group: [[-2:3:1], [-14:25:8], [-13422227300:-49322830557:12167000000]] | Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [-13422227300:-49322830557:12167000000]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
Subgroup of Mordell Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
Of course, the ``process`` function would have done all this | Of course, the :meth:`process()` function would have done all this | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
Subgroup of Mordell Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
But we would still need to use the ``saturate`` function to | But we would still need to use the :meth:`saturate()` function to | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
side-effect. It proves that the inde of the points in their | side-effect. It proves that the index of the points in their | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
by reducing the poits modulo all primes of good reduction up | by reducing the points modulo all primes of good reduction up | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be satura... | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
On 32-bit machines, this MUST be < 21.48 else $\exp(h_lim)>2^31$ and overflows. On 64-bit machines it must be at most 43.668. However, this bound is a logarithic | On 32-bit machines, this *must* be < 21.48 else `\exp(h_{\text{lim}}) > 2^{31}` and overflows. On 64-bit machines, it must be *at most* 43.668. However, this bound is a logarithmic | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] In the next example, a serach bound of 12 is needed to find a non-torsin point:: | Subgroup of Mordell-Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] In the next example, a search bound of 12 is needed to find a non-torsion point:: | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
Subgroup of Mordell Weil group: [] | Subgroup of Mordell-Weil group: [] | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
Subgroup of Mordell Weil group: [[4413270:10381877:27000]] | Subgroup of Mordell-Weil group: [[4413270:10381877:27000]] | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
if height_limit >= 21.4: | if height_limit >= 21.4: | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
verbose == bool(verbose) | verbose = bool(verbose) | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
(list) a list of lists of length 3, each holding the | (list) A list of lists of length 3, each holding the | def points(self): """ Return a list of the generating points in this Mordell-Weil group. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py |
sage: W = Words('123') sage: W('1212').is_square() True sage: W('1213').is_square() False sage: W('12123').is_square() False sage: W().is_square() | sage: Word('1212').is_square() True sage: Word('1213').is_square() False sage: Word('12123').is_square() False sage: Word().is_square() | def is_square(self): r""" Returns True if self is a square, and False otherwise. EXAMPLES:: sage: Word([1,0,0,1]).is_square() False sage: W = Words('123') sage: W('1212').is_square() True sage: W('1213').is_square() False sage: W('12123').is_square() False sage: W().is_square() True """ if self.length() % 2 != 0: ret... | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py |
sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True TESTS:: sage: W = Words('123') sage: W('11').is_square_free() False sage: W('211').is_square_free() False sage: W('3211').is_square_free() False """ l = self.length() if l < 2: | sage: Word('12312').is_square_free() True sage: Word('31212').is_square_free() False sage: Word().is_square_free() True TESTS: We make sure that sage: Word('11').is_square_free() False sage: Word('211').is_square_free() False sage: Word('3211').is_square_free() False """ L = self.length() if L < 2: | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py |
suff = self for i in xrange(0, l-1): for ll in xrange(2, l-i+1, 2): if suff[:ll].is_square(): | for start in xrange(0, L-1): for end in xrange(start+2, L+1, 2): if self[start:end].is_square(): | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py |
suff = suff[1:] | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_square_free() True sage: W('31212').is_square_free() False sage: W().is_square_free() True | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py | |
sage: W = Words('012') sage: W('012012012').is_cube() True sage: W('01010101').is_cube() False sage: W().is_cube() True sage: W('012012').is_cube() | sage: Word('012012012').is_cube() True sage: Word('01010101').is_cube() False sage: Word().is_cube() True sage: Word('012012').is_cube() | def is_cube(self): r""" Returns True if self is a cube, and False otherwise. EXAMPLES:: sage: W = Words('012') sage: W('012012012').is_cube() True sage: W('01010101').is_cube() False sage: W().is_cube() True sage: W('012012').is_cube() False """ if self.length() % 3 != 0: return False l = self.length() / 3 return sel... | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py |
sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: | sage: Word('12312').is_cube_free() True sage: Word('32221').is_cube_free() False sage: Word().is_cube_free() True TESTS: We make sure that sage: Word('111').is_cube_free() False sage: Word('2111').is_cube_free() False sage: Word('32111').is_cube_free() False """ L = self.length() if L < 3: | def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: return True suff = self for i in xrange(0, l - 3): f... | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py |
suff = self for i in xrange(0, l - 3): for ll in xrange(3, l-i+1, 3): if suff[:ll].is_cube(): | for start in xrange(0, L - 2): for end in xrange(start+3, L+1, 3): if self[start:end].is_cube(): | def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: return True suff = self for i in xrange(0, l - 3): f... | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py |
suff = suff[1:] | def is_cube_free(self): r""" Returns True if self does not contain cubes, and False otherwise. EXAMPLES:: sage: W = Words('123') sage: W('12312').is_cube_free() True sage: W('32221').is_cube_free() False sage: W().is_cube_free() True """ l = self.length() if l < 3: return True suff = self for i in xrange(0, l - 3): f... | 518df6c0b2cc2e9706aecc89fca2d76463030382 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/518df6c0b2cc2e9706aecc89fca2d76463030382/finite_word.py | |
Return the frequency table corresponding to the given string. | Return the frequency table corresponding to the given 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
- ``string`` -- a string EXAMPLE:: | - ``string`` -- a string of symbols over some alphabet. OUTPUT: - A table of frequency of each unique symbol in ``string``. If ``string`` is an empty string, return an empty table. EXAMPLES: The frequency table of a non-empty 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a': 5, ' ': 9, 'c': 1, 'b': 1, 'e': 8, 'g': 3, 'f': 1, 'i': 2, 'm': 4, 's': 5, 'o': 4, 'n': 1, 'p': 3, 'S': 1, 'r': 5, 'u': 2, 't': 4, 'v': 1, 'y': 2, 'l': 2} | sage: str = "Stop counting my characters!" sage: T = sorted(frequency_table(str).items()) sage: for symbol, code in T: ... print symbol, code ... 3 ! 1 S 1 a 2 c 3 e 1 g 1 h 1 i 1 m 1 n 2 o 2 p 1 r 2 s 1 t 3 u 1 y 1 The frequency of an empty string:: sage: frequency_table("") {} | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
for l in string: d[l] = d.get(l,0) + 1 | for s in string: d[s] = d.get(s, 0) + 1 | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
class Huffman(): | class Huffman(SageObject): | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
Huffman Encoding This class implements the basic functionalities of Huffman's encoding. It can build a Huffman code from a given string, or from the information of a dictionary associating to each key (the elements of the alphabet) a weight (most of the time, a probability value or a number of occurrences). For examp... | This class implements the basic functionalities of Huffman codes. It can build a Huffman code from a given string, or from the information of a dictionary associating to each key (the elements of the alphabet) a weight (most of the time, a probability value or a number of occurrences). INPUT: - ``string`` -- (defaul... | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
We could have obtained the same result by "training" the Huffman code on the following table of frequency :: | We can obtain the same result by "training" the Huffman code with the following table of frequency:: | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
sage: h2 = Huffman(frequencies = ft) Once ``h1`` has been trained, and hence possesses an encoding code, | sage: h2 = Huffman(table=ft) Once ``h1`` has been trained, and hence possesses an encoding table, | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
Which can be decoded the following way:: | We can decode the above encoded string in the following way:: | 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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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'... | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
EXAMPLE:: | EXAMPLES:: | def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. INPUT: - ``dic`` (dictionary) -- associates to each letter of the alphabet a frequency or a number of occurrences. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
def _build_code(self, dic): r""" 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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py | ||
index = dic.items() | def _build_code(self, dic): r""" 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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. INPUT: - ``dic`` (dictionary) -- associates to each letter of the alphabet a frequency or a number of occurrences. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. INPUT: - ``dic`` (dictionary) -- associates to each letter of the alphabet a frequency or a number of occurrences. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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. | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
Returns the current encoding table | Returns the current encoding table. INPUT: - None. | def encoding_table(self): r""" Returns the current encoding table | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
""" | <BLANKLINE> """ | def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 []) | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 []) | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 []) | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/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 []) | 0aa5d0e07206199e4e64708c13056046cecfe083 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/0aa5d0e07206199e4e64708c13056046cecfe083/huffman.py |
- ``algorithm`` - string (default: 'gmp') - ``'gmp'`` - use the GMP C-library factorial function | - ``algorithm`` - string (default: 'gmp'): - ``'gmp'`` - use the GMP C-library factorial function | def factorial(n, algorithm='gmp'): r""" Compute the factorial of `n`, which is the product `1\cdot 2\cdot 3 \cdots (n-1)\cdot n`. INPUT: - ``n`` - an integer - ``algorithm`` - string (default: 'gmp') - ``'gmp'`` - use the GMP C-library factorial function - ``'pari'`` - use PARI's factorial function OUTPUT: an... | 07a0e7a1987887a17f526710029b60138c7463cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/07a0e7a1987887a17f526710029b60138c7463cb/arith.py |
- ``'pari'`` - use PARI's factorial function | - ``'pari'`` - use PARI's factorial function | def factorial(n, algorithm='gmp'): r""" Compute the factorial of `n`, which is the product `1\cdot 2\cdot 3 \cdots (n-1)\cdot n`. INPUT: - ``n`` - an integer - ``algorithm`` - string (default: 'gmp') - ``'gmp'`` - use the GMP C-library factorial function - ``'pari'`` - use PARI's factorial function OUTPUT: an... | 07a0e7a1987887a17f526710029b60138c7463cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/07a0e7a1987887a17f526710029b60138c7463cb/arith.py |
modulo `m\*n`. | modulo `m*n`. | def crt(a,b,m=None,n=None): r""" Use the Chinese Remainder Theorem to find some `x` such that `x=a \bmod m` and `x=b \bmod n`. Note that `x` is only well-defined modulo `m\*n`. EXAMPLES:: sage: crt(2, 1, 3, 5) -4 sage: crt(13,20,100,301) -2087 You can also use upper case:: sage: c = CRT(2,3, 3, 5); c 8 sage: c % 3 ... | 07a0e7a1987887a17f526710029b60138c7463cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/07a0e7a1987887a17f526710029b60138c7463cb/arith.py |
K = NumberField_quadratic(polynomial, name, check, embedding, latex_name=latex_name) | K = NumberField_quadratic(polynomial, name, latex_name, check, embedding) | def NumberField(polynomial, name=None, check=True, names=None, cache=True, embedding=None, latex_name=None): r""" Return *the* number field defined by the given irreducible polynomial and with variable with the given name. If check is True (the default), also verify that the defining polynomial is irreducible and over ... | 38b974c37b8097f32967101a6708a4ccf2c60e99 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/38b974c37b8097f32967101a6708a4ccf2c60e99/number_field.py |
K = NumberField_absolute(polynomial, name, None, check, embedding, latex_name=latex_name) | K = NumberField_absolute(polynomial, name, latex_name, check, embedding) | def NumberField(polynomial, name=None, check=True, names=None, cache=True, embedding=None, latex_name=None): r""" Return *the* number field defined by the given irreducible polynomial and with variable with the given name. If check is True (the default), also verify that the defining polynomial is irreducible and over ... | 38b974c37b8097f32967101a6708a4ccf2c60e99 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/38b974c37b8097f32967101a6708a4ccf2c60e99/number_field.py |
def __init__(self, polynomial, name=None, check=True, embedding=None, latex_name=None): | def __init__(self, polynomial, name=None, latex_name=None, check=True, embedding=None): | def __init__(self, polynomial, name=None, check=True, embedding=None, latex_name=None): """ Create a quadratic number field. EXAMPLES:: sage: k.<a> = QuadraticField(5, check=False); k Number Field in a with defining polynomial x^2 - 5 Don't do this:: sage: k.<a> = QuadraticField(4, check=False); k Number Field in a... | 38b974c37b8097f32967101a6708a4ccf2c60e99 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/38b974c37b8097f32967101a6708a4ccf2c60e99/number_field.py |
Initializes base class Ellipse. | Initializes base class ``Ellipse``. | def __init__(self, x, y, r1, r2, angle, options): """ Initializes base class Ellipse. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
The bounding box is computed as minimal as possible. | The bounding box is computed to be as minimal as possible. | def get_minmax_data(self): """ Returns a dictionary with the bounding box data. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
An example without angle:: | An example without an angle:: | def get_minmax_data(self): """ Returns a dictionary with the bounding box data. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
The same example with a rotation of angle pi/2:: | The same example with a rotation of angle `\pi/2`:: | def get_minmax_data(self): """ Returns a dictionary with the bounding box data. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
Return the allowed options for the Ellipse class. | Return the allowed options for the ``Ellipse`` class. | def _allowed_options(self): """ Return the allowed options for the Ellipse class. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
String representation of Ellipse primitive. | String representation of ``Ellipse`` primitive. | def _repr_(self): """ String representation of Ellipse primitive. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
Plot 3d is not implemented. | Plotting in 3D is not implemented. | def plot3d(self): r""" Plot 3d is not implemented. | 5be14d52af6bacc0b6e9a15c729933c57aed3aae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/5be14d52af6bacc0b6e9a15c729933c57aed3aae/ellipse.py |
have_tkzgraph = not bool(os.system('kpsewhich tkz-graph.sty > /dev/null')) | have_tkzgraph = not bool(os.system('kpsewhich tkz-graph.sty &> /dev/null')) | def check_tkz_graph(): r""" Checks if the proper `\mbox{\rm\LaTeX}` packages for the ``tikzpicture`` environment are installed in the user's environment. If the requisite packages are not found on the first call to this function, warnings are printed. Thereafter, the function caches its result in the variable ``_have_... | f264b8da94a91083692385e97d33948e1a6aa572 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/f264b8da94a91083692385e97d33948e1a6aa572/graph_latex.py |
have_tkzberge = not bool(os.system('kpsewhich tkz-berge.sty > /dev/null')) | have_tkzberge = not bool(os.system('kpsewhich tkz-berge.sty &> /dev/null')) | def check_tkz_graph(): r""" Checks if the proper `\mbox{\rm\LaTeX}` packages for the ``tikzpicture`` environment are installed in the user's environment. If the requisite packages are not found on the first call to this function, warnings are printed. Thereafter, the function caches its result in the variable ``_have_... | f264b8da94a91083692385e97d33948e1a6aa572 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/f264b8da94a91083692385e97d33948e1a6aa572/graph_latex.py |
have_tkzgraph = not bool(os.system('kpsewhich tkz-graph.sty > /dev/null')) have_tkzberge = not bool(os.system('kpsewhich tkz-berge.sty > /dev/null')) | have_tkzgraph = not bool(os.system('kpsewhich tkz-graph.sty &> /dev/null')) have_tkzberge = not bool(os.system('kpsewhich tkz-berge.sty &> /dev/null')) | def have_tkz_graph(): r""" Returns ``True`` if the proper `\mbox{\rm\LaTeX}` packages for the ``tikzpicture`` environment are installed in the user's environment. The first time it is run, this function caches its result in the variable ``_have_tkz_graph``, and any subsequent time, it just checks the value of the vari... | f264b8da94a91083692385e97d33948e1a6aa572 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/f264b8da94a91083692385e97d33948e1a6aa572/graph_latex.py |
sage: K.<a> = NumberField(polygen(QQ)) sage: K._S_class_group_and_units( (K.ideal(5),) ) ([5, -1], []) | def _S_class_group_and_units(self, S, proof=True): """ Compute S class group and units. INPUT: - ``S`` - a tuple of primes of the base field - ``proof`` - if False, assume Pari's GRH++ in computing the class group OUTPUT: - ``units, clgp_gens``, where: - ``units`` - A list of generators of the unit group. - ``cl... | 4e3abc6335f920049561734968d767d67ddbf5ef /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/4e3abc6335f920049561734968d767d67ddbf5ef/number_field.py | |
""" | r""" | def selmer_group(self, S, m, proof=True): """ Compute the Selmer group `K(S,m)`, which is defined to be the subgroup of `K^\times/(K^\times)^m` consisting of elements `a` such that `K(\sqrt[m]{a})/K` is unramified at all primes of `K` lying above a place outside of `S`. INPUT: - ``S`` - A set of primes of self. - ``... | 4e3abc6335f920049561734968d767d67ddbf5ef /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/4e3abc6335f920049561734968d767d67ddbf5ef/number_field.py |
EXAMPLES: | EXAMPLES:: | def __call__(self, im_gens, check=True): """ Return the homomorphism defined by images of generators. | 51033ac1bce902c6a61ac281e81029b3df39c94f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/51033ac1bce902c6a61ac281e81029b3df39c94f/homset.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. In other words, given two graphs ``G`` and ``H`` which are isomorphic, suppose ``G_c`` a... | c157f6bdbb7e44efe2b0f726c6a5f48795fff6b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c157f6bdbb7e44efe2b0f726c6a5f48795fff6b6/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. In other words, given two graphs ``G`` and ``H`` which are isomorphic, suppose ``G_c`` a... | c157f6bdbb7e44efe2b0f726c6a5f48795fff6b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c157f6bdbb7e44efe2b0f726c6a5f48795fff6b6/generic_graph.py |
sage: browse_sage_doc(identity_matrix, 'rst')[:9] '**File:**' sage: browse_sage_doc(identity_matrix, 'rst')[-60:] 'MatrixSpace of 3 by 3 sparse matrices over Integer Ring\n ' sage: browse_sage_doc(identity_matrix, 'html', False)[:59] '<div class="docstring">\n \n <p><strong>File:</strong> /v' | sage: browse_sage_doc(identity_matrix, 'rst') "...**File:**...**Type:**...**Definition:** identity_matrix..." sage: identity_matrix.__doc__.replace('\\','\\\\') in browse_sage_doc(identity_matrix, 'rst') True sage: browse_sage_doc(identity_matrix, 'html', False) '...div...File:...Type:...Definition:...identity_matrix..... | def __call__(self, obj, output='html', view=True): r""" Return the documentation for ``obj``. | a7e259bb5d37c2906658e93ceb84e3c81a851b74 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/a7e259bb5d37c2906658e93ceb84e3c81a851b74/sagedoc.py |
sage: f = attrcall('core', 3) sage: loads(dumps(f)) | sage: f = attrcall('core', 3); f | def __init__(self, name, args, kwds): """ TESTS:: sage: f = attrcall('core', 3) sage: loads(dumps(f)) *.core(3) """ self.name = name self.args = args self.kwds = kwds | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py |
def __repr__(self): """ Returns a string representation of this object. The star in the output represents the object passed into self. EXAMPLES:: sage: attrcall('core', 3) *.core(3) sage: attrcall('hooks', flatten=True) *.hooks(flatten=True) sage: attrcall('hooks', 3, flatten=True) *.hooks(3, flatten=True) """ s = "... | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py | ||
def __repr__(self): """ Returns a string representation of this object. The star in the output represents the object passed into self. EXAMPLES:: sage: attrcall('core', 3) *.core(3) sage: attrcall('hooks', flatten=True) *.hooks(flatten=True) sage: attrcall('hooks', 3, flatten=True) *.hooks(3, flatten=True) """ s = "... | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py | ||
def __eq__(self, other): """ Equality testing EXAMPLES:: sage: attrcall('core', 3, flatten = True) == attrcall('core', 3, flatten = True) True sage: attrcall('core', 2) == attrcall('core', 3) False sage: attrcall('core', 2) == 1 False """ return self.__class__ == other.__class__ and self.__dict__ == other.__dict__ ... | def __repr__(self): """ Returns a string representation of this object. The star in the output represents the object passed into self. EXAMPLES:: sage: attrcall('core', 3) *.core(3) sage: attrcall('hooks', flatten=True) *.hooks(flatten=True) sage: attrcall('hooks', 3, flatten=True) *.hooks(3, flatten=True) """ s = "... | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py | |
def attrcall(name, *args, **kwds): """ Returns a callable which takes in an object, gets the method named name from that object, and calls it with the specified arguments and keywords. INPUT: - ``name`` - a string of the name of the method you want to call - ``args, kwds`` - arguments and keywords to be passed to... | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py | ||
- ``name`` - a string of the name of the method you want to call - ``args, kwds`` - arguments and keywords to be passed to the method | - ``name`` - a string of the name of the method you want to call - ``args, kwds`` - arguments and keywords to be passed to the method | def attrcall(name, *args, **kwds): """ Returns a callable which takes in an object, gets the method named name from that object, and calls it with the specified arguments and keywords. INPUT: - ``name`` - a string of the name of the method you want to call - ``args, kwds`` - arguments and keywords to be passed to... | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py |
def attrcall(name, *args, **kwds): """ Returns a callable which takes in an object, gets the method named name from that object, and calls it with the specified arguments and keywords. INPUT: - ``name`` - a string of the name of the method you want to call - ``args, kwds`` - arguments and keywords to be passed to... | 8fc6666bf20fafee57f630bd6803fba7305ff2a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8fc6666bf20fafee57f630bd6803fba7305ff2a0/misc.py | ||
For example, :: | For example:: | def old_cremona_letter_code(n): r""" Returns the *old* Cremona letter code corresponding to an integer. integer. For example, :: 1 --> A 26 --> Z 27 --> AA 52 --> ZZ 53 --> AAA etc. INPUT: - ``n`` - int OUTPUT: str EXAMPLES:: sage: old_cremona_letter_code(1) 'A' sage: old_cremona_letter_code(26) 'Z' sage: ol... | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
sage: it.next() Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: it.next() Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field """ return self.iter([11, self.largest_conductor()+1]) | sage: it.next().label() '11a1' sage: it.next().label() '11a2' sage: it.next().label() '11a3' sage: it.next().label() '14a1' sage: skip = [it.next() for _ in range(100)] sage: it.next().label() '45a3' """ return self.iter(xsrange(11,self.largest_conductor()+1)) | def __iter__(self): """ Returns an iterator through all EllipticCurve objects in the Cremona database. | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
Returns an iterator through all curves with conductor between Nmin and Nmax-1, inclusive, in the database. | Return an iterator through all curves in the database with given conductors. | def iter(self, conductors): """ Returns an iterator through all curves with conductor between Nmin and Nmax-1, inclusive, in the database. INPUT: - ``conductors`` - list or generator of ints OUTPUT: generator that iterates over EllipticCurve objects. | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
Returns an iterator through all optimal curves with conductor between Nmin and Nmax-1 in the database. | Return an iterator through all optimal curves in the database with given conductors. | def iter_optimal(self, conductors): """ Returns an iterator through all optimal curves with conductor between Nmin and Nmax-1 in the database. INPUT: | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
Returns a list of all curves with conductor between Nmin and Nmax-1, inclusive, in the database. | Returns a list of all curves with given conductors. | def list(self, conductors): """ Returns a list of all curves with conductor between Nmin and Nmax-1, inclusive, in the database. INPUT: - ``conductors`` - list or generator of ints OUTPUT: - list of EllipticCurve objects. | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
Returns a list of all optimal curves with conductor between Nmin and Nmax-1, inclusive, in the database. | Returns a list of all optimal curves with given conductors. | def list_optimal(self, conductors): """ Returns a list of all optimal curves with conductor between Nmin and Nmax-1, inclusive, in the database. INPUT: - ``conductors`` - list or generator of ints list of EllipticCurve objects. OUTPUT: list of EllipticCurve objects. | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
The smallest conductor for which the database is complete. (Always 1.) | The smallest conductor for which the database is complete: always 1. | def smallest_conductor(self): """ The smallest conductor for which the database is complete. (Always 1.) OUTPUT: - ``int`` - smallest conductor EXAMPLES:: sage: CremonaDatabase().smallest_conductor() 1 """ return 1 | c505e04eee8babcf64b9ccd5039fa569f6981a5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/c505e04eee8babcf64b9ccd5039fa569f6981a5b/cremona.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.