Changeset d4932a in git for factory/fac_sqrfree.cc
 Timestamp:
 Jun 25, 2010, 4:25:41 PM (14 years ago)
 Branches:
 (u'fiekerDuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
 Children:
 cedebce21b0dc12678683874874cce5b35d8c23d
 Parents:
 9919421a652e331106b0f71cb3996f006942bc13
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/fac_sqrfree.cc
r9919421 rd4932a 34 34 // join elements with the same degree 35 35 while ( I.hasItem() ) { 36 37 38 39 40 41 42 43 36 f = I.getItem().factor(); 37 exp = I.getItem().exp(); 38 I++; 39 while ( I.hasItem() && I.getItem().exp() == exp ) { 40 f *= I.getItem().factor(); 41 I++; 42 } 43 result.append( CFFactor( f, exp ) ); 44 44 } 45 45 … … 57 57 58 58 if ( ! leadcf.isOne() ) 59 59 t0 /= leadcf; 60 60 61 61 divexp = p; 62 62 while ( t0.degree(x) > 0 ) 63 63 { 64 65 66 67 64 t = gcd( t0, t0.deriv() ); 65 v = t0 / t; 66 k = 0; 67 while ( v.degree(x) > 0 ) 68 68 { 69 70 69 k = k+1; 70 if ( k % p == 0 ) 71 71 { 72 73 74 75 76 77 78 79 80 81 82 83 72 t /= v; 73 k = k+1; 74 } 75 w = gcd( t, v ); 76 h = v / w; 77 v = w; 78 t /= v; 79 if ( h.degree(x) > 0 ) 80 F.append( CFFactor( h/h.lc(), e*k ) ); 81 } 82 t0 = apply( t, divexpfunc ); 83 e = p * e; 84 84 } 85 85 if ( ! leadcf.isOne() ) 86 86 { 87 87 if ( !F.isEmpty() && (F.getFirst().exp() == 1) ) 88 88 { 89 90 91 92 89 leadcf = F.getFirst().factor() * leadcf; 90 F.removeFirst(); 91 } 92 F.insert( CFFactor( leadcf, 1 ) ); 93 93 } 94 94 return F; … … 117 117 while ( ! c.degree() == 0 ) 118 118 { 119 120 121 122 123 124 125 126 119 y = gcd( w, c ); z = w / y; 120 if ( degree( z ) > 0 ) 121 if ( lc( z ).sign() < 0 ) 122 F.append( CFFactor( z, i ) ); 123 else 124 F.append( CFFactor( z, i ) ); 125 i++; 126 w = y; c = c / y; 127 127 } 128 128 if ( degree( w ) > 0 ) 129 130 131 132 129 if ( lc( w ).sign() < 0 ) 130 F.append( CFFactor( w, i ) ); 131 else 132 F.append( CFFactor( w, i ) ); 133 133 return F; 134 134 } … … 138 138 { 139 139 if ( a.inCoeffDomain() ) 140 140 return CFFactor( a, 1 ); 141 141 CanonicalForm cont = content( a ); 142 142 CanonicalForm aa = a / cont; … … 148 148 while ( ! c.degree(v) == 0 ) 149 149 { 150 151 152 153 154 155 156 157 150 y = gcd( w, c ); z = w / y; 151 if ( degree( z, v ) > 0 ) 152 if ( lc( z ).sign() < 0 ) 153 F.append( CFFactor( z, i ) ); 154 else 155 F.append( CFFactor( z, i ) ); 156 i++; 157 w = y; c = c / y; 158 158 } 159 159 if ( degree( w,v ) > 0 ) 160 161 162 163 160 if ( lc( w ).sign() < 0 ) 161 F.append( CFFactor( w, i ) ); 162 else 163 F.append( CFFactor( w, i ) ); 164 164 if ( ! cont.isOne() ) 165 165 F = Union( F, sqrFreeZ( cont ) ); 166 166 if ( lc( a ).sign() < 0 ) 167 167 { 168 168 if ( F.getFirst().exp() == 1 ) 169 169 { 170 171 172 173 174 170 CanonicalForm f = F.getFirst().factor(); 171 CFFListIterator(F).getItem() = CFFactor( f, 1 ); 172 } 173 else 174 F.insert( CFFactor( 1, 1 ) ); 175 175 } 176 176 return F;
Note: See TracChangeset
for help on using the changeset viewer.