Changeset 498648 in git for factory/cf_chinese.cc
- Timestamp:
- Jun 27, 2011, 4:20:53 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
- Children:
- 29179092d0c3ba3d252b203cd763be600dd7b096
- Parents:
- 2ae57ff78cd82da1abf9ba52505c9ea78709e89c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_chinese.cc
r2ae57f r498648 20 20 #include "cf_iter.h" 21 21 22 #ifdef HAVE_NTL 23 #include "NTLconvert.h" 24 #endif 22 25 23 26 //{{{ void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew ) … … 199 202 if ( c.inCoeffDomain()) 200 203 { 201 result += power( x, i.exp() ) * Farey_n(c,q); 204 #ifdef HAVE_NTL 205 if (c.inZ() && isOn (SW_USE_NTL)) 206 { 207 ZZ NTLc= convertFacCF2NTLZZ (c); 208 bool lessZero= (sign (NTLc) == -1); 209 if (lessZero) 210 negate (NTLc, NTLc); 211 ZZ NTLq= convertFacCF2NTLZZ (q); 212 ZZ bound; 213 SqrRoot (bound, NTLq/2); 214 ZZ NTLnum, NTLden; 215 if (ReconstructRational (NTLnum, NTLden, NTLc, NTLq, bound, bound)) 216 { 217 if (lessZero) 218 negate (NTLnum, NTLnum); 219 CanonicalForm num= convertNTLZZX2CF (to_ZZX (NTLnum), Variable (1)); 220 CanonicalForm den= convertNTLZZX2CF (to_ZZX (NTLden), Variable (1)); 221 On (SW_RATIONAL); 222 result += power (x, i.exp())*(num/den); 223 Off (SW_RATIONAL); 224 } 225 } 226 else 227 #endif 228 result += power( x, i.exp() ) * Farey_n(c,q); 202 229 } 203 230 else
Note: See TracChangeset
for help on using the changeset viewer.