bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices. | def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices. | 459,600 |
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices. | def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices. | 459,601 |
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices. | def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices. | 459,602 |
def sturm_bound(self, M=None): r""" For a space M of modular forms, this function returns an integer B such that two modular forms in either self or M are equal if and only if their q-expansions are equal to precision B (note that this is 1+ the usual Sturm bound, since `O(q^\mathrm{prec})` has precision prec). If M is... | def sturm_bound(self, M=None): r""" For a space M of modular forms, this function returns an integer B such that two modular forms in either self or M are equal if and only if their q-expansions are equal to precision B (note that this is 1+ the usual Sturm bound, since `O(q^\mathrm{prec})` has precision prec). If M is... | 459,603 |
cdef RealNumber result = domain(fn(*py_args)) | cdef RealNumber result = domain(fn(*py_args)) | 459,604 |
def write_interpreter(self, write): r""" Generate the code for the C interpreter. | def write_interpreter(self, write): r""" Generate the code for the C interpreter. | 459,605 |
def write_interpreter(self, write): r""" Generate the code for the C interpreter. | def write_interpreter(self, write): r""" Generate the code for the C interpreter. | 459,606 |
def write_wrapper(self, write): r""" Generate the code for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the wrapper. | def write_wrapper(self, write): r""" Generate the code for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the wrapper. | 459,607 |
def write_wrapper(self, write): r""" Generate the code for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the wrapper. | def write_wrapper(self, write): r""" Generate the code for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the wrapper. | 459,608 |
def write_pxd(self, write): r""" Generate the pxd file for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the pxd file. | def write_pxd(self, write): r""" Generate the pxd file for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the pxd file. | 459,609 |
def write_pxd(self, write): r""" Generate the pxd file for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the pxd file. | def write_pxd(self, write): r""" Generate the pxd file for the Cython wrapper. This function calls its write parameter successively with strings; when these strings are concatenated, the result is the code for the pxd file. | 459,610 |
def get_interpreter(self): r""" Returns the code for the C interpreter. | def get_interpreter(self): r""" Returns the code for the C interpreter. | 459,611 |
def get_wrapper(self): r""" Returns the code for the Cython wrapper. | def get_wrapper(self): r""" Returns the code for the Cython wrapper. | 459,612 |
def get_pxd(self): r""" Returns the code for the Cython .pxd file. | def get_pxd(self): r""" Returns the code for the Cython .pxd file. | 459,613 |
def get_pxd(self): r""" Returns the code for the Cython .pxd file. | def get_pxd(self): r""" Returns the code for the Cython .pxd file. | 459,614 |
def build_interp(interp_spec, dir): r""" Given an InterpreterSpec, writes the C interpreter and the Cython wrapper (generates a pyx and a pxd file). EXAMPLES: sage: from sage.ext.gen_interpreters import * sage: testdir = tmp_filename() sage: os.mkdir(testdir) sage: rdf_interp = RDFInterpreter() sage: build_interp(rdf_... | def build_interp(interp_spec, dir): r""" Given an InterpreterSpec, writes the C interpreter and the Cython wrapper (generates a pyx and a pxd file). EXAMPLES: sage: from sage.ext.gen_interpreters import * sage: testdir = tmp_filename() sage: os.mkdir(testdir) sage: rdf_interp = RDFInterpreter() sage: build_interp(rdf_... | 459,615 |
def rebuild(dir): r""" Check whether the interpreter and wrapper sources have been written since the last time this module was changed. If not, write them. EXAMPLES: sage: from sage.ext.gen_interpreters import * sage: testdir = tmp_filename() sage: os.mkdir(testdir) sage: rebuild(testdir) Building interpreters for fa... | def rebuild(dir): r""" Check whether the interpreter and wrapper sources have been written since the last time this module was changed. If not, write them. EXAMPLES: sage: from sage.ext.gen_interpreters import * sage: testdir = tmp_filename() sage: os.mkdir(testdir) sage: rebuild(testdir) Building interpreters for fa... | 459,616 |
... def variance(self, bias = False): | ... def variance(self, bias = False): | 459,617 |
def __call__(self, x, check=True): """ Convert ``x`` to an element of this multivariate polynomial ring, possibly non-canonically. EXAMPLES: | def __call__(self, x, check=True): """ Convert ``x`` to an element of this multivariate polynomial ring, possibly non-canonically. EXAMPLES: | 459,618 |
def __init__(self, base_ring, name="x", sparse=False, element_class=None, implementation=None): """ TESTS: sage: from sage.rings.polynomial.polynomial_ring import PolynomialRing_field as PRing sage: R = PRing(QQ, 'x'); R Univariate Polynomial Ring in x over Rational Field sage: type(R.gen()) <class 'sage.rings.polynomi... | def __init__(self, base_ring, name="x", sparse=False, element_class=None, implementation=None): """ TESTS: sage: from sage.rings.polynomial.polynomial_ring import PolynomialRing_field as PRing sage: R = PRing(QQ, 'x'); R Univariate Polynomial Ring in x over Rational Field sage: type(R.gen()) <class 'sage.rings.polynomi... | 459,619 |
def _call_element_(self, _the_element, *args, **kwds): """ Calling a callable symbolic expression returns a symbolic expression with the appropriate arguments substituted. EXAMPLES:: sage: var('a, x, y, z') (a, x, y, z) sage: f(x,y) = a + 2*x + 3*y + z sage: f (x, y) |--> a + 2*x + 3*y + z sage: f(1,2) a + z + 8 sage... | def _call_element_(self, _the_element, *args, **kwds): """ Calling a callable symbolic expression returns a symbolic expression with the appropriate arguments substituted. EXAMPLES:: sage: var('a, x, y, z') (a, x, y, z) sage: f(x,y) = a + 2*x + 3*y + z sage: f (x, y) |--> a + 2*x + 3*y + z sage: f(1,2) a + z + 8 sage... | 459,620 |
def show(self, **kwds): """ Show this graphics image with the default image viewer. | def show(self, **kwds): """ Show this graphics image with the default image viewer. | 459,621 |
def get_fake_div(self, ex): """ EXAMPLES:: | def get_fake_div(self, ex): """ EXAMPLES:: | 459,622 |
def get_fake_div(self, ex): """ EXAMPLES:: | def get_fake_div(self, ex): """ EXAMPLES:: | 459,623 |
def arithmetic(self, ex, operator): r""" EXAMPLES:: | def arithmetic(self, ex, operator): r""" EXAMPLES:: | 459,624 |
def _latex_(self): """ Return Latex representation of this Maxima object. This calls the tex command in Maxima, then does a little post-processing to fix bugs in the resulting Maxima output. EXAMPLES:: sage: maxima('sqrt(2) + 1/3 + asin(5)')._latex_() '\\sin^{-1}\\cdot5+\\sqrt{2}+{{1}\\over{3}}' | def _latex_(self): """ Return Latex representation of this Maxima object. This calls the tex command in Maxima, then does a little post-processing to fix bugs in the resulting Maxima output. EXAMPLES:: sage: maxima('sqrt(2) + 1/3 + asin(5)')._latex_() '\\sin^{-1}\\cdot5+\\sqrt{2}+{{1}\\over{3}}' | 459,625 |
def _allowed_options(self): """ Return the allowed options for the Point class. | def _allowed_options(self): """ Return the allowed options for the Point class. | 459,626 |
def _allowed_options(self): """ Return the allowed options for the Point class. | def _allowed_options(self): """ Return the allowed options for the Point class. | 459,627 |
def point(points, **kwds): """ Returns either a 2-dimensional or 3-dimensional point or sum of points. INPUT: - ``points`` - either a single point (as a tuple) or a list of points. For information regarding additional arguments, see either point2d? or point3d?. EXAMPLES:: sage: point((1,2)) sage: point((1,2,3)) s... | def point(points, **kwds): """ Returns either a 2-dimensional or 3-dimensional point or sum of points. INPUT: - ``points`` - either a single point (as a tuple) or a list of points. For information regarding additional arguments, see either point2d? or point3d?. EXAMPLES:: sage: point((1,2)) sage: point((1,2,3)) s... | 459,628 |
def is_divisible_by(self, m): """ Return True if there exists a point `Q` defined over the same field as self such that `mQ` == self. | def is_divisible_by(self, m): """ Return True if there exists a point `Q` defined over the same field as self such that `mQ` == self. | 459,629 |
def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 459,630 |
def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 459,631 |
def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 459,632 |
def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | def RealProjectiveSpace(self, n): r""" A triangulation of `\Bold{R}P^n` for any `n \geq 0`. | 459,633 |
def height(self): r""" Returns the height of self. | def height(self): r""" Returns the height of self. | 459,634 |
def width(self): r""" Returns the width of self. | def width(self): r""" Returns the width of self. | 459,635 |
def tikz_trajectory(self): r""" Returns the trajectory of self as a tikz str. | def tikz_trajectory(self): r""" Returns the trajectory of self as a tikz str. | 459,636 |
def tikz_trajectory(self): r""" Returns the trajectory of self as a tikz str. | def tikz_trajectory(self): r""" Returns the trajectory of self as a tikz str. | 459,637 |
def ModularForms(group = 1, weight = 2, base_ring = None, use_cache = True, prec = defaults.DEFAULT_PRECISION): r""" Create an ambient space of modular forms. INPUT: - ``group`` - A congruence subgroup or a Dirichlet character eps. - ``weight`` - int, the weight, which must be an integer = 1. - ``base_ring`` -... | def ModularForms(group = 1, weight = 2, base_ring = None, use_cache = True, prec = defaults.DEFAULT_PRECISION): r""" Create an ambient space of modular forms. INPUT: - ``group`` - A congruence subgroup or a Dirichlet character eps. - ``weight`` - int, the weight, which must be an integer = 1. - ``base_ring`` -... | 459,638 |
def integral(self, x=None, a=None, b=None, definite=False): r""" By default, returns the indefinite integral of the function. If definite=True is given, returns the definite integral. | def integral(self, x=None, a=None, b=None, definite=False): r""" By default, returns the indefinite integral of the function. If definite=True is given, returns the definite integral. | 459,639 |
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... | 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``... | 459,640 |
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... | 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... | 459,641 |
def hasse_diagram(self): """ Returns the Hasse_diagram of the poset as a Sage DiGraph object. EXAMPLES:: sage: Q = Poset({5:[2,3], 1:[3,4], 2:[0], 3:[0], 4:[0]}) sage: Q.hasse_diagram() Digraph on 6 vertices | def hasse_diagram(self): """ Returns the Hasse_diagram of the poset as a Sage DiGraph object. EXAMPLES:: sage: Q = Poset({5:[2,3], 1:[3,4], 2:[0], 3:[0], 4:[0]}) sage: Q.hasse_diagram() Digraph on 6 vertices | 459,642 |
def is_divisible_by(self, m): """ Return True if there exists a point `Q` defined over the same field as self such that `mQ` == self. | def is_divisible_by(self, m): """ Return True if there exists a point `Q` defined over the same field as self such that `mQ` == self. | 459,643 |
def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 459,644 |
def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 459,645 |
def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 459,646 |
def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.unit... | def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.unit... | 459,647 |
def __init__(self, data, name=''): """ EXAMPLES:: | def __init__(self, data, name=''): """ EXAMPLES:: | 459,648 |
def __getattr__(self, name): """ Return the unit with the given name. | def __getattr__(self, name): """ Return the unit with the given name. | 459,649 |
def __repr__(self): """ Return string representation of this collection of units. | def __repr__(self): """ Return string representation of this collection of units. | 459,650 |
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'... | 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'... | 459,651 |
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'... | def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``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 ... | 459,652 |
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'... | 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 = "Stop counting my characters!" sage: T = sorted(frequency_table(str).items()) sage: for symbol, co... | 459,653 |
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'... | 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'... | 459,654 |
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'... | 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'... | 459,655 |
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'... | 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'... | 459,656 |
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'... | 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'... | 459,657 |
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'... | 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'... | 459,658 |
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'... | 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'... | 459,659 |
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'... | 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'... | 459,660 |
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'... | 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'... | 459,661 |
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | 459,662 |
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | 459,663 |
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | 459,664 |
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman | 459,665 |
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | 459,666 |
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | 459,667 |
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix | 459,668 |
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. | 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. | 459,669 |
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. | def_build_code(self,dic):r"""ReturnsaHuffmancodeforeachoneofthegivenelements.INPUT:-``dic``(dictionary)--associatestoeachletterofthealphabetafrequencyoranumberofoccurrences. | 459,670 |
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. | 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. | 459,671 |
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. | 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. | 459,672 |
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. | 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. | 459,673 |
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table | def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table | 459,674 |
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table | defencode(self,string):r"""Returnsanencodingofthegivenstringbasedonthecurrentencodingtable | 459,675 |
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table | def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table | 459,676 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,677 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,678 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,679 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,680 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,681 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,682 |
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table. | 459,683 |
def encoding_table(self): r""" Returns the current encoding table | def encoding_table(self): r""" Returns the current encoding table | 459,684 |
def encoding_table(self): r""" Returns the current encoding table | def encoding_table(self): r""" Returns the current encoding table | 459,685 |
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | 459,686 |
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | 459,687 |
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | def tree(self): r""" Returns the Huffman tree corresponding to the current encoding | 459,688 |
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 []) | 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... | 459,689 |
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 []) | def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = parent s = "".join([parent, bit]) 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 []) | 459,690 |
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 []) | 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 []) | 459,691 |
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 []) | 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 []) | 459,692 |
def KolakoskiWord(self, alphabet=(1,2)): r""" Returns the Kolakoski word over the given alphabet and starting with the first letter of the alphabet. | def KolakoskiWord(self, alphabet=(1,2)): r""" Returns the Kolakoski word over the given alphabet and starting with the first letter of the alphabet. | 459,693 |
def KolakoskiWord(self, alphabet=(1,2)): r""" Returns the Kolakoski word over the given alphabet and starting with the first letter of the alphabet. | def KolakoskiWord(self, alphabet=(1,2)): r""" Returns the Kolakoski word over the given alphabet and starting with the first letter of the alphabet. | 459,694 |
def is_prime(n, flag=0): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify pri... | def is_prime(n): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify primality u... | 459,695 |
def is_prime(n, flag=0): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify pri... | def is_prime(n, flag=0): r""" Returns ``True`` if `n` is prime, and ``False`` otherwise. AUTHORS: - Kevin Stueve kstueve@uw.edu (2010-01-17): delegated calculation to ``n.is_prime()`` INPUT: - ``n`` - the object for which to determine primality OUTPUT: - ``bool`` - True or False .. note:: We do not consid... | 459,696 |
def is_prime(n, flag=0): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify pri... | def is_prime(n, flag=0): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify pri... | 459,697 |
def is_prime(n, flag=0): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify pri... | def is_prime(n, flag=0): r""" Returns True if `x` is prime, and False otherwise. The result is proven correct - *this is NOT a pseudo-primality test!*. INPUT: - ``flag`` - int - ``0`` (default) - use a combination of algorithms. - ``1`` - certify primality using the Pocklington-Lehmer Test. - ``2`` - certify pri... | 459,698 |
def _call_(self, x): r""" TEST:: | def _call_(self, x): r""" TEST:: | 459,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.