Changeset d9a25e7 in git


Ignore:
Timestamp:
Jan 13, 2021, 3:49:35 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e37c4ea9c75bd6e3085b62192a568e3f7754921a
Parents:
d13b0189befa38be770476b393bffce13bd31e62
Message:
to GF from very, very long Z
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/ffields.cc

    rd13b01 rd9a25e7  
    721721}
    722722
     723static number nfMapMPZ(number c, const coeffs src, const coeffs dst)
     724{
     725  mpz_t tmp;
     726  mpz_init(tmp);
     727  mpz_mod_ui(tmp,(mpz_ptr)c,dst->m_nfCharP);
     728  long l=mpz_get_si(tmp);
     729  return nfInit(l,dst);
     730}
     731
     732static number nfInitMPZ(mpz_t m, const coeffs cf)
     733{
     734  mpz_t tmp;
     735  mpz_init(tmp);
     736  mpz_mod_ui(tmp,m,cf->m_nfCharP);
     737  long l=mpz_get_si(tmp);
     738  return nfInit(l,cf);
     739}
     740
    723741static number nfMapViaInt(number c, const coeffs src, const coeffs dst)
    724742{
    725   int i=src->cfInt(c,src);
     743  long i=src->cfInt(c,src);
    726744  if (i==0) return (number)(long)dst->m_nfCharQ;
    727745  while (i <  0)    i += dst->m_nfCharP;
    728746  while (i >= dst->m_nfCharP) i -= dst->m_nfCharP;
    729   if (i==0) return (number)(long)dst->m_nfCharQ;
    730   unsigned short cc=0;
    731   while (i>1)
    732   {
    733     cc=dst->m_nfPlus1Table[cc];
    734     i--;
    735   }
    736 #ifdef LDEBUG
    737   nfTest((number)(long)cc, dst);
    738 #endif
    739   return (number)(long)cc;
     747  return nfInit(i,dst);
    740748}
    741749
     
    789797  if (nCoeff_is_Z(src)) /* Z*/
    790798  {
    791     return nfMapViaInt;
     799    return nfMapMPZ;
    792800  }
    793801  if (nCoeff_is_Zp(src) && (src->ch==dst->m_nfCharP)) /* Zp*/
     
    865873  r->cfExactDiv= nfDiv;
    866874  r->cfInit = nfInit;
     875  r->cfInitMPZ = nfInitMPZ;
    867876  //r->cfSize  = ndSize;
    868877  r->cfInt  = nfInt;
Note: See TracChangeset for help on using the changeset viewer.