Changeset df98dd in git for libpolys/coeffs/coeffs.h
- Timestamp:
- Nov 19, 2014, 7:07:14 PM (10 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- ac000b6db9daa244791307cb7daa15521f68941e
- Parents:
- ca90c606ac5700642199c11e9336ebe0ffd08636
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-11-19 19:07:14+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-11-19 19:20:50+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/coeffs.h
rca90c60 rdf98dd 418 418 // test properties and type 419 419 /// Returns the type of coeffs domain 420 static inlinen_coeffType getCoeffType(const coeffs r)420 static FORCE_INLINE n_coeffType getCoeffType(const coeffs r) 421 421 { assume(r != NULL); return r->type; } 422 422 … … 426 426 427 427 /// "copy" coeffs, i.e. increment ref 428 static inlinecoeffs nCopyCoeff(const coeffs r)428 static FORCE_INLINE coeffs nCopyCoeff(const coeffs r) 429 429 { assume(r!=NULL); r->ref++; return r;} 430 430 … … 433 433 434 434 /// initialisations after each ring change 435 static inlinevoid nSetChar(const coeffs r)435 static FORCE_INLINE void nSetChar(const coeffs r) 436 436 { STATISTIC(nSetChar); assume(r!=NULL); assume(r->cfSetChar != NULL); r->cfSetChar(r); } 437 437 … … 441 441 442 442 /// Return the characteristic of the coeff. domain. 443 static inlineint n_GetChar(const coeffs r)443 static FORCE_INLINE int n_GetChar(const coeffs r) 444 444 { STATISTIC(n_GetChar); assume(r != NULL); return r->ch; } 445 445 … … 448 448 449 449 /// return a copy of 'n' 450 static inlinenumber n_Copy(number n, const coeffs r)450 static FORCE_INLINE number n_Copy(number n, const coeffs r) 451 451 { STATISTIC(n_Copy); assume(r != NULL); assume(r->cfCopy!=NULL); return r->cfCopy(n, r); } 452 452 453 453 /// delete 'p' 454 static inlinevoid n_Delete(number* p, const coeffs r)454 static FORCE_INLINE void n_Delete(number* p, const coeffs r) 455 455 { STATISTIC(n_Delete); assume(r != NULL); assume(r->cfDelete!= NULL); r->cfDelete(p, r); } 456 456 457 457 /// TRUE iff 'a' and 'b' represent the same number; 458 458 /// they may have different representations 459 static inlineBOOLEAN n_Equal(number a, number b, const coeffs r)459 static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r) 460 460 { STATISTIC(n_Equal); assume(r != NULL); assume(r->cfEqual!=NULL); return r->cfEqual(a, b, r); } 461 461 462 462 /// TRUE iff 'n' represents the zero element 463 static inlineBOOLEAN n_IsZero(number n, const coeffs r)463 static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r) 464 464 { STATISTIC(n_IsZero); assume(r != NULL); assume(r->cfIsZero!=NULL); return r->cfIsZero(n,r); } 465 465 466 466 /// TRUE iff 'n' represents the one element 467 static inlineBOOLEAN n_IsOne(number n, const coeffs r)467 static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r) 468 468 { STATISTIC(n_IsOne); assume(r != NULL); assume(r->cfIsOne!=NULL); return r->cfIsOne(n,r); } 469 469 470 470 /// TRUE iff 'n' represents the additive inverse of the one element, i.e. -1 471 static inlineBOOLEAN n_IsMOne(number n, const coeffs r)471 static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r) 472 472 { STATISTIC(n_IsMOne); assume(r != NULL); assume(r->cfIsMOne!=NULL); return r->cfIsMOne(n,r); } 473 473 … … 491 491 /// start with - 492 492 /// 493 static inlineBOOLEAN n_GreaterZero(number n, const coeffs r)493 static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r) 494 494 { STATISTIC(n_GreaterZero); assume(r != NULL); assume(r->cfGreaterZero!=NULL); return r->cfGreaterZero(n,r); } 495 495 … … 508 508 /// !!! Recommendation: remove implementations for unordered fields 509 509 /// !!! and raise errors instead, in these cases 510 static inlineBOOLEAN n_Greater(number a, number b, const coeffs r)510 static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r) 511 511 { STATISTIC(n_Greater); assume(r != NULL); assume(r->cfGreater!=NULL); return r->cfGreater(a,b,r); } 512 512 513 513 #ifdef HAVE_RINGS 514 static inlineint n_DivComp(number a, number b, const coeffs r)514 static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r) 515 515 { STATISTIC(n_DivComp); assume(r != NULL); assume(r->cfDivComp!=NULL); return r->cfDivComp (a,b,r); } 516 516 517 517 /// TRUE iff n has a multiplicative inverse in the given coeff field/ring r 518 static inlineBOOLEAN n_IsUnit(number n, const coeffs r)518 static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r) 519 519 { STATISTIC(n_IsUnit); assume(r != NULL); assume(r->cfIsUnit!=NULL); return r->cfIsUnit(n,r); } 520 520 … … 526 526 // CF: shold imply that n/GetUnit(n) is normalized in Z/kZ 527 527 // it would make more sense to return the inverse... 528 static inlinenumber n_GetUnit(number n, const coeffs r)528 static FORCE_INLINE number n_GetUnit(number n, const coeffs r) 529 529 { STATISTIC(n_GetUnit); assume(r != NULL); assume(r->cfGetUnit!=NULL); return r->cfGetUnit(n,r); } 530 530 531 static inlinecoeffs n_CoeffRingQuot1(number c, const coeffs r)531 static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r) 532 532 { STATISTIC(n_CoeffRingQuot1); assume(r != NULL); assume(r->cfQuot1 != NULL); return r->cfQuot1(c, r); } 533 533 #endif 534 534 535 535 /// a number representing i in the given coeff field/ring r 536 static inlinenumber n_Init(long i, const coeffs r)536 static FORCE_INLINE number n_Init(long i, const coeffs r) 537 537 { STATISTIC(n_Init); assume(r != NULL); assume(r->cfInit!=NULL); return r->cfInit(i,r); } 538 538 539 539 /// conversion of a GMP integer to number 540 static inlinenumber n_InitMPZ(mpz_t n, const coeffs r)540 static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r) 541 541 { STATISTIC(n_InitMPZ); assume(r != NULL); assume(r->cfInitMPZ != NULL); return r->cfInitMPZ(n,r); } 542 542 543 543 /// conversion of n to an int; 0 if not possible 544 544 /// in Z/pZ: the representing int lying in (-p/2 .. p/2] 545 static inlineint n_Int(number &n, const coeffs r)545 static FORCE_INLINE int n_Int(number &n, const coeffs r) 546 546 { STATISTIC(n_Int); assume(r != NULL); assume(r->cfInt!=NULL); return r->cfInt(n,r); } 547 547 548 548 /// conversion of n to a GMP integer; 0 if not possible 549 static inlinevoid n_MPZ(mpz_t result, number &n, const coeffs r)549 static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r) 550 550 { STATISTIC(n_MPZ); assume(r != NULL); assume(r->cfMPZ!=NULL); r->cfMPZ(result, n, r); } 551 551 … … 553 553 /// in-place negation of n 554 554 /// MUST BE USED: n = n_InpNeg(n) (no copy is returned) 555 static inlinenumber n_InpNeg(number n, const coeffs r)555 static FORCE_INLINE number n_InpNeg(number n, const coeffs r) 556 556 { STATISTIC(n_InpNeg); assume(r != NULL); assume(r->cfInpNeg!=NULL); return r->cfInpNeg(n,r); } 557 557 … … 560 560 /// 561 561 /// !!! Recommendation: rename to 'n_Inverse' 562 static inlinenumber n_Invers(number a, const coeffs r)562 static FORCE_INLINE number n_Invers(number a, const coeffs r) 563 563 { STATISTIC(n_Invers); assume(r != NULL); assume(r->cfInvers!=NULL); return r->cfInvers(a,r); } 564 564 … … 566 566 /// return 0 only when n represents zero; 567 567 /// (used for pivot strategies in matrix computations with entries from r) 568 static inlineint n_Size(number n, const coeffs r)568 static FORCE_INLINE int n_Size(number n, const coeffs r) 569 569 { STATISTIC(n_Size); assume(r != NULL); assume(r->cfSize!=NULL); return r->cfSize(n,r); } 570 570 … … 574 574 /// !!! Recommendation: remove this method from the user-interface, i.e., 575 575 /// !!! this should be hidden 576 static inlinevoid n_Normalize(number& n, const coeffs r)576 static FORCE_INLINE void n_Normalize(number& n, const coeffs r) 577 577 { STATISTIC(n_Normalize); assume(r != NULL); assume(r->cfNormalize!=NULL); r->cfNormalize(n,r); } 578 578 579 579 /// write to the output buffer of the currently used reporter 580 580 //CF: the "&" should be removed, as one wants to write constants as well 581 static inlinevoid n_WriteLong(number& n, const coeffs r)581 static FORCE_INLINE void n_WriteLong(number& n, const coeffs r) 582 582 { STATISTIC(n_WriteLong); assume(r != NULL); assume(r->cfWriteLong!=NULL); r->cfWriteLong(n,r); } 583 583 584 584 /// write to the output buffer of the currently used reporter 585 585 /// in a shortest possible way, e.g. in K(a): a2 instead of a^2 586 static inlinevoid n_WriteShort(number& n, const coeffs r)586 static FORCE_INLINE void n_WriteShort(number& n, const coeffs r) 587 587 { STATISTIC(n_WriteShort); assume(r != NULL); assume(r->cfWriteShort!=NULL); r->cfWriteShort(n,r); } 588 588 589 static inlinevoid n_Write(number& n, const coeffs r, const BOOLEAN bShortOut = TRUE)589 static FORCE_INLINE void n_Write(number& n, const coeffs r, const BOOLEAN bShortOut = TRUE) 590 590 { STATISTIC(n_Write); if (bShortOut) n_WriteShort(n, r); else n_WriteLong(n, r); } 591 591 … … 594 594 /// !!! interface. As defined here, it is merely a helper 595 595 /// !!! method for parsing number input strings. 596 static inlineconst char *n_Read(const char * s, number * a, const coeffs r)596 static FORCE_INLINE const char *n_Read(const char * s, number * a, const coeffs r) 597 597 { STATISTIC(n_Read); assume(r != NULL); assume(r->cfRead!=NULL); return r->cfRead(s, a, r); } 598 598 599 599 /// return the denominator of n 600 600 /// (if elements of r are by nature not fractional, result is 1) 601 static inlinenumber n_GetDenom(number& n, const coeffs r)601 static FORCE_INLINE number n_GetDenom(number& n, const coeffs r) 602 602 { STATISTIC(n_GetDenom); assume(r != NULL); assume(r->cfGetDenom!=NULL); return r->cfGetDenom(n, r); } 603 603 604 604 /// return the numerator of n 605 605 /// (if elements of r are by nature not fractional, result is n) 606 static inlinenumber n_GetNumerator(number& n, const coeffs r)606 static FORCE_INLINE number n_GetNumerator(number& n, const coeffs r) 607 607 { STATISTIC(n_GetNumerator); assume(r != NULL); assume(r->cfGetNumerator!=NULL); return r->cfGetNumerator(n, r); } 608 608 609 609 /// return the quotient of 'a' and 'b', i.e., a/b; 610 610 /// raise an error if 'b' is not invertible in r 611 static inlinenumber n_Div(number a, number b, const coeffs r)611 static FORCE_INLINE number n_Div(number a, number b, const coeffs r) 612 612 { STATISTIC(n_Div); assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); } 613 613 … … 616 616 /// n_ExactDiv performs it, may skip additional tests. 617 617 /// Can always be substituted by n_Div at the cost of larger computing time. 618 static inlinenumber n_ExactDiv(number a, number b, const coeffs r)618 static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r) 619 619 { STATISTIC(n_ExactDiv); assume(r != NULL); assume(r->cfExactDiv!=NULL); return r->cfExactDiv(a,b,r); } 620 620 621 621 /// for r a field, return n_Init(0,r) 622 622 /// otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a 623 static inlinenumber n_IntMod(number a, number b, const coeffs r)623 static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r) 624 624 { STATISTIC(n_IntMod); assume(r != NULL); return r->cfIntMod(a,b,r); } 625 625 626 626 /// fill res with the power a^b 627 static inlinevoid n_Power(number a, int b, number *res, const coeffs r)627 static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r) 628 628 { STATISTIC(n_Power); assume(r != NULL); assume(r->cfPower!=NULL); r->cfPower(a,b,res,r); } 629 629 630 630 /// return the product of 'a' and 'b', i.e., a*b 631 static inlinenumber n_Mult(number a, number b, const coeffs r)631 static FORCE_INLINE number n_Mult(number a, number b, const coeffs r) 632 632 { STATISTIC(n_Mult); assume(r != NULL); assume(r->cfMult!=NULL); return r->cfMult(a, b, r); } 633 633 634 634 /// multiplication of 'a' and 'b'; 635 635 /// replacement of 'a' by the product a*b 636 static inlinevoid n_InpMult(number &a, number b, const coeffs r)636 static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r) 637 637 { STATISTIC(n_InpMult); assume(r != NULL); assume(r->cfInpMult!=NULL); r->cfInpMult(a,b,r); } 638 638 639 639 /// addition of 'a' and 'b'; 640 640 /// replacement of 'a' by the sum a+b 641 static inlinevoid n_InpAdd(number &a, number b, const coeffs r)641 static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r) 642 642 { STATISTIC(n_InpAdd); assume(r != NULL); assume(r->cfInpAdd!=NULL); r->cfInpAdd(a,b,r); 643 643 … … 649 649 650 650 /// return the sum of 'a' and 'b', i.e., a+b 651 static inlinenumber n_Add(number a, number b, const coeffs r)651 static FORCE_INLINE number n_Add(number a, number b, const coeffs r) 652 652 { STATISTIC(n_Add); assume(r != NULL); assume(r->cfAdd!=NULL); const number sum = r->cfAdd(a, b, r); 653 653 … … 662 662 663 663 /// return the difference of 'a' and 'b', i.e., a-b 664 static inlinenumber n_Sub(number a, number b, const coeffs r)664 static FORCE_INLINE number n_Sub(number a, number b, const coeffs r) 665 665 { STATISTIC(n_Sub); assume(r != NULL); assume(r->cfSub!=NULL); const number d = r->cfSub(a, b, r); 666 666 … … 679 679 /// in K(a)/<p(a)>: not implemented 680 680 /// in K(t_1, ..., t_n): not implemented 681 static inlinenumber n_Gcd(number a, number b, const coeffs r)681 static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r) 682 682 { STATISTIC(n_Gcd); assume(r != NULL); assume(r->cfGcd!=NULL); return r->cfGcd(a,b,r); } 683 static inlinenumber n_SubringGcd(number a, number b, const coeffs r)683 static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r) 684 684 { STATISTIC(n_SubringGcd); assume(r != NULL); assume(r->cfSubringGcd!=NULL); return r->cfSubringGcd(a,b,r); } 685 685 686 686 /// beware that ExtGCD is only relevant for a few chosen coeff. domains 687 687 /// and may perform something unexpected in some cases... 688 static inlinenumber n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)688 static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r) 689 689 { STATISTIC(n_ExtGcd); assume(r != NULL); assume(r->cfExtGcd!=NULL); return r->cfExtGcd (a,b,s,t,r); } 690 static inlinenumber n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)690 static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r) 691 691 { STATISTIC(n_XExtGcd); assume(r != NULL); assume(r->cfXExtGcd!=NULL); return r->cfXExtGcd (a,b,s,t,u,v,r); } 692 static inlinenumber n_EucNorm(number a, const coeffs r)692 static FORCE_INLINE number n_EucNorm(number a, const coeffs r) 693 693 { STATISTIC(n_EucNorm); assume(r != NULL); assume(r->cfEucNorm!=NULL); return r->cfEucNorm (a,r); } 694 694 /// if r is a ring with zero divisors, return an annihilator!=0 of b 695 695 /// otherwise return NULL 696 static inlinenumber n_Ann(number a, const coeffs r)696 static FORCE_INLINE number n_Ann(number a, const coeffs r) 697 697 { STATISTIC(n_Ann); assume(r != NULL); return r->cfAnn (a,r); } 698 static inlinenumber n_QuotRem(number a, number b, number *q, const coeffs r)698 static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r) 699 699 { STATISTIC(n_QuotRem); assume(r != NULL); assume(r->cfQuotRem!=NULL); return r->cfQuotRem (a,b,q,r); } 700 700 … … 705 705 /// in K(a)/<p(a)>: not implemented 706 706 /// in K(t_1, ..., t_n): not implemented 707 static inlinenumber n_Lcm(number a, number b, const coeffs r)707 static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r) 708 708 { STATISTIC(n_Lcm); assume(r != NULL); assume(r->cfLcm!=NULL); return r->cfLcm(a,b,r); } 709 709 710 710 /// assume that r is a quotient field (otherwise, return 1) 711 711 /// for arguments (a1/a2,b1/b2) return (lcm(a1,b2)/1) 712 static inlinenumber n_NormalizeHelper(number a, number b, const coeffs r)712 static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r) 713 713 { STATISTIC(n_NormalizeHelper); assume(r != NULL); assume(r->cfNormalizeHelper!=NULL); return r->cfNormalizeHelper(a,b,r); } 714 714 715 715 /// set the mapping function pointers for translating numbers from src to dst 716 static inlinenMapFunc n_SetMap(const coeffs src, const coeffs dst)716 static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst) 717 717 { STATISTIC(n_SetMap); assume(src != NULL && dst != NULL); assume(dst->cfSetMap!=NULL); return dst->cfSetMap(src,dst); } 718 718 … … 720 720 /// test whether n is a correct number; 721 721 /// only used if LDEBUG is defined 722 static inlineBOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r)722 static FORCE_INLINE BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r) 723 723 { STATISTIC(n_Test); assume(r != NULL); assume(r->cfDBTest != NULL); return r->cfDBTest(n, filename, linenumber, r); } 724 724 #else … … 726 726 /// test whether n is a correct number; 727 727 /// only used if LDEBUG is defined 728 static inlineBOOLEAN n_DBTest(number, const char*, const int, const coeffs)728 static FORCE_INLINE BOOLEAN n_DBTest(number, const char*, const int, const coeffs) 729 729 { STATISTIC(n_Test); return TRUE; } 730 730 #endif 731 731 732 732 /// output the coeff description 733 static inlinevoid n_CoeffWrite(const coeffs r, BOOLEAN details = TRUE)733 static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details = TRUE) 734 734 { STATISTIC(n_CoeffWrite); assume(r != NULL); assume(r->cfCoeffWrite != NULL); r->cfCoeffWrite(r, details); } 735 735 736 736 // Tests: 737 static inlineBOOLEAN nCoeff_is_Ring_2toM(const coeffs r)737 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r) 738 738 { assume(r != NULL); return (getCoeffType(r)==n_Z2m); } 739 739 740 static inlineBOOLEAN nCoeff_is_Ring_ModN(const coeffs r)740 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_ModN(const coeffs r) 741 741 { assume(r != NULL); return (getCoeffType(r)==n_Zn); } 742 742 743 static inlineBOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)743 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r) 744 744 { assume(r != NULL); return (getCoeffType(r)==n_Znm); } 745 745 746 static inlineBOOLEAN nCoeff_is_Ring_Z(const coeffs r)746 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r) 747 747 { assume(r != NULL); return (getCoeffType(r)==n_Z); } 748 748 749 static inlineBOOLEAN nCoeff_is_Ring(const coeffs r)749 static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r) 750 750 { assume(r != NULL); return (r->is_field==0); } 751 751 752 752 /// returns TRUE, if r is a field or r has no zero divisors (i.e is a domain) 753 static inlineBOOLEAN nCoeff_is_Domain(const coeffs r)753 static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r) 754 754 { 755 755 assume(r != NULL); … … 765 765 /// in Z/2^kZ: TRUE iff ((a = 0 mod 2^k) and (b = 0 or b is a power of 2)) 766 766 /// or ((a, b <> 0) and (b/gcd(a, b) is odd)) 767 static inlineBOOLEAN n_DivBy(number a, number b, const coeffs r)767 static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r) 768 768 { STATISTIC(n_DivBy); assume(r != NULL); 769 769 #ifdef HAVE_RINGS … … 776 776 } 777 777 778 static inlinenumber n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym,const coeffs r)778 static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym,const coeffs r) 779 779 { STATISTIC(n_ChineseRemainderSym); assume(r != NULL); assume(r->cfChineseRemainder != NULL); return r->cfChineseRemainder(a,b,rl,sym,r); } 780 780 781 static inlinenumber n_Farey(number a, number b, const coeffs r)781 static FORCE_INLINE number n_Farey(number a, number b, const coeffs r) 782 782 { STATISTIC(n_Farey); assume(r != NULL); assume(r->cfFarey != NULL); return r->cfFarey(a,b,r); } 783 783 784 static inlineint n_ParDeg(number n, const coeffs r)784 static FORCE_INLINE int n_ParDeg(number n, const coeffs r) 785 785 { STATISTIC(n_ParDeg); assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r); } 786 786 787 787 /// Returns the number of parameters 788 static inlineint n_NumberOfParameters(const coeffs r)788 static FORCE_INLINE int n_NumberOfParameters(const coeffs r) 789 789 { STATISTIC(n_NumberOfParameters); assume(r != NULL); return r->iNumberOfParameters; } 790 790 791 791 /// Returns a (const!) pointer to (const char*) names of parameters 792 static inlinechar const * * n_ParameterNames(const coeffs r)792 static FORCE_INLINE char const * * n_ParameterNames(const coeffs r) 793 793 { STATISTIC(n_ParameterNames); assume(r != NULL); return r->pParameterNames; } 794 794 795 795 /// return the (iParameter^th) parameter as a NEW number 796 796 /// NOTE: parameter numbering: 1..n_NumberOfParameters(...) 797 static inlinenumber n_Param(const int iParameter, const coeffs r)797 static FORCE_INLINE number n_Param(const int iParameter, const coeffs r) 798 798 { assume(r != NULL); 799 799 assume((iParameter >= 1) || (iParameter <= n_NumberOfParameters(r))); … … 802 802 } 803 803 804 static inlinenumber n_RePart(number i, const coeffs cf)804 static FORCE_INLINE number n_RePart(number i, const coeffs cf) 805 805 { STATISTIC(n_RePart); assume(cf != NULL); assume(cf->cfRePart!=NULL); return cf->cfRePart(i,cf); } 806 806 807 static inlinenumber n_ImPart(number i, const coeffs cf)807 static FORCE_INLINE number n_ImPart(number i, const coeffs cf) 808 808 { STATISTIC(n_ImPart); assume(cf != NULL); assume(cf->cfImPart!=NULL); return cf->cfImPart(i,cf); } 809 809 810 810 /// returns TRUE, if r is not a field and r has non-trivial units 811 static inlineBOOLEAN nCoeff_has_Units(const coeffs r)811 static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r) 812 812 { assume(r != NULL); return ((getCoeffType(r)==n_Zn) || (getCoeffType(r)==n_Z2m) || (getCoeffType(r)==n_Znm)); } 813 813 814 static inlineBOOLEAN nCoeff_is_Zp(const coeffs r)814 static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r) 815 815 { assume(r != NULL); return getCoeffType(r)==n_Zp; } 816 816 817 static inlineBOOLEAN nCoeff_is_Zp(const coeffs r, int p)817 static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r, int p) 818 818 { assume(r != NULL); return ((getCoeffType(r)==n_Zp) && (r->ch == p)); } 819 819 820 static inlineBOOLEAN nCoeff_is_Q(const coeffs r)820 static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r) 821 821 { assume(r != NULL); return getCoeffType(r)==n_Q && (r->is_field); } 822 822 823 static inlineBOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */823 static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */ 824 824 { assume(r != NULL); return (getCoeffType(r)==n_R) || (getCoeffType(r)==n_long_R) || (getCoeffType(r)==n_long_C); } 825 825 // (r->ringtype == 0) && (r->ch == -1); ?? 826 826 827 static inlineBOOLEAN nCoeff_is_R(const coeffs r)827 static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r) 828 828 { assume(r != NULL); return getCoeffType(r)==n_R; } 829 829 830 static inlineBOOLEAN nCoeff_is_GF(const coeffs r)830 static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r) 831 831 { assume(r != NULL); return getCoeffType(r)==n_GF; } 832 832 833 static inlineBOOLEAN nCoeff_is_GF(const coeffs r, int q)833 static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r, int q) 834 834 { assume(r != NULL); return (getCoeffType(r)==n_GF) && (r->ch == q); } 835 835 836 836 /* TRUE iff r represents an algebraic or transcendental extension field */ 837 static inlineBOOLEAN nCoeff_is_Extension(const coeffs r)837 static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r) 838 838 { 839 839 assume(r != NULL); … … 848 848 height above some field of characteristic p (may be Z/pZ or some 849 849 Galois field of characteristic p) */ 850 static inlineBOOLEAN nCoeff_is_Zp_a(const coeffs r)850 static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r) 851 851 { 852 852 assume(r != NULL); … … 861 861 height above some field of characteristic p (may be Z/pZ or some 862 862 Galois field of characteristic p) */ 863 static inlineBOOLEAN nCoeff_is_Zp_a(const coeffs r, int p)863 static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p) 864 864 { 865 865 assume(r != NULL); … … 874 874 actually: TRUE iff the given r is an extension tower of arbitrary 875 875 height above some field of characteristic 0 (may be Q, R, or C) */ 876 static inlineBOOLEAN nCoeff_is_Q_a(const coeffs r)876 static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r) 877 877 { 878 878 assume(r != NULL); … … 883 883 884 884 885 static inlineBOOLEAN nCoeff_is_long_R(const coeffs r)885 static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r) 886 886 { assume(r != NULL); return getCoeffType(r)==n_long_R; } 887 887 888 static inlineBOOLEAN nCoeff_is_long_C(const coeffs r)888 static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r) 889 889 { assume(r != NULL); return getCoeffType(r)==n_long_C; } 890 890 891 static inlineBOOLEAN nCoeff_is_CF(const coeffs r)891 static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r) 892 892 { assume(r != NULL); return getCoeffType(r)==n_CF; } 893 893 894 894 /// TRUE, if the computation of the inverse is fast, 895 895 /// i.e. prefer leading coeff. 1 over content 896 static inlineBOOLEAN nCoeff_has_simple_inverse(const coeffs r)896 static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r) 897 897 { assume(r != NULL); return r->has_simple_Inverse; } 898 898 899 899 /// TRUE if n_Delete/n_New are empty operations 900 static inlineBOOLEAN nCoeff_has_simple_Alloc(const coeffs r)900 static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r) 901 901 { assume(r != NULL); return r->has_simple_Alloc; } 902 902 903 903 /// TRUE iff r represents an algebraic extension field 904 static inlineBOOLEAN nCoeff_is_algExt(const coeffs r)904 static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r) 905 905 { assume(r != NULL); return (getCoeffType(r)==n_algExt); } 906 906 907 907 /// is it an alg. ext. of Q? 908 static inlineBOOLEAN nCoeff_is_Q_algext(const coeffs r)908 static FORCE_INLINE BOOLEAN nCoeff_is_Q_algext(const coeffs r) 909 909 { assume(r != NULL); return ((n_GetChar(r) == 0) && nCoeff_is_algExt(r)); } 910 910 911 911 /// TRUE iff r represents a transcendental extension field 912 static inlineBOOLEAN nCoeff_is_transExt(const coeffs r)912 static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r) 913 913 { assume(r != NULL); return (getCoeffType(r)==n_transExt); } 914 914 … … 923 923 /// NOTE/TODO: see also the description by Hans 924 924 /// TODO: rename into n_ClearIntegerContent 925 static inlinevoid n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)925 static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r) 926 926 { STATISTIC(n_ClearContent); assume(r != NULL); r->cfClearContent(numberCollectionEnumerator, c, r); } 927 927 … … 930 930 /// with which all the number coeffs. were multiplied) 931 931 /// NOTE/TODO: see also the description by Hans 932 static inlinevoid n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r)932 static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r) 933 933 { STATISTIC(n_ClearDenominators); assume(r != NULL); r->cfClearDenominators(numberCollectionEnumerator, d, r); } 934 934 … … 939 939 // *p_Content) and p_Cleardenom_n (which doesn't)!!! 940 940 941 static inlinevoid n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)941 static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r) 942 942 { STATISTIC(n_ClearContent); number c; n_ClearContent(numberCollectionEnumerator, c, r); n_Delete(&c, r); } 943 943 944 static inlinevoid n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)944 static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r) 945 945 { STATISTIC(n_ClearDenominators); assume(r != NULL); number d; n_ClearDenominators(numberCollectionEnumerator, d, r); n_Delete(&d, r); } 946 946 … … 954 954 /// TODO: make it a virtual method of coeffs, together with: 955 955 /// Decompose & Compose, rParameter & rPar 956 static inlinechar * nCoeffString(const coeffs cf)956 static FORCE_INLINE char * nCoeffString(const coeffs cf) 957 957 { STATISTIC(nCoeffString); assume( cf != NULL ); return cf->cfCoeffString(cf); } 958 958 959 959 960 static inlinechar * nCoeffName (const coeffs cf)960 static FORCE_INLINE char * nCoeffName (const coeffs cf) 961 961 { STATISTIC(nCoeffName); assume( cf != NULL ); return cf->cfCoeffName(cf); } 962 962 963 static inlinenumber n_Random(siRandProc p, number p1, number p2, const coeffs cf)963 static FORCE_INLINE number n_Random(siRandProc p, number p1, number p2, const coeffs cf) 964 964 { STATISTIC(n_Random); assume( cf != NULL ); assume( cf->cfRandom != NULL ); return cf->cfRandom(p, p1, p2, cf); } 965 965 966 966 /// io via ssi: 967 static inlinevoid n_WriteFd(number a, FILE *f, const coeffs r)967 static FORCE_INLINE void n_WriteFd(number a, FILE *f, const coeffs r) 968 968 { STATISTIC(n_WriteFd); assume(r != NULL); assume(r->cfWriteFd != NULL); return r->cfWriteFd(a, f, r); } 969 969 970 970 /// io via ssi: 971 static inlinenumber n_ReadFd( s_buff f, const coeffs r)971 static FORCE_INLINE number n_ReadFd( s_buff f, const coeffs r) 972 972 { STATISTIC(n_ReadFd); assume(r != NULL); assume(r->cfReadFd != NULL); return r->cfReadFd(f, r); } 973 973 974 974 975 // the following wrappers went to numbers.cc since they needed factory 976 // knowledge! 975 977 number n_convFactoryNSingN( const CanonicalForm n, const coeffs r); 976 978
Note: See TracChangeset
for help on using the changeset viewer.