Changeset f41d12 in git
- Timestamp:
- Dec 13, 2011, 8:02:27 PM (11 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- 0943bdd5f1e662166add7c3fed483d8971bd4108
- Parents:
- 3ef9c82a32b5b066dbd0e7b53857aa1fe70108a5f78374aba946095faa511cce5808e17088898c1a
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_algorithm.h
r3ef9c8 rf41d12 70 70 CFFList factorize ( const CanonicalForm & f, const Variable & alpha ); 71 71 72 CFFList sqrFree ( const CanonicalForm & f );72 CFFList sqrFree ( const CanonicalForm & f, bool sort= false ); 73 73 74 74 bool isSqrFree ( const CanonicalForm & f ); -
factory/cf_factor.cc
r3ef9c8 rf41d12 26 26 #include "cf_algorithm.h" 27 27 #include "facFqFactorize.h" 28 #include "facFqSquarefree.h" 28 29 #include "cf_map.h" 29 30 #include "algext.h" … … 829 830 } 830 831 831 CFFList sqrFree ( const CanonicalForm & f )832 CFFList sqrFree ( const CanonicalForm & f, bool sort ) 832 833 { 833 834 // ASSERT( f.isUnivariate(), "multivariate factorization not implemented" ); … … 837 838 result = sqrFreeZ( f ); 838 839 else 839 result = sqrFreeFp( f ); 840 841 //return ( sort ? sortCFFList( result ) : result ); 840 { 841 Variable alpha; 842 if (hasFirstAlgVar (f, alpha)) 843 result = FqSqrf( f, alpha ); 844 else 845 result= FpSqrf (f); 846 } 847 if (sort) 848 { 849 CFFactor buf= result.getFirst(); 850 result.removeFirst(); 851 result= sortCFFList (result); 852 result.insert (buf); 853 } 842 854 return result; 843 855 } -
factory/fac_multivar.cc
r3ef9c8 rf41d12 361 361 { 362 362 if ( i.getItem().factor().inCoeffDomain() ) 363 { 364 if ( ! i.getItem().factor().isOne() ) 365 R.append( CFFactor( i.getItem().factor(), i.getItem().exp() ) ); 366 } 363 R.append( CFFactor( i.getItem().factor(), i.getItem().exp() ) ); 367 364 else 368 365 { -
factory/fac_sqrfree.cc
r3ef9c8 rf41d12 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 } -
libpolys/polys/clapsing.cc
r3ef9c8 rf41d12 1035 1035 number N=NULL; 1036 1036 number NN=NULL; 1037 number old_lead_coeff=n_Copy(pGetCoeff(f), r->cf); 1037 1038 1038 1039 if (!rField_is_Zp(r) && !rField_is_Zp_a(r)) /* Q, Q(a) */ … … 1154 1155 res->m[0]=p_One(r); 1155 1156 } 1156 } 1157 if (N!=NULL) 1158 { 1159 p_Mult_nn(res->m[0],N,r); 1160 n_Delete(&N,r->cf); 1161 N=NULL; 1162 } 1163 } 1164 if (rField_is_Q_a(r) && (r->cf->extRing->minideal!=NULL)) 1165 { 1166 int i=IDELEMS(res)-1; 1167 int stop=1; 1168 if (with_exps!=0) stop=0; 1169 for(;i>=stop;i--) 1170 { 1171 p_Norm(res->m[i],r); 1172 } 1173 if (with_exps==0) p_SetCoeff(res->m[0],old_lead_coeff,r); 1174 else n_Delete(&old_lead_coeff,r->cf); 1175 } 1176 else 1177 n_Delete(&old_lead_coeff,r->cf); 1157 1178 p_Delete(&f,r); 1158 1179 errorreported=save_errorreported; … … 1160 1181 if (res==NULL) 1161 1182 WerrorS( feNotImplemented ); 1183 if (NN!=NULL) 1184 { 1185 n_Delete(&NN,r->cf); 1186 } 1187 if (N!=NULL) 1188 { 1189 n_Delete(&N,r->cf); 1190 } 1162 1191 return res; 1163 1192 }
Note: See TracChangeset
for help on using the changeset viewer.