Changeset 44d5ad in git


Ignore:
Timestamp:
Jul 12, 2011, 2:09:23 PM (12 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
964389e50adfc08d7756a47697064d105b4d086b
Parents:
0afa076b284b40edfd3ac479c184b33b3cdc12b6
git-author:
Frank Seelisch <seelisch@mathematik.uni-kl.de>2011-07-12 14:09:23+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:39:14+01:00
Message:
added documentation in coeffs.h
Location:
libpolys/coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    r0afa07 r44d5ad  
    275275// the access methods (part 2):
    276276
    277 /// return a copy of a
     277/// return a copy of 'n'
    278278static inline number n_Copy(number n,    const coeffs r)
    279279{   assume(r != NULL); assume(r->cfCopy!=NULL); return r->cfCopy(n, r); }
    280280
     281/// delete 'p'
    281282static inline void   n_Delete(number* p, const coeffs r)
    282283{   assume(r != NULL); assume(r->cfDelete!= NULL); r->cfDelete(p, r); }
    283284
     285/// TRUE iff 'a' and 'b' represent the same number;
     286/// they may have different representations
    284287static inline BOOLEAN n_Equal(number a, number b, const coeffs r)
    285288{ assume(r != NULL); assume(r->cfEqual!=NULL); return r->cfEqual(a, b, r); }
    286289
     290/// TRUE iff 'n' represents the zero element
    287291static inline BOOLEAN n_IsZero(number n, const coeffs r)
    288292{ assume(r != NULL); assume(r->cfIsZero!=NULL); return r->cfIsZero(n,r); }
    289293
     294/// TRUE iff 'n' represents the one element
    290295static inline BOOLEAN n_IsOne(number n,  const coeffs r)
    291296{ assume(r != NULL); assume(r->cfIsOne!=NULL); return r->cfIsOne(n,r); }
    292297
     298/// TRUE iff 'n' represents the additive inverse of the one element, i.e. -1
    293299static inline BOOLEAN n_IsMOne(number n, const coeffs r)
    294300{ assume(r != NULL); assume(r->cfIsMOne!=NULL); return r->cfIsMOne(n,r); }
    295301
     302/// ordered fields: TRUE iff 'n' is positive;
     303/// in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long
     304///          representing n
     305/// in C:    TRUE iff (Im(n) != 0 and Im(n) >= 0) or
     306///                   (Im(n) == 0 and Re(n) >= 0)
     307/// in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0))
     308/// in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0)
     309///                            or (LC(numerator(n) is not a constant)
     310/// in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1)
     311/// in Z/mZ: TRUE iff the internal mpz is greater than zero
     312/// in Z: TRUE iff n > 0
     313///
     314/// !!! Recommendation: remove implementations for unordered fields
     315/// !!!                 and raise errors instead, in these cases
    296316static inline BOOLEAN n_GreaterZero(number n, const coeffs r)
    297 { assume(r != NULL); assume(r->cfGreaterZero!=NULL); return r->cfGreaterZero(n,r); }
     317{
     318  assume(r != NULL); assume(r->cfGreaterZero!=NULL);
     319  return r->cfGreaterZero(n,r);
     320}
     321
     322/// ordered fields: TRUE iff 'a' is larger than 'b';
     323/// in Z/pZ: TRUE iff la > lb, where la and lb are the long's representing
     324//                             a and b, respectively
     325/// in C:    TRUE iff (Im(a) > Im(b))
     326/// in K(a)/<p(a)>: TRUE iff (a != 0 and (b == 0 or deg(a) > deg(b))
     327/// in K(t_1, ..., t_n): TRUE only if one or both numerator polynomials are
     328///                      zero or if their degrees are equal. In this case,
     329///                      TRUE if LC(numerator(a)) > LC(numerator(b))
     330/// in Z/2^kZ: TRUE if n_DivBy(a, b)
     331/// in Z/mZ: TRUE iff the internal mpz's fulfill the relation '>'
     332/// in Z: TRUE iff a > b
     333///
     334/// !!! Recommendation: remove implementations for unordered fields
     335/// !!!                 and raise errors instead, in these cases
    298336static inline BOOLEAN n_Greater(number a, number b, const coeffs r)
    299337{ assume(r != NULL); assume(r->cfGreater!=NULL); return r->cfGreater(a,b,r); }
    300338
    301339#ifdef HAVE_RINGS
     340/// TRUE iff n has a multiplicative inverse in the given coeff field/ring r
    302341static inline BOOLEAN n_IsUnit(number n, const coeffs r)
    303342{ assume(r != NULL); assume(r->cfIsUnit!=NULL); return r->cfIsUnit(n,r); }
    304343
     344/// in Z: 1
     345/// in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that
     346///                                   is co-prime with k
     347/// in Z/2^kZ: largest odd divisor of n (taken in Z)
     348/// other cases: not implemented
    305349static inline number n_GetUnit(number n, const coeffs r)
    306350{ assume(r != NULL); assume(r->cfGetUnit!=NULL); return r->cfGetUnit(n,r); }
    307351#endif
    308352
    309 /// init with an integer
     353/// a number representing i in the given coeff field/ring r
    310354static inline number n_Init(int i,       const coeffs r)
    311355{ assume(r != NULL); assume(r->cfInit!=NULL); return r->cfInit(i,r); }
    312356
    313 /// conversion to int; 0 if not possible
     357/// conversion of n to an int; 0 if not possible
     358/// in Z/pZ: the representing int lying in (-p/2 .. p/2]
    314359static inline int n_Int(number &n,       const coeffs r)
    315360{ assume(r != NULL); assume(r->cfInt!=NULL); return r->cfInt(n,r); }
    316361
    317 /// changes argument  inline: a:= -a
     362/// in-place negation of n
    318363static inline number n_Neg(number n,     const coeffs r)
    319364{ assume(r != NULL); assume(r->cfNeg!=NULL); return r->cfNeg(n,r); }
    320365
    321 /// return 1/a
     366/// return the multiplicative inverse of 'a';
     367/// raise an error if 'a' is not invertible
     368///
     369/// !!! Recommendation: rename to 'n_Inverse'
    322370static inline number n_Invers(number a,  const coeffs r)
    323371{ assume(r != NULL); assume(r->cfInvers!=NULL); return r->cfInvers(a,r); }
    324372
    325 /// use for pivot strategies, (0) => 0, otherwise positive
     373/// return a non-negative measure for the complexity of n;
     374/// return 0 only when n represents zero;
     375/// (used for pivot strategies in matrix computations with entries from r)
    326376static inline int    n_Size(number n,    const coeffs r)
    327377{ assume(r != NULL); assume(r->cfSize!=NULL); return r->cfSize(n,r); }
    328378
    329 /// normalize the number. i.e. go to some canonnical representation (inplace)
     379/// inplace-normalization of n;
     380/// produces some canonical representation of n;
     381///
     382/// !!! Recommendation: remove this method from the user-interface, i.e.,
     383/// !!!                 this should be hidden
    330384static inline void   n_Normalize(number& n, const coeffs r)
    331385{ assume(r != NULL); assume(r->cfNormalize!=NULL); r->cfNormalize(n,r); }
    332386
    333 /// Normalize and Write to the output buffer of reporter
     387/// write to the output buffer of the currently used reporter
    334388static inline void   n_Write(number& n,  const coeffs r)
    335389{ assume(r != NULL); assume(r->cfWrite!=NULL); r->cfWrite(n,r); }
    336390
    337 /// @todo: Describe me!!!
     391/// @todo: Describe me!!! --> Hans
     392///
     393/// !!! Recommendation: This method is to cryptic to be part of the user-
     394/// !!!                 interface. As defined here, it is merely a helper
     395/// !!!                 method for parsing number input strings.
    338396static inline const char *n_Read(const char * s, number * a, const coeffs r)
    339397{ assume(r != NULL); assume(r->cfRead!=NULL); return r->cfRead(s, a, r); }
    340398
    341 /// Normalize and get denomerator
     399/// return the denominator of n
     400/// (if elements of r are by nature not fractional, result is 1)
    342401static inline number n_GetDenom(number& n, const coeffs r)
    343402{ assume(r != NULL); assume(r->cfGetDenom!=NULL); return r->cfGetDenom(n, r); }
    344403
    345 /// Normalize and get numerator
     404/// return the numerator of n
     405/// (if elements of r are by nature not fractional, result is n)
    346406static inline number n_GetNumerator(number& n, const coeffs r)
    347407{ assume(r != NULL); assume(r->cfGetNumerator!=NULL); return r->cfGetNumerator(n, r); }
    348408
     409/// fill res with the power a^b
    349410static inline void   n_Power(number a, int b, number *res, const coeffs r)
    350411{ assume(r != NULL); assume(r->cfPower!=NULL); r->cfPower(a,b,res,r); }
    351412
     413/// return the product of 'a' and 'b', i.e., a*b
    352414static inline number n_Mult(number a, number b, const coeffs r)
    353415{ assume(r != NULL); assume(r->cfMult!=NULL); return r->cfMult(a, b, r); }
    354416
    355 /// Inplace multiplication: a := a * b
     417/// multiplication of 'a' and 'b';
     418/// replacement of 'a' by the product a*b
    356419static inline void n_InpMult(number &a, number b, const coeffs r)
    357420{ assume(r != NULL); assume(r->cfInpMult!=NULL); r->cfInpMult(a,b,r); }
    358421
     422/// return the difference of 'a' and 'b', i.e., a-b
    359423static inline number n_Sub(number a, number b, const coeffs r)
    360424{ assume(r != NULL); assume(r->cfSub!=NULL); return r->cfSub(a, b, r); }
    361425
     426/// return the sum of 'a' and 'b', i.e., a+b
    362427static inline number n_Add(number a, number b, const coeffs r)
    363428{ assume(r != NULL); assume(r->cfAdd!=NULL); return r->cfAdd(a, b, r); }
    364429
     430/// return the quotient of 'a' and 'b', i.e., a/b;
     431/// raise an error if 'b' is not invertible in r
    365432static inline number n_Div(number a, number b, const coeffs r)
    366433{ assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); }
    367434
     435/// in Z: largest c such that c*b <= a
     436/// in Z/nZ, Z/2^kZ: computed as in the case Z (from integers representing
     437///                  'a' and 'b')
     438/// in Z/pZ: return a/b
     439/// in K(a)/<p(a)>: return a/b
     440/// in K(t_1, ..., t_n): return a/b
     441/// other fields: not implemented
    368442static inline number n_IntDiv(number a, number b, const coeffs r)
    369443{ assume(r != NULL); assume(r->cfIntDiv!=NULL); return r->cfIntDiv(a,b,r); }
    370444
     445/// @todo: Describe me!!!
     446///
     447/// What is the purpose of this method, especially in comparison with
     448/// n_Div?
     449/// !!! Recommendation: remove this method from the user-interface.
    371450static inline number n_ExactDiv(number a, number b, const coeffs r)
    372451{ assume(r != NULL); assume(r->cfExactDiv!=NULL); return r->cfExactDiv(a,b,r); }
    373452
     453/// in Z: return the gcd of 'a' and 'b'
     454/// in Z/nZ, Z/2^kZ: computed as in the case Z
     455/// in Z/pZ, C, R: not implemented
     456/// in Q: return the gcd of the numerators of 'a' and 'b'
     457/// in K(a)/<p(a)>: not implemented
     458/// in K(t_1, ..., t_n): not implemented
    374459static inline number n_Gcd(number a, number b, const coeffs r)
    375460{ assume(r != NULL); assume(r->cfGcd!=NULL); return r->cfGcd(a,b,r); }
    376461
     462/// in Z: return the lcm of 'a' and 'b'
     463/// in Z/nZ, Z/2^kZ: computed as in the case Z
     464/// in Z/pZ, C, R: not implemented
     465/// in Q: return the lcm of the numerators of 'a' and the denominator of 'b'
     466/// in K(a)/<p(a)>: not implemented
     467/// in K(t_1, ..., t_n): not implemented
    377468static inline number n_Lcm(number a, number b, const coeffs r)
    378469{ assume(r != NULL); assume(r->cfLcm!=NULL); return r->cfLcm(a,b,r); }
    379470
     471/// set the mapping function pointers for translating numbers from src to dst
    380472static inline nMapFunc n_SetMap(const coeffs src, const coeffs dst)
    381473{ assume(src != NULL && dst != NULL); assume(dst->cfSetMap!=NULL); return dst->cfSetMap(src,dst); }
    382474
    383 /// Tests whether n is a correct number: only used if LDEBUG is defined
     475/// test whether n is a correct number;
     476/// only used if LDEBUG is defined
    384477static inline BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r)
    385478{
     
    424517}
    425518
    426 /// Test whether a can be divided by b?
     519/// test whether 'a' is divisible 'b';
     520/// for r encoding a field: TRUE iff 'b' does not represent zero
     521/// in Z: TRUE iff 'b' divides 'a' (with remainder = zero)
     522/// in Z/nZ: TRUE iff (a = 0 and b divides n in Z) or
     523///                   (a != 0 and b/gcd(a, b) is co-prime with n, i.e.
     524///                                              a unit in Z/nZ)
     525/// in Z/2^kZ: TRUE iff ((a = 0 mod 2^k) and (b = 0 or b is a power of 2))
     526///                  or ((a, b <> 0) and (b/gcd(a, b) is odd))
    427527static inline BOOLEAN n_DivBy(number a, number b, const coeffs r)
    428528{
     
    517617{ assume(r != NULL); return getCoeffType(r)==n_CF; }
    518618
    519 /// TRUE, if the computation of the inverse is fast (i.e. prefer leading coeff. 1 over content)
     619/// TRUE, if the computation of the inverse is fast,
     620/// i.e. prefer leading coeff. 1 over content
    520621static inline BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
    521622{ assume(r != NULL); return r->has_simple_Inverse; }
    522 /* Z/2^n, Z/p, GF(p,n), R, long_R, long_C*/
    523 // /* { return (r->ch>1) || (r->ch== -1); } *//* Z/p, GF(p,n), R, long_R, long_C*/
    524 // #ifdef HAVE_RINGS
    525 // { return (r->ringtype > 0) || (r->ch>1) || ((r->ch== -1) && (r->float_len < 10)); } /* Z/2^n, Z/p, GF(p,n), R, long_R, long_C*/
    526 // #else
    527 // { return (r->ch>1) || ((r->ch== -1) && (r->float_len < 10)); } /* Z/p, GF(p,n), R, long_R, long_C*/
    528 // #endif
    529623
    530624/// TRUE if n_Delete/n_New are empty operations
    531625static inline BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
    532626{ assume(r != NULL); return r->has_simple_Alloc; }
    533 /* Z/p, GF(p,n), R, Ring_2toM: nCopy, nNew, nDelete are dummies*/
    534 // return (rField_is_Zp(r)
    535 //         || rField_is_GF(r)
    536 // #ifdef HAVE_RINGS
    537 //             || rField_is_Ring_2toM(r)
    538 // #endif
    539 //             || rField_is_R(r)); }
    540 
    541 /* TRUE iff r represents an algebraic extension field */
     627
     628/// TRUE iff r represents an algebraic extension field
    542629static inline BOOLEAN nCoeff_is_algExt(const coeffs r)
    543630{ assume(r != NULL); return (getCoeffType(r)==n_algExt); }
    544631
    545 /* TRUE iff r represents a transcendental extension field */
     632/// TRUE iff r represents a transcendental extension field
    546633static inline BOOLEAN nCoeff_is_transExt(const coeffs r)
    547634{ assume(r != NULL); return (getCoeffType(r)==n_transExt); }
     
    554641// HAVE_RINGS: cfDivComp, cfExtGcd...
    555642
    556 
    557 
    558643// Deprecated:
    559644static inline int n_GetChar(const coeffs r)
  • libpolys/coeffs/modulop.cc

    r0afa07 r44d5ad  
    6161
    6262/*2
    63 * convert a number to int (-p/2 .. p/2)
     63* convert a number to an int in (-p/2 .. p/2]
    6464*/
    6565int npInt(number &n, const coeffs r)
  • libpolys/coeffs/rmodulo2m.cc

    r0afa07 r44d5ad  
    278278}
    279279
    280 /* Is a divisible by b? There are two cases:
     280/* Is 'a' divisible by 'b'? There are two cases:
    281281   1) a = 0 mod 2^m; then TRUE iff b = 0 or b is a power of 2
    282    2) a, b <> 0; then TRUE iff b/gcd(a, b) is a unit mod 2^m
    283    TRUE iff b(gcd(a, b) is a unit */
     282   2) a, b <> 0; then TRUE iff b/gcd(a, b) is a unit mod 2^m */
    284283BOOLEAN nr2mDivBy (number a, number b, const coeffs r)
    285284{
Note: See TracChangeset for help on using the changeset viewer.