Changeset 6caa2a6 in git
- Timestamp:
- Mar 22, 2012, 2:12:44 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- 8baf483af507d28dd83b7b3ad71d29b53b7cab06
- Parents:
- 9ebec2d49d73d2930aed03c7b76f347cbf7537fa
- git-author:
- Martin Lee <martinlee84@web.de>2012-03-22 14:12:44+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-04-04 14:42:27+02:00
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqSquarefree.cc
r9ebec2 r6caa2a6 87 87 { 88 88 g= gcd (w, u); 89 if ( degree(g) > 0)89 if (!g.inCoeffDomain()) 90 90 result.append (CFFactor (g, j)); 91 91 w= w/g; … … 95 95 j++; 96 96 } 97 if ( degree(w) > 0)97 if (!w.inCoeffDomain()) 98 98 result.append (CFFactor (w, j)); 99 99 return result; … … 132 132 found= false; 133 133 CFFListIterator k= tmp2; 134 if (!k.hasItem() ) tmp2.append (j.getItem());134 if (!k.hasItem() && !j.getItem().factor().inCoeffDomain()) tmp2.append (j.getItem()); 135 135 else 136 136 { … … 144 144 } 145 145 } 146 if (found == false )146 if (found == false && !j.getItem().factor().inCoeffDomain()) 147 147 tmp2.append(j.getItem()); 148 148 } … … 172 172 i.getItem()= CFFactor (i.getItem().factor()/tmp, i.getItem().exp()); 173 173 j.getItem()= CFFactor (j.getItem().factor()/tmp, j.getItem().exp()); 174 if ( degree (tmp) > 0 && tmp.level() > 0)174 if (!tmp.inCoeffDomain()) 175 175 { 176 176 tmp= M (tmp); … … 182 182 for (CFFListIterator i= tmp2; i.hasItem(); i++) 183 183 { 184 if ( degree (i.getItem().factor()) > 0 && i.getItem().factor().level() >= 0)184 if (!i.getItem().factor().inCoeffDomain()) 185 185 { 186 186 tmp= M (i.getItem().factor()); … … 190 190 for (CFFListIterator j= tmp1; j.hasItem(); j++) 191 191 { 192 if ( degree (j.getItem().factor()) > 0 && j.getItem().factor().level() >= 0)192 if (!j.getItem().factor().inCoeffDomain()) 193 193 { 194 194 tmp= M (j.getItem().factor()); -
factory/facFqSquarefree.h
r9ebec2 r6caa2a6 19 19 #include "cf_assert.h" 20 20 #include "cf_factory.h" 21 21 #include "fac_sqrfree.h" 22 22 23 23 /// squarefree factorization over a finite field … … 37 37 /// @return a list of squarefree factors with multiplicity 38 38 inline 39 CFFList FpSqrf (const CanonicalForm& F ///< [in] a poly 39 CFFList FpSqrf (const CanonicalForm& F, ///< [in] a poly 40 bool sort= true ///< [in] sort factors by exponent? 40 41 ) 41 42 { 42 43 Variable a= 1; 43 CFFList result= squarefreeFactorization (F, a); 44 int n= F.level(); 45 CanonicalForm cont, bufF= F; 46 CFFList bufResult; 47 48 CFFList result; 49 for (int i= n; i >= 1; i++) 50 { 51 cont= content (bufF, i); 52 bufResult= squarefreeFactorization (cont, a); 53 if (bufResult.getFirst().factor().inCoeffDomain()) 54 bufResult.removeFirst(); 55 result= Union (result, bufResult); 56 bufF /= cont; 57 if (bufF.inCoeffDomain()) 58 break; 59 } 60 if (!bufF.inCoeffDomain()) 61 { 62 bufResult= squarefreeFactorization (bufF, a); 63 if (bufResult.getFirst().factor().inCoeffDomain()) 64 bufResult.removeFirst(); 65 result= Union (result, bufResult); 66 } 67 if (sort) 68 result= sortCFFList (result); 44 69 result.insert (CFFactor (Lc(F), 1)); 45 70 return result; … … 52 77 inline 53 78 CFFList FqSqrf (const CanonicalForm& F, ///< [in] a poly 54 const Variable& alpha ///< [in] algebraic variable 79 const Variable& alpha, ///< [in] algebraic variable 80 bool sort= true ///< [in] sort factors by exponent? 55 81 ) 56 82 { 57 CFFList result= squarefreeFactorization (F, alpha); 83 int n= F.level(); 84 CanonicalForm cont, bufF= F; 85 CFFList bufResult; 86 87 CFFList result; 88 for (int i= n; i >= 1; i++) 89 { 90 cont= content (bufF, i); 91 bufResult= squarefreeFactorization (cont, alpha); 92 if (bufResult.getFirst().factor().inCoeffDomain()) 93 bufResult.removeFirst(); 94 result= Union (result, bufResult); 95 bufF /= cont; 96 if (bufF.inCoeffDomain()) 97 break; 98 } 99 if (!bufF.inCoeffDomain()) 100 { 101 bufResult= squarefreeFactorization (bufF, alpha); 102 if (bufResult.getFirst().factor().inCoeffDomain()) 103 bufResult.removeFirst(); 104 result= Union (result, bufResult); 105 } 106 if (sort) 107 result= sortCFFList (result); 58 108 result.insert (CFFactor (Lc(F), 1)); 59 109 return result; … … 65 115 /// @return a list of squarefree factors with multiplicity 66 116 inline 67 CFFList GFSqrf (const CanonicalForm& F ///< [in] a poly 117 CFFList GFSqrf (const CanonicalForm& F, ///< [in] a poly 118 bool sort= true ///< [in] sort factors by exponent? 68 119 ) 69 120 { 70 121 ASSERT (CFFactory::gettype() == GaloisFieldDomain, 71 122 "GF as base field expected"); 72 Variable a= 1; 73 CFFList result= squarefreeFactorization (F, a); 74 result.insert (CFFactor (Lc(F), 1)); 75 return result; 123 return FpSqrf (F, sort); 76 124 } 77 125
Note: See TracChangeset
for help on using the changeset viewer.