Changeset 6ccdd3a in git
- Timestamp:
- May 26, 2011, 4:42:12 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ba3e3ef698fa0b7c5867199959cc83330073d3cb')
- Children:
- 7af488ec51790060979537b35a03fb345e053f90
- Parents:
- 5a4b26f3e00776270c3ba83b16c92a69f3cca0e0
- git-author:
- Frank Seelisch <seelisch@mathematik.uni-kl.de>2011-05-26 16:42:12+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:39:06+01:00
- Files:
-
- 2 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
r5a4b26 r6ccdd3a 3497 3497 new_ring->P=lev; 3498 3498 new_ring->parameter=names; 3499 new_ring-> algring=alg_ring;3499 new_ring->extRing=alg_ring; 3500 3500 new_ring->ch=1; 3501 3501 rComplete(new_ring,TRUE); -
Singular/iparith.cc
r5a4b26 r6ccdd3a 5986 5986 if (rField_is_Extension(currRing)) 5987 5987 { 5988 assume(currRing-> algring!=NULL);5988 assume(currRing->extRing!=NULL); 5989 5989 lnumber n=(lnumber)pGetCoeff(p); 5990 ringvar=-p_Var(n->z,currRing-> algring);5990 ringvar=-p_Var(n->z,currRing->extRing); 5991 5991 } 5992 5992 if(ringvar==0) -
Singular/ipassign.cc
r5a4b26 r6ccdd3a 182 182 currRing->minpoly=p; 183 183 naMinimalPoly=((lnumber)currRing->minpoly)->z; 184 if (p_GetExp(((lnumber)currRing->minpoly)->z,1,currRing-> algring)==0)184 if (p_GetExp(((lnumber)currRing->minpoly)->z,1,currRing->extRing)==0) 185 185 { 186 186 Werror("minpoly must not be constant"); -
Singular/ipshell.cc
r5a4b26 r6ccdd3a 1757 1757 else if (rIsExtension(r)) 1758 1758 { 1759 if (r-> algring!=NULL)1760 rDecomposeCF(&(L->m[0]),r-> algring,r);1759 if (r->extRing!=NULL) 1760 rDecomposeCF(&(L->m[0]),r->extRing,r); 1761 1761 else 1762 1762 { … … 2311 2311 if (is_gf_char==-1) 2312 2312 { 2313 R-> algring=rCompose((lists)L->m[0].Data());2314 if (R-> algring==NULL)2313 R->extRing=rCompose((lists)L->m[0].Data()); 2314 if (R->extRing==NULL) 2315 2315 { 2316 2316 WerrorS("could not create rational function coefficient field"); 2317 2317 goto rCompose_err; 2318 2318 } 2319 if (R-> algring->ch>0)2320 R->ch= -R-> algring->ch;2319 if (R->extRing->ch>0) 2320 R->ch= -R->extRing->ch; 2321 2321 else 2322 2322 R->ch=1; 2323 R->P=R-> algring->N;2323 R->P=R->extRing->N; 2324 2324 R->parameter=(char**)omAlloc0(R->P*sizeof(char_ptr)); 2325 2325 int i; 2326 2326 for(i=R->P-1;i>=0;i--) 2327 R->parameter[i]=omStrDup(R-> algring->names[i]);2328 if (R-> algring->qideal!=NULL)2327 R->parameter[i]=omStrDup(R->extRing->names[i]); 2328 if (R->extRing->qideal!=NULL) 2329 2329 { 2330 if (IDELEMS(R-> algring->qideal)==1)2330 if (IDELEMS(R->extRing->qideal)==1) 2331 2331 { 2332 2332 R->minpoly=naInit(1,R); 2333 2333 lnumber n=(lnumber)R->minpoly; 2334 n->z=R-> algring->qideal->m[0];2334 n->z=R->extRing->qideal->m[0]; 2335 2335 naMinimalPoly=n->z; 2336 R-> algring->qideal->m[0]=NULL;2337 idDelete(&(R-> algring->qideal));2336 R->extRing->qideal->m[0]=NULL; 2337 idDelete(&(R->extRing->qideal)); 2338 2338 //redefineFunctionPointers(); 2339 2339 } -
Singular/maps_ip.cc
r5a4b26 r6ccdd3a 204 204 { 205 205 ideal theMapI=idInit(rPar(currRing),1); 206 nMapFunc nMap=nSetMap(currRing-> algring);206 nMapFunc nMap=nSetMap(currRing->extRing); 207 207 208 208 int i; … … 214 214 pp=theMapI->m[i-1]=pOne(); 215 215 lnumber n=(lnumber)pGetCoeff(pp); 216 p_SetExp(n->z,i,1,currRing-> algring);217 p_Setm(n->z,currRing-> algring);216 p_SetExp(n->z,i,1,currRing->extRing); 217 p_Setm(n->z,currRing->extRing); 218 218 } 219 219 else … … 235 235 tmpW.data=n->z; 236 236 if (n->n!=NULL) WarnS("ignoring denominators of coefficients..."); 237 if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,currRing-> algring,NULL,NULL,0,nMap))237 if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,currRing->extRing,NULL,NULL,0,nMap)) 238 238 { 239 239 WerrorS("map failed"); -
Singular/mpsr_PutPoly.cc
r5a4b26 r6ccdd3a 196 196 mp_failr(IMP_PutUint32(link, 1)); 197 197 mp_failr(IMP_PutUint32(link, GetPlength(b->z))); 198 return PutAlgPoly(link, b->z, CurrPutRing-> algring);198 return PutAlgPoly(link, b->z, CurrPutRing->extRing); 199 199 } 200 200 else … … 203 203 mp_failr(IMP_PutUint32(link, 2)); 204 204 mp_failr(IMP_PutUint32(link, GetPlength(b->z))); 205 failr(PutAlgPoly(link, b->z, CurrPutRing-> algring));205 failr(PutAlgPoly(link, b->z, CurrPutRing->extRing)); 206 206 mp_failr(IMP_PutUint32(link, GetPlength(b->n))); 207 return PutAlgPoly(link, b->n, CurrPutRing-> algring);207 return PutAlgPoly(link, b->n, CurrPutRing->extRing); 208 208 } 209 209 } … … 419 419 // alg numbers 420 420 // create temporary ring for describing the coeeficient domain 421 ring alg_r = r-> algring;421 ring alg_r = r->extRing; 422 422 alg_r->minpoly = r->minpoly; 423 423 -
Singular/walk.cc
r5a4b26 r6ccdd3a 1950 1950 res->VarOffset = NULL; 1951 1951 res->ref=0; 1952 if (currRing-> algring!=NULL)1953 currRing-> algring->ref++;1952 if (currRing->extRing!=NULL) 1953 currRing->extRing->ref++; 1954 1954 1955 1955 if (currRing->parameter!=NULL) … … 2029 2029 r->VarOffset = NULL; 2030 2030 r->ref=0; 2031 if (currRing-> algring!=NULL)2032 currRing-> algring->ref++;2031 if (currRing->extRing!=NULL) 2032 currRing->extRing->ref++; 2033 2033 2034 2034 if (currRing->parameter!=NULL) -
kernel/structs.h
r5a4b26 r6ccdd3a 582 582 p_SetmProc p_Setm; 583 583 n_Procs_s* cf; 584 ring algring;584 ring extRing; 585 585 #ifdef HAVE_PLURAL 586 586 private: -
kernel/walkSupport.cc
r5a4b26 r6ccdd3a 1030 1030 res->VarOffset = NULL; 1031 1031 res->ref=0; 1032 if (r-> algring!=NULL)1033 r-> algring->ref++;1032 if (r->extRing!=NULL) 1033 r->extRing->ref++; 1034 1034 if (r->parameter!=NULL) 1035 1035 { -
libpolys/coeffs/coeffs.h
r5a4b26 r6ccdd3a 180 180 /* for extension fields we need to be able to represent polynomials, 181 181 so here is the polynomial ring: */ 182 ring algring;182 ring extRing; 183 183 184 184 //number minpoly; //< no longer needed: replaced by 185 // //< algring->minideal->[0]185 // //< extRing->minideal->[0] 186 186 187 187 -
libpolys/polys/OBSOLETE_pInitContent.cc
r5a4b26 r6ccdd3a 107 107 while (c_n!=NULL) 108 108 { // each monom: coeff in Q 109 d=nlLcm(hzz,pGetCoeff(c_n),r-> algring);110 n_Delete(&hzz,r-> algring);109 d=nlLcm(hzz,pGetCoeff(c_n),r->extRing); 110 n_Delete(&hzz,r->extRing); 111 111 hzz=d; 112 112 pIter(c_n); … … 115 115 while (c_n!=NULL) 116 116 { // each monom: coeff in Q 117 d=nlLcm(h,pGetCoeff(c_n),r-> algring);118 n_Delete(&h,r-> algring);117 d=nlLcm(h,pGetCoeff(c_n),r->extRing); 118 n_Delete(&h,r->extRing); 119 119 h=d; 120 120 pIter(c_n); … … 127 127 number hzztmp=nlInvers(hzz); 128 128 number hh=nlMult(hzz,h); 129 nlDelete(&hzz,r-> algring);130 nlDelete(&h,r-> algring);131 number hg=nlGcd(hzztmp,htmp,r-> algring);132 nlDelete(&hzztmp,r-> algring);133 nlDelete(&htmp,r-> algring);129 nlDelete(&hzz,r->extRing); 130 nlDelete(&h,r->extRing); 131 number hg=nlGcd(hzztmp,htmp,r->extRing); 132 nlDelete(&hzztmp,r->extRing); 133 nlDelete(&htmp,r->extRing); 134 134 h=nlMult(hh,hg); 135 nlDelete(&hg,r-> algring);136 nlDelete(&hh,r-> algring);135 nlDelete(&hg,r->extRing); 136 nlDelete(&hh,r->extRing); 137 137 nlNormalize(h); 138 138 if(!nlIsOne(h)) … … 147 147 d=nlMult(h,pGetCoeff(c_n)); 148 148 nlNormalize(d); 149 nlDelete(&pGetCoeff(c_n),r-> algring);149 nlDelete(&pGetCoeff(c_n),r->extRing); 150 150 pGetCoeff(c_n)=d; 151 151 pIter(c_n); … … 156 156 d=nlMult(h,pGetCoeff(c_n)); 157 157 nlNormalize(d); 158 nlDelete(&pGetCoeff(c_n),r-> algring);158 nlDelete(&pGetCoeff(c_n),r->extRing); 159 159 pGetCoeff(c_n)=d; 160 160 pIter(c_n); … … 163 163 } 164 164 } 165 nlDelete(&h,r-> algring);165 nlDelete(&h,r->extRing); 166 166 } 167 167 } -
libpolys/polys/clapconv.cc
r5a4b26 r6ccdd3a 169 169 for ( i = rVar(r); i>0 ; i-- ) 170 170 p_SetExp( term, i , exp[i+var_start],r); 171 //if (rRing_has_Comp(currRing-> algring)) p_SetComp(term, 0, currRing->algring); // done by pInit171 //if (rRing_has_Comp(currRing->extRing)) p_SetComp(term, 0, currRing->extRing); // done by pInit 172 172 if (par_start==0) 173 173 { 174 174 for ( i = 1; i <= var_start; i++ ) 175 175 //z->e[i-1]+=exp[i]; 176 p_AddExp(z,i,exp[i],r-> algring);176 p_AddExp(z,i,exp[i],r->extRing); 177 177 } 178 178 else … … 180 180 for ( i = par_start+1; i <= var_start+rPar(currRing); i++ ) 181 181 //z->e[i-1]+=exp[i]; 182 p_AddExp(z,i,exp[i-par_start],r-> algring);182 p_AddExp(z,i,exp[i-par_start],r->extRing); 183 183 } 184 184 pGetCoeff(term)=(number)ALLOC0_LNUMBER(); … … 226 226 } 227 227 } 228 if ( (e = p_GetExp( p, 1, r-> algring )) != 0 )228 if ( (e = p_GetExp( p, 1, r->extRing )) != 0 ) 229 229 term *= power( a , e ); 230 230 result += term; … … 237 237 { 238 238 if ( f.isImm() ) 239 return n_Init( f.intval(), r-> algring );239 return n_Init( f.intval(), r->extRing ); 240 240 else 241 241 { … … 271 271 // pNext( t ) = NULL; //already done by napNew 272 272 pGetCoeff(t)=convFactoryNSingAN( i.coeff(), r ); 273 if (n_IsZero(napGetCoeff(t),r-> algring))274 { 275 p_Delete(&t,r-> algring);273 if (n_IsZero(napGetCoeff(t),r->extRing)) 274 { 275 p_Delete(&t,r->extRing); 276 276 } 277 277 else 278 278 { 279 p_SetExp(t,1,i.exp(),r-> algring);280 a=p_Add_q(a,t,r-> algring);279 p_SetExp(t,1,i.exp(),r->extRing); 280 a=p_Add_q(a,t,r->extRing); 281 281 } 282 282 } … … 286 286 { 287 287 lnumber l=(lnumber)r->minpoly; 288 if (p_GetExp(a,1,r-> algring) >= p_GetExp(l->z,1,r->algring))288 if (p_GetExp(a,1,r->extRing) >= p_GetExp(l->z,1,r->extRing)) 289 289 a = napRemainder( a, l->z); 290 290 } … … 302 302 { 303 303 n_Normalize(pGetCoeff(p),r); 304 CanonicalForm term=convSingPFactoryP(((lnumber)pGetCoeff(p))->z,r-> algring);304 CanonicalForm term=convSingPFactoryP(((lnumber)pGetCoeff(p))->z,r->extRing); 305 305 306 306 if ((((lnumber)pGetCoeff(p))->n!=NULL) … … 353 353 p_SetExp( term, i ,exp[i], r); 354 354 //if (rRing_has_Comp(currRing)) p_SetComp(term, 0, currRing); // done by pInit 355 pGetCoeff(term)=(number) ALLOC0_LNUMBER();356 ((lnumber)pGetCoeff(term))->z=convFactoryPSingP( f, r-> algring );355 pGetCoeff(term)=(number)omAlloc0Bin(rnumber_bin); 356 ((lnumber)pGetCoeff(term))->z=convFactoryPSingP( f, r->extRing ); 357 357 p_Setm( term,r ); 358 358 result = p_Add_q( result, term,r ); -
libpolys/polys/clapsing.cc
r5a4b26 r6ccdd3a 281 281 pIter(p); 282 282 } 283 g = convSingPFactoryP( ((lnumber)g1)->z, r->cf-> algring );284 g = gcd( g, convSingPFactoryP( ((lnumber)g2)->z , r->cf-> algring));283 g = convSingPFactoryP( ((lnumber)g1)->z, r->cf->extRing ); 284 g = gcd( g, convSingPFactoryP( ((lnumber)g2)->z , r->cf->extRing)); 285 285 286 286 // second run: gcd's … … 289 289 while ( (p != NULL) && (g != 1) && ( g != 0)) 290 290 { 291 h = convSingPFactoryP( ((lnumber)pGetCoeff(p))->z, r->cf-> algring );291 h = convSingPFactoryP( ((lnumber)pGetCoeff(p))->z, r->cf->extRing ); 292 292 pIter( p ); 293 293 … … 307 307 { 308 308 lnumber c=(lnumber)pGetCoeff(p); 309 p_Delete(&c->z,r->cf-> algring); // 2nd arg used to be nacRing310 c->z=convFactoryPSingP( i.getItem() / g, r->cf-> algring );309 p_Delete(&c->z,r->cf->extRing); // 2nd arg used to be nacRing 310 c->z=convFactoryPSingP( i.getItem() / g, r->cf->extRing ); 311 311 //nTest((number)c); 312 312 //#ifdef LDEBUG … … 514 514 else if (rField_is_Extension(r)) 515 515 { 516 if (r->cf-> algring->minideal!=NULL)517 { 518 CanonicalForm mipo=convSingPFactoryP(r->cf-> algring->minideal->m[0],519 r->cf-> algring);516 if (r->cf->extRing->minideal!=NULL) 517 { 518 CanonicalForm mipo=convSingPFactoryP(r->cf->extRing->minideal->m[0], 519 r->cf->extRing); 520 520 Variable a=rootOf(mipo); 521 521 CanonicalForm F( convSingPFactoryP( f,r ) ); … … 576 576 intvec *w=NULL; 577 577 if (v!=NULL) w=*v; 578 if (r->cf-> algring->minideal==NULL)578 if (r->cf->extRing->minideal==NULL) 579 579 { 580 580 if(!count_Factors(res,w,j,ff,convFactoryPSingP( J.getItem().factor(),r ),r)) … … 708 708 } 709 709 } 710 if (rField_is_Q_a(r) && (r->cf-> algring->minideal!=NULL))710 if (rField_is_Q_a(r) && (r->cf->extRing->minideal!=NULL)) 711 711 { 712 712 int i=IDELEMS(res)-1; … … 1228 1228 { 1229 1229 CanonicalForm mipo=convSingPFactoryP(((lnumber)currRing->minpoly)->z, 1230 currRing-> algring);1230 currRing->extRing); 1231 1231 Variable a=rootOf(mipo); 1232 1232 CanonicalForm F( convSingAFactoryA( f,a, currRing ) ), … … 1242 1242 else 1243 1243 { 1244 CanonicalForm F( convSingPFactoryP( f,currRing-> algring ) ),1245 G( convSingPFactoryP( g,currRing-> algring ) );1244 CanonicalForm F( convSingPFactoryP( f,currRing->extRing ) ), 1245 G( convSingPFactoryP( g,currRing->extRing ) ); 1246 1246 CanonicalForm GCD; 1247 1247 // calculate gcd … … 1249 1249 1250 1250 // calculate lcm 1251 res= convFactoryPSingP( (F/GCD)*G, currRing-> algring );1251 res= convFactoryPSingP( (F/GCD)*G, currRing->extRing ); 1252 1252 } 1253 1253 … … 1267 1267 { 1268 1268 CanonicalForm mipo=convSingPFactoryP(((lnumber)currRing->minpoly)->z, 1269 currRing-> algring);1269 currRing->extRing); 1270 1270 Variable a=rootOf(mipo); 1271 1271 CanonicalForm F( convSingAFactoryA( f,a, currRing ) ), … … 1283 1283 else 1284 1284 { 1285 CanonicalForm F( convSingPFactoryP( f,currRing-> algring ) ),1286 G( convSingPFactoryP( g,currRing-> algring ) );1285 CanonicalForm F( convSingPFactoryP( f,currRing->extRing ) ), 1286 G( convSingPFactoryP( g,currRing->extRing ) ); 1287 1287 CanonicalForm GCD; 1288 1288 … … 1291 1291 if ((GCD!=1) && (GCD!=0)) 1292 1292 { 1293 ff= convFactoryPSingP( F/ GCD, currRing-> algring );1294 gg= convFactoryPSingP( G/ GCD, currRing-> algring );1293 ff= convFactoryPSingP( F/ GCD, currRing->extRing ); 1294 gg= convFactoryPSingP( G/ GCD, currRing->extRing ); 1295 1295 } 1296 1296 } -
libpolys/polys/ext_fields/algext.cc
r5a4b26 r6ccdd3a 4 4 /* $Id$ */ 5 5 /* 6 * ABSTRACT: numbers in an algebraic extension field K (a)6 * ABSTRACT: numbers in an algebraic extension field K[a] / < f(a) > 7 7 * Assuming that we have a coeffs object cf, then these numbers 8 8 * are polynomials in the polynomial ring K[a] represented by 9 * cf-> algring.9 * cf->extRing. 10 10 * IMPORTANT ASSUMPTIONS: 11 * 1.) So far we assume that cf-> algring is a valid polynomial11 * 1.) So far we assume that cf->extRing is a valid polynomial 12 12 * ring in exactly one variable, i.e., K[a], where K is allowed 13 13 * to be any field (representable in SINGULAR and which may … … 15 15 * towers). 16 16 * 2.) Moreover, this implementation assumes that 17 * cf-> algring->minideal is not NULL but an ideal with at17 * cf->extRing->minideal is not NULL but an ideal with at 18 18 * least one non-zero generator which may be accessed by 19 * cf->algring->minideal->m[0] and which represents the minimal 20 * polynomial of the extension variable 'a' in K[a]. 19 * cf->extRing->minideal->m[0] and which represents the minimal 20 * polynomial f(a) of the extension variable 'a' in K[a]. 21 * 3.) As soon as an std method for polynomial rings becomes 22 * availabe, all reduction steps modulo f(a) should be replaced 23 * by a call to std. Moreover, in this situation one can finally 24 * move from K[a] / < f(a) > to 25 * K[a_1, ..., a_s] / I, with I some zero-dimensional ideal 26 * in K[a_1, ..., a_s] given by a lex 27 * Gröbner basis. 28 * The code in algext.h and algext.cc is then capable of 29 * computing in K[a_1, ..., a_s] / I. 21 30 */ 22 31 … … 98 107 while (nCoeff_is_Extension(cf)) 99 108 { 100 assume(cf-> algring != NULL); assume(cf->algring->cf != NULL);101 cf = cf-> algring->cf;109 assume(cf->extRing != NULL); assume(cf->extRing->cf != NULL); 110 cf = cf->extRing->cf; 102 111 height++; 103 112 } … … 229 238 Print("// with the minimal polynomial f(%s) = %s\n", x, 230 239 p_String(naMinpoly, naRing)); 231 PrintS("// and K: "); n_CoeffWrite(cf-> algring->cf);240 PrintS("// and K: "); n_CoeffWrite(cf->extRing->cf); 232 241 } 233 242 … … 379 388 /* basically, just write aAsPoly using p_Write, 380 389 but use brackets around the output, if a is not 381 a constant living in naCoeffs = cf-> algring->cf */390 a constant living in naCoeffs = cf->extRing->cf */ 382 391 BOOLEAN useBrackets = !(p_IsConstant(aAsPoly, naRing)); 383 392 if (useBrackets) StringAppendS("("); … … 409 418 } 410 419 411 /* expects *param to be castable to ExtInfo */420 /* expects *param to be castable to AlgExtInfo */ 412 421 static BOOLEAN naCoeffIsEqual(const coeffs cf, n_coeffType n, void * param) 413 422 { 414 423 if (naID != n) return FALSE; 415 ExtInfo *e = (ExtInfo *)param;424 AlgExtInfo *e = (AlgExtInfo *)param; 416 425 /* for extension coefficient fields we expect the underlying 417 426 polynomials rings to be IDENTICAL, i.e. the SAME OBJECT; … … 487 496 number naMap00(number a, const coeffs src, const coeffs dst) 488 497 { 489 assume(src == dst-> algring->cf);490 poly result = p_One(dst-> algring);491 p_SetCoeff(result, naCopy(a, src), dst-> algring);498 assume(src == dst->extRing->cf); 499 poly result = p_One(dst->extRing); 500 p_SetCoeff(result, naCopy(a, src), dst->extRing); 492 501 return (number)result; 493 502 } … … 498 507 /* mapping via intermediate int: */ 499 508 int n = n_Int(a, src); 500 number q = n_Init(n, dst-> algring->cf);501 poly result = p_One(dst-> algring);502 p_SetCoeff(result, q, dst-> algring);509 number q = n_Init(n, dst->extRing->cf); 510 poly result = p_One(dst->extRing); 511 p_SetCoeff(result, q, dst->extRing); 503 512 return (number)result; 504 513 } … … 514 523 number naMap0P(number a, const coeffs src, const coeffs dst) 515 524 { 516 int p = rChar(dst-> algring);525 int p = rChar(dst->extRing); 517 526 int n = nlModP(a, p, src); 518 number q = n_Init(n, dst-> algring->cf);519 poly result = p_One(dst-> algring);520 p_SetCoeff(result, q, dst-> algring);527 number q = n_Init(n, dst->extRing->cf); 528 poly result = p_One(dst->extRing); 529 p_SetCoeff(result, q, dst->extRing); 521 530 return (number)result; 522 531 } … … 525 534 number naMapPP(number a, const coeffs src, const coeffs dst) 526 535 { 527 assume(src == dst-> algring->cf);528 poly result = p_One(dst-> algring);529 p_SetCoeff(result, naCopy(a, src), dst-> algring);536 assume(src == dst->extRing->cf); 537 poly result = p_One(dst->extRing); 538 p_SetCoeff(result, naCopy(a, src), dst->extRing); 530 539 return (number)result; 531 540 } … … 536 545 /* mapping via intermediate int: */ 537 546 int n = n_Int(a, src); 538 number q = n_Init(n, dst-> algring->cf);539 poly result = p_One(dst-> algring);540 p_SetCoeff(result, q, dst-> algring);547 number q = n_Init(n, dst->extRing->cf); 548 poly result = p_One(dst->extRing); 549 p_SetCoeff(result, q, dst->extRing); 541 550 return (number)result; 542 551 } … … 576 585 if (nCoeff_is_Q(bSrc) && nCoeff_is_Q(bDst)) 577 586 { 578 if (strcmp(rParameter(src-> algring)[0],579 rParameter(dst-> algring)[0]) == 0)587 if (strcmp(rParameter(src->extRing)[0], 588 rParameter(dst->extRing)[0]) == 0) 580 589 return naCopyMap; /// Q(a) --> Q(a) 581 590 else … … 585 594 if (nCoeff_is_Zp(bSrc) && nCoeff_is_Zp(bDst)) 586 595 { 587 if (strcmp(rParameter(src-> algring)[0],588 rParameter(dst-> algring)[0]) == 0)596 if (strcmp(rParameter(src->extRing)[0], 597 rParameter(dst->extRing)[0]) == 0) 589 598 return naCopyMap; /// Z/p(a) --> Z/p(a) 590 599 else … … 599 608 assume( getCoeffType(cf) == naID ); 600 609 601 ExtInfo *e = (ExtInfo *)infoStruct;602 /// first check whether cf-> algring != NULL and delete old ring???603 cf-> algring = e->r;604 cf-> algring->minideal = e->i;605 606 assume(cf-> algring != NULL); // algring;607 assume((cf-> algring->minideal != NULL) && // minideal has one608 (IDELEMS(cf-> algring->minideal) != 0) && // non-zero generator609 (cf-> algring->minideal->m[0] != NULL) ); // at m[0];610 assume(cf-> algring->cf != NULL); // algring->cf;610 AlgExtInfo *e = (AlgExtInfo *)infoStruct; 611 /// first check whether cf->extRing != NULL and delete old ring??? 612 cf->extRing = e->r; 613 cf->extRing->minideal = e->i; 614 615 assume(cf->extRing != NULL); // extRing; 616 assume((cf->extRing->minideal != NULL) && // minideal has one 617 (IDELEMS(cf->extRing->minideal) != 0) && // non-zero generator 618 (cf->extRing->minideal->m[0] != NULL) ); // at m[0]; 619 assume(cf->extRing->cf != NULL); // extRing->cf; 611 620 assume(getCoeffType(cf) == naID); // coeff type; 612 621 613 622 /* propagate characteristic up so that it becomes 614 623 directly accessible in cf: */ 615 cf->ch = cf-> algring->cf->ch;624 cf->ch = cf->extRing->cf->ch; 616 625 617 626 #ifdef LDEBUG -
libpolys/polys/ext_fields/algext.h
r5a4b26 r6ccdd3a 6 6 /* $Id$ */ 7 7 /* 8 * ABSTRACT: numbers in an algebraic extension field K (a)8 * ABSTRACT: numbers in an algebraic extension field K[a] / < f(a) > 9 9 * Assuming that we have a coeffs object cf, then these numbers 10 10 * are polynomials in the polynomial ring K[a] represented by 11 * cf-> algring.11 * cf->extRing. 12 12 * IMPORTANT ASSUMPTIONS: 13 * 1.) So far we assume that cf-> algring is a valid polynomial13 * 1.) So far we assume that cf->extRing is a valid polynomial 14 14 * ring in exactly one variable, i.e., K[a], where K is allowed 15 15 * to be any field (representable in SINGULAR and which may … … 17 17 * towers). 18 18 * 2.) Moreover, this implementation assumes that 19 * cf-> algring->minideal is not NULL but an ideal with at19 * cf->extRing->minideal is not NULL but an ideal with at 20 20 * least one non-zero generator which may be accessed by 21 * cf->algring->minideal->m[0] and which represents the minimal 22 * polynomial of the extension variable 'a' in K[a]. 21 * cf->extRing->minideal->m[0] and which represents the minimal 22 * polynomial f(a) of the extension variable 'a' in K[a]. 23 * 3.) As soon as an std method for polynomial rings becomes 24 * availabe, all reduction steps modulo f(a) should be replaced 25 * by a call to std. Moreover, in this situation one can finally 26 * move from K[a] / < f(a) > to 27 * K[a_1, ..., a_s] / I, with I some zero-dimensional ideal 28 * in K[a_1, ..., a_s] given by a lex 29 * Gröbner basis. 30 * The code in algext.h and algext.cc is then capable of 31 * computing in K[a_1, ..., a_s] / I. 23 32 */ 33 24 34 #include <coeffs/coeffs.h> 25 35 … … 30 40 typedef struct sip_sideal * ideal; 31 41 32 /// struct for pass initialization parameters to naInitChar 33 typedef struct 34 { 35 ring r; 36 ideal i; 37 } ExtInfo; 42 /// struct for passing initialization parameters to naInitChar 43 typedef struct { ring r; ideal i; } AlgExtInfo; 38 44 39 45 /// Get a mapping function from src into the domain of this type (n_algExt) … … 87 93 88 94 /* polynomial ring in which our numbers live */ 89 #define naRing cf-> algring95 #define naRing cf->extRing 90 96 91 97 /* coeffs object in which the coefficients of our numbers live; … … 93 99 * coefficients of our numbers, e.g., use naCoeffs->nAdd to add 94 100 * coefficients of our numbers */ 95 #define naCoeffs cf-> algring->cf101 #define naCoeffs cf->extRing->cf 96 102 97 103 /* minimal polynomial */ -
libpolys/polys/ext_fields/longalg.cc
r5a4b26 r6ccdd3a 174 174 else if (i < 0) 175 175 { 176 n aIsChar0 = 0;177 npSetChar(-i, r-> algring); // to be changed HS176 ntIsChar0 = 0; 177 npSetChar(-i, r->extRing); // to be changed HS 178 178 } 179 179 #ifdef TEST … … 183 183 } 184 184 #endif 185 nacRing = r-> algring;185 nacRing = r->extRing; 186 186 nacInit = nacRing->cf->cfInit; 187 187 nacInt = nacRing->cf->n_Int; … … 950 950 if (i!=0) 951 951 { 952 number c=n_Init(i,r-> algring);953 if (!n_IsZero(c,r-> algring))954 { 955 poly z=p_Init(r-> algring);952 number c=n_Init(i,r->extRing); 953 if (!n_IsZero(c,r->extRing)) 954 { 955 poly z=p_Init(r->extRing); 956 956 pSetCoeff0(z,c); 957 957 lnumber l = (lnumber)omAllocBin(rnumber_bin); … … 1007 1007 { 1008 1008 lnumber l=(lnumber)n; 1009 if ((l!=NULL)&&(l->n==NULL)&&(p_IsConstant(l->z,r-> algring)))1010 { 1011 return nacInt(pGetCoeff(l->z),r-> algring);1009 if ((l!=NULL)&&(l->n==NULL)&&(p_IsConstant(l->z,r->extRing))) 1010 { 1011 return nacInt(pGetCoeff(l->z),r->extRing); 1012 1012 } 1013 1013 return 0; … … 1023 1023 lnumber l = (lnumber) * p; 1024 1024 if (l==NULL) return; 1025 p_Delete(&(l->z),r-> algring);1026 p_Delete(&(l->n),r-> algring);1025 p_Delete(&(l->z),r->extRing); 1026 p_Delete(&(l->n),r->extRing); 1027 1027 omFreeBin((void *)l, rnumber_bin); 1028 1028 } … … 1051 1051 lnumber src = (lnumber)p; 1052 1052 erg = (lnumber)omAlloc0Bin(rnumber_bin); 1053 erg->z = p_Copy(src->z,r-> algring);1054 erg->n = p_Copy(src->n,r-> algring);1053 erg->z = p_Copy(src->z,r->extRing); 1054 erg->n = p_Copy(src->n,r->extRing); 1055 1055 erg->s = src->s; 1056 1056 return (number)erg; … … 1715 1715 { 1716 1716 if (pNext(x->z)!=NULL) 1717 result->z = p_Copy(x->z, r-> algring);1717 result->z = p_Copy(x->z, r->extRing); 1718 1718 else 1719 1719 result->z = napGcd0(x->z, y->z); … … 1730 1730 poly rz=napGcd(x->z, y->z); 1731 1731 CanonicalForm F, G, R; 1732 R=convSingPFactoryP(rz,r-> algring);1732 R=convSingPFactoryP(rz,r->extRing); 1733 1733 p_Normalize(x->z,nacRing); 1734 F=convSingPFactoryP(x->z,r-> algring)/R;1734 F=convSingPFactoryP(x->z,r->extRing)/R; 1735 1735 p_Normalize(y->z,nacRing); 1736 G=convSingPFactoryP(y->z,r-> algring)/R;1736 G=convSingPFactoryP(y->z,r->extRing)/R; 1737 1737 F = gcd( F, G ); 1738 1738 if (F.isOne()) … … 1740 1740 else 1741 1741 { 1742 p_Delete(&rz,r-> algring);1743 result->z=convFactoryPSingP( F*R,r-> algring );1742 p_Delete(&rz,r->extRing); 1743 result->z=convFactoryPSingP( F*R,r->extRing ); 1744 1744 p_Normalize(result->z,nacRing); 1745 1745 } … … 2117 2117 naTest(la); 2118 2118 naTest(lb); 2119 poly x = p_Copy(a->z, r-> algring);2119 poly x = p_Copy(a->z, r->extRing); 2120 2120 number t = napLcm(b->z); // get all denom of b->z 2121 2121 if (!nacIsOne(t)) … … 2125 2125 while (xx!=NULL) 2126 2126 { 2127 bt = nacGcd(t, pGetCoeff(xx), r-> algring);2127 bt = nacGcd(t, pGetCoeff(xx), r->extRing); 2128 2128 rr = nacMult(t, pGetCoeff(xx)); 2129 n_Delete(&pGetCoeff(xx),r-> algring);2129 n_Delete(&pGetCoeff(xx),r->extRing); 2130 2130 pGetCoeff(xx) = nacDiv(rr, bt); 2131 2131 nacNormalize(pGetCoeff(xx)); 2132 n_Delete(&bt,r-> algring);2133 n_Delete(&rr,r-> algring);2132 n_Delete(&bt,r->extRing); 2133 n_Delete(&rr,r->extRing); 2134 2134 pIter(xx); 2135 2135 } 2136 2136 } 2137 n_Delete(&t,r-> algring);2137 n_Delete(&t,r->extRing); 2138 2138 result->z = x; 2139 2139 #ifdef HAVE_FACTORY … … 2141 2141 { 2142 2142 result->z=singclap_alglcm(result->z,b->n); 2143 p_Delete(&x,r-> algring);2143 p_Delete(&x,r->extRing); 2144 2144 } 2145 2145 #endif -
libpolys/polys/ext_fields/longtrans.cc
r5a4b26 r6ccdd3a 128 128 { 129 129 ntIsChar0 = 0; 130 npSetChar(-i, r-> algring); // to be changed HS130 npSetChar(-i, r->extRing); // to be changed HS 131 131 } 132 132 #ifdef TEST … … 136 136 } 137 137 #endif 138 nacRing = r-> algring;138 nacRing = r->extRing; 139 139 nacInit = nacRing->cf->cfInit; 140 140 nacInt = nacRing->cf->n_Int; … … 431 431 void napWrite(poly p, const BOOLEAN has_denom, const ring r) 432 432 { 433 ring nacring = r-> algring;433 ring nacring = r->extRing; 434 434 if (p == NULL) StringAppendS("0"); 435 435 else if (p_LmIsConstant(p, nacring)) … … 987 987 vs. ntSetMap */ 988 988 if (currRing->parameter!=NULL) 989 nMap=currRing-> algring->cf->cfSetMap(oldRing->algring, nacRing);989 nMap=currRing->extRing->cf->cfSetMap(oldRing->extRing, nacRing); 990 990 else 991 nMap=currRing->cf->cfSetMap(oldRing-> algring, currRing);991 nMap=currRing->cf->cfSetMap(oldRing->extRing, currRing); 992 992 if (nMap==NULL) return NULL; /* emergency exit only */ 993 993 while(za!=NULL) … … 1003 1003 if (currRing->parameter!=NULL) 1004 1004 { 1005 assume(oldRing-> algring!=NULL);1006 pGetCoeff(p)=(number) ALLOC0_LNUMBER();1005 assume(oldRing->extRing!=NULL); 1006 pGetCoeff(p)=(number)omAlloc0Bin(rnumber_bin); 1007 1007 pan=(lnumber)pGetCoeff(p); 1008 1008 pan->s=2; … … 1079 1079 if (x->n!=NULL) 1080 1080 { 1081 lnumber rr= ALLOC0_LNUMBER();1082 rr->z=p_Copy(x->n,r-> algring);1081 lnumber rr=(lnumber)omAlloc0Bin(rnumber_bin); 1082 rr->z=p_Copy(x->n,r->extRing); 1083 1083 rr->s = 2; 1084 1084 return (number)rr; … … 1090 1090 { 1091 1091 lnumber x=(lnumber)n; 1092 lnumber rr= ALLOC0_LNUMBER();1093 rr->z=p_Copy(x->z,r-> algring);1092 lnumber rr=(lnumber)omAlloc0Bin(rnumber_bin); 1093 rr->z=p_Copy(x->z,r->extRing); 1094 1094 rr->s = 2; 1095 1095 return (number)rr; … … 1105 1105 if (i!=0) 1106 1106 { 1107 number c=n_Init(i,r-> algring);1108 if (!n_IsZero(c,r-> algring))1109 { 1110 poly z=p_Init(r-> algring);1107 number c=n_Init(i,r->extRing); 1108 if (!n_IsZero(c,r->extRing)) 1109 { 1110 poly z=p_Init(r->extRing); 1111 1111 pSetCoeff0(z,c); 1112 1112 lnumber l = (lnumber)ALLOC_LNUMBER(); … … 1193 1193 { 1194 1194 lnumber l=(lnumber)n; 1195 if ((l!=NULL)&&(l->n==NULL)&&(p_IsConstant(l->z,r-> algring)))1196 { 1197 return nacInt(pGetCoeff(l->z),r-> algring);1195 if ((l!=NULL)&&(l->n==NULL)&&(p_IsConstant(l->z,r->extRing))) 1196 { 1197 return nacInt(pGetCoeff(l->z),r->extRing); 1198 1198 } 1199 1199 return 0; … … 1209 1209 lnumber l = (lnumber) * p; 1210 1210 if (l==NULL) return; 1211 p_Delete(&(l->z),r-> algring);1212 p_Delete(&(l->n),r-> algring);1213 FREE_LNUMBER(l);1211 p_Delete(&(l->z),r->extRing); 1212 p_Delete(&(l->n),r->extRing); 1213 omFreeBin((ADDRESS)l, rnumber_bin); 1214 1214 } 1215 1215 *p = NULL; … … 1236 1236 lnumber erg; 1237 1237 lnumber src = (lnumber)p; 1238 erg = ALLOC_LNUMBER();1239 erg->z = p_Copy(src->z,r-> algring);1240 erg->n = p_Copy(src->n,r-> algring);1238 erg = (lnumber)omAlloc0Bin(rnumber_bin); 1239 erg->z = p_Copy(src->z,r->extRing); 1240 erg->n = p_Copy(src->n,r->extRing); 1241 1241 erg->s = src->s; 1242 1242 return (number)erg; … … 1871 1871 poly rz=napGcd(x->z, y->z); 1872 1872 CanonicalForm F, G, R; 1873 R=convSingPFactoryP(rz,r-> algring);1873 R=convSingPFactoryP(rz,r->extRing); 1874 1874 p_Normalize(x->z,nacRing); 1875 F=convSingPFactoryP(x->z,r-> algring)/R;1875 F=convSingPFactoryP(x->z,r->extRing)/R; 1876 1876 p_Normalize(y->z,nacRing); 1877 G=convSingPFactoryP(y->z,r-> algring)/R;1877 G=convSingPFactoryP(y->z,r->extRing)/R; 1878 1878 F = gcd( F, G ); 1879 1879 if (F.isOne()) … … 1881 1881 else 1882 1882 { 1883 p_Delete(&rz,r-> algring);1884 result->z=convFactoryPSingP( F*R,r-> algring );1883 p_Delete(&rz,r->extRing); 1884 result->z=convFactoryPSingP( F*R,r->extRing ); 1885 1885 p_Normalize(result->z,nacRing); 1886 1886 } … … 2222 2222 ntTest(la); 2223 2223 ntTest(lb); 2224 poly x = p_Copy(a->z, r-> algring);2224 poly x = p_Copy(a->z, r->extRing); 2225 2225 number t = napLcm(b->z); // get all denom of b->z 2226 2226 if (!nacIsOne(t)) … … 2230 2230 while (xx!=NULL) 2231 2231 { 2232 bt = nacGcd(t, pGetCoeff(xx), r-> algring);2232 bt = nacGcd(t, pGetCoeff(xx), r->extRing); 2233 2233 rr = nacMult(t, pGetCoeff(xx)); 2234 n_Delete(&pGetCoeff(xx),r-> algring);2234 n_Delete(&pGetCoeff(xx),r->extRing); 2235 2235 pGetCoeff(xx) = nacDiv(rr, bt); 2236 2236 nacNormalize(pGetCoeff(xx)); 2237 n_Delete(&bt,r-> algring);2238 n_Delete(&rr,r-> algring);2237 n_Delete(&bt,r->extRing); 2238 n_Delete(&rr,r->extRing); 2239 2239 pIter(xx); 2240 2240 } 2241 2241 } 2242 n_Delete(&t,r-> algring);2242 n_Delete(&t,r->extRing); 2243 2243 result->z = x; 2244 2244 #ifdef HAVE_FACTORY … … 2246 2246 { 2247 2247 result->z=singclap_alglcm(result->z,b->n); 2248 p_Delete(&x,r-> algring);2248 p_Delete(&x,r->extRing); 2249 2249 } 2250 2250 #endif … … 2436 2436 nMapFunc nMap=ntSetMap(oldRing,currRing); 2437 2437 if (currRing->parameter!=NULL) 2438 nMap=currRing-> algring->cf->cfSetMap(oldRing->algring, nacRing);2438 nMap=currRing->extRing->cf->cfSetMap(oldRing->extRing, nacRing); 2439 2439 else 2440 nMap=currRing->cf->cfSetMap(oldRing-> algring, currRing);2440 nMap=currRing->cf->cfSetMap(oldRing->extRing, currRing); 2441 2441 if (nMap==NULL) return NULL; /* emergency exit only */ 2442 2442 do … … 2453 2453 if (currRing->parameter!=NULL) 2454 2454 { 2455 assume(oldRing-> algring!=NULL);2456 pGetCoeff(p)=(number) ALLOC0_LNUMBER();2455 assume(oldRing->extRing!=NULL); 2456 pGetCoeff(p)=(number)omAlloc0Bin(rnumber_bin); 2457 2457 pan=(lnumber)pGetCoeff(p); 2458 2458 pan->s=2; … … 2524 2524 if (x->n!=NULL) 2525 2525 { 2526 lnumber rr= ALLOC0_LNUMBER();2527 rr->z=p_Copy(x->n,r-> algring);2526 lnumber rr=(lnumber)omAlloc0Bin(rnumber_bin); 2527 rr->z=p_Copy(x->n,r->extRing); 2528 2528 rr->s = 2; 2529 2529 return (number)rr; … … 2535 2535 { 2536 2536 lnumber x=(lnumber)n; 2537 lnumber rr= ALLOC0_LNUMBER();2538 rr->z=p_Copy(x->z,r-> algring);2537 lnumber rr=(lnumber)omAlloc0Bin(rnumber_bin); 2538 rr->z=p_Copy(x->z,r->extRing); 2539 2539 rr->s = 2; 2540 2540 return (number)rr; -
libpolys/polys/ext_fields/longtrans.h
r5a4b26 r6ccdd3a 121 121 /* for computing with polynomials living in nacRing */ 122 122 poly napPermNumber(number z, int * par_perm, int P, ring r); 123 #define napAddExp(p,i,e) (p_AddExp(p,i,e,currRing-> algring))123 #define napAddExp(p,i,e) (p_AddExp(p,i,e,currRing->extRing)) 124 124 #define napLength(p) pLength(p) 125 #define napNeg(p) (p_Neg(p,currRing-> algring))125 #define napNeg(p) (p_Neg(p,currRing->extRing)) 126 126 #define napVariables naNumbOfPar 127 127 #define napGetCoeff(p) pGetCoeff(p) 128 #define napGetExpFrom(p,i,r) (p_GetExp(p,i,r-> algring))129 #define napSetExp(p,i,e) (p_SetExp(p,i,e,currRing-> algring))130 #define napNew() (p_Init(currRing-> algring))131 #define napAdd(p1,p2) (p_Add_q(p1,p2,currRing-> algring))132 #define napSetm(p) p_Setm(p,currRing-> algring)128 #define napGetExpFrom(p,i,r) (p_GetExp(p,i,r->extRing)) 129 #define napSetExp(p,i,e) (p_SetExp(p,i,e,currRing->extRing)) 130 #define napNew() (p_Init(currRing->extRing)) 131 #define napAdd(p1,p2) (p_Add_q(p1,p2,currRing->extRing)) 132 #define napSetm(p) p_Setm(p,currRing->extRing) 133 133 #define napCopy(p) p_Copy(p,nacRing) 134 134 #define napSetCoeff(p,n) {n_Delete(&pGetCoeff(p),nacRing);pGetCoeff(p)=n;} -
libpolys/polys/monomials/p_polys.cc
r5a4b26 r6ccdd3a 2067 2067 while (c_n!=NULL) 2068 2068 { // each monom: coeff in Q 2069 d=nlLcm(hzz,pGetCoeff(c_n),r-> algring->cf);2070 n_Delete(&hzz,r-> algring->cf);2069 d=nlLcm(hzz,pGetCoeff(c_n),r->extRing->cf); 2070 n_Delete(&hzz,r->extRing->cf); 2071 2071 hzz=d; 2072 2072 pIter(c_n); … … 2075 2075 while (c_n!=NULL) 2076 2076 { // each monom: coeff in Q 2077 d=nlLcm(h,pGetCoeff(c_n),r-> algring->cf);2078 n_Delete(&h,r-> algring->cf);2077 d=nlLcm(h,pGetCoeff(c_n),r->extRing->cf); 2078 n_Delete(&h,r->extRing->cf); 2079 2079 h=d; 2080 2080 pIter(c_n); … … 2084 2084 /* hzz contains the 1/lcm of all denominators in c_n_n->z*/ 2085 2085 /* h contains the 1/lcm of all denominators in c_n_n->n*/ 2086 number htmp=nlInvers(h,r-> algring->cf);2087 number hzztmp=nlInvers(hzz,r-> algring->cf);2088 number hh=nlMult(hzz,h,r-> algring->cf);2089 nlDelete(&hzz,r-> algring->cf);2090 nlDelete(&h,r-> algring->cf);2091 number hg=nlGcd(hzztmp,htmp,r-> algring->cf);2092 nlDelete(&hzztmp,r-> algring->cf);2093 nlDelete(&htmp,r-> algring->cf);2094 h=nlMult(hh,hg,r-> algring->cf);2095 nlDelete(&hg,r-> algring->cf);2096 nlDelete(&hh,r-> algring->cf);2097 nlNormalize(h,r-> algring->cf);2098 if(!nlIsOne(h,r-> algring->cf))2086 number htmp=nlInvers(h,r->extRing->cf); 2087 number hzztmp=nlInvers(hzz,r->extRing->cf); 2088 number hh=nlMult(hzz,h,r->extRing->cf); 2089 nlDelete(&hzz,r->extRing->cf); 2090 nlDelete(&h,r->extRing->cf); 2091 number hg=nlGcd(hzztmp,htmp,r->extRing->cf); 2092 nlDelete(&hzztmp,r->extRing->cf); 2093 nlDelete(&htmp,r->extRing->cf); 2094 h=nlMult(hh,hg,r->extRing->cf); 2095 nlDelete(&hg,r->extRing->cf); 2096 nlDelete(&hh,r->extRing->cf); 2097 nlNormalize(h,r->extRing->cf); 2098 if(!nlIsOne(h,r->extRing->cf)) 2099 2099 { 2100 2100 p=ph; … … 2105 2105 while (c_n!=NULL) 2106 2106 { // each monom: coeff in Q 2107 d=nlMult(h,pGetCoeff(c_n),r-> algring->cf);2108 nlNormalize(d,r-> algring->cf);2109 nlDelete(&pGetCoeff(c_n),r-> algring->cf);2107 d=nlMult(h,pGetCoeff(c_n),r->extRing->cf); 2108 nlNormalize(d,r->extRing->cf); 2109 nlDelete(&pGetCoeff(c_n),r->extRing->cf); 2110 2110 pGetCoeff(c_n)=d; 2111 2111 pIter(c_n); … … 2114 2114 while (c_n!=NULL) 2115 2115 { // each monom: coeff in Q 2116 d=nlMult(h,pGetCoeff(c_n),r-> algring->cf);2117 nlNormalize(d,r-> algring->cf);2118 nlDelete(&pGetCoeff(c_n),r-> algring->cf);2116 d=nlMult(h,pGetCoeff(c_n),r->extRing->cf); 2117 nlNormalize(d,r->extRing->cf); 2118 nlDelete(&pGetCoeff(c_n),r->extRing->cf); 2119 2119 pGetCoeff(c_n)=d; 2120 2120 pIter(c_n); … … 2123 2123 } 2124 2124 } 2125 nlDelete(&h,r-> algring->cf);2125 nlDelete(&h,r->extRing->cf); 2126 2126 #endif 2127 2127 } … … 3452 3452 lnumber c=(lnumber)pGetCoeff(qq); 3453 3453 if (c->z->next==NULL) 3454 p_AddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst-> algring);3454 p_AddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst->extRing); 3455 3455 else /* more difficult: we have really to multiply: */ 3456 3456 { 3457 3457 lnumber mmc=(lnumber)naInit(1,dst); 3458 p_SetExp(mmc->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst-> algring);3459 p_Setm(mmc->z,dst-> algring->cf);3458 p_SetExp(mmc->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst->extRing); 3459 p_Setm(mmc->z,dst->extRing->cf); 3460 3460 pGetCoeff(qq)=n_Mult((number)c,(number)mmc,dst->cf); 3461 3461 n_Delete((number *)&c,dst->cf); -
libpolys/polys/monomials/ring.cc
r5a4b26 r6ccdd3a 1388 1388 1389 1389 /* 1390 if (r-> algring!=NULL)1391 r-> algring->ref++;1390 if (r->extRing!=NULL) 1391 r->extRing->ref++; 1392 1392 1393 res-> algring=r->algring;1393 res->extRing=r->extRing; 1394 1394 //memset: res->minideal=NULL; 1395 1395 */ … … 1536 1536 { 1537 1537 if ( rMinpolyIsNULL(r2) ) return FALSE; 1538 if (! p_EqualPolys(r1->cf-> algring->minideal->m[0],1539 r2->cf-> algring->minideal->m[0],1540 r1->cf-> algring))1538 if (! p_EqualPolys(r1->cf->extRing->minideal->m[0], 1539 r2->cf->extRing->minideal->m[0], 1540 r1->cf->extRing)) 1541 1541 return FALSE; 1542 1542 } … … 1965 1965 1966 1966 if (!rMinpolyIsNULL(r)) 1967 omCheckAddr(r->cf-> algring->minideal->m[0]);1967 omCheckAddr(r->cf->extRing->minideal->m[0]); 1968 1968 1969 1969 //assume(r->cf!=NULL); … … 5372 5372 if( rField_is_Extension(r) ) 5373 5373 { 5374 const ring R = C-> algring;5374 const ring R = C->extRing; 5375 5375 assume( R != NULL ); 5376 5376 return idIs0(R->minideal); -
libpolys/polys/monomials/ring.h
r5a4b26 r6ccdd3a 544 544 if( rField_is_Extension(r) ) 545 545 { 546 const ring R = C-> algring;546 const ring R = C->extRing; 547 547 assume( R != NULL ); 548 548 return rVar( R ); … … 561 561 if( rField_is_Extension(r) ) 562 562 { 563 const ring R = C-> algring;563 const ring R = C->extRing; 564 564 assume( R != NULL ); 565 565 return R->names; -
libpolys/tests/polys_test.h
r5a4b26 r6ccdd3a 563 563 TS_ASSERT(type == n_algExt); 564 564 565 ExtInfo extParam;565 AlgExtInfo extParam; 566 566 extParam.r = r; 567 567 extParam.i = minIdeal; … … 619 619 620 620 poly u; 621 u = NULL; plusTerm(u, 1, 1, 1, cf-> algring);622 plusTerm(u, 1, 1, 0, cf-> algring); // a + 1623 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);624 u = NULL; plusTerm(u, 1, 1, 1, cf-> algring);625 plusTerm(u, -1, 1, 0, cf-> algring); // a - 1626 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);627 u = NULL; plusTerm(u, 1, 1, 1, cf-> algring);628 plusTerm(u, 5, 1, 0, cf-> algring); // a + 5629 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);630 u = NULL; plusTerm(u, 1, 1, 1, cf-> algring);631 plusTerm(u, -5, 1, 0, cf-> algring); // a - 5632 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);633 u = NULL; plusTerm(u, 17, 1, 1, cf-> algring);634 plusTerm(u, 5, 1, 0, cf-> algring); // 17a + 5635 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);621 u = NULL; plusTerm(u, 1, 1, 1, cf->extRing); 622 plusTerm(u, 1, 1, 0, cf->extRing); // a + 1 623 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 624 u = NULL; plusTerm(u, 1, 1, 1, cf->extRing); 625 plusTerm(u, -1, 1, 0, cf->extRing); // a - 1 626 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 627 u = NULL; plusTerm(u, 1, 1, 1, cf->extRing); 628 plusTerm(u, 5, 1, 0, cf->extRing); // a + 5 629 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 630 u = NULL; plusTerm(u, 1, 1, 1, cf->extRing); 631 plusTerm(u, -5, 1, 0, cf->extRing); // a - 5 632 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 633 u = NULL; plusTerm(u, 17, 1, 1, cf->extRing); 634 plusTerm(u, 5, 1, 0, cf->extRing); // 17a + 5 635 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 636 636 637 637 rDelete(s); // kills 'cf' and 'r' as well … … 664 664 TS_ASSERT(type == n_algExt); 665 665 666 ExtInfo extParam;666 AlgExtInfo extParam; 667 667 extParam.r = r; 668 668 extParam.i = minIdeal; … … 720 720 721 721 poly u; 722 u = NULL; plusTerm(u, 1, 1, 2, cf-> algring);723 plusTerm(u, 33, 1, 0, cf-> algring); // b^2 + 33724 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);725 u = NULL; plusTerm(u, 1, 1, 5, cf-> algring);726 plusTerm(u, -137, 1, 0, cf-> algring); // b^5 - 137727 checkInverse((number)u, cf); p_Delete(&u, cf-> algring);722 u = NULL; plusTerm(u, 1, 1, 2, cf->extRing); 723 plusTerm(u, 33, 1, 0, cf->extRing); // b^2 + 33 724 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 725 u = NULL; plusTerm(u, 1, 1, 5, cf->extRing); 726 plusTerm(u, -137, 1, 0, cf->extRing); // b^5 - 137 727 checkInverse((number)u, cf); p_Delete(&u, cf->extRing); 728 728 729 729 clog << endl … … 732 732 733 733 poly v; 734 v = NULL; plusTerm(v, 1, 1, 2, cf-> algring);735 plusTerm(v, 7, 1, 1, cf-> algring);736 plusTerm(v, 1, 1, 0, cf-> algring); // b^2 + 7b + 1734 v = NULL; plusTerm(v, 1, 1, 2, cf->extRing); 735 plusTerm(v, 7, 1, 1, cf->extRing); 736 plusTerm(v, 1, 1, 0, cf->extRing); // b^2 + 7b + 1 737 737 number w = n_Mult((number)v, (number)v, cf); // (b^2 + 7b + 1)^2 738 738 number y = n_Mult((number)v, (number)w, cf); // (b^2 + 7b + 1)^3 739 p_Delete(&v, cf-> algring);740 v = NULL; plusTerm(v, 2, 1, 2, cf-> algring);741 plusTerm(v, -61, 1, 1, cf-> algring); // 2b^2 - 61b739 p_Delete(&v, cf->extRing); 740 v = NULL; plusTerm(v, 2, 1, 2, cf->extRing); 741 plusTerm(v, -61, 1, 1, cf->extRing); // 2b^2 - 61b 742 742 number z = n_Mult((number)w, 743 743 (number)v, cf); // (b^2 + 7b + 1)^2 * (2b^2 - 61b) 744 p_Delete(&v, cf-> algring);745 746 clog << "z = "; p_Write((poly)z, cf-> algring);747 clog << "y = "; p_Write((poly)y, cf-> algring);744 p_Delete(&v, cf->extRing); 745 746 clog << "z = "; p_Write((poly)z, cf->extRing); 747 clog << "y = "; p_Write((poly)y, cf->extRing); 748 748 number theGcd = n_Gcd(z, y, cf); // should yield w = (b^2 + 7b + 1)^2 749 clog << "gcd(z, y) = "; p_Write((poly)theGcd, cf-> algring);749 clog << "gcd(z, y) = "; p_Write((poly)theGcd, cf->extRing); 750 750 751 751 v = (poly)n_Sub(theGcd, w, cf); 752 752 TS_ASSERT( v == NULL ); 753 p_Delete(&v, cf-> algring);753 p_Delete(&v, cf->extRing); 754 754 755 755 clog << endl … … 758 758 759 759 poly zFactor; poly yFactor; 760 poly ppp = p_ExtGcd((poly)z, zFactor, (poly)y, yFactor, cf-> algring);760 poly ppp = p_ExtGcd((poly)z, zFactor, (poly)y, yFactor, cf->extRing); 761 761 v = (poly)n_Sub(theGcd, (number)ppp, cf); 762 762 TS_ASSERT( v == NULL ); 763 clog << "z = "; p_Write((poly)z, cf-> algring);764 clog << "zFactor = "; p_Write(zFactor, cf-> algring);765 clog << "y = "; p_Write((poly)y, cf-> algring);766 clog << "yFactor = "; p_Write((poly)yFactor, cf-> algring);763 clog << "z = "; p_Write((poly)z, cf->extRing); 764 clog << "zFactor = "; p_Write(zFactor, cf->extRing); 765 clog << "y = "; p_Write((poly)y, cf->extRing); 766 clog << "yFactor = "; p_Write((poly)yFactor, cf->extRing); 767 767 number v1 = n_Mult(z, (number)zFactor, cf); 768 768 number v2 = n_Mult(y, (number)yFactor, cf); 769 769 number v3 = n_Add(v1, v2, cf); 770 clog << "z * zFactor + y * yFactor = "; p_Write((poly)v3, cf-> algring);771 clog << "gcd(z, y) = "; p_Write(ppp, cf-> algring);770 clog << "z * zFactor + y * yFactor = "; p_Write((poly)v3, cf->extRing); 771 clog << "gcd(z, y) = "; p_Write(ppp, cf->extRing); 772 772 number v4 = n_Sub(v3, w, cf); 773 773 TS_ASSERT( v4 == NULL ); 774 774 775 p_Delete(&ppp, cf-> algring); p_Delete(&zFactor, cf->algring);776 p_Delete(&yFactor, cf-> algring);775 p_Delete(&ppp, cf->extRing); p_Delete(&zFactor, cf->extRing); 776 p_Delete(&yFactor, cf->extRing); 777 777 n_Delete(&z, cf); n_Delete(&y, cf); n_Delete(&w, cf); 778 n_Delete(&theGcd, cf); p_Delete(&v, cf-> algring); n_Delete(&v1, cf);778 n_Delete(&theGcd, cf); p_Delete(&v, cf->extRing); n_Delete(&v1, cf); 779 779 n_Delete(&v2, cf); n_Delete(&v3, cf); n_Delete(&v4, cf); 780 780 … … 808 808 TS_ASSERT(type == n_algExt); 809 809 810 ExtInfo extParam;810 AlgExtInfo extParam; 811 811 extParam.r = r; 812 812 extParam.i = minIdeal;
Note: See TracChangeset
for help on using the changeset viewer.