Ticket #2843: padics_ZZ_pXModulus.patch

File padics_ZZ_pXModulus.patch, 3.6 KB (added by wjp, 14 years ago)
  • sage/rings/padics/pow_computer_ext.pyx

    # HG changeset patch
    # User Willem Jan Palenstijn <wpalenst@math.leidenuniv.nl>
    # Date 1207694492 -7200
    # Node ID 48e6dbc80d25821e66f7ec3bb7e230a7ce436ac0
    # Parent  bb63d33f61c4cfe7a797ff674e44654f489ea72e
    convert ZZ_pX_eis_shift's local modulus to a pointer since NTL doesn't
    always support re-assignment of ZZ_pXModulus objects
    
    diff -r bb63d33f61c4 -r 48e6dbc80d25 sage/rings/padics/pow_computer_ext.pyx
    a b cdef int ZZ_pX_eis_shift(PowComputer_ZZ_ 
    254254    cdef ZZ_pX_c highshift
    255255    cdef ZZ_pX_c working, working2
    256256    cdef ntl_ZZ_pContext_class c
    257     cdef ZZ_pX_Modulus_c m
     257    cdef ZZ_pX_Modulus_c* m
    258258    cdef long pshift = n / self.e
    259259    cdef long eis_part = n % self.e
    260260    cdef long two_shift = 1
    cdef int ZZ_pX_eis_shift(PowComputer_ZZ_ 
    287287    if n < 0:
    288288        if fm:
    289289            c = self.get_top_context()
    290             m = self.get_top_modulus()[0]
     290            m = self.get_top_modulus()
    291291        else:
    292292            c = self.get_context(finalprec)
    293             m = self.get_modulus(finalprec)[0]
     293            m = self.get_modulus(finalprec)
    294294        c.restore_c()
    295295        ##printer = ntl_ZZ_pX([],c)
    296         ZZ_pX_PowerXMod_long_pre(powerx, -n, m)
     296        ZZ_pX_PowerXMod_long_pre(powerx, -n, m[0])
    297297        ##printer.x = powerx
    298298        ##print printer
    299299        ZZ_pX_conv_modulus(x[0], a[0], c.x)
    300         ZZ_pX_MulMod_pre(x[0], powerx, a[0], m)
     300        ZZ_pX_MulMod_pre(x[0], powerx, a[0], m[0])
    301301        ##printer.x = x[0]
    302302        ##print printer
    303303        return 0
    cdef int ZZ_pX_eis_shift(PowComputer_ZZ_ 
    356356#            pshift = pshift >> 1
    357357    if fm:
    358358        c = self.get_top_context()
    359         m = self.get_top_modulus()[0]
     359        m = self.get_top_modulus()
    360360    else:
    361361        c = self.get_context(finalprec + pshift + 1)
    362362    c.restore_c()
    cdef int ZZ_pX_eis_shift(PowComputer_ZZ_ 
    366366            pshift -= 1
    367367            if fm:
    368368                ZZ_pX_right_pshift(working, working, self.pow_ZZ_tmp(1)[0],c.x)
    369                 ZZ_pX_MulMod_premul(working, working, high_shifter_fm[0], m)
     369                ZZ_pX_MulMod_premul(working, working, high_shifter_fm[0], m[0])
    370370            else:
    371371                c = self.get_context(finalprec + pshift + 1)
    372                 m = self.get_modulus(finalprec + pshift + 1)[0]
     372                m = self.get_modulus(finalprec + pshift + 1)
    373373                ZZ_pX_right_pshift(working, working, self.pow_ZZ_tmp(1)[0],c.x)
    374374                ZZ_pX_conv_modulus(highshift, high_shifter[0], c.x)
    375                 ZZ_pX_MulMod_pre(working, working, highshift, m)
     375                ZZ_pX_MulMod_pre(working, working, highshift, m[0])
    376376    elif not fm:
    377         m = self.get_modulus(finalprec + 1)[0]
     377        m = self.get_modulus(finalprec + 1)
    378378    ZZ_pX_conv_modulus(working2, working, c.x)
    379379    i = 0
    380380    two_shift = 1
    cdef int ZZ_pX_eis_shift(PowComputer_ZZ_ 
    396396            ##printer.x = low_part
    397397            ##print "low_part = %s"%(printer)
    398398            if fm:
    399                 ZZ_pX_MulMod_premul(low_part, low_part, low_shifter_fm[i], m)
     399                ZZ_pX_MulMod_premul(low_part, low_part, low_shifter_fm[i], m[0])
    400400            else:
    401401                ZZ_pX_conv_modulus(lowshift, low_shifter[i], c.x)
    402                 ZZ_pX_MulMod_pre(low_part, low_part, lowshift, m)
     402                ZZ_pX_MulMod_pre(low_part, low_part, lowshift, m[0])
    403403            ##printer.x = low_part
    404404            ##print "low_part = %s"%(printer)
    405405            ZZ_pX_add(working2, low_part, shifted_high_part)