Changeset 58603f in git for factory/FLINTconvert.cc
- Timestamp:
- Aug 4, 2019, 9:34:39 PM (5 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 2f9e3f171a90f561e7a3c81734eb72998dc8fe82
- Parents:
- 112c79d4f91036791f523bcfbb261d1ba63c2d8f557b878dd8c840afb5ec95de122ba27a0ec99926
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/FLINTconvert.cc
r112c79 r58603f 163 163 if (f.isImm ()) 164 164 { 165 fmpz_set_si (fmpq_numref (result), f.intval()); 166 fmpz_set_si (fmpq_denref (result), 1); 165 fmpq_set_si (result, f.intval(), 1); 167 166 } 168 167 else if(f.inQ()) … … 182 181 fmpz_set_mpz (fmpq_numref (result), gmp_val); 183 182 mpz_clear (gmp_val); 184 fmpz_ set_si (fmpq_denref (result), 1);183 fmpz_one(fmpq_denref(result)); 185 184 } 186 185 else … … 574 573 else 575 574 { 576 int c=f.intval(); 577 if (c<0) c+=getCharacteristic(); 575 int c=f.intval(); // with Off(SW_SYMMETRIC_FF): 0<=c<p 578 576 nmod_mpoly_push_term_ui_ui(result,c,exp,ctx); 579 577 } … … 608 606 ulong * exp = (ulong*)Alloc(N*sizeof(ulong)); 609 607 memset(exp,0,N*sizeof(ulong)); 608 bool save_sym_ff= isOn (SW_SYMMETRIC_FF); 609 if (save_sym_ff) Off (SW_SYMMETRIC_FF); 610 610 convFlint_RecPP( f, exp, res, ctx, N ); 611 if (save_sym_ff) On(SW_SYMMETRIC_FF); 611 612 Free(exp,N*sizeof(ulong)); 612 613 } … … 692 693 convFactoryPFlintMP(F,f,ctx,N); 693 694 convFactoryPFlintMP(G,g,ctx,N); 694 nmod_mpoly_init 3(res,lF+lG,bits+1,ctx);695 nmod_mpoly_init(res,ctx); 695 696 nmod_mpoly_mul(res,f,g,ctx); 696 697 nmod_mpoly_clear(g,ctx); … … 713 714 convFactoryPFlintMP(F,f,ctx,N); 714 715 convFactoryPFlintMP(G,g,ctx,N); 715 fmpq_mpoly_init 3(res,lF+lG,bits+1,ctx);716 fmpq_mpoly_init(res,ctx); 716 717 fmpq_mpoly_mul(res,f,g,ctx); 717 718 fmpq_mpoly_clear(g,ctx); … … 737 738 convFactoryPFlintMP(F,f,ctx,N); 738 739 convFactoryPFlintMP(G,g,ctx,N); 739 nmod_mpoly_init 3(res,lf,bits,ctx);740 nmod_mpoly_init(res,ctx); 740 741 int ok=nmod_mpoly_gcd(res,f,g,ctx); 741 742 nmod_mpoly_clear(g,ctx); … … 750 751 return RES; 751 752 } 753 754 static CanonicalForm b_content ( const CanonicalForm & f ) 755 { 756 if ( f.inCoeffDomain() ) 757 return f; 758 else 759 { 760 CanonicalForm result = 0; 761 CFIterator i; 762 for ( i = f; i.hasTerms() && (!result.isOne()); i++ ) 763 result=bgcd( b_content(i.coeff()) , result ); 764 return result; 765 } 766 } 767 752 768 753 769 CanonicalForm gcdFlintMP_QQ(const CanonicalForm& F, const CanonicalForm& G) … … 779 795 } 780 796 RES=convFlintMPFactoryP(res,ctx,N); 797 // gcd(2x,4x) should be 2x, so RES should also have the gcd(lc(F),lc(G)) 798 RES*=bgcd(b_content(F),b_content(G)); 781 799 } 782 800 fmpq_mpoly_clear(res,ctx);
Note: See TracChangeset
for help on using the changeset viewer.