code stringlengths 17 6.64M |
|---|
def _nega_combine(L, m, k):
"\n Same as ``_combine()``, but doesn't ignore the second\n half of the last list; instead it makes that piece wrap around\n negacyclically.\n "
M = (1 << m)
half_K = (1 << (k - 1))
return ([(L[0][j] - L[(M - 1)][(j + half_K)]) for j in range(half_K)] + [(L[(i +... |
def _negaconvolution(L1, L2, n):
'\n Negacyclic convolution of L1 and L2.\n\n L1 and L2 must both have length `2^n`.\n '
if (n <= 3):
return _negaconvolution_naive(L1, L2)
return _negaconvolution_fft(L1, L2, n)
|
def _negaconvolution_fft(L1, L2, n):
'\n Return negacyclic convolution of lists L1 and L2, using FFT algorithm.\n\n L1 and L2 must both have length `2^n`, where `n \\geq 3`.\n Assumes all entries of L1 and L2 belong to the same ring.\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.convoluti... |
def _convolution_fft(L1, L2):
'\n Return convolution of non-empty lists L1 and L2, using FFT algorithm.\n\n L1 and L2 may have arbitrary lengths `\\geq 4`.\n Assumes all entries of L1 and L2 belong to the same ring.\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.convolution import _convolu... |
class FlatteningMorphism(Morphism):
"\n EXAMPLES::\n\n sage: R = QQ['a','b']['x','y','z']['t1','t2']\n sage: from sage.rings.polynomial.flatten import FlatteningMorphism\n sage: f = FlatteningMorphism(R)\n sage: f.codomain()\n Multivariate Polynomial Ring in a, b, x, y, z, t1... |
class UnflatteningMorphism(Morphism):
"\n Inverses for :class:`FlatteningMorphism`\n\n EXAMPLES::\n\n sage: R = QQ['c','x','y','z']\n sage: S = QQ['c']['x','y','z']\n sage: from sage.rings.polynomial.flatten import UnflatteningMorphism\n sage: f = UnflatteningMorphism(R, S)\n ... |
class SpecializationMorphism(Morphism):
'\n Morphisms to specialize parameters in (stacked) polynomial rings\n\n EXAMPLES::\n\n sage: R.<c> = PolynomialRing(QQ)\n sage: S.<x,y,z> = PolynomialRing(R)\n sage: D = dict({c:1})\n sage: from sage.rings.polynomial.flatten import Special... |
class FractionSpecializationMorphism(Morphism):
'\n A specialization morphism for fraction fields over (stacked) polynomial rings\n '
def __init__(self, domain, D):
'\n Initialize the morphism with a domain and dictionary of specializations\n\n EXAMPLES::\n\n sage: R.<a... |
def prefix_check(str_list):
"\n Check if any strings in a list are prefixes of another string in\n the list.\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.groebner_fan import prefix_check\n sage: prefix_check(['z1','z1z1'])\n False\n sage: prefix_check(['z1','zz1'])\n ... |
def max_degree(list_of_polys):
'\n Compute the maximum degree of a list of polynomials\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.groebner_fan import max_degree\n sage: R.<x,y> = PolynomialRing(QQ,2)\n sage: p_list = [x^2-y,x*y^10-x]\n sage: max_degree(p_list)\n 1... |
def _cone_parse(fan_dict_cone):
"\n Utility function that parses cone information into a dict indexed by\n dimension.\n\n INPUT:\n\n - ``fan_dict_cone`` - the value of a fan_dict with\n key 'CONES'\n\n EXAMPLES::\n\n sage: R.<x,y,z,w> = PolynomialRing(QQ,4)\n sage: I = R.ideal(... |
class PolyhedralCone(SageObject):
def __init__(self, gfan_polyhedral_cone, ring=QQ):
'\n Convert polymake/gfan data on a polyhedral cone into a sage class.\n\n Currently (18-03-2008) needs a lot of work.\n\n EXAMPLES::\n\n sage: R3.<x,y,z> = PolynomialRing(QQ,3)\n ... |
class PolyhedralFan(SageObject):
def __init__(self, gfan_polyhedral_fan, parameter_indices=None):
'\n Convert polymake/gfan data on a polyhedral fan into a sage class.\n\n INPUT:\n\n - ``gfan_polyhedral_fan`` - output from gfan of a\n polyhedral fan.\n\n EXAMPLES::\... |
class InitialForm(SageObject):
def __init__(self, cone, rays, initial_forms):
'\n A system of initial forms from a polynomial system.\n\n To each form is associated a cone and a list of\n polynomials (the initial form system itself).\n\n This class is intended for internal use... |
def verts_for_normal(normal, poly):
'\n Return the exponents of the vertices of a Newton polytope\n that make up the supporting hyperplane for the given outward\n normal.\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.groebner_fan import verts_for_normal\n sage: R.<x,y,z> = Polynomi... |
class TropicalPrevariety(PolyhedralFan):
def __init__(self, gfan_polyhedral_fan, polynomial_system, poly_ring, parameters=None):
'\n This class is a subclass of the PolyhedralFan class,\n with some additional methods for tropical prevarieties.\n\n INPUT:\n\n - ``gfan_polyhedra... |
def ring_to_gfan_format(input_ring):
"\n Converts a ring to gfan's format.\n\n EXAMPLES::\n\n sage: R.<w,x,y,z> = QQ[]\n sage: from sage.rings.polynomial.groebner_fan import ring_to_gfan_format\n sage: ring_to_gfan_format(R)\n 'Q[w, x, y, z]'\n sage: R2.<x,y> = GF(2)[]\n ... |
def ideal_to_gfan_format(input_ring, polys):
'\n Return the ideal in gfan\'s notation.\n\n EXAMPLES::\n\n sage: R.<x,y,z> = PolynomialRing(QQ,3)\n sage: polys = [x^2*y - z, y^2*z - x, z^2*x - y]\n sage: from sage.rings.polynomial.groebner_fan import ideal_to_gfan_format\... |
class GroebnerFan(SageObject):
def __init__(self, I, is_groebner_basis=False, symmetry=None, verbose=False):
"\n This class is used to access capabilities of the program ``Gfan``.\n\n In addition to computing Groebner fans, ``Gfan`` can compute\n other things in tropical geometry suc... |
class ReducedGroebnerBasis(SageObject, list):
def __init__(self, groebner_fan, gens, gfan_gens):
'\n A class for representing reduced Groebner bases as produced by\n ``gfan``.\n\n INPUT:\n\n - ``groebner_fan`` - a GroebnerFan object from an\n ideal\n\n - ``g... |
class Ideal_1poly_field(Ideal_pid):
'\n An ideal in a univariate polynomial ring over a field.\n '
def residue_class_degree(self):
'\n Return the degree of the generator of this ideal.\n\n This function is included for compatibility with ideals in rings of integers of number field... |
class InfinitePolynomial(CommutativePolynomial, metaclass=InheritComparisonClasscallMetaclass):
"\n Create an element of a Polynomial Ring with a Countably Infinite Number of Variables.\n\n Usually, an InfinitePolynomial is obtained by using the generators\n of an Infinite Polynomial Ring (see :mod:`~sag... |
class InfinitePolynomial_sparse(InfinitePolynomial):
"\n Element of a sparse Polynomial Ring with a Countably Infinite Number of Variables.\n\n INPUT:\n\n - ``A`` -- an Infinite Polynomial Ring in sparse implementation\n - ``p`` -- a *classical* polynomial that can be interpreted in ``A``.\n\n Of c... |
class InfinitePolynomial_dense(InfinitePolynomial):
'\n Element of a dense Polynomial Ring with a Countably Infinite Number of Variables.\n\n INPUT:\n\n - ``A`` -- an Infinite Polynomial Ring in dense implementation\n - ``p`` -- a *classical* polynomial that can be interpreted in ``A``.\n\n Of cour... |
class InfinitePolynomialRingFactory(UniqueFactory):
'\n A factory for creating infinite polynomial ring elements. It\n handles making sure that they are unique as well as handling\n pickling. For more details, see\n :class:`~sage.structure.factory.UniqueFactory` and\n :mod:`~sage.rings.polynomial... |
class InfiniteGenDict():
"\n A dictionary-like class that is suitable for usage in ``sage_eval``.\n\n The generators of an Infinite Polynomial Ring are not\n variables. Variables of an Infinite Polynomial Ring are returned\n by indexing a generator. The purpose of this class is to return a\n variab... |
class GenDictWithBasering():
"\n A dictionary-like class that is suitable for usage in ``sage_eval``.\n\n This pseudo-dictionary accepts strings as index, and then walks down\n a chain of base rings of (infinite) polynomial rings until it finds\n one ring that has the given string as variable name, wh... |
class InfinitePolynomialRing_sparse(CommutativeRing):
"\n Sparse implementation of Infinite Polynomial Rings.\n\n An Infinite Polynomial Ring with generators `x_\\ast, y_\\ast,\n ...` over a field `F` is a free commutative `F`-algebra generated\n by `x_0, x_1, x_2, ..., y_0, y_1, y_2, ..., ...` and is... |
class InfinitePolynomialGen(SageObject):
'\n This class provides the object which is responsible for returning\n variables in an infinite polynomial ring (implemented in\n :meth:`.__getitem__`).\n\n EXAMPLES::\n\n sage: X.<x1,x2> = InfinitePolynomialRing(RR)\n sage: x1\n x1_*\n ... |
class InfinitePolynomialRing_dense(InfinitePolynomialRing_sparse):
'\n Dense implementation of Infinite Polynomial Rings\n\n Compared with :class:`~sage.rings.polynomial.infinite_polynomial_ring.InfinitePolynomialRing_sparse`,\n from which this class inherits, it keeps a polynomial ring that comprises al... |
class IntegerValuedPolynomialRing(UniqueRepresentation, Parent):
'\n The integer-valued polynomial ring over a base ring `R`.\n\n Integer-valued polynomial rings are commutative and associative\n algebras, with a basis indexed by non-negative integers.\n\n There are two natural bases, made of the sequ... |
class LaurentPolynomialIdeal(Ideal_generic):
def __init__(self, ring, gens, coerce=True, hint=None):
"\n Create an ideal in a Laurent polynomial ring.\n\n To compute structural properties of an ideal in the Laurent polynomial ring\n `R[x_1^{\\pm},\\ldots,x_n^{\\pm}]`, we form the cor... |
def is_LaurentPolynomialRing(R):
"\n Return ``True`` if and only if R is a Laurent polynomial ring.\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.laurent_polynomial_ring import is_LaurentPolynomialRing\n sage: P = PolynomialRing(QQ, 2, 'x')\n sage: is_LaurentPolynomialRing(P)\n ... |
def LaurentPolynomialRing(base_ring, *args, **kwds):
"\n Return the globally unique univariate or multivariate Laurent polynomial\n ring with given properties and variable name or names.\n\n There are four ways to call the Laurent polynomial ring constructor:\n\n 1. ``LaurentPolynomialRing(base_ring, ... |
def _split_dict_(D, indices, group_by=None):
"\n Split the dictionary ``D`` by ``indices`` and ``group_by``.\n\n INPUT:\n\n - ``D`` -- a dictionary.\n\n - ``indices`` -- a tuple or list of nonnegative integers.\n\n - ``group_by`` -- a tuple or list of nonnegative integers.\n If this is ``None`... |
def _split_laurent_polynomial_dict_(P, M, d):
"\n Helper function for splitting a multivariate Laurent polynomial\n during conversion.\n\n INPUT:\n\n - ``P`` -- the parent to which we want to convert.\n\n - ``M`` -- the parent from which we want to convert.\n\n - ``d`` -- a dictionary mapping tu... |
def from_fraction_field(L, x):
"\n Helper function to construct a Laurent polynomial from an element of its\n parent's fraction field.\n\n INPUT:\n\n - ``L`` -- an instance of :class:`LaurentPolynomialRing_generic`\n - ``x`` -- an element of the fraction field of ``L``\n\n OUTPUT:\n\n An inst... |
class LaurentPolynomialRing_univariate(LaurentPolynomialRing_generic):
def __init__(self, R):
"\n EXAMPLES::\n\n sage: L = LaurentPolynomialRing(QQ,'x')\n sage: type(L)\n <class 'sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_univariate_with_ca... |
class LaurentPolynomialRing_mpair(LaurentPolynomialRing_generic):
def __init__(self, R):
"\n EXAMPLES::\n\n sage: L = LaurentPolynomialRing(QQ,2,'x') # needs sage.modules\n sage: type(L) ... |
class LaurentPolynomialRing_generic(CommutativeRing, Parent):
'\n Laurent polynomial ring (base class).\n\n EXAMPLES:\n\n This base class inherits from :class:`~sage.rings.ring.CommutativeRing`.\n Since :trac:`11900`, it is also initialised as such::\n\n sage: R.<x1,x2> = LaurentPolynomialRing(... |
def _run_msolve(ideal, options):
'\n Internal utility function\n '
base = ideal.base_ring()
if (not ((base is QQ) or (isinstance(base, FiniteField) and base.is_prime_field() and (base.characteristic() < (2 ** 31))))):
raise NotImplementedError(f'unsupported base field: {base}')
drlpolrin... |
def groebner_basis_degrevlex(ideal, proof=True):
"\n Compute a degrevlex Gröbner basis using msolve\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.msolve import groebner_basis_degrevlex\n\n sage: R.<a,b,c> = PolynomialRing(GF(101), 3, order='lex')\n sage: I = sage.rings.ideal.Katsu... |
def variety(ideal, ring, *, proof=True):
'\n Compute the variety of a zero-dimensional ideal using msolve.\n\n Part of the initial implementation was loosely based on the example\n interfaces available as part of msolve, with the authors\' permission.\n\n EXAMPLES::\n\n sage: from sage.rings.po... |
class MPolynomial_element(MPolynomial):
'\n Generic multivariate polynomial.\n\n This implementation is based on the :class:`~sage.rings.polynomial.polydict.PolyDict`.\n\n .. TODO::\n\n As mentioned in their docstring,\n :class:`~sage.rings.polynomial.polydict.PolyDict` objects never clear\... |
class MPolynomial_polydict(Polynomial_singular_repr, MPolynomial_element):
'\n Multivariate polynomials implemented in pure python using\n polydicts.\n '
def __init__(self, parent, x):
"\n EXAMPLES::\n\n sage: R, x = PolynomialRing(QQbar, 10, 'x').objgens() ... |
def degree_lowest_rational_function(r, x):
'\n Return the difference of valuations of ``r`` with respect to variable ``x``.\n\n INPUT:\n\n - ``r`` -- a multivariate rational function\n\n - ``x`` -- a multivariate polynomial ring generator\n\n OUTPUT: integer -- the difference `val_x(p) - val_x(q)` ... |
class RequireField(MethodDecorator):
'\n Decorator which throws an exception if a computation over a\n coefficient ring which is not a field is attempted.\n\n .. NOTE::\n\n This decorator is used automatically internally so the user\n does not need to use it manually.\n '
def __call... |
def is_MPolynomialIdeal(x) -> bool:
"\n Return ``True`` if the provided argument ``x`` is an ideal in a\n multivariate polynomial ring.\n\n INPUT:\n\n - ``x`` - an arbitrary object\n\n EXAMPLES::\n\n sage: from sage.rings.polynomial.multi_polynomial_ideal import is_MPolynomialIdeal\n ... |
class MPolynomialIdeal_magma_repr():
def _magma_init_(self, magma):
'\n Return a Magma ideal matching this ideal if the base ring\n coerces to Magma and Magma is available.\n\n INPUT:\n\n - ``magma`` - Magma instance\n\n EXAMPLES::\n\n sage: # optional - mag... |
class MPolynomialIdeal_singular_base_repr():
@require_field
def syzygy_module(self):
"\n Computes the first syzygy (i.e., the module of relations of the\n given generators) of the ideal.\n\n EXAMPLES::\n\n sage: R.<x,y> = PolynomialRing(QQ)\n sage: f = 2*x^2... |
class MPolynomialIdeal_singular_repr(MPolynomialIdeal_singular_base_repr):
'\n An ideal in a multivariate polynomial ring, which has an\n underlying Singular ring associated to it.\n '
def _singular_(self, singular=singular_default):
'\n Return Singular ideal corresponding to this ide... |
class MPolynomialIdeal_macaulay2_repr():
'\n An ideal in a multivariate polynomial ring, which has an underlying\n Macaulay2 ring associated to it.\n\n EXAMPLES::\n\n sage: R.<x,y,z,w> = PolynomialRing(ZZ, 4)\n sage: I = ideal(x*y-z^2, y^2-w^2)\n sage: I\n Ideal (x*y - z^2, y^... |
class NCPolynomialIdeal(MPolynomialIdeal_singular_repr, Ideal_nc):
def __init__(self, ring, gens, coerce=True, side='left'):
'\n Creates a non-commutative polynomial ideal.\n\n INPUT:\n\n - ``ring`` - the g-algebra to which this ideal belongs\n - ``gens`` - the generators of t... |
@richcmp_method
class MPolynomialIdeal(MPolynomialIdeal_singular_repr, MPolynomialIdeal_macaulay2_repr, MPolynomialIdeal_magma_repr, Ideal_generic):
def __init__(self, ring, gens, coerce=True):
"\n Create an ideal in a multivariate polynomial ring.\n\n INPUT:\n\n - ``ring`` - the rin... |
class MPolynomialIdeal_quotient(MPolynomialIdeal):
"\n An ideal in a quotient of a multivariate polynomial ring.\n\n EXAMPLES::\n\n sage: Q.<x,y,z,w> = QQ['x,y,z,w'].quotient(['x*y-z^2', 'y^2-w^2'])\n sage: I = ideal(x + y^2 + z - 1)\n sage: I\n Ideal (w^2 + x + z - 1) of Quotien... |
class MPolynomialRing_macaulay2_repr():
'\n A mixin class for polynomial rings that support conversion to Macaulay2.\n '
def _macaulay2_init_(self, macaulay2=None):
"\n EXAMPLES::\n\n sage: PolynomialRing(QQ, 'x', 2, implementation='generic')._macaulay2_init_() # optional - ... |
class MPolynomialRing_polydict(MPolynomialRing_macaulay2_repr, PolynomialRing_singular_repr, MPolynomialRing_base):
"\n Multivariable polynomial ring.\n\n EXAMPLES::\n\n sage: R = PolynomialRing(Integers(12), 'x', 5); R\n Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Ring of integers... |
class MPolynomialRing_polydict_domain(IntegralDomain, MPolynomialRing_polydict):
def __init__(self, base_ring, n, names, order):
order = TermOrder(order, n)
MPolynomialRing_polydict.__init__(self, base_ring, n, names, order)
def is_integral_domain(self, proof=True):
return True
... |
def is_PolynomialSequence(F):
'\n Return ``True`` if ``F`` is a ``PolynomialSequence``.\n\n INPUT:\n\n - ``F`` - anything\n\n EXAMPLES::\n\n sage: P.<x,y> = PolynomialRing(QQ)\n sage: I = [[x^2 + y^2], [x^2 - y^2]]\n sage: F = Sequence(I, P); F\n [x^2 + y^2, x^2 - y^2]\n\n ... |
def PolynomialSequence(arg1, arg2=None, immutable=False, cr=False, cr_str=None):
"\n Construct a new polynomial sequence object.\n\n INPUT:\n\n - ``arg1`` - a multivariate polynomial ring, an ideal or a matrix\n\n - ``arg2`` - an iterable object of parts or polynomials\n (default:``None``)\n\n ... |
class PolynomialSequence_generic(Sequence_generic):
def __init__(self, parts, ring, immutable=False, cr=False, cr_str=None):
"\n Construct a new system of multivariate polynomials.\n\n INPUT:\n\n - ``part`` - a list of lists with polynomials\n\n - ``ring`` - a multivariate po... |
class PolynomialSequence_gf2(PolynomialSequence_generic):
'\n Polynomial Sequences over `\\GF{2}`.\n '
def eliminate_linear_variables(self, maxlength=Infinity, skip=None, return_reductors=False, use_polybori=False):
'\n Return a new system where linear leading variables are\n elim... |
class PolynomialSequence_gf2e(PolynomialSequence_generic):
'\n PolynomialSequence over `\\GF{2^e}`, i.e extensions over\n `\\GF(2)`.\n '
def weil_restriction(self):
'\n Project this polynomial system to `\\GF{2}`.\n\n That is, compute the Weil restriction of scalars for the\n ... |
def MacMahonOmega(var, expression, denominator=None, op=operator.ge, Factorization_sort=False, Factorization_simplify=True):
'\n Return `\\Omega_{\\mathrm{op}}` of ``expression`` with respect to ``var``.\n\n To be more precise, calculate\n\n .. MATH::\n\n \\Omega_{\\mathrm{op}} \\frac{n}{d_1 \\dot... |
def _simplify_(numerator, terms):
'\n Cancels common factors of numerator and denominator.\n\n INPUT:\n\n - ``numerator`` -- a Laurent polynomial\n\n - ``terms`` -- a tuple or other iterable of Laurent polynomials\n\n The denominator is the product of factors `1 - t` for each\n `t` in ``term... |
def _Omega_(A, decoded_factors):
'\n Helper function for :func:`MacMahonOmega` which accesses the low level functions\n and does the substituting.\n\n INPUT:\n\n - ``A`` -- a dictionary mapping `a` to `c` representing a summand\n `c\\mu^a` of the numerator\n\n - ``decoded_factors`` -- a tuple ... |
@cached_function
def Omega_ge(a, exponents):
'\n Return `\\Omega_{\\ge}` of the expression specified by the input.\n\n To be more precise, calculate\n\n .. MATH::\n\n \\Omega_{\\ge} \\frac{\\mu^a}{\n (1 - z_0 \\mu^{e_0}) \\dots (1 - z_{n-1} \\mu^{e_{n-1}})}\n\n and return its numerator a... |
def _Omega_numerator_(a, x, y, t):
'\n Return the numerator of `\\Omega_{\\ge}` of the expression\n specified by the input.\n\n To be more precise, calculate\n\n .. MATH::\n\n \\Omega_{\\ge} \\frac{\\mu^a}{\n (1 - x_1 \\mu) \\dots (1 - x_n \\mu)\n (1 - y_1 / \\mu) \\dots (1 - y_m ... |
def _Omega_numerator_P_(a, x, y, t):
'\n Helper function for :func:`_Omega_numerator_`.\n\n This is an implementation of the function `P` of [APR2001]_.\n\n INPUT:\n\n - ``a`` -- an integer\n\n - ``x`` and ``y`` -- a tuple of Laurent polynomials\n\n The tuple ``x`` here is the flattened ``x`` ... |
@cached_function
def _Omega_factors_denominator_(x, y):
'\n Return the denominator of `\\Omega_{\\ge}` of the expression\n specified by the input.\n\n To be more precise, calculate\n\n .. MATH::\n\n \\Omega_{\\ge} \\frac{1}{\n (1 - x_1 \\mu) \\dots (1 - x_n \\mu)\n (1 - y_1 / \\mu... |
def partition(items, predicate=bool):
'\n Split ``items`` into two parts by the given ``predicate``.\n\n INPUT:\n\n - ``item`` -- an iterator\n\n - ``predicate`` -- a function\n\n OUTPUT:\n\n A pair of iterators; the first contains the elements not satisfying\n the ``predicate``, the second t... |
def homogeneous_symmetric_function(j, x):
"\n Return a complete homogeneous symmetric polynomial\n (:wikipedia:`Complete_homogeneous_symmetric_polynomial`).\n\n INPUT:\n\n - ``j`` -- the degree as a nonnegative integer\n\n - ``x`` -- an iterable of variables\n\n OUTPUT:\n\n A polynomial of th... |
class OreFunction(AlgebraElement):
'\n An element in a Ore function field.\n '
def __init__(self, parent, numerator, denominator=None, simplify=True):
"\n Initialize this element.\n\n TESTS::\n\n sage: R.<t> = GF(5)[]\n sage: der = R.derivation()\n ... |
class ConstantOreFunctionSection(Map):
"\n Representation of the canonical homomorphism from the constants of a Ore\n function field to the base field.\n\n This class is needed by the coercion system.\n\n EXAMPLES::\n\n sage: # needs sage.rings.finite_rings\n sage: from sage.rings.polyno... |
class OreFunctionBaseringInjection(Morphism):
'\n Representation of the canonical homomorphism from a field `k` into a Ore\n function field over `k`.\n\n This class is needed by the coercion system.\n '
def __init__(self, domain, codomain):
"\n Initialize this morphism.\n\n ... |
class OreFunction_with_large_center(OreFunction):
"\n A special class for elements of Ore function fields whose\n center has finite index.\n\n TESTS::\n\n sage: # needs sage.rings.finite_rings\n sage: k.<a> = GF(5^3)\n sage: Frob = k.frobenius_endomorphism()\n sage: S.<x> = k[... |
class OreFunctionField(Algebra, UniqueRepresentation):
'\n A class for fraction fields of Ore polynomial rings.\n '
Element = None
def __init__(self, ring, category=None):
"\n Initialize this Ore function field.\n\n TESTS::\n\n sage: # needs sage.rings.finite_rings\... |
class SectionOreFunctionCenterInjection(Section):
'\n Section of the canonical injection of the center of a Ore\n function field into this field\n '
def __init__(self, embed):
"\n Initialize this map.\n\n TESTS::\n\n sage: # needs sage.rings.finite_rings\n ... |
class OreFunctionCenterInjection(RingHomomorphism):
'\n Canonical injection of the center of a Ore function field\n into this field.\n '
def __init__(self, domain, codomain, ringembed):
"\n Initialize this morphism.\n\n TESTS::\n\n sage: # needs sage.rings.finite_rin... |
class OreFunctionField_with_large_center(OreFunctionField):
'\n A specialized class for Ore polynomial fields whose center has finite index.\n '
def __init__(self, ring, category=None):
"\n Initialize this Ore function field.\n\n TESTS::\n\n sage: # needs sage.rings.fin... |
class OrePolynomialRing(UniqueRepresentation, Algebra):
"\n Construct and return the globally unique Ore polynomial ring with the\n given properties and variable names.\n\n Given a ring `R` and a ring automorphism `\\sigma` of `R` and a\n `\\sigma`-derivation `\\partial`, the ring of Ore polynomials\n... |
class Polynomial_padic(Polynomial):
def __init__(self, parent, x=None, check=True, is_gen=False, construct=False):
Polynomial.__init__(self, parent, is_gen, construct)
def _repr(self, name=None):
"\n EXAMPLES::\n\n sage: R.<w> = PolynomialRing(Zp(5, prec=5, type='capped-abs... |
def _pari_padic_factorization_to_sage(G, R, leading_coeff):
'\n Given a PARI factorization matrix `G` representing a factorization\n of some polynomial in the `p`-adic polynomial ring `R`,\n return the corresponding Sage factorization. All factors in `G`\n are assumed to have content 1 (this is how PA... |
class Polynomial_padic_capped_relative_dense(Polynomial_generic_cdv, Polynomial_padic):
def __init__(self, parent, x=None, check=True, is_gen=False, construct=False, absprec=infinity, relprec=infinity):
'\n TESTS::\n\n sage: K = Qp(13,7)\n sage: R.<t> = K[]\n sage:... |
def _extend_by_infinity(L, n):
return (L + ([infinity] * (n - len(L))))
|
def make_padic_poly(parent, x, version):
if (version == 0):
return parent(x, construct=True)
else:
raise ValueError('unknown pickling version')
|
class Polynomial_padic_flat(Polynomial_generic_dense, Polynomial_padic):
def __init__(self, parent, x=None, check=True, is_gen=False, construct=False, absprec=None):
'\n TESTS:\n\n Check that :trac:`13620` has been fixed::\n\n sage: K = ZpFM(3)\n sage: R.<t> = K[]\n ... |
def Ring(n, order='lp', names=None, blocks=None):
if (blocks is None):
blocks = []
pbnames = names
if (pbnames is None):
pbnames = [(('x(' + str(idx)) + ')') for idx in range(n)]
order = TermOrder_from_pb_order(n, order, blocks)
return BooleanPolynomialRing(n, names=pbnames, order=... |
def WeakRingRef(ring):
return weakref.weakref(ring)
|
def add_up_polynomials(polys, init):
'\n Adds up the polynomials in polys (which should be a BoolePolynomialVector or a sequence of ???\n '
if (not isinstance(polys, BoolePolynomialVector)):
vec = BoolePolynomialVector
for p in polys:
vec.append(p)
polys = vec
ret... |
def gauss_on_polys(l):
vec = BoolePolynomialVector(l)
return list(_gauss_on_polys(vec))
|
class Block():
'\n The block class represents a block of variables\n <var_name>(start_index,...,start_index+size-1), it is the preferred\n block type for simple one-dimensional variable sets\n '
def __init__(self, var_name, size, start_index=0, reverse=False):
indices = range(start_index,... |
class AlternatingBlock():
'\n The Alternating Block class is used for doing tricky variable\n schemes,where base names vary, e.g.\n a(0),b(0),a(1),b(1),a(2),b(2)\n '
def __init__(self, var_names, size_per_variable, start_index=0, reverse=False):
self.var_names = var_names
self.siz... |
def shift(f, i):
def g(j):
return f((i + j))
g.__name__ = f.__name__
return g
|
class AdderBlock(AlternatingBlock):
def __init__(self, adder_bits, sums='s', carries='c', input1='a', input2='b', start_index=0):
AlternatingBlock.__init__(self, (sums, carries, input1, input2), adder_bits, start_index=start_index, reverse=True)
self.input1 = input1
self.input2 = input2
... |
class HigherOrderBlock():
'\n HigherOrderBlocks are multidimensional blocks of variables.\n\n For each dimension a separate start_index and size can be specified.\n\n var_name : variables will be called <var_name>(multiindex), where multiindex is a tuple of the size <size_tuple>\n\n size_tuple : speci... |
class InOutBlock():
def __init__(self, out_size, in_size, output='out', input='in', in_start_index=0, out_start_index=0, out_reverse=False, in_reverse=False):
self.output = Block(var_name=output, start_index=out_start_index, size=out_size, reverse=out_reverse)
self.input = Block(var_name=input, s... |
class MultiBlock():
def __init__(self, sizes=None, var_names=['v'], start_indices=[], reverses=None):
if (reverses is None):
reverses = []
if (sizes is None):
sizes = []
self.start_indices = (start_indices + ([0] * (len(var_names) - len(start_indices))))
re... |
class PrefixedDictProxy():
'docstring for PrefixedDictProxy'
def __init__(self, wrapped, prefix):
super().__init__()
self.wrapped = wrapped
self.prefix = prefix
def __getitem__(self, k):
try:
return self.wrapped[(self.prefix + k)]
except KeyError:
... |
class MacroBlock():
def __init__(self, prefix):
self.prefix = prefix
self.blocks = []
self.combinations = []
self.connections = []
def declare(self, blocks):
self.blocks = blocks
def connect(self, combinations):
self.combinations = combinations
def _... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.