Changeset f78374 in git for factory/fac_sqrfree.cc
- Timestamp:
- Dec 13, 2011, 1:49:48 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- f41d12e69588befe7fc3383e41747d4ac6575de4
- Parents:
- 3ef9c82a32b5b066dbd0e7b53857aa1fe70108a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/fac_sqrfree.cc
r3ef9c8 rf78374 9 9 #include "canonicalform.h" 10 10 #include "cf_map.h" 11 #include "cf_algorithm.h" 11 12 12 13 static int divexp = 1; … … 140 141 if ( a.inCoeffDomain() ) 141 142 return CFFactor( a, 1 ); 142 CanonicalForm cont = content( a ); 143 CanonicalForm aa = a / cont; 143 CanonicalForm aa, LcA; 144 if (isOn (SW_RATIONAL)) 145 { 146 LcA= bCommonDen (a); 147 aa= a*LcA; 148 } 149 else 150 { 151 LcA= icontent (a); 152 if (lc (a).sign() < 0) 153 LcA= -LcA; 154 aa= a/LcA; 155 } 156 CanonicalForm cont = content( aa ); 157 aa /= cont; 144 158 CanonicalForm b = aa.deriv(), c = gcd( aa, b ); 145 159 CanonicalForm y, z, w = aa / c; … … 152 166 if ( degree( z, v ) > 0 ) 153 167 { 154 if ( lc( z ).sign() < 0 ) 155 F.append( CFFactor( -z, i ) ); 156 else 157 F.append( CFFactor( z, i ) ); 168 if (isOn (SW_RATIONAL)) 169 { 170 z /= Lc (z); 171 z *= bCommonDen (z); 172 } 173 if (lc (z).sign() < 0) 174 z= -z; 175 F.append( CFFactor( z, i ) ); 158 176 } 159 177 i++; … … 162 180 if ( degree( w,v ) > 0 ) 163 181 { 164 if ( lc( w ).sign() < 0 ) 165 F.append( CFFactor( -w, i ) ); 166 else 167 F.append( CFFactor( w, i ) ); 182 if (isOn (SW_RATIONAL)) 183 { 184 w /= Lc (w); 185 w *= bCommonDen (w); 186 } 187 if (lc (w).sign() < 0) 188 w= -w; 189 F.append( CFFactor( w, i ) ); 168 190 } 169 191 if ( ! cont.isOne() ) 170 F = Union( F, sqrFreeZ( cont ) ); 171 if ( lc( a ).sign() < 0 ) 172 { 173 if ( F.getFirst().exp() == 1 ) 174 { 175 CanonicalForm f = F.getFirst().factor(); 176 CFFListIterator(F).getItem() = CFFactor( -f, 1 ); 177 } 178 else 179 F.insert( CFFactor( -1, 1 ) ); 180 } 192 { 193 CFFList buf= sqrFreeZ (cont); 194 buf.removeFirst(); 195 F = Union( F, buf ); 196 } 197 F.insert (CFFactor (LcA, 1)); 181 198 return F; 182 199 }
Note: See TracChangeset
for help on using the changeset viewer.