- Timestamp:
- Nov 29, 2021, 3:12:38 PM (2 years ago)
- Branches:
- (u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
- Children:
- 1c90ae397653250439ad7f58016a650d1f64d3af
- Parents:
- 8e89a3717be03ec921eaaddd599f3dba8a2774be
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cfGcdAlgExt.cc
r8e89a3 reccae7 370 370 } 371 371 372 static void leadDeg(const CanonicalForm & f, int degs[]) 373 { // leading degree vector w.r.t. lex. monomial order x(i+1) > x(i) 374 // 'a' should point to an array of sufficient size level(f)+1 375 if(f.inCoeffDomain()) 376 return; 377 CanonicalForm tmp = f; 378 do 379 { 380 degs[tmp.level()] = tmp.degree(); 381 tmp = LC(tmp); 382 } 383 while(!tmp.inCoeffDomain()); 384 } 385 372 386 void tryBrownGCD( const CanonicalForm & F, const CanonicalForm & G, const CanonicalForm & M, CanonicalForm & result, bool & fail, bool topLevel ) 373 387 { // assume F,G are multivariate polys over Z/p(a) for big prime p, M "univariate" polynomial in an algebraic variable … … 530 544 return; 531 545 } 532 int *L = new int[mv+1]; // L is addressed by i from 2 to mv533 int *N = new int[mv+1];546 int L[mv+1]; 547 int N[mv+1]; 534 548 for(int i=2; i<=mv; i++) 535 549 L[i] = N[i] = 0; 536 L =leadDeg(f, L);537 N =leadDeg(g, N);550 leadDeg(f, L); 551 leadDeg(g, N); 538 552 CanonicalForm gamma; 539 553 TIMING_START (alg_euclid_p) … … 587 601 for(int i=2; i<=mv; i++) 588 602 dg_im[i] = 0; // reset (this is necessary, because some entries may not be updated by call to leadDeg) 589 dg_im = leadDeg(g_image, dg_im); // dg_im cannot be NIL-pointer603 leadDeg(g_image, dg_im); 590 604 if(isEqual(dg_im, L, 2, mv)) 591 605 { … … 786 800 for(int i=1; i<=mv; i++) // initialize 'bound', 'other' with zeros 787 801 bound[i] = other[i] = 0; 788 bound =leadDeg(f,bound); // 'bound' is set the leading degree vector of f789 other =leadDeg(g,other);802 leadDeg(f,bound); // 'bound' is set the leading degree vector of f 803 leadDeg(g,other); 790 804 for(int i=1; i<=mv; i++) // entry at i=0 not visited 791 805 if(other[i] < bound[i]) … … 831 845 for(int i=1; i<=mv; i++) 832 846 other[i] = 0; // reset (this is necessary, because some entries may not be updated by call to leadDeg) 833 other =leadDeg(Dp,other);847 leadDeg(Dp,other); 834 848 835 849 if(isEqual(bound, other, 1, mv)) // equal … … 918 932 919 933 920 int * leadDeg(const CanonicalForm & f, int *degs)921 { // leading degree vector w.r.t. lex. monomial order x(i+1) > x(i)922 // if f is in a coeff domain, the zero pointer is returned923 // 'a' should point to an array of sufficient size level(f)+1924 if(f.inCoeffDomain())925 return 0;926 CanonicalForm tmp = f;927 do928 {929 degs[tmp.level()] = tmp.degree();930 tmp = LC(tmp);931 }932 while(!tmp.inCoeffDomain());933 return degs;934 }935 936 934 937 935 bool isLess(int *a, int *b, int lower, int upper) -
factory/cfGcdAlgExt.h
r8e89a3 reccae7 35 35 void tryBrownGCD( const CanonicalForm & F, const CanonicalForm & G, const CanonicalForm & M, CanonicalForm & result, bool & fail, bool topLevel= true ); 36 36 37 int * leadDeg(const CanonicalForm & f, int *degs);38 37 bool isLess(int *a, int *b, int lower, int upper); 39 38 bool isEqual(int *a, int *b, int lower, int upper);
Note: See TracChangeset
for help on using the changeset viewer.