Changeset 6caa2a6 in git for factory/facFqSquarefree.h
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.