Ticket #9541: trac_9541-part9-libsingular-second_steps.patch

File trac_9541-part9-libsingular-second_steps.patch, 23.7 KB (added by was, 7 years ago)
  • module_list.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1279839056 -7200
    # Node ID 313613462727c43cf4142c5b82c73b5009dd67b1
    # Parent  6f449c1dcdaad8f3c26a286205d2fa6308feb27d
    [mq]: trac_9541-part9-libsingular-second_steps.patch
    
    diff -r 6f449c1dcdaa -r 313613462727 module_list.py
    a b  
    12011201        ################################
    12021202
    12031203    Extension('sage.rings.number_field.number_field_base',
    1204               sources = ['sage/rings/number_field/number_field_base.pyx'],
    1205               include_dirs = [SAGE_ROOT+'/local/include/FLINT/', SAGE_ROOT+'/devel/sage/sage/libs/flint'],
    1206               extra_compile_args=["-std=c99", "-D_XPG6"],
    1207               libraries=['flint'],
    1208               depends = [SAGE_ROOT + "/local/include/FLINT/flint.h"]),
     1204              sources = ['sage/rings/number_field/number_field_base.pyx']
     1205              ),
    12091206
    12101207    Extension('sage.rings.number_field.implementation',
    12111208              sources = ['sage/rings/number_field/implementation.pyx' , "sage/libs/flint/fmpq_poly.c"],
     
    12311228
    12321229    Extension('sage.rings.number_field.number_field_element_generic',
    12331230              sources = ['sage/rings/number_field/number_field_element_generic.pyx'],
    1234               include_dirs = [SAGE_ROOT+'/local/include/FLINT/', SAGE_ROOT+'/devel/sage/sage/libs/flint'],
    1235               extra_compile_args=["-std=c99", "-D_XPG6"]
     1231              include_dirs = [SAGE_ROOT+'/local/include/FLINT/', SAGE_ROOT+'/devel/sage/sage/libs/flint',
     1232                              SAGE_ROOT +'/local/include/singular'],
     1233              language = 'c++',
     1234              libraries=['flint', 'singular'],
    12361235              ),
    12371236   
    12381237    Extension('sage.rings.number_field.number_field_element_flint',
    12391238              sources = ['sage/rings/number_field/number_field_element_flint.pyx', "sage/libs/flint/fmpq_poly.c"],
    12401239              include_dirs = [SAGE_ROOT+'/local/include/FLINT/', SAGE_ROOT+'/devel/sage/sage/libs/flint'],
    12411240              extra_compile_args=["-std=c99", "-D_XPG6"],
    1242               libraries=['flint'],
    1243               depends = [SAGE_ROOT + "/local/include/FLINT/flint.h"]),
     1241              libraries=['flint']),
    12441242
    12451243    Extension('sage.rings.number_field.number_field_element_libsingular',
    12461244              sources = ['sage/rings/number_field/number_field_element_libsingular.pyx'],
  • sage/rings/number_field/implementation.pxd

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/implementation.pxd
    a b  
    1212
    1313# FLINT-based implementation
    1414include "../../libs/flint/fmpq_poly.pxd"
    15 
    1615cdef class ArithmeticImplementation_flint(ArithmeticImplementation):
    1716    cdef fmpq_poly_t modulus
    1817
    1918cdef class ArithmeticImplementation_libsingular(ArithmeticImplementation):
     19    cdef object nf_t_wrap
     20    cdef object ideal
    2021    cdef object ring
    21     cdef object ideal
    22     cdef object groebner_strategy
    2322
    2423cdef class ArithmeticImplementation_quadratic(ArithmeticImplementation):
    2524    pass
  • sage/rings/number_field/implementation.pyx

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/implementation.pyx
    a b  
    88"""
    99
    1010##############################################################################
    11 #       Copyright (C) 2004, 2005, 2006, 2007 William Stein <wstein@gmail.com>
     11#       Copyright (C) 2010 William Stein <wstein@gmail.com>
    1212#
    1313#  Distributed under the terms of the GNU General Public License (GPL)
    1414#
     
    178178        """
    179179        return True
    180180
     181from number_field_element_libsingular import nf_t_wrap
     182
    181183cdef class ArithmeticImplementation_libsingular(ArithmeticImplementation):
    182     def __init__(self, ring, ideal):
     184    def __init__(self, ideal):
    183185        """
    184186        EXAMPLES::
    185187
     
    187189            Arithmetic implementation 'singular'
    188190        """
    189191        ArithmeticImplementation.__init__(self, 'singular')
    190         self.ring = ring
     192        self.nf_t_wrap = nf_t_wrap(ideal)
    191193        self.ideal = ideal
    192         self.groebner_strategy = ideal._groebner_strategy()
     194        self.ring = ideal.ring()
    193195
    194196cdef class ArithmeticImplementation_quadratic(ArithmeticImplementation):
    195197    def __init__(self):
  • sage/rings/number_field/number_field_base.pxd

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/number_field_base.pxd
    a b  
    11from sage.rings.ring cimport Field
    2 from implementation cimport ArithmeticImplementation
    32
    43cdef class NumberField(Field):
    5     cdef ArithmeticImplementation _implementation
    6     cpdef ArithmeticImplementation implementation(self)
    7     cpdef _set_implementation(self, ArithmeticImplementation implementation)
     4    cdef object _implementation
     5    cpdef object implementation(self)
     6    cpdef _set_implementation(self, implementation)
  • sage/rings/number_field/number_field_base.pyx

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/number_field_base.pyx
    a b  
    3434from sage.rings.ring cimport Field
    3535
    3636cdef class NumberField(Field):
    37     cpdef ArithmeticImplementation implementation(self):
     37    cpdef implementation(self):
    3838        """
    3939        EXAMPLES::
    4040       
     
    4949        """
    5050        return self._implementation
    5151
    52     cpdef _set_implementation(self, ArithmeticImplementation implementation):
     52    cpdef _set_implementation(self, implementation):
    5353        """
    5454        Do not call this.  It is for internal use only, during object construction.
    5555
  • sage/rings/number_field/number_field_element_libsingular.pxd

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/number_field_element_libsingular.pxd
    a b  
    11from number_field_element cimport NumberFieldElement
    22
    3 from sage.libs.singular.decl cimport poly, ring
     3##################################################################
     4# Pure C-level API for relative number fields and their elements
     5##################################################################
    46
     7from sage.libs.singular.decl cimport poly, ring, ideal, skStrategy
    58from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular
     9from sage.libs.singular.groebner_strategy cimport GroebnerStrategy
    610
    7 from sage.libs.singular.groebner_strategy cimport GroebnerStrategy
    811
     12# number field data types
     13
     14cdef struct nf:
     15    ring* ring
     16    ideal* ideal
     17    skStrategy* strategy
     18ctypedef nf nf_t[1]
     19
     20cdef struct nfelt:
     21    poly* poly
     22ctypedef nfelt nfelt_t[1]
     23
     24# number field functions
     25cdef void nf_init_sage_ideal(nf_t K, I)
     26
     27# number field element functions
     28cdef void nfelt_init(nfelt_t x)
     29cdef void nfelt_init_set_poly(nfelt_t x, poly* poly, nf_t K)
     30cdef void nfelt_clear(nfelt_t x, nf_t K)
     31
     32cdef int nfelt_is_zero(nfelt_t op)
     33cdef void nfelt_invert(nfelt_t inverted_number, nfelt_t number, nf_t K)
     34
     35cdef void nfelt_mul(nfelt_t rop, nfelt_t op1, nfelt_t op2, nf_t K)
     36cdef void nfelt_add(nfelt_t rop, nfelt_t op1, nfelt_t op2, nf_t K)
     37cdef void nfelt_sub(nfelt_t rop, nfelt_t op1, nfelt_t op2, nf_t K)
     38cdef void nfelt_div(nfelt_t q, nfelt_t n, nfelt_t d, nf_t K)
     39cdef void nfelt_div(nfelt_t q, nfelt_t n, nfelt_t d, nf_t K)
     40
     41cdef void nfelt_canonicalize(nfelt_t rop, nf_t K)
     42cdef object nfelt_pystr(nfelt_t op, nf_t K)
     43
     44cimport implementation
     45
     46##################################################################
     47# Cython class that wraps the C-level number field API
     48##################################################################
     49cdef class nf_t_wrap:
     50    cdef nf_t nf
     51    cdef object ideal
     52       
     53
     54##################################################################
     55# Cython class that wraps the C-level API
     56##################################################################
    957cdef class NumberFieldElement_libsingular(NumberFieldElement):
    10     cdef poly *_poly
     58    cdef nfelt_t poly
     59    cdef _new(self)
     60    cdef MPolynomialRing_libsingular mpoly_ring(self)
     61    cdef imp(self)
    1162
    12     cdef _new(self)
    13     cdef ring* ring(self)
    14     cdef MPolynomialRing_libsingular mpoly_ring(self)
    15     cdef GroebnerStrategy groebner_strategy(self)
    16     cdef poly* normal_form(self, poly* p)
    1763   
    1864   
  • sage/rings/number_field/number_field_element_libsingular.pyx

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/number_field_element_libsingular.pyx
    a b  
     1"""
     2Relative Number Field Elements
     3
     4This module implements relative number field elements using an
     5optimized sparse representation that is built on top of libsingular.
     6
     7AUTHOR:
     8    - William Stein (2010-07-22)
     9"""
     10
     11
    112###############################################################################
    2 #       Copyright (C) 2004, 2007, 2010 William Stein <wstein@gmail.com>
     13#       Copyright (C) 2010 William Stein <wstein@gmail.com>
    314#
    415#  Distributed under the terms of the GNU General Public License (GPL)
    516#
     
    2233from sage.structure.element cimport RingElement, ModuleElement, Element
    2334from number_field_base cimport NumberField
    2435
     36from sage.libs.singular.decl cimport (
     37    p_Copy, p_Delete, p_ISet,
     38    currRing, rChangeCurrRing,
     39    redNF, redtailBba,
     40    IDELEMS, idInit, idLift, id_Delete)
     41
     42# singular poly arith
     43from sage.libs.singular.polynomial cimport (
     44    singular_polynomial_call, singular_polynomial_cmp,
     45    singular_polynomial_add, singular_polynomial_sub,
     46    singular_polynomial_neg, singular_polynomial_rmul, singular_polynomial_mul,
     47    singular_polynomial_div_coeff, singular_polynomial_pow,
     48    singular_polynomial_str, singular_polynomial_latex,
     49    singular_polynomial_str_with_changed_varnames,
     50    singular_polynomial_deg, singular_polynomial_length_bounded)
     51
    2552from implementation cimport ArithmeticImplementation_libsingular
    2653
    27 from sage.libs.singular.polynomial cimport singular_polynomial_str
     54cdef class NumberFieldElement_libsingular(NumberFieldElement):
    2855
    29 from sage.libs.singular.decl cimport p_Copy, currRing, rChangeCurrRing, redNF, redtailBba, p_Delete
    30 
    31 # singular poly arith
    32 from sage.libs.singular.polynomial cimport singular_polynomial_call, singular_polynomial_cmp, singular_polynomial_add, singular_polynomial_sub, singular_polynomial_neg
    33 from sage.libs.singular.polynomial cimport singular_polynomial_rmul, singular_polynomial_mul, singular_polynomial_div_coeff, singular_polynomial_pow
    34 from sage.libs.singular.polynomial cimport singular_polynomial_str, singular_polynomial_latex, singular_polynomial_str_with_changed_varnames
    35 from sage.libs.singular.polynomial cimport singular_polynomial_deg
    36 from sage.libs.singular.polynomial cimport singular_polynomial_length_bounded
    37 
    38 cdef class NumberFieldElement_libsingular(NumberFieldElement):
     56    #### BENCHMARKING CODE -- todo: delete in official release
    3957
    4058    def bench(self):
    4159        self._parent
     
    5068        cdef ArithmeticImplementation_libsingular A
    5169        A = <ArithmeticImplementation_libsingular> (<NumberField>self._parent)._implementation
    5270
     71    def _ideal(self):
     72        cdef ArithmeticImplementation_libsingular A
     73        A = <ArithmeticImplementation_libsingular> (<NumberField>self._parent)._implementation
     74        return A.ideal
     75
    5376    def bench5(self):
    5477        cdef ArithmeticImplementation_libsingular A
    5578        A = <ArithmeticImplementation_libsingular> (<NumberField>self._parent)._implementation
     
    6689
    6790    def bench9(self):
    6891        self.groebner_strategy()
     92
     93    def bench10(self):
     94        cdef nf_t K
     95        nf_init_sage_ideal(K, self._ideal())
    6996       
     97        cdef nfelt_t x
     98        nfelt_init_set_poly(x, (<MPolynomial_libsingular>(self.mpoly_ring().gen(0)))._poly, K)
     99
     100    def bench11(self, int n):
     101        cdef nf_t K
     102        nf_init_sage_ideal(K, self._ideal())
     103       
     104        cdef nfelt_t x
     105        nfelt_init_set_poly(x, (<MPolynomial_libsingular>(self.mpoly_ring().gen(0)))._poly, K)
     106
     107        cdef int i
     108        cdef nfelt_t y
     109        for i in range(n):
     110            nfelt_init(y)
     111            nfelt_mul(y, x, x, K)
     112            nfelt_clear(y, K)
     113
     114    def bench12(self, int n):
     115        cdef nf_t K
     116        nf_init_sage_ideal(K, self._ideal())
     117       
     118        cdef nfelt_t x
     119        nfelt_init_set_poly(x, (<MPolynomial_libsingular>(self.mpoly_ring().gen(0)))._poly, K)
     120
     121        cdef int i
     122        cdef nfelt_t y
     123        for i in range(n):
     124            nfelt_init(y)
     125            nfelt_div(y, x, x, K)
     126            nfelt_clear(y, K)
     127
     128    #### end BENCHMARKING CODE
     129
    70130    def __init__(self, parent, f):
    71131        self._parent = parent
    72         cdef MPolynomial_libsingular g = self.mpoly_ring().gen(0)
    73         self._poly = p_Copy(g._poly, self.ring())
    74        
    75     cdef inline ring* ring(self):
    76         return self.mpoly_ring()._ring
     132        #cdef MPolynomial_libsingular g = self.mpoly_ring()(f)
     133        cdef MPolynomial_libsingular g = self.mpoly_ring().gen()
     134        nfelt_init_set_poly(self.poly, g._poly, imp(self).nf)
     135
     136    cdef imp(self):
     137        cdef ArithmeticImplementation_libsingular A
     138        A = <ArithmeticImplementation_libsingular> (<NumberField>self._parent)._implementation
     139        return A
    77140
    78141    cdef inline MPolynomialRing_libsingular mpoly_ring(self):
    79142        cdef ArithmeticImplementation_libsingular A
     
    81144        cdef MPolynomialRing_libsingular R = <MPolynomialRing_libsingular>(A.ring)
    82145        return R
    83146
    84     cdef GroebnerStrategy groebner_strategy(self):
    85         cdef ArithmeticImplementation_libsingular A
    86         A = <ArithmeticImplementation_libsingular> (<NumberField>self._parent)._implementation
    87         return A.groebner_strategy
    88 
    89     cdef poly* normal_form(self, poly* p):
    90         if unlikely(self.ring() != currRing):
    91             rChangeCurrRing(self.ring())
    92         cdef int max_ind
    93         cdef poly *_p = redNF(p_Copy(p, self.ring()), max_ind, 0, self.groebner_strategy()._strat)
    94         if likely(_p!=NULL):
    95             _p = redtailBba(_p, max_ind, self.groebner_strategy()._strat)
    96         return _p
    97    
    98147    cdef inline _new(self):
    99148        cdef NumberFieldElement_libsingular x = PY_NEW(NumberFieldElement_libsingular)
    100149        x._parent = self._parent
    101         x._poly = NULL
     150        nfelt_init(x.poly)
    102151        return x
    103152
    104153    cdef void _randomize(self, num_bound, den_bound, distribution):
    105154        raise NotImplementedError
    106155   
    107     def polynomial(self):
    108         raise NotImplementedError
     156    def __repr__(self):
     157        return nfelt_pystr(self.poly, imp(self).nf)
    109158
    110     def __repr__(self):
    111         return singular_polynomial_str(self._poly, self.ring())
     159    cpdef RingElement _mul_(self, RingElement right):
     160        cdef NumberFieldElement_libsingular rop = self._new()
     161        nfelt_mul(rop.poly, self.poly, (<NumberFieldElement_libsingular>right).poly, imp(self).nf)
     162        return rop
     163   
     164    cpdef ModuleElement _add_(self, ModuleElement right):
     165        cdef NumberFieldElement_libsingular rop = self._new()
     166        nfelt_add(rop.poly, self.poly, (<NumberFieldElement_libsingular>right).poly, imp(self).nf)
     167        return rop
    112168
    113     cpdef RingElement _mul_(left, RingElement r):
    114         cdef NumberFieldElement_libsingular right = r
    115         cdef poly* p
    116         singular_polynomial_mul(&p, left._poly, right._poly, left.ring())
    117         cdef NumberFieldElement_libsingular x = left._new()
    118         x._poly = left.normal_form(p)
    119         if p != NULL: p_Delete(&p, left.ring())
    120         return x
    121    
    122     cpdef ModuleElement _add_(left, ModuleElement r):
    123         cdef NumberFieldElement_libsingular x = left._new(), right = r       
    124         singular_polynomial_add(&x._poly, left._poly, right._poly, left.ring())
    125         return x
     169    cpdef ModuleElement _sub_(self, ModuleElement right):
     170        cdef NumberFieldElement_libsingular rop = self._new()
     171        nfelt_sub(rop.poly, self.poly, (<NumberFieldElement_libsingular>right).poly, imp(self).nf)
     172        return rop
    126173
    127     cpdef ModuleElement _sub_(left, ModuleElement r):
    128         cdef NumberFieldElement_libsingular x = left._new(), right = r               
    129         singular_polynomial_sub(&x._poly, left._poly, right._poly, left.ring())
    130         return x
    131 
    132     cpdef RingElement _div_(left, RingElement r):
    133         cdef NumberFieldElement_libsingular x = left._new(), right = r
    134         raise NotImplementedError
     174    cpdef RingElement _div_(self, RingElement right):
     175        if nfelt_is_zero((<NumberFieldElement_libsingular>right).poly):
     176            raise ZeroDivisionError
     177        cdef NumberFieldElement_libsingular rop = self._new()
     178        nfelt_div(rop.poly, self.poly, (<NumberFieldElement_libsingular>right).poly, imp(self).nf)
     179        return rop
    135180
    136181    def __invert__(self):
    137         raise NotImplementedError                               
     182        if nfelt_is_zero(self.poly):
     183            raise ZeroDivisionError
     184        cdef NumberFieldElement_libsingular rop = self._new()
     185        nfelt_invert(rop.poly, self.poly, imp(self).nf)
     186        return rop
    138187
    139188    def __richcmp__(left, right, int op):
    140189        return (<Element>left)._richcmp(right, op)
     190
    141191    cdef int _cmp_c_impl(left, Element right) except -2:
    142         raise NotImplementedError                               
     192        return cmp(left.polynomial(), right.polynomial())
    143193
    144194    def _integer_(self, Z=None):
    145195        raise NotImplementedError                               
     
    147197    def _rational_(self):
    148198        raise NotImplementedError                                       
    149199
    150    
     200    def polynomial(self):
     201        # TODO
     202        return 389
     203
     204
     205
    151206cdef class OrderElement_libsingular(NumberFieldElement_libsingular):
    152207    pass
     208
     209
     210
     211
     212############################################################
     213# Implementation of number field functions
     214############################################################
     215
     216cdef void nf_init_sage_ideal(nf_t K, I):
     217    """
     218    INPUT:
     219        - K -- uninitialized number field
     220        - ideal -- a Sage multipolynomial ring ideal
     221
     222    IMPORTANT: This nf is only valid so long as the ideal does not get
     223    garbage collected by Python!  Keep a reference to that ideal
     224    around!
     225    """
     226    K.strategy = (<GroebnerStrategy>(I._groebner_strategy()))._strat
     227    cdef MPolynomialRing_libsingular R = I.ring()
     228    K.ring = R._ring
     229    gens = I.gens()
     230    K.ideal = idInit(len(gens),1)
     231    cdef MPolynomial_libsingular f
     232    cdef int i = 0
     233    for f in gens:
     234        K.ideal.m[i] = p_Copy(f._poly, K.ring)
     235        i += 1
     236
     237############################################################
     238# Implementation of number field element functions
     239############################################################
     240
     241cdef void nfelt_init(nfelt_t x):
     242    x.poly = NULL
     243
     244cdef void nfelt_clear(nfelt_t x, nf_t K):
     245    if x.poly != NULL:
     246        p_Delete(&x.poly, K.ring)
     247    x.poly = NULL
     248
     249cdef int nfelt_is_zero(nfelt_t op):
     250    return op.poly == NULL
     251
     252cdef void nfelt_init_set_si(nfelt_t op, int i, nf_t K):
     253    op.poly = p_ISet(i, K.ring)
     254
     255cdef void nfelt_set_si(nfelt_t op, int i, nf_t K):
     256    nfelt_clear(op, K)
     257    op.poly = p_ISet(i, K.ring)
     258
     259cdef void nfelt_invert(nfelt_t inverted_number, nfelt_t number, nf_t K):
     260    cdef nfelt_t one
     261    nfelt_init_set_si(one, 1, K)
     262    nfelt_div(inverted_number, one, number, K)
     263
     264cdef void nfelt_mul(nfelt_t rop, nfelt_t op1, nfelt_t op2, nf_t K):
     265    nfelt_clear(rop, K)
     266    singular_polynomial_mul(&(rop.poly), op1.poly, op2.poly, K.ring)
     267    nfelt_canonicalize(rop, K)
     268
     269cdef void nfelt_add(nfelt_t rop, nfelt_t op1, nfelt_t op2, nf_t K):
     270    nfelt_clear(rop, K)
     271    singular_polynomial_add(&(rop.poly), op1.poly, op2.poly, K.ring)
     272   
     273cdef void nfelt_sub(nfelt_t rop, nfelt_t op1, nfelt_t op2, nf_t K):
     274    nfelt_clear(rop, K)
     275    singular_polynomial_sub(&(rop.poly), op1.poly, op2.poly, K.ring)
     276   
     277cdef void nfelt_div(nfelt_t q, nfelt_t n, nfelt_t d, nf_t K):
     278    cdef ideal *I, *nI, *res
     279   
     280    # Initialize the ideal generated by n.
     281    nI = idInit(1, 1)
     282    nI.m[0] = p_Copy(n.poly, K.ring)
     283
     284    # Initialize the ideal with generators [d] + K.ideal.gens()
     285    I = idInit(IDELEMS(K.ideal)+1, 1)
     286    I.m[0] = p_Copy(d.poly, K.ring)
     287    for i in range(1, IDELEMS(K.ideal)+1):
     288        I.m[i] = p_Copy(K.ideal.m[i-1], K.ring)
     289
     290    # Now compute the lift of nI
     291    res = idLift(I, nI, NULL, 0, 0, 0)
     292    nfelt_clear(q, K)
     293    q.poly = p_Copy(res.m[0], K.ring)
     294    id_Delete(&nI, K.ring)
     295    id_Delete(&I, K.ring)
     296
     297cdef void nfelt_canonicalize(nfelt_t op, nf_t K):
     298    if unlikely(K.ring != currRing): rChangeCurrRing(K.ring)
     299    cdef int max_ind
     300    op.poly = redNF(p_Copy(op.poly, K.ring), max_ind, 0, K.strategy)
     301    if likely(op.poly != NULL):
     302        op.poly = redtailBba(op.poly, max_ind, K.strategy)
     303
     304cdef object nfelt_pystr(nfelt_t op, nf_t K):
     305    return singular_polynomial_str(op.poly, K.ring)
     306
     307cdef void nfelt_init_set_poly(nfelt_t x, poly* poly, nf_t K):
     308    x.poly = p_Copy(poly, K.ring)
     309
     310cdef nf_t_wrap imp(NumberFieldElement_libsingular x):
     311    return (<ArithmeticImplementation_libsingular>(x.imp())).nf_t_wrap
     312
     313
     314cdef class nf_t_wrap:
     315    def __init__(self, ideal):
     316        self.ideal = ideal
     317        nf_init_sage_ideal(self.nf, ideal)
     318       
  • sage/rings/number_field/number_field_rel.py

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/number_field_rel.py
    a b  
    296296            self._element_class = number_field_element_libsingular.NumberFieldElement_libsingular
    297297            self._order_element_class = number_field_element_libsingular.OrderElement_libsingular
    298298            ring, ideal = self._libsingular_ring(polynomial)
    299             self._set_implementation(arithmetic_implementation.ArithmeticImplementation_libsingular(ring, ideal))
     299            self._set_implementation(arithmetic_implementation.ArithmeticImplementation_libsingular(ideal))
    300300        else:
    301301            raise ValueError, "invalid relative number field implementation '%s'"%implementation
    302302        assert self.implementation() is not None
  • sage/rings/number_field/order_base.pxd

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/order_base.pxd
    a b  
    11from sage.rings.ring cimport IntegralDomain
    2 from implementation cimport ArithmeticImplementation
    32
    43cdef class Order_base(IntegralDomain):
    54    cdef public object _K   # number field
    6     cdef ArithmeticImplementation _implementation
    7     cpdef ArithmeticImplementation implementation(self)
    8     cpdef _set_implementation(self, ArithmeticImplementation implementation)
     5    cdef object _implementation
     6    cpdef object implementation(self)
     7    cpdef _set_implementation(self, implementation)
  • sage/rings/number_field/order_base.pyx

    diff -r 6f449c1dcdaa -r 313613462727 sage/rings/number_field/order_base.pyx
    a b  
    11cdef class Order_base(IntegralDomain):
    2     cpdef ArithmeticImplementation implementation(self):
     2    cpdef object implementation(self):
    33        """
    44        EXAMPLES::
    55       
     
    1010        """
    1111        return self._implementation
    1212
    13     cpdef _set_implementation(self, ArithmeticImplementation implementation):
     13    cpdef _set_implementation(self, implementation):
    1414        """
    1515        Do not use this!  It is used internally during object construction.
    1616