Ticket #9054: trac_9054-invert_ideal.patch

File trac_9054-invert_ideal.patch, 1.9 KB (added by mderickx, 10 years ago)
• sage/rings/function_field/function_field_ideal.py

```# HG changeset patch
# User Maarten Derickx <m.derickx.student@gmail.com>
# Date 1316031695 -7200
# Node ID 6f8e65667825ffd0345261f51cfa3dce2dc131cc
# Parent  153bb398098fc3436dd120f465b9533a52d9a3ff
#9054 fix jullians last comment

diff --git a/sage/rings/function_field/function_field_ideal.py b/sage/rings/function_field/function_field_ideal.py```
 a from sage.rings.ideal import Ideal_generic from sage.modules import free_module_element class FunctionFieldIdeal(Ideal_generic): """ A fractional ideal of a function field. sage: L. = R.extension(y^2 - x^3 - 1); M = L.equation_order() sage: sage.rings.function_field.function_field_ideal.ideal_with_gens_over_base(M, [x^3+1,-y]) Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 TESTS:: sage: K. = FunctionField(QQ) sage: O = K.maximal_order() sage: I = O*x sage: ~I Ideal (1/x) of Maximal order in Rational function field in x over Rational Field sage: ~I == O.ideal(1/x) True """ K = R.fraction_field() V, from_V, to_V = K.vector_space() import function_field_order if isinstance(R, function_field_order.FunctionFieldOrder_rational): try: v = R._ring.ideal([x.element() for x in gens]).gens_reduced() gens = free_module_element.vector(x.element() for x in gens) d = gens.denominator() gens *= d v = R._ring.ideal(gens.list()).gens_reduced() assert len(v) == 1 basis = [to_V(v[0])] basis = [to_V(v[0]/d)] M = V.span_of_basis(basis, check=False, already_echelonized=True, base_ring=R) except Exception, msg: print msg   # TODO --for debugging