Changeset d9a25e7 in git
- Timestamp:
- Jan 13, 2021, 3:49:35 PM (3 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- e37c4ea9c75bd6e3085b62192a568e3f7754921a
- Parents:
- d13b0189befa38be770476b393bffce13bd31e62
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/ffields.cc
rd13b01 rd9a25e7 721 721 } 722 722 723 static 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 732 static 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 723 741 static number nfMapViaInt(number c, const coeffs src, const coeffs dst) 724 742 { 725 inti=src->cfInt(c,src);743 long i=src->cfInt(c,src); 726 744 if (i==0) return (number)(long)dst->m_nfCharQ; 727 745 while (i < 0) i += dst->m_nfCharP; 728 746 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); 740 748 } 741 749 … … 789 797 if (nCoeff_is_Z(src)) /* Z*/ 790 798 { 791 return nfMap ViaInt;799 return nfMapMPZ; 792 800 } 793 801 if (nCoeff_is_Zp(src) && (src->ch==dst->m_nfCharP)) /* Zp*/ … … 865 873 r->cfExactDiv= nfDiv; 866 874 r->cfInit = nfInit; 875 r->cfInitMPZ = nfInitMPZ; 867 876 //r->cfSize = ndSize; 868 877 r->cfInt = nfInt;
Note: See TracChangeset
for help on using the changeset viewer.