Changeset fb0a2c0 in git
- Timestamp:
- Feb 8, 2007, 2:13:45 PM (16 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 45b750f46db46153c194606edbe187a53309d6dc
- Parents:
- 6968f1f960104183ebb0a3099dc1bd90ce83c771
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/tgb.cc
r6968f1 rfb0a2c0 5 5 * Computer Algebra System SINGULAR * 6 6 ****************************************/ 7 /* $Id: tgb.cc,v 1.12 5 2007-02-08 10:40:18bricken Exp $ */7 /* $Id: tgb.cc,v 1.126 2007-02-08 13:13:45 bricken Exp $ */ 8 8 /* 9 9 * ABSTRACT: slimgb and F4 implementation … … 20 20 #include "tgb_internal.h" 21 21 #include "tgbgauss.h" 22 #include "F4.h" 22 23 23 #include "digitech.h" 24 24 #include "gring.h" … … 2251 2251 public: 2252 2252 poly temp_term; 2253 #if ndef BUCKETS_FOR_NORO_RED2253 #ifdef NORO_RED_ARRAY_RESERVER 2254 2254 int reserved; 2255 2255 poly* recursionPolyBuffer; … … 2280 2280 poly lookup(poly term, BOOLEAN& succ, int & len); 2281 2281 NoroCache(){ 2282 #if ndef BUCKETS_FOR_NORO_RED2282 #ifdef NORO_RED_ARRAY_RESERVER 2283 2283 reserved=0; 2284 2284 recursionPolyBuffer=(poly*)omalloc(1000000*sizeof(poly)); … … 2286 2286 temp_term=pOne(); 2287 2287 } 2288 #if ndef BUCKETS_FOR_NORO_RED2288 #ifdef NORO_RED_ARRAY_RESERVER 2289 2289 poly* reserve(int n){ 2290 2290 poly* res=recursionPolyBuffer+reserved; … … 2303 2303 } 2304 2304 p_Delete(&temp_term,currRing); 2305 #if ndef BUCKETS_FOR_NORO_RED2305 #ifdef NORO_RED_ARRAY_RESERVER 2306 2306 omfree(recursionPolyBuffer); 2307 2307 #endif … … 2360 2360 poly noro_red(poly p, int &len, NoroCache* cache,slimgb_alg* c); 2361 2361 2362 poly noro_red_mon(poly t, int &len, BOOLEAN& changed, NoroCache* cache,slimgb_alg* c){ 2362 class MonRedRes{ 2363 public: 2364 poly p; 2365 number coef; 2366 BOOLEAN changed; 2367 int len; 2368 BOOLEAN onlyBorrowed; 2369 bool operator<(const MonRedRes& other) const{ 2370 int cmp=p_LmCmp(p,other.p,currRing); 2371 if ((cmp<0)||((cmp==0)&&((onlyBorrowed)&&(!(other.onlyBorrowed))))){ 2372 return true; 2373 } else return false; 2374 } 2375 }; 2376 2377 MonRedRes noro_red_mon(poly t, NoroCache* cache,slimgb_alg* c){ 2378 MonRedRes res_holder; 2363 2379 BOOLEAN succ; 2364 2380 //wrp(t); 2365 changed=TRUE;2366 poly cache_lookup=cache->lookup(t,succ, len);//don't own this yet2381 res_holder.changed=TRUE; 2382 poly cache_lookup=cache->lookup(t,succ, res_holder.len);//don't own this yet 2367 2383 if (succ){ 2368 2384 if (cache_lookup==t){ 2369 2385 //know they are equal 2370 len=1; 2371 changed=FALSE; 2372 return t; 2386 //res_holder.len=1; 2387 2388 res_holder.changed=FALSE; 2389 res_holder.p=t; 2390 res_holder.coef=npInit(1); 2391 res_holder.onlyBorrowed=FALSE; 2392 return res_holder; 2373 2393 } 2374 2394 poly t_new=ppMult_nn(cache_lookup,pGetCoeff(t)); 2375 2395 p_Delete(&t,c->r); 2376 return t_new; 2396 //res_holder.len=1; 2397 //res_holder.changed=TRUE; 2398 res_holder.p=t_new; 2399 res_holder.coef=npInit(1); 2400 res_holder.onlyBorrowed=FALSE; 2401 return res_holder; 2402 //return t_new; 2377 2403 } else { 2378 2404 unsigned long sev=p_GetShortExpVector(t,currRing); … … 2395 2421 res=pp_Mult_mm(pNext(c->strat->S[i]),exp_diff,c->r); 2396 2422 2397 len=c->strat->lenS[i]-1;2398 res=noro_red(res, len,cache,c);2423 res_holder.len=c->strat->lenS[i]-1; 2424 res=noro_red(res,res_holder.len,cache,c); 2399 2425 2400 2426 cache->insert(t,res,pLength(res)); … … 2402 2428 //p_Delete(&t_copy_mon,c->r); 2403 2429 res=pMult_nn(res,coef_bak); 2404 return res; 2430 res_holder.changed=TRUE; 2431 res_holder.p=res; 2432 res_holder.coef=npInit(1); 2433 res_holder.onlyBorrowed=FALSE; 2434 return res_holder; 2435 2405 2436 } else { 2406 2437 number coef_bak=p_GetCoeff(t,c->r); 2407 2438 number one=npInit(1); 2408 2439 p_SetCoeff(t,one,c->r); 2409 len=1;2410 cache->insert(t,t, len);2440 res_holder.len=1; 2441 cache->insert(t,t,res_holder.len); 2411 2442 p_SetCoeff(t,coef_bak,c->r); 2412 return t; 2443 //return t; 2444 res_holder.changed=FALSE; 2445 res_holder.p=t; 2446 2447 res_holder.coef=npInit(1); 2448 res_holder.onlyBorrowed=FALSE; 2449 return res_holder; 2413 2450 } 2414 2451 } … … 2440 2477 return NULL; 2441 2478 } 2442 if (len==1){ 2443 BOOLEAN changed; 2444 return noro_red_mon(p,len,changed,cache,c); 2445 } 2479 2446 2480 #ifdef BUCKETS_FOR_NORO_RED 2447 2481 kBucket_pt bucket=kBucketCreate(currRing); … … 2461 2495 pIter(p); 2462 2496 pNext(t)=NULL; 2463 int l;2497 //int l; 2464 2498 //poly reference=p_Head(t,c->r); 2465 BOOLEAN changed;2466 t=noro_red_mon(t,l,changed,cache,c);2467 if (!( changed)){2499 //BOOLEAN changed; 2500 MonRedRes red=noro_red_mon(t,cache,c); 2501 if (!(red.changed)){ 2468 2502 unchanged_size++; 2469 2503 if (unchanged_head){ 2470 pNext(unchanged_tail)= t;2504 pNext(unchanged_tail)=red.p; 2471 2505 pIter(unchanged_tail); 2472 2506 } else{ 2473 unchanged_tail= t;2474 unchanged_head= t;2507 unchanged_tail=red.p; 2508 unchanged_head=red.p; 2475 2509 } 2476 2510 } else{ 2477 assume( l==pLength(t));2511 assume(red.len==pLength(red.p)); 2478 2512 #ifdef BUCKETS_FOR_NORO_RED 2479 kBucket_Add_q(bucket, t,&l);2513 kBucket_Add_q(bucket,red.p,&red.len); 2480 2514 #else 2481 pre_buckets[pos++]= t;2515 pre_buckets[pos++]=red.p; 2482 2516 #endif 2483 2517 }
Note: See TracChangeset
for help on using the changeset viewer.