Changeset 5a4e17 in git for libpolys/polys/ext_fields/transext.cc
- Timestamp:
- Aug 14, 2013, 5:44:47 PM (10 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- e7af713b2118666efd56a51c8fd09dcc0b99e0ee
- Parents:
- adae8b2811aa80401958b914b4cfc7d0ad8eb36b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/ext_fields/transext.cc
radae8b r5a4e17 1100 1100 1101 1101 fraction f = (fraction)a; 1102 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; ntTest(a); return; } 1102 if (COM(f)!=0) p_Normalize(NUM(f), ntRing); 1103 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; } 1104 1105 p_Normalize(DEN(f), ntRing); 1103 1106 1104 1107 assume( DEN(f) != NULL ); … … 1153 1156 1154 1157 if (IS0(a)) return; 1155 if (NUM(f)!=NULL) p_Normalize(NUM(f), ntRing);1156 if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);1157 1158 if (!simpleTestsHaveAlreadyBeenPerformed) 1158 1159 { 1160 p_Normalize(NUM(f), ntRing); 1161 if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing); 1159 1162 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; } 1160 1163 … … 1169 1172 } 1170 1173 } 1174 if (rField_is_Q(ntRing)) 1175 { 1176 number c=n_Copy(pGetCoeff(NUM(f)),ntCoeffs); 1177 poly p=pNext(NUM(f)); 1178 while((p!=NULL)&&(!n_IsOne(c,ntCoeffs))) 1179 { 1180 number cc=n_Gcd(c,pGetCoeff(p),ntCoeffs); 1181 n_Delete(&c,ntCoeffs); 1182 c=cc; 1183 pIter(p); 1184 }; 1185 p=DEN(f); 1186 while((p!=NULL)&&(!n_IsOne(c,ntCoeffs))) 1187 { 1188 number cc=n_Gcd(c,pGetCoeff(p),ntCoeffs); 1189 n_Delete(&c,ntCoeffs); 1190 c=cc; 1191 pIter(p); 1192 }; 1193 if(!n_IsOne(c,ntCoeffs)) 1194 { 1195 p=NUM(f); 1196 do 1197 { 1198 number cc=n_Div(pGetCoeff(p),c,ntCoeffs); 1199 n_Normalize(cc,ntCoeffs); 1200 p_SetCoeff(p,cc,ntRing); 1201 pIter(p); 1202 } while(p!=NULL); 1203 p=DEN(f); 1204 do 1205 { 1206 number cc=n_Div(pGetCoeff(p),c,ntCoeffs); 1207 n_Normalize(cc,ntCoeffs); 1208 p_SetCoeff(p,cc,ntRing); 1209 pIter(p); 1210 } while(p!=NULL); 1211 n_Delete(&c,ntCoeffs); 1212 if(pNext(DEN(f))==NULL) 1213 { 1214 if (p_IsOne(DEN(f),ntRing)) 1215 { 1216 p_LmDelete(&DEN(f),ntRing); 1217 COM(f)=0; 1218 return; 1219 } 1220 else 1221 { 1222 return; 1223 } 1224 } 1225 } 1226 } 1171 1227 1172 1228 #ifdef HAVE_FACTORY 1173 /* Note that, over Q, singclap_gcd will remove the denominators in all 1174 rational coefficients of pNum and pDen, before starting to compute 1175 the gcd. Thus, we do not need to ensure that the coefficients of 1176 pNum and pDen live in Z; they may well be elements of Q\Z. */ 1177 /* singclap_gcd destroys its arguments; we hence need copies: */ 1178 poly pGcd = singclap_gcd(p_Copy(NUM(f), ntRing), p_Copy(DEN(f), ntRing), cf->extRing); 1179 if (p_IsConstant(pGcd, ntRing) && 1180 n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)) 1229 poly pGcd; 1230 /* here we assume: NUM(f), DEN(f) !=NULL, in Z_a reqp. Z/p_a */ 1231 pGcd = singclap_gcd_r(NUM(f), DEN(f), ntRing); 1232 if (p_IsConstant(pGcd, ntRing) 1233 //&& n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs) 1234 ) 1181 1235 { /* gcd = 1; nothing to cancel; 1182 1236 Suppose the given rational function field is over Q. Although the … … 1350 1404 the gcd. Thus, we do not need to ensure that the coefficients of 1351 1405 pa and pb live in Z; they may well be elements of Q\Z. */ 1352 poly pGcd = singclap_gcd(pa, pb, cf->extRing);1406 poly pGcd = singclap_gcd(pa, pb, ntRing); 1353 1407 if (p_IsConstant(pGcd, ntRing) && 1354 1408 n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
Note: See TracChangeset
for help on using the changeset viewer.