def __init__(self, A, gens=None, given_by_matrix=False):
        """
        EXAMPLES::

            sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])])
            sage: I = A.ideal(A([0,1]))
            sage: TestSuite(I).run(skip="_test_category") # Currently ideals are not using the category framework
        """
        k = A.base_ring()
        n = A.degree()
        if given_by_matrix:
            self._basis_matrix = gens
            gens = gens.rows()
        elif gens is None:
            self._basis_matrix = Matrix(k, 0, n)
        elif isinstance(gens, (list, tuple)):
            B = [
                FiniteDimensionalAlgebraIdeal(A, x).basis_matrix()
                for x in gens
            ]
            B = reduce(lambda x, y: x.stack(y), B, Matrix(k, 0, n))
            self._basis_matrix = B.echelon_form().image().basis_matrix()
        elif is_Matrix(gens):
            gens = FiniteDimensionalAlgebraElement(A, gens)
        elif isinstance(gens, FiniteDimensionalAlgebraElement):
            gens = gens.vector()
            B = Matrix([gens * b for b in A.table()])
            self._basis_matrix = B.echelon_form().image().basis_matrix()
        Ideal_generic.__init__(self, A, gens)
    def __init__(self, A, gens=None, given_by_matrix=False):
        """
        EXAMPLES::

            sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])])
            sage: I = A.ideal(A([0,1]))
            sage: TestSuite(I).run(skip="_test_category") # Currently ideals are not using the category framework
        """
        k = A.base_ring()
        n = A.degree()
        if given_by_matrix:
            self._basis_matrix = gens
            gens = gens.rows()
        elif gens is None:
            self._basis_matrix = Matrix(k, 0, n)
        elif isinstance(gens, (list, tuple)):
            B = [FiniteDimensionalAlgebraIdeal(A, x).basis_matrix() for x in gens]
            B = reduce(lambda x, y: x.stack(y), B, Matrix(k, 0, n))
            self._basis_matrix = B.echelon_form().image().basis_matrix()
        elif is_Matrix(gens):
            gens = FiniteDimensionalAlgebraElement(A, gens)
        elif isinstance(gens, FiniteDimensionalAlgebraElement):
            gens = gens.vector()
            B = Matrix([gens * b for b in A.table()])
            self._basis_matrix = B.echelon_form().image().basis_matrix()
        Ideal_generic.__init__(self, A, gens)
Exemple #3
0
    def __init__(self, ring, gens, coerce=True):
        """
        INPUT:

        ``ring`` -- an infinite polynomial ring
        ``gens`` -- generators of this ideal
        ``coerce`` -- (bool, default ``True``) coerce the given generators into ``ring``

        EXAMPLES::

            sage: X.<x,y> = InfinitePolynomialRing(QQ)
            sage: I=X*(x[1]^2+y[2]^2,x[1]*x[2]*y[3]+x[1]*y[4]) # indirect doctest
            sage: I
            Symmetric Ideal (x_1^2 + y_2^2, x_2*x_1*y_3 + x_1*y_4) of Infinite polynomial ring in x, y over Rational Field
            sage: from sage.rings.polynomial.symmetric_ideal import SymmetricIdeal
            sage: J=SymmetricIdeal(X,[x[1]^2+y[2]^2,x[1]*x[2]*y[3]+x[1]*y[4]])
            sage: I==J
            True

        """
        Ideal_generic.__init__(self, ring, gens, coerce=coerce)
    def __init__(self, ring, module):
        """
        INPUT:

            - ``ring`` -- an order in a function field
            - ``module`` -- a module

        EXAMPLES::

            sage: R.<x> = FunctionField(QQ); S.<y> = R[]
            sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
            sage: I = M.ideal(y)
            sage: type(I)
            <class 'sage.rings.function_field.function_field_ideal.FunctionFieldIdeal_module'>
        """
        self._ring = ring
        self._module = module
        self._structure = ring.fraction_field().vector_space()
        V, from_V, to_V = self._structure
        gens = tuple([from_V(a) for a in module.basis()])
        Ideal_generic.__init__(self, ring, gens, coerce=False)
    def __init__(self, ring, gens, coerce=True):
        """
        INPUT:

        ``ring`` -- an infinite polynomial ring
        ``gens`` -- generators of this ideal
        ``coerce`` -- (bool, default ``True``) coerce the given generators into ``ring``

        EXAMPLES::

            sage: X.<x,y> = InfinitePolynomialRing(QQ)
            sage: I=X*(x[1]^2+y[2]^2,x[1]*x[2]*y[3]+x[1]*y[4]) # indirect doctest
            sage: I
            Symmetric Ideal (x_1^2 + y_2^2, x_2*x_1*y_3 + x_1*y_4) of Infinite polynomial ring in x, y over Rational Field
            sage: from sage.rings.polynomial.symmetric_ideal import SymmetricIdeal
            sage: J=SymmetricIdeal(X,[x[1]^2+y[2]^2,x[1]*x[2]*y[3]+x[1]*y[4]])
            sage: I==J
            True

        """
        Ideal_generic.__init__(self, ring, gens, coerce=coerce)
Exemple #6
0
    def __init__(self, ring, module):
        """
        INPUT:

            - ``ring`` -- an order in a function field
            - ``module`` -- a module

        EXAMPLES::

            sage: R.<x> = FunctionField(QQ); S.<y> = R[]
            sage: L.<y> = R.extension(y^2 - x^3 - 1); M = L.equation_order()   
            sage: I = M.ideal(y)
            sage: type(I)
            <class 'sage.rings.function_field.function_field_ideal.FunctionFieldIdeal_module'>
        """
        self._ring = ring
        self._module = module
        self._structure = ring.fraction_field().vector_space()
        V, from_V, to_V = self._structure
        gens = tuple([from_V(a) for a in module.basis()])
        Ideal_generic.__init__(self, ring, gens, coerce=False)
Exemple #7
0
    def __init__(self, ring, gens, coerce=True, hint=None):
        r"""
        Create an ideal in a Laurent polynomial ring.

        To compute structural properties of an ideal in the Laurent polynomial ring
        `R[x_1^{\pm},\ldots,x_n^{\pm}]`, we form the corresponding ideal in the
        associated ordinary polynomial ring `R[x_1,\ldots,x_n]` which is saturated
        with respect to the ideal `(x_1 \cdots x_n)`. Since computing the saturation
        can be expensive, we employ some strategies to reduce the need for it.
    
        - We only create the polynomial ideal as needed.

        - For some operations, we try some superficial tests first. E.g., for
          comparisons, we first look directly at generators.
        - The attribute ``hint`` is a lower bound on the associated polynomial ideal.
          Hints are automatically forwarded by certain creation operations (such as
          sums and base extensions), and can be manually forwarded in other cases.

        INPUT:

        - ``ring`` -- the ring the ideal is defined in
        - ``gens`` -- a list of generators for the ideal
        - ``coerce`` -- whether or not to coerce elements into ``ring``
        - ``hint`` -- an ideal in the associated polynomial ring (optional; see above)

        EXAMPLES::

            sage: R.<x,y> = LaurentPolynomialRing(IntegerRing(), 2, order='lex')
            sage: R.ideal([x, y])
            Ideal (x, y) of Multivariate Laurent Polynomial Ring in x, y over Integer Ring
            sage: R.<x0,x1> = LaurentPolynomialRing(GF(3), 2)
            sage: R.ideal([x0^2, x1^-3])
            Ideal (x0^2, x1^-3) of Multivariate Laurent Polynomial Ring in x0, x1 over Finite Field of size 3

            sage: P.<x,y> = LaurentPolynomialRing(QQ, 2)
            sage: I = P.ideal([~x + ~y - 1])
            sage: print(I)
            Ideal (-1 + y^-1 + x^-1) of Multivariate Laurent Polynomial Ring in x, y over Rational Field
            sage: I.is_zero()
            False
            sage: (x^(-2) + x^(-1)*y^(-1) - x^(-1)) in I
            True

            sage: P.<x,y,z> = LaurentPolynomialRing(QQ, 3)
            sage: I1 = P.ideal([x*y*z+x*y+2*y^2, x+z])
            sage: I2 = P.ideal([x*y*z+x*y+2*y^2+x+z, x+z])
            sage: I1 == I2
            True
            sage: I3 = P.ideal([x*y*z+x*y+2*y^2+x+z, x+z, y])
            sage: I1 < I3
            True
            sage: I1.minimal_associated_primes()
            (Ideal (-1/2*z^2 + y - 1/2*z, x + z) of Multivariate Laurent Polynomial Ring in x, y, z over Rational Field,)

            sage: K.<z> = CyclotomicField(4)
            sage: J = I1.base_extend(K)
            sage: J.base_ring()
            Cyclotomic Field of order 4 and degree 2
        """
        Ideal_generic.__init__(self, ring, gens, coerce=coerce)
        self._poly_ring = ring.polynomial_ring()
        self._poly_ideal = None  # Create only as needed
        self._saturated = False
        if hint is None:
            self._hint = self._poly_ring.zero_ideal()
        else:
            self._hint = hint.change_ring(self._poly_ring)