Changeset b12b7c in git
- Timestamp:
- Jun 16, 2010, 3:56:13 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- a296bb8b3051f16b293d46d397aec1747775e971
- Parents:
- 5dcc9a60fe5f6363361635bb231ee206f6a174b4
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2010-06-16 15:56:13+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:11+01:00
- Location:
- coeffs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
coeffs/coeffs.h
r5dcc9a6 rb12b7c 38 38 typedef mpz_ptr int_number; 39 39 #endif 40 41 //42 // the access macros:43 44 #define n_Copy(n, r) (r)->cfCopy(n,r)45 #define n_Delete(n, r) (r)->cfDelete(n,r)46 #define n_Mult(n1, n2, r) (r)->cfMult(n1, n2,r)47 #define n_Add(n1, n2, r) (r)->cfAdd(n1, n2,r)48 #define n_IsZero(n, r) (r)->cfIsZero(n,r)49 #define n_Equal(n1, n2, r) (r)->cfEqual(n1, n2,r)50 #define n_Neg(n, r) (r)->cfNeg(n,r)51 #define n_Sub(n1, n2, r) (r)->cfSub(n1, n2,r)52 #define n_GetChar(r) nInternalChar(r)53 #define n_Init(i, r) (r)->cfInit(i,r)54 #define n_IsOne(n, r) (r)->cfIsOne(n,r)55 #define n_IsMOne(n, r) (r)->cfIsMOne(n,r)56 #define n_GreaterZero(n, r) (r)->cfGreaterZero(n,r)57 #define n_Write(n, r) (r)->cfWrite(n,r)58 #define n_Normalize(n, r) (r)->cfNormalize(n,r)59 #define n_Gcd(a, b, r) (r)->cfGcd(a,b,r)60 #define n_IntDiv(a, b, r) (r)->cfIntDiv(a,b,r)61 #define n_Div(a, b, r) (r)->cfDiv(a,b,r)62 #define n_Invers(a, r) (r)->cfInvers(a,r)63 #define n_ExactDiv(a, b, r) (r)->cfExactDiv(a,b,r)64 // #define n_Test(a,r) (r)->cfDBTest(a,r,__FILE__,__LINE__)65 #define n_InpMult(a, b, r) (r)->cfInpMult(a,b,r)66 #define n_Power(a, b, res, r) (r)->cfPower(a,b,res,r)67 #define n_Size(n,r) (r)->cfSize(n,r)68 #define n_GetDenom(N,r) (r)->cfGetDenom((N),r)69 #define n_GetNumerator(N,r) (r)->cfGetNumerator((N),r)70 40 71 41 // and the routines w.r.t. currRing: … … 155 125 /// convertion, 0 if impossible 156 126 int (*cfInt)(number &n, const coeffs r); 127 157 128 #ifdef HAVE_RINGS 158 129 int (*cfDivComp)(number a,number b,const coeffs r); … … 161 132 number (*cfExtGcd)(number a, number b, number *s, number *t,const coeffs r); 162 133 #endif 134 163 135 /// changes argument inline: a:= -a 164 136 number (*cfNeg)(number a, const coeffs r); … … 182 154 (*cfIsMOne)(number a, const coeffs r), 183 155 (*cfGreaterZero)(number a, const coeffs r); 156 184 157 void (*cfPower)(number a, int i, number * result, const coeffs r); 185 158 number (*cfGetDenom)(number &n, const coeffs r); … … 200 173 #ifdef LDEBUG 201 174 /// Test: is "a" a correct number? 202 BOOLEAN (*cfDBTest)(number a, const char *f, const int l,const coeffs r);175 BOOLEAN (*cfDBTest)(number a, const char *f, const int l, const coeffs r); 203 176 #endif 204 177 … … 252 225 #define n_New(n, r) nNew(n) 253 226 254 static inline BOOLEAN n_DBTest(number a, const char *filename, const int linenumber, const coeffs r) 227 228 // the access methods: 229 230 /// return a copy of a 231 static inline number n_Copy(number n, const coeffs r){ return (r)->cfCopy(n, r); } 232 static inline void n_Delete(number* p, const coeffs r){ return (r)->cfDelete(p, r); } 233 234 static inline BOOLEAN n_AreEqual(number a, number b, const coeffs r){ return (r)->cfEqual(a, b, r); } 235 static inline BOOLEAN n_IsZero(number n, const coeffs r){ return (r)->cfIsZero(n,r); } 236 static inline BOOLEAN n_IsOne(number n, const coeffs r){ return (r)->cfIsOne(n,r); } 237 static inline BOOLEAN n_IsMOne(number n, const coeffs r){ return (r)->cfIsMOne(n,r); } 238 static inline BOOLEAN n_IsGreaterZero(number n, const coeffs r){ return (r)->cfGreaterZero(n,r); } 239 // cfGreater? 240 241 /// init with an integer 242 static inline number n_Init(int i, const coeffs r){ return (r)->cfInit(i,r); } 243 244 /// changes argument inline: a:= -a 245 static inline number n_Neg(number n, const coeffs r){ return (r)->cfNeg(n,r); } 246 247 /// return 1/a 248 static inline number n_Invers(number a, const coeffs r){ return (r)->cfInvers(a,r); } 249 250 /// how complicated, (0) => 0, otherwise positive 251 static inline int n_Size(number n, const coeffs r){ return (r)->cfSize(n,r); } 252 253 /// normalize the number. i.e. go to some canonnical representation (inplace) 254 static inline void n_Normalize(number& n, const coeffs r){ return (r)->cfNormalize(n,r); } 255 256 /// Normalize and Write 257 static inline void n_Write(number& n, const coeffs r){ return (r)->cfWrite(n,r); } 258 259 /// Normalize and get denomerator 260 static inline number n_GetDenom(number& n, const coeffs r){ return (r)->cfGetDenom(n, r); } 261 262 /// Normalize and get numerator 263 static inline number n_GetNumerator(number& n, const coeffs r){ return (r)->cfGetNumerator(n, r); } 264 265 static inline void n_Power(number a, int b, number *res, const coeffs r){ return (r)->cfPower(a,b,res,r); } 266 267 268 static inline number n_Mult(number a, number b, const coeffs r){ return (r)->cfMult(a, b, r); } 269 /// Inplace multiplication: a := a * b 270 static inline void n_InpMult(number &a, number b, const coeffs r){ return (r)->cfInpMult(a,b,r); } 271 272 static inline number n_Sub(number a, number b, const coeffs r){ return (r)->cfSub(a, b, r); } 273 static inline number n_Add(number a, number b, const coeffs r){ return (r)->cfAdd(a, b, r); } 274 275 static inline number n_Div(number a, number b, const coeffs r){ return (r)->cfDiv(a,b,r); } 276 static inline number n_IntDiv(number a, number b, const coeffs r){ return (r)->cfIntDiv(a,b,r); } 277 static inline number n_ExactDiv(number a, number b, const coeffs r){ return (r)->cfExactDiv(a,b,r); } 278 279 static inline number n_Gcd(number a, number b, const coeffs r){ return (r)->cfGcd(a,b,r); } 280 281 /// Tests whether n is a correct number. 282 static inline BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r) 255 283 { 256 284 #ifdef LDEBUG 257 return (r)->cfDBTest(a, filename, linenumber, r); 258 // return (r)->cfDBTest(a,r,filename,linenumber); // testing error message 285 return (r)->cfDBTest(n, filename, linenumber, r); 259 286 #else 260 287 return TRUE; … … 264 291 #define n_Test(a,r) n_DBTest(a, __FILE__, __LINE__, r) 265 292 266 #endif 267 293 // Missing wrappers for: 294 // cfIntMod, cfPar, cfParDeg, cfInt, cfRePart, cfImPart, cfRead, cfLcm, cfSetMap, cfName, cfInit_bigint 295 // HAVE_RINGS: cfDivComp, cfIsUnit, cfGetUnit, cfExtGcd... cfDivBy 296 297 298 // Deprecated: 299 static inline BOOLEAN n_GreaterZero(number n, const coeffs r){ return n_IsGreaterZero(n,r); } 300 static inline BOOLEAN n_Equal(number a, number b, const coeffs r){ return n_AreEqual(a, b, r); } 301 302 // Deprecated: 303 static inline int n_GetChar(const coeffs r){ return nInternalChar(r); } 304 305 #endif 306 -
coeffs/test.cc
r5dcc9a6 rb12b7c 19 19 bool Test(const coeffs r) 20 20 { 21 number a = r->cfInit(666, r);21 number a = n_Init(666, r); 22 22 n_Test(a,r); 23 23 24 number b = r->cfAdd(a, a, r);24 number b = n_Add(a, a, r); 25 25 n_Test(b,r); 26 26 27 StringSetS("a: "); r->cfWrite( a, r);PrintS(StringAppend("\n"));28 StringSetS("b: "); r->cfWrite( b, r);PrintS(StringAppend("\n"));27 StringSetS("a: "); n_Write(a, r);PrintS(StringAppend("\n")); 28 StringSetS("b: "); n_Write(b, r);PrintS(StringAppend("\n")); 29 29 30 r->cfDelete(&a, r);31 r->cfDelete(&b, r);30 n_Delete(&a, r); 31 n_Delete(&b, r); 32 32 33 33 return false;
Note: See TracChangeset
for help on using the changeset viewer.