Changeset 8cb8e1 in git
- Timestamp:
- Apr 28, 2010, 2:53:08 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- db3180ca57d54e8d3b4f38b7dc0c1af1a3bdba44
- Parents:
- 77e585d91301adb39a7f4d69c34f795b82ace33a
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2010-04-28 14:53:08+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:49:01+01:00
- Location:
- coeffs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
coeffs/gnumpc.cc
r77e585 r8cb8e1 16 16 #include "gnumpfl.h" 17 17 #include "mpr_complex.h" 18 #include "output.h" 19 #include "omalloc.h" 18 20 19 21 extern size_t gmp_output_digits; 20 22 21 23 22 number ngcMapQ(number from )24 number ngcMapQ(number from, const coeffs) 23 25 { 24 26 if ( from != NULL ) … … 39 41 number N() const {return _n;} 40 42 }; 41 static number ngcMapLongR(number from )43 static number ngcMapLongR(number from, const coeffs) 42 44 { 43 45 if ( from != NULL ) … … 49 51 return NULL; 50 52 } 51 static number ngcMapR(number from )53 static number ngcMapR(number from, const coeffs) 52 54 { 53 55 if ( from != NULL ) … … 60 62 } 61 63 extern ring ngfMapRing; 62 static number ngcMapP(number from )64 static number ngcMapP(number from, const coeffs) 63 65 { 64 66 if ( from != NULL) … … 145 147 146 148 /*2 147 * copy a to b148 */ 149 number ngcCopy(number a )149 * copy a to b 150 */ 151 number ngcCopy(number a, const coeffs) 150 152 { 151 153 gmp_complex* b= new gmp_complex( *(gmp_complex*)a ); … … 163 165 gmp_complex ngc_m1(-1); 164 166 165 number ngcNeg (number a )167 number ngcNeg (number a, const coeffs) 166 168 { 167 169 gmp_complex* r=(gmp_complex*)a; … … 173 175 * 1/a 174 176 */ 175 number ngcInvers(number a )177 number ngcInvers(number a, const coeffs) 176 178 { 177 179 gmp_complex* r = NULL; … … 190 192 * u:= a + b 191 193 */ 192 number ngcAdd (number a, number b )194 number ngcAdd (number a, number b, const coeffs) 193 195 { 194 196 gmp_complex* r= new gmp_complex( (*(gmp_complex*)a) + (*(gmp_complex*)b) ); … … 199 201 * u:= a - b 200 202 */ 201 number ngcSub (number a, number b )203 number ngcSub (number a, number b, const coeffs R) 202 204 { 203 205 gmp_complex* r= new gmp_complex( (*(gmp_complex*)a) - (*(gmp_complex*)b) ); … … 217 219 * u := a / b 218 220 */ 219 number ngcDiv (number a, number b )221 number ngcDiv (number a, number b, const coeffs) 220 222 { 221 223 if (((gmp_complex*)b)->isZero()) … … 232 234 * u:= x ^ exp 233 235 */ 234 void ngcPower ( number x, int exp, number * u 236 void ngcPower ( number x, int exp, number * u, const coeffs R) 235 237 { 236 238 if ( exp == 0 ) … … 259 261 if (exp&1==1) 260 262 { 261 ngcPower(x,exp-1,u );263 ngcPower(x,exp-1,u, R); 262 264 gmp_complex *n=new gmp_complex(); 263 265 *n=*(gmp_complex*)x; … … 269 271 number w; 270 272 nNew(&w); 271 ngcPower(x,exp/2,&w );272 ngcPower(w,2,u );273 ngcPower(x,exp/2,&w, R); 274 ngcPower(w,2,u, R); 273 275 nDelete(&w); 274 276 } 275 277 } 276 278 277 BOOLEAN ngcIsZero (number a )279 BOOLEAN ngcIsZero (number a, const coeffs) 278 280 { 279 281 return ( ((gmp_complex*)a)->real().isZero() && ((gmp_complex*)a)->imag().isZero()); 280 282 } 281 283 282 number ngcRePart(number a )284 number ngcRePart(number a, const coeffs) 283 285 { 284 286 gmp_complex* n = new gmp_complex(((gmp_complex*)a)->real()); … … 286 288 } 287 289 288 number ngcImPart(number a )290 number ngcImPart(number a, const coeffs) 289 291 { 290 292 gmp_complex* n = new gmp_complex(((gmp_complex*)a)->imag()); … … 295 297 * za >= 0 ? 296 298 */ 297 BOOLEAN ngcGreaterZero (number a )299 BOOLEAN ngcGreaterZero (number a, const coeffs) 298 300 { 299 301 if ( ! ((gmp_complex*)a)->imag().isZero() ) … … 306 308 * a > b ? 307 309 */ 308 BOOLEAN ngcGreater (number a, number b )310 BOOLEAN ngcGreater (number a, number b, const coeffs) 309 311 { 310 312 gmp_complex *aa=(gmp_complex*)a; … … 316 318 * a = b ? 317 319 */ 318 BOOLEAN ngcEqual (number a, number b )320 BOOLEAN ngcEqual (number a, number b, const coeffs) 319 321 { 320 322 gmp_complex *aa=(gmp_complex*)a; … … 326 328 * a == 1 ? 327 329 */ 328 BOOLEAN ngcIsOne (number a )330 BOOLEAN ngcIsOne (number a, const coeffs) 329 331 { 330 332 return (((gmp_complex*)a)->real().isOne() && ((gmp_complex*)a)->imag().isZero()); … … 335 337 * a == -1 ? 336 338 */ 337 BOOLEAN ngcIsMOne (number a )339 BOOLEAN ngcIsMOne (number a, const coeffs) 338 340 { 339 341 return (((gmp_complex*)a)->real().isMOne() && ((gmp_complex*)a)->imag().isZero()); … … 344 346 * extracts the number a from s, returns the rest 345 347 */ 346 const char * ngcRead (const char * s, number * a )348 const char * ngcRead (const char * s, number * a, const coeffs R) 347 349 { 348 350 if ((*s >= '0') && (*s <= '9')) 349 351 { 350 352 gmp_float *re=NULL; 351 s=ngfRead(s,(number *)&re );353 s=ngfRead(s,(number *)&re, R); 352 354 gmp_complex *aa=new gmp_complex(*re); 353 355 *a=(number)aa; -
coeffs/gnumpc.h
r77e585 r8cb8e1 26 26 number ngcDiv(number a, number b, const coeffs r); 27 27 void ngcPower(number x, int exp, number *lu, const coeffs r); 28 number ngcCopy(number a );28 number ngcCopy(number a, const coeffs); 29 29 number ngc_Copy(number a, coeffs r); 30 30 const char * ngcRead (const char *s, number *a, const coeffs r); … … 35 35 36 36 #ifdef LDEBUG 37 BOOLEAN ngcDBTest(number a, const char *f, const int l );37 BOOLEAN ngcDBTest(number a, const char *f, const int l, const coeffs); 38 38 #endif 39 39 void ngcDelete(number *a, const coeffs r); -
coeffs/numbers.h
r77e585 r8cb8e1 114 114 115 115 116 #ifdef _TRY 117 #define rField_is_Q(r) nField_is_Q(r) 118 #define rField_is_long_R(r) nField_is_long_R(r) 119 #define rField_is_long_C(r) nField_is_long_C(r) 120 #define rField_is_R(r) nField_is_R(r) 121 #define rField_is_Zp(r) nField_is_Zp(r) 122 #endif 123 124 116 125 #ifdef HAVE_RINGS 117 126 static inline BOOLEAN nField_is_Zp(const coeffs r) … … 124 133 { return (r->ringtype == 0) && (r->ch == 0) && (r->parameter==NULL); } 125 134 135 126 136 static inline BOOLEAN nField_is_numeric(const coeffs r) /* R, long R, long C */ 127 137 { return (r->ringtype == 0) && (r->ch == -1); } … … 162 172 return FALSE; 163 173 } 174 164 175 #else 176 177 165 178 static inline BOOLEAN nField_is_Zp(const coeffs r) 166 179 { return (r->ch > 1) && (r->parameter==NULL); }
Note: See TracChangeset
for help on using the changeset viewer.