Changeset 9fb610 in git
- Timestamp:
- Mar 10, 2007, 4:41:49 PM (17 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 88492ede6c4234be98e154a965829ff216366144
- Parents:
- 68c1c44e5af6cb14e14acff3b217f125b4e15830
- Location:
- kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/pInline1.h
r68c1c4 r9fb610 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline1.h,v 1. 8 2007-01-15 17:12:57 SingularExp $9 * Version: $Id: pInline1.h,v 1.9 2007-03-10 15:41:49 levandov Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE1_H … … 168 168 for(i=l;i<=k;i++) 169 169 { 170 np->exp[(r->VarOffset[i] & 0xffffff)] =0; 170 //np->exp[(r->VarOffset[i] & 0xffffff)] =0; 171 p_SetExp(np,i,0,r); 171 172 } 172 173 p_Setm(np,r); -
kernel/pInline2.h
r68c1c4 r9fb610 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline2.h,v 1.1 1 2007-03-04 22:56:16levandov Exp $9 * Version: $Id: pInline2.h,v 1.12 2007-03-10 15:41:49 levandov Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE2_H … … 159 159 for(;i<=r->N;i++) 160 160 { 161 if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE; 161 if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE; 162 // if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE; 162 163 } 163 164 return TRUE; -
kernel/ratgring.cc
r68c1c4 r9fb610 7 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: ratgring.cc,v 1. 5 2007-03-10 13:17:15 SingularExp $9 * Version: $Id: ratgring.cc,v 1.6 2007-03-10 15:41:49 levandov Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 65 65 if (q == NULL) return p; 66 66 poly res = p_Head(p,r); 67 while ( p_Comp_k_n(p, q, ishift, r))67 while ( (q!=NULL) && (p_Comp_k_n(p, q, ishift+1, r))) 68 68 { 69 69 res = p_Add_q(res,p_Head(q,r),r); 70 q = pNext( p);70 q = pNext(q); 71 71 } 72 72 return res; 73 73 } 74 74 75 /* TO TEST!!! */ 75 76 /* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials 76 77 have the same D-part */ … … 79 80 { 80 81 poly q = pNext(p); 81 poly res = p_Head(p,r); 82 poly res; // = p_Head(p,r); 83 res = p_GetExp_k_n(p, ishift+1, r->N, r); 84 p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r); 82 85 poly s; 83 while ( p_Comp_k_n(p, q, ishift, r) ) 84 { 85 s = p_GetExp_k_n(q, ishift, r->N, r); 86 while ((q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r))) 87 { 88 s = p_GetExp_k_n(q, ishift+1, r->N, r); 89 p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r); 86 90 res = p_Add_q(res,s,r); 87 q = pNext( p);91 q = pNext(q); 88 92 } 89 93 return res; 90 94 } 91 95 92 void p_LmDeleteAndNextRat(poly p, int ishift, ring r)96 void p_LmDeleteAndNextRat(poly *p, int ishift, ring r) 93 97 { 94 98 /* modifies p*/ 95 p_LmCheckPolyRing2(p, r); 96 while ( p_Comp_k_n(p, pNext(p), ishift, r) ) 97 { 98 p_LmDelete(&p,r); 99 } 100 } 99 Print("start: "); Print(" "); p_wrp(*p,r); 100 p_LmCheckPolyRing2(*p, r); 101 poly q = p_Head(*p,r); 102 // in the next line ishift is correct 103 while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift, r) )) 104 { 105 p_LmDelete(p,r); 106 Print("while: ");p_wrp(*p,r);Print(" "); 107 } 108 p_wrp(*p,r);Print(" "); 109 PrintS("end\n"); 110 p_LmDelete(&q,r); 111 } 112 113 /* to test!!! */ 114 /* ExpVector(pr) = ExpVector(p1) - ExpVector(p2) */ 115 void p_ExpVectorDiffRat(poly pr, poly p1, poly p2, int ishift, ring r) 116 { 117 p_LmCheckPolyRing1(p1, r); 118 p_LmCheckPolyRing1(p2, r); 119 p_LmCheckPolyRing1(pr, r); 120 int i; 121 poly t=pr; 122 Exponent_t e1,e2; 123 for (i=ishift+1 ; i<=r->N; i++) 124 { 125 e1 = p_GetExp(p1, i, r); 126 e2 = p_GetExp(p2, i, r); 127 // pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r)); 128 if (e1 < e2) 129 { 130 #ifdef PDEBUG 131 Print("negative ExpVectorDiff\n"); 132 #endif 133 p_Delete(&t,r); 134 break; 135 } 136 else 137 { 138 p_SetExp(t,i, e1-e2,r); 139 } 140 } 141 p_Setm(t,r); 142 } 143 144 145 101 146 102 147 /* returns ideal (u,v) s.t. up + vq = 0 */ … … 120 165 K = sh->m[0]; /* take just the first element - to be enhanced later */ 121 166 K1 = pTakeOutComp(&K, 1); // 1st component is taken out from K 122 // K2 = pTakeOutComp(&K, 2);123 p_SetCompP(K1,0,r);124 pShift(&K,-2); // 2nd component to 0th comp. 125 // K2 = pTakeOutComp(&K, 2); 126 p_SetCompP(K2,0,r);127 K2 = K;167 // pShift(&K,-2); // 2nd component to 0th comp. 168 K2 = pTakeOutComp(&K, 1); 169 // K2 = K; 170 171 Print("syz1: "); p_wrp(K1,r); 172 Print("syz2: "); p_wrp(K2,r); 128 173 129 174 /* checking signs before multiplying */ … … 134 179 bck2 = n_GreaterZero(ck2,r); 135 180 /* K1 <0, K2 <0 (-K1,-K2) */ 136 if ( !(bck1 && bck2) ) /* - , - */137 {138 K1 = p_Neg(K1,r);139 K2 = p_Neg(K2,r);140 }141 id Delete(&h);181 // if ( !(bck1 && bck2) ) /* - , - */ 182 // { 183 // K1 = p_Neg(K1,r); 184 // K2 = p_Neg(K2,r); 185 // } 186 id_Delete(&h,r); 142 187 h = idInit(2,1); 143 188 h->m[0] = p_Copy(K1,r); 144 189 h->m[1] = p_Copy(K2,r); 145 id Delete(&sh);190 id_Delete(&sh,r); 146 191 return(h); 147 192 } … … 322 367 int is = ishift; /* TODO */ 323 368 324 poly m 325 p_ExpVectorDiff (m, p2, p1, r); // includes X and D parts369 poly m = pOne(); 370 p_ExpVectorDiffRat(m, p2, p1, ishift, r); // includes X and D parts 326 371 //p_Setm(m,r); 327 m = p_GetExp_k_n(m,1,ishift-1,r); /* rat D-exp of m */372 // m = p_GetExp_k_n(m,1,ishift,r); /* rat D-exp of m */ 328 373 #ifdef PDEBUG 329 374 p_Test(m,r); … … 331 376 332 377 /* pSetComp(m,r)=0? */ 333 poly HH, H; 378 poly HH = NULL; 379 poly H = NULL; 334 380 HH = p_Copy(p_HeadRat(p1,is,r),r); // lm_D(g) 335 381 H = r->nc->p_Procs.mm_Mult_p(m, p_Copy(HH, r), r); // d^aplha lm_D(g) … … 338 384 poly P = p_Copy( p_GetCoeffRat(p2, is, r), r); 339 385 340 HH = p_Neg(HH, r); 341 poly out = p_Add_q(p_Copy(p1,r), HH, r); // out == t_g 386 // HH = p_Neg(HH, r); 387 // poly out = NULL; 388 // out = p_Add_q(p_Copy(p1,r), HH, r); // out == t_g 389 390 Print("f: "); p_wrp(p2,r); PrintS(" "); 391 Print("g: "); p_wrp(p1,r); PrintS(" "); 342 392 343 393 // alt: 344 // out = p_Copy(p1,r); 345 // p_LmDeleteAndNextRat(out, is, r); 394 poly out = p1; //p_Copy(p1,r); 395 p_LmDeleteAndNextRat(&out, is+1, r); // out == t_g 396 397 Print("t_g: "); p_wrp(out,r); 346 398 347 399 ideal ncsyz = ncGCD(P,K,r); … … 349 401 poly PP = p_Copy(ncsyz->m[1],r); // p' 350 402 351 HH = p_Copy(p_HeadRat(p2,is,r),r);352 HH = p_Neg(HH, r);353 p2 = p_Add_q(p2, HH, r); // t_f403 // HH = p_Copy(p_HeadRat(p2,is,r),r); 404 // HH = p_Neg(HH, r); 405 // p2 = p_Add_q(p2, HH, r); // t_f 354 406 355 407 // alt: 356 // p_LmDeleteAndNextRat(p2, is, r); 357 358 359 HH = p_Copy(p_HeadRat(H,is,r),r); 360 HH = p_Neg(HH, r); 361 H = p_Add_q(H, HH, r); // r_g 408 p_LmDeleteAndNextRat(&p2, is+1, r); // t_f 409 410 Print("t_f: "); p_wrp(p2,r); 411 412 // HH = p_Copy(p_HeadRat(H,is,r),r); 413 // HH = p_Neg(HH, r); 414 // H = p_Add_q(H, HH, r); // r_g 362 415 363 416 // alt: 364 // p_LmDeleteAndNextRat(H, is, r); 365 366 367 p2 = p_Mult_q(p2, KK, r); // p2 = k' t_f 417 p_LmDeleteAndNextRat(&H, is+1, r); // r_g 418 419 Print("r_g: "); p_wrp(H,r); 420 421 p2 = p_Mult_q(KK, p2, r); // p2 = k' t_f 368 422 p_Test(p2,r); 369 423 // p_Delete(&KK,r); 370 424 425 Print("k' t_f: "); p_wrp(p2,r); 426 371 427 out = r->nc->p_Procs.mm_Mult_p(m, out, r); // d^aplha t_g 372 428 p_Delete(&m,r); 373 429 430 Print("d^a t_g: "); p_wrp(out,r); 431 PrintS(" end reduction"); 374 432 out = p_Add_q(H, out, r); 375 433 p_Test(out,r); … … 381 439 return(out); 382 440 } 383 384 385 441 386 442 // return: FALSE, if there exists i in ishift..r->N, … … 402 458 * arrays reducer and red_length are [0..(rl-1)] 403 459 */ 404 int redRat (poly* h, poly *reducer, int *red_length,int rl, int ishift, ring r)460 int redRat (poly* h, poly *reducer, int *red_length, int rl, int ishift, ring r) 405 461 { 406 462 if ((*h)==NULL) return 0; … … 430 486 p_wrp(reducer[j],r); 431 487 } 432 poly hh=nc_rat_ReduceSpolyNew(*h, reducer[j], ishift, r); 433 p_Delete(h,r); *h=hh; 488 poly hh=nc_rat_ReduceSpolyNew(reducer[j], *h, ishift, r); 489 // p_Delete(h,r); 490 *h=hh; 434 491 if (TEST_OPT_DEBUG) 435 492 { -
kernel/ratgring.h
r68c1c4 r9fb610 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: ratgring.h,v 1. 3 2007-03-10 13:14:33 SingularExp $ */6 /* $Id: ratgring.h,v 1.4 2007-03-10 15:41:49 levandov Exp $ */ 7 7 /* 8 8 * ABSTRACT additional defines etc for --with-plural … … 26 26 poly p_HeadRat(poly p, int ishift, ring r); 27 27 28 void p_LmDeleteAndNextRat(poly p, int ishift, ring r); 28 void p_LmDeleteAndNextRat(poly *p, int ishift, ring r); 29 30 void p_ExpVectorDiffRat(poly pr, poly p1, poly p2, int ishift, ring r); 29 31 30 32 ideal ncGCD(poly p, poly q, ring r);
Note: See TracChangeset
for help on using the changeset viewer.