Macros | Functions | Variables
old.gring.cc File Reference
#include <misc/auxiliary.h>
#include "nc.h"
#include "sca.h"
#include "gb_hack.h"
#include <polys/monomials/ring.h>
#include <coeffs/numbers.h>
#include <polys/coeffrings.h>
#include <misc/options.h>
#include <polys/monomials/p_polys.h>
#include <polys/simpleideals.h>
#include <polys/matpol.h>
#include <polys/kbuckets.h>
#include <polys/sbuckets.h>
#include <polys/prCopy.h>
#include <polys/operations/p_Mult_q.h>
#include "summator.h"
#include "ncSAMult.h"
#include "ncSAFormula.h"

Go to the source code of this file.

Macros

#define MYTEST   0
 
#define OUTPUT   0
 
#define PLURAL_INTERNAL_DECLARATIONS
 
#define freeT(A, v)   omFreeSize((ADDRESS)A,(v+1)*sizeof(int))
 
#define freeN(A, k)   omFreeSize((ADDRESS)A,k*sizeof(number))
 

Functions

poly nc_p_CopyGet (poly a, const ring r)
 
poly nc_p_CopyPut (poly a, const ring r)
 
poly nc_p_Bracket_qq (poly p, const poly q, const ring r)
 returns [p,q], destroys p More...
 
intgetNCExtensions ()
 
int setNCExtensions (int iMask)
 
bool ncExtensions (int iMask)
 
poly gnc_pp_Mult_mm (const poly p, const poly m, const ring r, poly &last)
 
poly gnc_p_Mult_mm (poly p, const poly m, const ring r)
 
poly gnc_mm_Mult_p (const poly m, poly p, const ring r)
 
poly gnc_mm_Mult_pp (const poly m, const poly p, const ring r)
 
poly gnc_CreateSpolyOld (const poly p1, const poly p2, const ring r)
 
poly gnc_ReduceSpolyOld (const poly p1, poly p2, const ring r)
 
poly gnc_CreateSpolyNew (const poly p1, const poly p2, const ring r)
 
poly gnc_ReduceSpolyNew (const poly p1, poly p2, const ring r)
 
void gnc_kBucketPolyRedNew (kBucket_pt b, poly p, number *c)
 
void gnc_kBucketPolyRed_ZNew (kBucket_pt b, poly p, number *c)
 
void gnc_kBucketPolyRedOld (kBucket_pt b, poly p, number *c)
 
void gnc_kBucketPolyRed_ZOld (kBucket_pt b, poly p, number *c)
 
void nc_CleanUp (nc_struct *p)
 
void nc_rCleanUp (ring r)
 
poly p_Lcm (const poly a, const poly b, const long lCompM, const ring r)
 
poly p_Lcm (const poly a, const poly b, const ring r)
 
poly nc_p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, int &shorter, const poly, const ring r)
 for p_Minus_mm_Mult_qq in pInline2.h More...
 
poly nc_p_Plus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, const int, const ring r)
 
poly _gnc_p_Mult_q (poly p, poly q, const int copy, const ring r)
 
poly _nc_p_Mult_q (poly pPolyP, poly pPolyQ, const ring rRing)
 general NC-multiplication with destruction More...
 
poly _nc_pp_Mult_qq (const poly pPolyP, const poly pPolyQ, const ring rRing)
 general NC-multiplication without destruction More...
 
poly gnc_mm_Mult_nn (int *F, int *G, const ring r)
 
poly gnc_mm_Mult_uu (int *F, int jG, int bG, const ring r)
 
poly gnc_uu_Mult_ww (int i, int a, int j, int b, const ring r)
 
poly gnc_p_Mult_mm_Common (poly p, const poly m, int side, const ring r)
 
poly gnc_pp_Mult_mm (const poly p, const poly m, const ring r)
 
poly gnc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r)
 
static poly gnc_uu_Mult_ww_formula (int i, int a, int j, int b, const ring r)
 
poly gnc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r)
 
poly nc_CreateShortSpoly (poly p1, poly p2, const ring r)
 
void nc_PolyPolyRedOld (poly &b, poly p, number *c, const ring r)
 
void nc_PolyPolyRedNew (poly &b, poly p, number *c, const ring r)
 
void nc_PolyPolyRed (poly &b, poly p, number *c, const ring r)
 
poly nc_mm_Bracket_nn (poly m1, poly m2, const ring r)
 returns [m1,m2] for two monoms, destroys nothing without coeffs More...
 
matrix nc_PrintMat (int a, int b, ring r, int metric)
 returns matrix with the info on noncomm multiplication More...
 
void nc_CleanUp (ring r)
 
void nc_rKill (ring r)
 complete destructor More...
 
BOOLEAN nc_CheckSubalgebra (poly PolyVar, ring r)
 
BOOLEAN gnc_CheckOrdCondition (matrix D, ring r)
 
BOOLEAN gnc_InitMultiplication (ring r, bool bSetupQuotient=false)
 
BOOLEAN nc_CallPlural (matrix CCC, matrix DDD, poly CCN, poly DDN, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring)
 returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation! More...
 
bool nc_rCopy (ring res, const ring r, bool bSetupQuotient)
 
static void gnc_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
void nc_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
poly nc_pSubst (poly p, int n, poly e, const ring r)
 substitute the n-th variable by e in p destroy p e is not a constant More...
 
ring nc_rCreateNCcomm (ring r)
 
poly p_CopyEmbed (poly p, ring srcRing, int shift, int, ring dstRing)
 
BOOLEAN rIsLikeOpposite (ring rBase, ring rCandidate)
 checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so More...
 
poly pOppose (ring Rop, poly p, const ring dst)
 opposes a vector p from Rop to currRing (dst!) More...
 
ideal idOppose (ring Rop, ideal I, const ring dst)
 opposes a module I from Rop to currRing(dst) More...
 
bool nc_SetupQuotient (ring rGR, const ring rG, bool bCopy)
 

Variables

int iNCExtensions = SCAMASK | NOFORMULAMASK
 

Macro Definition Documentation

#define freeN (   A,
  k 
)    omFreeSize((ADDRESS)A,k*sizeof(number))

Definition at line 95 of file old.gring.cc.

#define freeT (   A,
  v 
)    omFreeSize((ADDRESS)A,(v+1)*sizeof(int))

Definition at line 94 of file old.gring.cc.

#define MYTEST   0

Definition at line 11 of file old.gring.cc.

#define OUTPUT   0

Definition at line 12 of file old.gring.cc.

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 26 of file old.gring.cc.

Function Documentation

poly _gnc_p_Mult_q ( poly  p,
poly  q,
const int  copy,
const ring  r 
)

Definition at line 236 of file old.gring.cc.

238 {
239  poly res=NULL;
240  poly qq,pp;
241  if (copy)
242  {
243  qq=p_Copy(q,r);
244  pp=p_Copy(p,r);
245  }
246  else
247  {
248  qq=q;
249  pp=p;
250  }
251  while (qq!=NULL)
252  {
253  res=p_Add_q(res, pp_Mult_mm(pp, qq, r), r); // p_Head(qq, r)?
254  qq=p_LmDeleteAndNext(qq,r);
255  }
256  p_Delete(&pp,r);
257  return(res);
258 }
CFArray copy(const CFList &list)
write elements of list into an array
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
return P p
Definition: myNF.cc:203
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:962
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
poly pp
Definition: myNF.cc:296
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly _nc_p_Mult_q ( poly  pPolyP,
poly  pPolyQ,
const ring  rRing 
)

general NC-multiplication with destruction

Definition at line 261 of file old.gring.cc.

262 {
263  assume( rIsPluralRing(rRing) );
264 #ifdef PDEBUG
265  p_Test(pPolyP, rRing);
266  p_Test(pPolyQ, rRing);
267 #endif
268 #ifdef RDEBUG
269  rTest(rRing);
270 #endif
271 
272  int lp, lq;
273 
274  pqLength(pPolyP, pPolyQ, lp, lq, MIN_LENGTH_BUCKET);
275 
276  bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (si_max(lp, lq) < MIN_LENGTH_BUCKET); // ???
277 
278  CPolynomialSummator sum(rRing, bUsePolynomial);
279 
280  if (lq <= lp) // ?
281  {
282  // always length(q) times "p * q[j]"
283  for( ; pPolyQ!=NULL; pPolyQ = p_LmDeleteAndNext( pPolyQ, rRing ) )
284  sum += pp_Mult_mm( pPolyP, pPolyQ, rRing);
285 
286  p_Delete( &pPolyP, rRing );
287  } else
288  {
289  // always length(p) times "p[i] * q"
290  for( ; pPolyP!=NULL; pPolyP = p_LmDeleteAndNext( pPolyP, rRing ) )
291  sum += nc_mm_Mult_pp( pPolyP, pPolyQ, rRing);
292 
293  p_Delete( &pPolyQ, rRing );
294  }
295 
296  return(sum);
297 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:22
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:962
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define assume(x)
Definition: mod2.h:405
#define rTest(r)
Definition: ring.h:769
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
Definition: p_Mult_q.cc:27
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(...
Definition: summator.h:29
poly _nc_pp_Mult_qq ( const poly  pPolyP,
const poly  pPolyQ,
const ring  rRing 
)

general NC-multiplication without destruction

Definition at line 300 of file old.gring.cc.

301 {
302  assume( rIsPluralRing(rRing) );
303 #ifdef PDEBUG
304  p_Test(pPolyP, rRing);
305  p_Test(pPolyQ, rRing);
306 #endif
307 #ifdef RDEBUG
308  rTest(rRing);
309 #endif
310 
311  int lp, lq;
312 
313  pqLength(pPolyP, pPolyQ, lp, lq, MIN_LENGTH_BUCKET);
314 
315  bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (si_max(lp, lq) < MIN_LENGTH_BUCKET); // ???
316 
317  CPolynomialSummator sum(rRing, bUsePolynomial);
318 
319  if (lq <= lp) // ?
320  {
321  // always length(q) times "p * q[j]"
322  for( poly q = pPolyQ; q !=NULL; q = pNext(q) )
323  sum += pp_Mult_mm(pPolyP, q, rRing);
324  } else
325  {
326  // always length(p) times "p[i] * q"
327  for( poly p = pPolyP; p !=NULL; p = pNext(p) )
328  sum += nc_mm_Mult_pp( p, pPolyQ, rRing);
329  }
330 
331  return(sum);
332 }
return P p
Definition: myNF.cc:203
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:22
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:962
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define rTest(r)
Definition: ring.h:769
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
Definition: p_Mult_q.cc:27
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(...
Definition: summator.h:29
int& getNCExtensions ( )

Definition at line 75 of file old.gring.cc.

76 {
77  return (iNCExtensions);
78 }
int iNCExtensions
Definition: old.gring.cc:73
BOOLEAN gnc_CheckOrdCondition ( matrix  D,
ring  r 
)

Definition at line 2679 of file old.gring.cc.

2680 {
2681  /* analyze D: an upper triangular matrix of polys */
2682  /* check the ordering condition for D */
2683 // ring save = currRing;
2684 // int WeChangeRing = 0;
2685 // if (r != currRing)
2686 // {
2687 // rChangeCurrRing(r);
2688 // WeChangeRing = 1;
2689 // }
2690  poly p,q;
2691  int i,j;
2692  int report = 0;
2693  for(i=1; i<r->N; i++)
2694  {
2695  for(j=i+1; j<=r->N; j++)
2696  {
2697  p = nc_p_CopyGet(MATELEM(D,i,j),r);
2698  if ( p != NULL)
2699  {
2700  q = p_One(r);
2701  p_SetExp(q,i,1,r);
2702  p_SetExp(q,j,1,r);
2703  p_Setm(q,r);
2704  if (p_LmCmp(q,p,r) != 1) /* i.e. lm(p)==xy < lm(q)==D_ij */
2705  {
2706  Werror("Bad ordering at %d,%d\n",i,j);
2707 #if 0 /*Singularg should not differ from Singular except in error case*/
2708  p_Write(p,r);
2709  p_Write(q,r);
2710 #endif
2711  report = 1;
2712  }
2713  p_Delete(&q,r);
2714  p_Delete(&p,r);
2715  p = NULL;
2716  }
2717  }
2718  }
2719 // if ( WeChangeRing )
2720 // rChangeCurrRing(save);
2721  return(report);
2722 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
poly nc_p_CopyGet(poly a, const ring r)
Definition: old.gring.cc:2578
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define MATELEM(mat, i, j)
Definition: matpol.h:29
poly gnc_CreateSpolyNew ( const poly  p1,
const poly  p2,
const ring  r 
)

Definition at line 1605 of file old.gring.cc.

1606 {
1607 #ifdef PDEBUG
1608  p_Test(p1, r);
1609  p_Test(p2, r);
1610 #if MYTEST
1611  Print("p1: "); p_Write(p1, r);
1612  Print("p2: "); p_Write(p2, r);
1613 #endif
1614 #endif
1615 
1616  const long lCompP1 = p_GetComp(p1,r);
1617  const long lCompP2 = p_GetComp(p2,r);
1618 
1619  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1620  {
1621 #ifdef PDEBUG
1622  Werror("gnc_CreateSpolyNew: different non-zero components!");
1623  assume(0);
1624 #endif
1625  return(NULL);
1626  }
1627 
1628 // if ((r->GetNC()->type==nc_lie) && pHasNotCF(p1,p2)) /* prod crit */
1629 // {
1630 // return(nc_p_Bracket_qq(pCopy(p2),p1));
1631 // }
1632 
1633 // poly pL=p_One( r);
1634 
1635  poly m1=p_One( r);
1636  poly m2=p_One( r);
1637 
1638  poly pL = p_Lcm(p1,p2,r); // pL = lcm( lm(p1), lm(p2) )
1639 
1640 
1641 #ifdef PDEBUG
1642 // p_Test(pL,r);
1643 #endif
1644 
1645  p_ExpVectorDiff(m1, pL, p1, r); // m1 = pL / lm(p1)
1646  //p_SetComp(m1,0,r);
1647  //p_Setm(m1,r);
1648 
1649 #ifdef PDEBUG
1650  p_Test(m1,r);
1651 #endif
1652 // assume(p_GetComp(m1,r) == 0);
1653 
1654  p_ExpVectorDiff(m2, pL, p2, r); // m2 = pL / lm(p2)
1655 
1656  //p_SetComp(m2,0,r);
1657  //p_Setm(m2,r);
1658 #ifdef PDEBUG
1659  p_Test(m2,r);
1660 #endif
1661 
1662 #ifdef PDEBUG
1663 #if MYTEST
1664  Print("m1: "); pWrite(m1);
1665  Print("m2: "); pWrite(m2);
1666 #endif
1667 #endif
1668 
1669 
1670 // assume(p_GetComp(m2,r) == 0);
1671 
1672 #ifdef PDEBUG
1673 #if 0
1674  if( (p_GetComp(m2,r) != 0) || (p_GetComp(m1,r) != 0) )
1675  {
1676  WarnS("gnc_CreateSpolyNew: wrong monomials!");
1677 
1678 
1679 #ifdef RDEBUG
1680  PrintS("m1 = "); p_Write(m1, r);
1681  p_DebugPrint(m1, r);
1682 
1683  PrintS("m2 = "); p_Write(m2, r);
1684  p_DebugPrint(m2, r);
1685 
1686  PrintS("p1 = "); p_Write(p1, r);
1687  p_DebugPrint(p1, r);
1688 
1689  PrintS("p2 = "); p_Write(p2, r);
1690  p_DebugPrint(p2, r);
1691 
1692  PrintS("pL = "); p_Write(pL, r);
1693  p_DebugPrint(pL, r);
1694 #endif
1695 
1696  }
1697 
1698 #endif
1699 #endif
1700 
1701  p_Delete(&pL,r);
1702 
1703  /* zero exponents !? */
1704  poly M1 = nc_mm_Mult_p(m1,p_Head(p1,r),r); // M1 = m1 * lt(p1)
1705  poly M2 = nc_mm_Mult_p(m2,p_Head(p2,r),r); // M2 = m2 * lt(p2)
1706 
1707 #ifdef PDEBUG
1708  p_Test(M1,r);
1709  p_Test(M2,r);
1710 
1711 #if MYTEST
1712  Print("M1: "); pWrite(M1);
1713  Print("M2: "); pWrite(M2);
1714 #endif
1715 #endif
1716 
1717  if(M1 == NULL || M2 == NULL)
1718  {
1719 #ifdef PDEBUG
1720  Print("\np1 = ");
1721  p_Write(p1, r);
1722 
1723  Print("m1 = ");
1724  p_Write(m1, r);
1725 
1726  Print("p2 = ");
1727  p_Write(p2, r);
1728 
1729  Print("m2 = ");
1730  p_Write(m2, r);
1731 
1732  Werror("ERROR in nc_CreateSpoly: result of multiplication is Zero!\n");
1733 #endif
1734  return(NULL);
1735  }
1736 
1737  number C1 = p_GetCoeff(M1,r); // C1 = lc(M1)
1738  number C2 = p_GetCoeff(M2,r); // C2 = lc(M2)
1739 
1740  /* GCD stuff */
1741  number C = n_SubringGcd(C1, C2, r->cf); // C = gcd(C1, C2)
1742 
1743  if (!n_IsOne(C, r)) // if C != 1
1744  {
1745  C1=n_Div(C1, C, r);n_Normalize(C1,r); // C1 = C1 / C
1746  C2=n_Div(C2, C, r);n_Normalize(C2,r); // C2 = C2 / C
1747  }
1748  else
1749  {
1750  C1=n_Copy(C1,r);
1751  C2=n_Copy(C2,r);
1752  }
1753 
1754  n_Delete(&C,r); // destroy the number C
1755 
1756  C1=n_InpNeg(C1,r);
1757 
1758 // number MinusOne=n_Init(-1,r);
1759 // if (n_Equal(C1,MinusOne,r)) // lc(M1) / gcd( lc(M1), lc(M2)) == -1 ????
1760 // {
1761 // M2=p_Add_q(M1,M2,r); // ?????
1762 // }
1763 // else
1764 // {
1765  M1=p_Mult_nn(M1,C2,r); // M1 = (C2*lc(p1)) * (lcm(lm(p1),lm(p2)) / lm(p1)) * lm(p1)
1766 
1767 #ifdef PDEBUG
1768  p_Test(M1,r);
1769 #endif
1770 
1771  M2=p_Mult_nn(M2,C1,r); // M2 =(-C1*lc(p2)) * (lcm(lm(p1),lm(p2)) / lm(p2)) * lm(p2)
1772 
1773 
1774 
1775 #ifdef PDEBUG
1776  p_Test(M2,r);
1777 
1778 #if MYTEST
1779  Print("M1: "); pWrite(M1);
1780  Print("M2: "); pWrite(M2);
1781 #endif
1782 #endif
1783 
1784 
1785  M2=p_Add_q(M1,M2,r); // M1 is killed, M2 = spoly(lt(p1), lt(p2)) = C2*M1 - C1*M2
1786 
1787 #ifdef PDEBUG
1788  p_Test(M2,r);
1789 
1790 #if MYTEST
1791  Print("M2: "); pWrite(M2);
1792 #endif
1793 
1794 #endif
1795 
1796 // M2 == 0 for supercommutative algebras!
1797 // }
1798 // n_Delete(&MinusOne,r);
1799 
1800  p_SetCoeff(m1,C2,r); // lc(m1) = C2!!!
1801  p_SetCoeff(m2,C1,r); // lc(m2) = C1!!!
1802 
1803 #ifdef PDEBUG
1804  p_Test(m1,r);
1805  p_Test(m2,r);
1806 #endif
1807 
1808 // poly tmp = p_Copy(p1,r); // tmp = p1
1809 // tmp=p_LmDeleteAndNext(tmp,r); // tmp = tail(p1)
1810 //#ifdef PDEBUG
1811 // p_Test(tmp,r);
1812 //#endif
1813 
1814  M1 = nc_mm_Mult_pp(m1, pNext(p1), r); // M1 = m1 * tail(p1), delete tmp // ???
1815 
1816 #ifdef PDEBUG
1817  p_Test(M1,r);
1818 
1819 #if MYTEST
1820  Print("M1: "); pWrite(M1);
1821 #endif
1822 
1823 #endif
1824 
1825  M2=p_Add_q(M2,M1,r); // M2 = spoly(lt(p1), lt(p2)) + m1 * tail(p1), delete M1
1826 #ifdef PDEBUG
1827  M1=NULL;
1828  p_Test(M2,r);
1829 
1830 #if MYTEST
1831  Print("M2: "); pWrite(M2);
1832 #endif
1833 
1834 #endif
1835 
1836 // tmp=p_Copy(p2,r); // tmp = p2
1837 // tmp=p_LmDeleteAndNext(tmp,r); // tmp = tail(p2)
1838 
1839 //#ifdef PDEBUG
1840 // p_Test(tmp,r);
1841 //#endif
1842 
1843  M1 = nc_mm_Mult_pp(m2, pNext(p2), r); // M1 = m2 * tail(p2), detele tmp
1844 
1845 #ifdef PDEBUG
1846  p_Test(M1,r);
1847 
1848 #if MYTEST
1849  Print("M1: "); pWrite(M1);
1850 #endif
1851 
1852 #endif
1853 
1854  M2 = p_Add_q(M2,M1,r); // M2 = spoly(lt(p1), lt(p2)) + m1 * tail(p1) + m2*tail(p2)
1855 
1856 #ifdef PDEBUG
1857  M1=NULL;
1858  p_Test(M2,r);
1859 
1860 #if MYTEST
1861  Print("M2: "); pWrite(M2);
1862 #endif
1863 
1864 #endif
1865 
1866  p_Delete(&m1,r); // => n_Delete(&C1,r);
1867  p_Delete(&m2,r); // => n_Delete(&C2,r);
1868 
1869 #ifdef PDEBUG
1870  p_Test(M2,r);
1871 #endif
1872 
1873  if (M2!=NULL) p_Cleardenom(M2,r);
1874 
1875  return(M2);
1876 }
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4176
#define Print
Definition: emacs.cc:83
poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r)
Definition: old.gring.cc:147
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:72
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:577
void pWrite(poly p)
Definition: polys.h:279
#define WarnS
Definition: emacs.cc:81
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:819
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:613
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:685
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
void Werror(const char *fmt,...)
Definition: reporter.cc:199
poly gnc_CreateSpolyOld ( const poly  p1,
const poly  p2,
const ring  r 
)

Definition at line 1517 of file old.gring.cc.

1518 {
1519 #ifdef PDEBUG
1520  if ((p_GetComp(p1,r)!=p_GetComp(p2,r))
1521  && (p_GetComp(p1,r)!=0)
1522  && (p_GetComp(p2,r)!=0))
1523  {
1524  dReportError("gnc_CreateSpolyOld : different components!");
1525  return(NULL);
1526  }
1527 #endif
1528  if ((ncRingType(r)==nc_lie) && p_HasNotCF(p1,p2, r)) /* prod crit */
1529  {
1530  return(nc_p_Bracket_qq(p_Copy(p2, r),p1, r));
1531  }
1532  poly pL=p_One(r);
1533  poly m1=p_One(r);
1534  poly m2=p_One(r);
1535  pL = p_Lcm(p1,p2,r);
1536  p_Setm(pL,r);
1537 #ifdef PDEBUG
1538  p_Test(pL,r);
1539 #endif
1540  p_ExpVectorDiff(m1,pL,p1,r);
1541  //p_SetComp(m1,0,r);
1542  //p_Setm(m1,r);
1543 #ifdef PDEBUG
1544  p_Test(m1,r);
1545 #endif
1546  p_ExpVectorDiff(m2,pL,p2,r);
1547  //p_SetComp(m2,0,r);
1548  //p_Setm(m2,r);
1549 #ifdef PDEBUG
1550  p_Test(m2,r);
1551 #endif
1552  p_Delete(&pL,r);
1553  /* zero exponents ! */
1554  poly M1 = nc_mm_Mult_p(m1,p_Head(p1,r),r);
1555  number C1 = p_GetCoeff(M1,r);
1556  poly M2 = nc_mm_Mult_p(m2,p_Head(p2,r),r);
1557  number C2 = p_GetCoeff(M2,r);
1558  /* GCD stuff */
1559  number C = n_SubringGcd(C1,C2,r->cf);
1560  if (!n_IsOne(C,r))
1561  {
1562  C1=n_Div(C1,C, r);n_Normalize(C1,r);
1563  C2=n_Div(C2,C, r);n_Normalize(C2,r);
1564  }
1565  else
1566  {
1567  C1=n_Copy(C1, r);
1568  C2=n_Copy(C2, r);
1569  }
1570  n_Delete(&C,r);
1571  M1=p_Mult_nn(M1,C2,r);
1572  p_SetCoeff(m1,C2,r);
1573  if (n_IsMOne(C1,r))
1574  {
1575  M2=p_Add_q(M1,M2,r);
1576  }
1577  else
1578  {
1579  C1=n_InpNeg(C1,r);
1580  M2=p_Mult_nn(M2,C1,r);
1581  M2=p_Add_q(M1,M2,r);
1582  p_SetCoeff(m2,C1,r);
1583  }
1584  /* M1 is killed, M2=res = C2 M1 - C1 M2 */
1585  poly tmp=p_Copy(p1,r);
1586  tmp=p_LmDeleteAndNext(tmp,r);
1587  M1=nc_mm_Mult_p(m1,tmp,r);
1588  tmp=p_Copy(p2,r);
1589  tmp=p_LmDeleteAndNext(tmp,r);
1590  M2=p_Add_q(M2,M1,r);
1591  M1=nc_mm_Mult_p(m2,tmp,r);
1592  M2=p_Add_q(M2,M1,r);
1593  p_Delete(&m1,r);
1594  p_Delete(&m2,r);
1595  // n_Delete(&C1,r);
1596  // n_Delete(&C2,r);
1597 #ifdef PDEBUG
1598  p_Test(M2,r);
1599 #endif
1600  if (M2!=NULL) M2=p_Cleardenom(M2,r);
1601  //if (M2!=NULL) p_Content(M2); // done by pCleardenom
1602  return(M2);
1603 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r)
Definition: old.gring.cc:147
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:72
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:577
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:819
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2295
polyrec * poly
Definition: hilb.h:10
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
BOOLEAN p_HasNotCF(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1334
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:613
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:685
int dReportError(const char *fmt,...)
Definition: dError.cc:45
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
Definition: nc.h:26
BOOLEAN gnc_InitMultiplication ( ring  r,
bool  bSetupQuotient = false 
)

Definition at line 3087 of file old.gring.cc.

3088 {
3089  /* returns TRUE if there were errors */
3090  /* initialize the multiplication: */
3091  /* r->GetNC()->MTsize, r->GetNC()->MT, r->GetNC()->COM, */
3092  /* and r->GetNC()->IsSkewConstant for the skew case */
3093  if (rVar(r)==1)
3094  {
3095  ncRingType(r, nc_comm);
3096  r->GetNC()->IsSkewConstant=1;
3097  return FALSE;
3098  }
3099 
3100 // ring save = currRing;
3101 // int WeChangeRing = 0;
3102 
3103 // if (currRing!=r)
3104 // {
3105 // rChangeCurrRing(r);
3106 // WeChangeRing = 1;
3107 // }
3108 // assume( (currRing == r)
3109 // && (currRing->GetNC()!=NULL) ); // otherwise we cannot work with all these matrices!
3110 
3111  int i,j;
3112  r->GetNC()->MT = (matrix *)omAlloc0((r->N*(r->N-1))/2*sizeof(matrix));
3113  r->GetNC()->MTsize = (int *)omAlloc0((r->N*(r->N-1))/2*sizeof(int));
3114  id_Test((ideal)r->GetNC()->C, r);
3115  matrix COM = mp_Copy(r->GetNC()->C, r);
3116  poly p,q;
3117  short DefMTsize=7;
3118  int IsNonComm=0;
3119 // bool tmpIsSkewConstant = false;
3120 
3121  for(i=1; i<r->N; i++)
3122  {
3123  for(j=i+1; j<=r->N; j++)
3124  {
3125  if ( MATELEM(r->GetNC()->D,i,j) == NULL ) /* quasicommutative case */
3126  {
3127  /* 1x1 mult.matrix */
3128  r->GetNC()->MTsize[UPMATELEM(i,j,r->N)] = 1;
3129  r->GetNC()->MT[UPMATELEM(i,j,r->N)] = mpNew(1,1);
3130  }
3131  else /* pure noncommutative case */
3132  {
3133  /* TODO check the special multiplication properties */
3134  IsNonComm = 1;
3135  p_Delete(&(MATELEM(COM,i,j)),r);
3136  //MATELEM(COM,i,j) = NULL; // done by p_Delete
3137  r->GetNC()->MTsize[UPMATELEM(i,j,r->N)] = DefMTsize; /* default sizes */
3138  r->GetNC()->MT[UPMATELEM(i,j,r->N)] = mpNew(DefMTsize, DefMTsize);
3139  }
3140  /* set MT[i,j,1,1] to c_i_j*x_i*x_j + D_i_j */
3141  p = p_One(r);
3142  if (MATELEM(r->GetNC()->C,i,j)!=NULL)
3143  p_SetCoeff(p,n_Copy(pGetCoeff(MATELEM(r->GetNC()->C,i,j)),r),r);
3144  p_SetExp(p,i,1,r);
3145  p_SetExp(p,j,1,r);
3146  p_Setm(p,r);
3147  p_Test(MATELEM(r->GetNC()->D,i,j),r);
3148  q = nc_p_CopyGet(MATELEM(r->GetNC()->D,i,j),r);
3149  p = p_Add_q(p,q,r);
3150  MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1) = nc_p_CopyPut(p,r);
3151  p_Delete(&p,r);
3152  // p = NULL;// done by p_Delete
3153  }
3154  }
3155  if (ncRingType(r)==nc_undef)
3156  {
3157  if (IsNonComm==1)
3158  {
3159  // assume(pN!=NULL);
3160  // if ((tmpIsSkewConstant==1) && (nIsOne(pGetCoeff(pN)))) r->GetNC()->type=nc_lie;
3161  // else r->GetNC()->type=nc_general;
3162  }
3163  if (IsNonComm==0)
3164  {
3165  ncRingType(r, nc_skew); // TODO: check whether it is commutative
3166  r->GetNC()->IsSkewConstant = 0; // true; //tmpIsSkewConstant; // BUG???
3167  } else
3168  assume( FALSE );
3169  }
3170  r->GetNC()->COM=COM;
3171 
3172  nc_p_ProcsSet(r, r->p_Procs);
3173 
3174  if(bSetupQuotient) // Test me!!!
3175  nc_SetupQuotient(r, NULL, false); // no copy!
3176 
3177 
3178 // if (save != currRing)
3179 // rChangeCurrRing(save);
3180 
3181  return FALSE;
3182 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define id_Test(A, lR)
Definition: simpleideals.h:67
void nc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3251
const ideal
Definition: gb_hack.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define COM(f)
Definition: transext.cc:72
bool nc_SetupQuotient(ring rGR, const ring rG, bool bCopy)
Definition: old.gring.cc:3475
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
Definition: nc.h:25
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
Definition: nc.h:27
poly nc_p_CopyGet(poly a, const ring r)
Definition: old.gring.cc:2578
ip_smatrix * matrix
int i
Definition: cfEzgcd.cc:123
Definition: nc.h:24
#define p_Test(p, r)
Definition: p_polys.h:160
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly nc_p_CopyPut(poly a, const ring r)
Definition: old.gring.cc:2599
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void gnc_kBucketPolyRed_ZNew ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 2113 of file old.gring.cc.

2114 {
2115  const ring r = b->bucket_ring;
2116  // b is multiplied by a constant in this impl.
2117  number ctmp;
2118  poly m=p_One(r);
2119  p_ExpVectorDiff(m,kBucketGetLm(b),p, r);
2120  //pSetm(m);
2121 #ifdef PDEBUG
2122  p_Test(m, r);
2123 #endif
2124 
2125  if(p_IsConstant(m,r))
2126  {
2127  p_Delete(&m, r);
2128  ctmp = kBucketPolyRed(b,p,pLength(p),NULL);
2129  }
2130  else
2131  {
2132  poly pp = nc_mm_Mult_pp(m,p,r);
2133  number c2;
2134  p_Cleardenom_n(pp,r,c2);
2135  p_Delete(&m, r);
2136  ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL);
2137  //cc=*c;
2138  //*c=nMult(*c,c2);
2139  n_Delete(&c2, r);
2140  //nDelete(&cc);
2141  p_Delete(&pp, r);
2142  }
2143  if (c!=NULL) *c=ctmp;
2144  else n_Delete(&ctmp, r);
2145 }
return P p
Definition: myNF.cc:203
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1064
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static int pLength(poly a)
Definition: p_polys.h:189
poly pp
Definition: myNF.cc:296
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2799
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
ring bucket_ring
Definition: kbuckets.h:191
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1781
int m
Definition: cfEzgcd.cc:119
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
void gnc_kBucketPolyRed_ZOld ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 2080 of file old.gring.cc.

2081 {
2082  const ring r = b->bucket_ring;
2083  // b is multiplied by a constant in this impl.
2084  number ctmp;
2085  poly m=p_One(r);
2086  p_ExpVectorDiff(m,kBucketGetLm(b),p, r);
2087  //pSetm(m);
2088 #ifdef PDEBUG
2089  p_Test(m, r);
2090 #endif
2091  if(p_IsConstant(m,r))
2092  {
2093  p_Delete(&m, r);
2094  ctmp = kBucketPolyRed(b,p,pLength(p),NULL);
2095  }
2096  else
2097  {
2098  poly pp = nc_mm_Mult_pp(m,p,r);
2099  number c2;
2100  p_Cleardenom_n(pp,r,c2);
2101  p_Delete(&m, r);
2102  ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL);
2103  //cc=*c;
2104  //*c=nMult(*c,c2);
2105  n_Delete(&c2, r);
2106  //nDelete(&cc);
2107  p_Delete(&pp, r);
2108  }
2109  if (c!=NULL) *c=ctmp;
2110  else n_Delete(&ctmp, r);
2111 }
return P p
Definition: myNF.cc:203
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1064
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static int pLength(poly a)
Definition: p_polys.h:189
poly pp
Definition: myNF.cc:296
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2799
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
ring bucket_ring
Definition: kbuckets.h:191
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1781
int m
Definition: cfEzgcd.cc:119
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
void gnc_kBucketPolyRedNew ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 2000 of file old.gring.cc.

2001 {
2002  const ring r = b->bucket_ring;
2003 #ifdef PDEBUG
2004 // Print(">*");
2005 #endif
2006 
2007 #ifdef KDEBUG
2008  if( !kbTest(b) )Werror("nc_kBucketPolyRed: broken bucket!");
2009 #endif
2010 
2011 #ifdef PDEBUG
2012  p_Test(p, r);
2013 #if MYTEST
2014  Print("p: "); p_Write(p, r);
2015 #endif
2016 #endif
2017 
2018  // b will not be multiplied by any constant in this impl.
2019  // ==> *c=1
2020  if (c!=NULL) *c=n_Init(1, r);
2021  poly m = p_One(r);
2022  const poly pLmB = kBucketGetLm(b); // no new copy!
2023 
2024  assume( pLmB != NULL );
2025 
2026 #ifdef PDEBUG
2027  p_Test(pLmB, r);
2028 
2029 #if MYTEST
2030  Print("pLmB: "); p_Write(pLmB, r);
2031 #endif
2032 #endif
2033 
2034  p_ExpVectorDiff(m, pLmB, p, r);
2035  //pSetm(m);
2036 
2037 #ifdef PDEBUG
2038  p_Test(m, r);
2039 #if MYTEST
2040  Print("m: "); p_Write(m, r);
2041 #endif
2042 #endif
2043 
2044  poly pp = nc_mm_Mult_pp(m, p, r);
2045  p_Delete(&m, r);
2046 
2047  assume( pp != NULL );
2048  const number n = p_GetCoeff(pp, r); // bug!
2049 
2050  if (!n_IsMOne(n, r) ) // does this improve performance??!? also see below... // TODO: check later on.
2051  // if n == -1 => nn = 1 and -1/n
2052  {
2053  number nn=n_InpNeg(n_Invers(n, r), r);
2054  number t = n_Mult(nn,p_GetCoeff(pLmB, r), r);
2055  n_Delete(&nn, r);
2056  pp = p_Mult_nn(pp,t,r);
2057  n_Delete(&t, r);
2058  }
2059  else
2060  {
2061  pp = p_Mult_nn(pp,p_GetCoeff(pLmB, r), r);
2062  }
2063 
2064  int l = pLength(pp);
2065 
2066 #ifdef PDEBUG
2067  p_Test(pp, r);
2068 // Print("PP: "); pWrite(pp);
2069 #endif
2070 
2071  kBucket_Add_q(b,pp,&l);
2072 
2073 
2074 #ifdef PDEBUG
2075 // Print("*>");
2076 #endif
2077 }
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:186
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static int pLength(poly a)
Definition: p_polys.h:189
poly pp
Definition: myNF.cc:296
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
ring bucket_ring
Definition: kbuckets.h:191
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible ...
Definition: coeffs.h:563
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:637
void gnc_kBucketPolyRedOld ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 1967 of file old.gring.cc.

1968 {
1969  const ring r = b->bucket_ring;
1970  // b will not be multiplied by any constant in this impl.
1971  // ==> *c=1
1972  if (c!=NULL) *c=n_Init(1, r);
1973  poly m=p_One(r);
1974  p_ExpVectorDiff(m,kBucketGetLm(b),p, r);
1975  //pSetm(m);
1976 #ifdef PDEBUG
1977  p_Test(m, r);
1978 #endif
1979  poly pp= nc_mm_Mult_pp(m,p, r);
1980  assume(pp!=NULL);
1981  p_Delete(&m, r);
1982  number n=p_GetCoeff(pp, r);
1983  number nn;
1984  if (!n_IsMOne(n, r))
1985  {
1986  nn=n_InpNeg(n_Invers(n, r), r);
1987  n= n_Mult(nn,p_GetCoeff(kBucketGetLm(b), r), r);
1988  n_Delete(&nn, r);
1989  pp=p_Mult_nn(pp,n,r);
1990  n_Delete(&n, r);
1991  }
1992  else
1993  {
1994  pp=p_Mult_nn(pp,p_GetCoeff(kBucketGetLm(b), r),r);
1995  }
1996  int l=pLength(pp);
1997  kBucket_Add_q(b,pp,&l);
1998 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static int pLength(poly a)
Definition: p_polys.h:189
poly pp
Definition: myNF.cc:296
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
ring bucket_ring
Definition: kbuckets.h:191
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible ...
Definition: coeffs.h:563
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
int l
Definition: cfEzgcd.cc:94
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:637
poly gnc_mm_Mult_nn ( int F,
int G,
const ring  r 
)

Definition at line 460 of file old.gring.cc.

462 {
463  poly out=NULL;
464  int i,j;
465  int iF,jG,iG;
466  int rN=r->N;
467 
468  int *F=(int *)omAlloc0((rN+1)*sizeof(int));
469  int *G=(int *)omAlloc0((rN+1)*sizeof(int));
470 
471  memcpy(F, F0,(rN+1)*sizeof(int));
472  // pExpVectorCopy(F,F0);
473  memcpy(G, G0,(rN+1)*sizeof(int));
474  // pExpVectorCopy(G,G0);
475  F[0]=0;
476  G[0]=0;
477 
478  iF=rN;
479  while ((F[iF]==0)&&(iF>=1)) iF--; /* last exp_num of F */
480  if (iF==0) /* F0 is zero vector */
481  {
482  out=p_One(r);
483  p_SetExpV(out,G0,r);
484  p_Setm(out,r);
485  freeT(F,rN);
486  freeT(G,rN);
487  return(out);
488  }
489  jG=1;
490  while ((G[jG]==0)&&(jG<rN)) jG++; /* first exp_num of G */
491  iG=rN;
492  while ((G[iG]==0)&&(iG>1)) iG--; /* last exp_num of G */
493 
494  out=p_One(r);
495 
496  if (iF<=jG)
497  /* i.e. no mixed exp_num , MERGE case */
498  {
499  { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
500  p_SetExpV(out,F,r);
501  p_Setm(out,r);
502  freeT(F,rN);
503  freeT(G,rN);
504  return(out);
505  }
506 
507  number cff=n_Init(1,r);
508  number tmp_num=NULL;
509  int cpower=0;
510 
511  if (ncRingType(r)==nc_skew)
512  {
513  if (r->GetNC()->IsSkewConstant==1)
514  {
515  int tpower=0;
516  for(j=jG; j<=iG; j++)
517  {
518  if (G[j]!=0)
519  {
520  cpower = 0;
521  for(i=j+1; i<=iF; i++)
522  {
523  cpower = cpower + F[i];
524  }
525  cpower = cpower*G[j]; // bug! here may happen an arithmetic overflow!!!
526  tpower = tpower + cpower;
527  }
528  }
529  cff = n_Copy(p_GetCoeff(MATELEM(r->GetNC()->COM,1,2),r),r);
530  n_Power(cff,tpower,&tmp_num, r);
531  n_Delete(&cff,r);
532  cff = tmp_num;
533  }
534  else /* skew commutative with nonequal coeffs */
535  {
536  number totcff=n_Init(1,r);
537  for(j=jG; j<=iG; j++)
538  {
539  if (G[j]!=0)
540  {
541  cpower = 0;
542  for(i=j+1; i<=iF; i++)
543  {
544  if (F[i]!=0)
545  {
546  cpower = F[i]*G[j]; // bug! overflow danger!!!
547  cff = n_Copy(p_GetCoeff(MATELEM(r->GetNC()->COM,j,i),r),r);
548  n_Power(cff,cpower,&tmp_num, r);
549  cff = n_Mult(totcff,tmp_num, r);
550  n_Delete(&totcff, r);
551  n_Delete(&tmp_num, r);
552  totcff = n_Copy(cff,r);
553  n_Delete(&cff,r);
554  }
555  } /* end 2nd for */
556  }
557  }
558  cff=totcff;
559  }
560  { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
561  p_SetExpV(out,F,r);
562  p_Setm(out,r);
563  p_SetCoeff(out,cff,r);
564  freeT(F,rN);
565  freeT(G,rN);
566  return(out);
567  } /* end nc_skew */
568 
569  /* now we have to destroy out! */
570  p_Delete(&out,r);
571 
572  if (iG==jG)
573  /* g is univariate monomial */
574  {
575  /* if (ri->GetNC()->type==nc_skew) -- postpone to TU */
576  out = gnc_mm_Mult_uu(F,jG,G[jG],r);
577  freeT(F,rN);
578  freeT(G,rN);
579  return(out);
580  }
581 
582  int *Prv=(int *)omAlloc0((rN+1)*sizeof(int));
583  int *Nxt=(int *)omAlloc0((rN+1)*sizeof(int));
584 
585  int *log=(int *)omAlloc0((rN+1)*sizeof(int));
586  int cnt=0; int cnf=0;
587 
588  /* splitting F wrt jG */
589  for (i=1;i<=jG;i++)
590  {
591  Prv[i]=F[i]; Nxt[i]=0; /* mult at the very end */
592  if (F[i]!=0) cnf++;
593  }
594 
595  if (cnf==0) freeT(Prv,rN);
596 
597  for (i=jG+1;i<=rN;i++)
598  {
599  Nxt[i]=F[i];
600  /* if (cnf!=0) Prv[i]=0; */
601  if (F[i]!=0)
602  {
603  cnt++;
604  } /* effective part for F */
605  }
606  freeT(F,rN);
607  cnt=0;
608 
609  for (i=1;i<=rN;i++)
610  {
611  if (G[i]!=0)
612  {
613  cnt++;
614  log[cnt]=i;
615  } /* lG for G */
616  }
617 
618 /* ---------------------- A C T I O N ------------------------ */
619  poly D=NULL;
620  poly Rout=NULL;
621  number *c=(number *)omAlloc0((rN+1)*sizeof(number));
622  c[0]=n_Init(1,r);
623 
624  int *Op=Nxt;
625  int *On=G;
626  int *U=(int *)omAlloc0((rN+1)*sizeof(int));
627 
628  for (i=jG;i<=rN;i++) U[i]=Nxt[i]+G[i]; /* make leadterm */
629  Nxt=NULL;
630  G=NULL;
631  cnt=1;
632  int t=0;
633  poly w=NULL;
634  poly Pn=p_One(r);
635  p_SetExpV(Pn,On,r);
636  p_Setm(Pn,r);
637 
638  while (On[iG]!=0)
639  {
640  t=log[cnt];
641 
642  w=gnc_mm_Mult_uu(Op,t,On[t],r);
643  c[cnt]=n_Mult(c[cnt-1],p_GetCoeff(w,r),r);
644  D = pNext(w); /* getting coef and rest D */
645  p_LmDelete(&w,r);
646  w=NULL;
647 
648  Op[t] += On[t]; /* update exp_vectors */
649  On[t] = 0;
650 
651  if (t!=iG) /* not the last step */
652  {
653  p_SetExpV(Pn,On,r);
654  p_Setm(Pn,r);
655 #ifdef PDEBUG
656  p_Test(Pn,r);
657 #endif
658 
659 // if (pNext(D)==0)
660 // is D a monomial? could be postponed higher
661 // {
662 // Rout=nc_mm_Mult_nn(D,Pn,r);
663 // }
664 // else
665 // {
666  Rout=gnc_p_Mult_mm(D,Pn,r);
667 // }
668  }
669  else
670  {
671  Rout=D;
672  D=NULL;
673  }
674 
675  if (Rout!=NULL)
676  {
677  Rout=p_Mult_nn(Rout,c[cnt-1],r); /* Rest is ready */
678  out=p_Add_q(out,Rout,r);
679  Rout=NULL;
680  }
681  cnt++;
682  }
683  freeT(On,rN);
684  freeT(Op,rN);
685  p_Delete(&Pn,r);
686  omFreeSize((ADDRESS)log,(rN+1)*sizeof(int));
687 
688  /* leadterm and Prv-part */
689 
690  Rout=p_One(r);
691  /* U is lead.monomial */
692  U[0]=0;
693  p_SetExpV(Rout,U,r);
694  p_Setm(Rout,r); /* use again this name Rout */
695 #ifdef PDEBUG
696  p_Test(Rout,r);
697 #endif
698  p_SetCoeff(Rout,c[cnt-1],r);
699  out=p_Add_q(out,Rout,r);
700  freeT(U,rN);
701  freeN(c,rN+1);
702  if (cnf!=0) /* Prv is non-zero vector */
703  {
704  Rout=p_One(r);
705  Prv[0]=0;
706  p_SetExpV(Rout,Prv,r);
707  p_Setm(Rout,r);
708 #ifdef PDEBUG
709  p_Test(Rout,r);
710 #endif
711  out=gnc_mm_Mult_p(Rout,out,r); /* getting the final result */
712  freeT(Prv,rN);
713  p_Delete(&Rout,r);
714  }
715  return (out);
716 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
gmp_float log(const gmp_float &a)
Definition: mpr_complex.cc:345
void * ADDRESS
Definition: auxiliary.h:161
static TreeM * G
Definition: janet.cc:38
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1456
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
#define freeN(A, k)
Definition: old.gring.cc:95
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:448
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
void On(int sw)
switches
int i
Definition: cfEzgcd.cc:123
Definition: nc.h:24
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
poly gnc_mm_Mult_uu(int *F, int jG, int bG, const ring r)
Definition: old.gring.cc:719
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:629
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define freeT(A, v)
Definition: old.gring.cc:94
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:443
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define MATELEM(mat, i, j)
Definition: matpol.h:29
poly gnc_mm_Mult_p ( const poly  m,
poly  p,
const ring  r 
)

Definition at line 448 of file old.gring.cc.

449 {
450  return( gnc_p_Mult_mm_Common(p, m, 0, r) );
451 }
return P p
Definition: myNF.cc:203
poly gnc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r)
Definition: old.gring.cc:347
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
poly gnc_mm_Mult_pp ( const poly  m,
const poly  p,
const ring  r 
)

Definition at line 453 of file old.gring.cc.

454 {
455  return( gnc_p_Mult_mm_Common(p_Copy(p,r), m, 0, r) );
456 }
return P p
Definition: myNF.cc:203
poly gnc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r)
Definition: old.gring.cc:347
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
poly gnc_mm_Mult_uu ( int F,
int  jG,
int  bG,
const ring  r 
)

Definition at line 719 of file old.gring.cc.

721 {
722  poly out=NULL;
723  int i;
724  number num=NULL;
725 
726  int rN=r->N;
727  int iF=r->N;
728  while ((F[iF]==0)&&(iF>0)) iF-- ; /* last exponent_num of F */
729 
730  if (iF==0) /* F==zero vector in other words */
731  {
732  out=p_One(r);
733  p_SetExp(out,jG,bG,r);
734  p_Setm(out,r);
735  return(out);
736  }
737 
738  int jF=1;
739  while ((F[jF]==0)&&(jF<=rN)) jF++; /* first exp of F */
740 
741  if (iF<=jG) /* i.e. no mixed exp_num */
742  {
743  out=p_One(r);
744  F[jG]=F[jG]+bG;
745  p_SetExpV(out,F,r);
746  p_Setm(out,r);
747  return(out);
748  }
749 
750  if (iF==jF) /* uni times uni */
751  {
752  out=gnc_uu_Mult_ww(iF,F[iF],jG,bG,r);
753  return(out);
754  }
755 
756  /* Now: F is mono with >=2 exponents, jG<iF */
757  /* check the quasi-commutative case */
758 // matrix LCOM=r->GetNC()->COM;
759 // number rescoef=n_Init(1,r);
760 // number tmpcoef=n_Init(1,r);
761 // int tmpint;
762 // i=iF;
763 // while (i>=jG+1)
764 // /* all the non-zero exponents */
765 // {
766 // if (MATELEM(LCOM,jG,i)!=NULL)
767 // {
768 // tmpcoef=pGetCoeff(MATELEM(LCOM,jG,i));
769 // tmpint=(int)F[i];
770 // nPower(tmpcoef,F[i],&tmpcoef);
771 // rescoef=nMult(rescoef,tmpcoef);
772 // i--;
773 // }
774 // else
775 // {
776 // if (F[i]!=0) break;
777 // }
778 // }
779 // if (iF==i)
780 // /* no action took place*/
781 // {
782 
783 // }
784 // else /* power the result up to bG */
785 // {
786 // nPower(rescoef,bG,&rescoef);
787 // /* + cleanup, post-processing */
788 // }
789 
790  int *Prv=(int*)omAlloc0((rN+1)*sizeof(int));
791  int *Nxt=(int*)omAlloc0((rN+1)*sizeof(int));
792  int *lF=(int *)omAlloc0((rN+1)*sizeof(int));
793 
794  int cnt=0; int cnf=0;
795  /* splitting F wrt jG */
796  for (i=1;i<=jG;i++) /* mult at the very end */
797  {
798  Prv[i]=F[i]; Nxt[i]=0;
799  if (F[i]!=0) cnf++;
800  }
801 
802  if (cnf==0)
803  {
804  freeT(Prv,rN); Prv = NULL;
805  }
806 
807  for (i=jG+1;i<=rN;i++)
808  {
809  Nxt[i]=F[i];
810  if (cnf!=0) { Prv[i]=0;}
811  if (F[i]!=0)
812  {
813  cnt++;
814  lF[cnt]=i;
815  } /* eff_part,lF_for_F */
816  }
817 
818  if (cnt==1) /* Nxt consists of 1 nonzero el-t only */
819  {
820  int q=lF[1];
821  poly Rout=p_One(r);
822  out=gnc_uu_Mult_ww(q,Nxt[q],jG,bG,r);
823 
824  freeT(Nxt,rN); Nxt = NULL;
825 
826  if (cnf!=0)
827  {
828  Prv[0]=0;
829  p_SetExpV(Rout,Prv,r);
830  p_Setm(Rout,r);
831 
832 #ifdef PDEBUG
833  p_Test(Rout,r);
834 #endif
835 
836  freeT(Prv,rN);
837  Prv = NULL;
838 
839  out=gnc_mm_Mult_p(Rout,out,r); /* getting the final result */
840  }
841 
842  freeT(lF,rN);
843  lF = NULL;
844 
845  p_Delete(&Rout,r);
846 
847  assume(Nxt == NULL);
848  assume(lF == NULL);
849  assume(Prv == NULL);
850 
851  return (out);
852  }
853 /* -------------------- MAIN ACTION --------------------- */
854 
855  poly D=NULL;
856  poly Rout=NULL;
857  number *c=(number *)omAlloc0((cnt+2)*sizeof(number));
858  c[cnt+1]=n_Init(1,r);
859  i=cnt+2; /* later in freeN */
860  int *Op=Nxt;
861 
862  int *On=(int *)omAlloc0((rN+1)*sizeof(int));
863  int *U=(int *)omAlloc0((rN+1)*sizeof(int));
864 
865 
866  // pExpVectorCopy(U,Nxt);
867  memcpy(U, Nxt,(rN+1)*sizeof(int));
868  U[jG] = U[jG] + bG;
869 
870  /* Op=Nxt and initial On=(0); */
871  Nxt=NULL;
872 
873  poly Pp;
874  poly Pn;
875  int t=0;
876  int first=lF[1];
877  int nlast=lF[cnt];
878  int kk=0;
879  /* cnt--; */
880  /* now lF[cnt] should be <=iF-1 */
881 
882  while (Op[first]!=0)
883  {
884  t=lF[cnt]; /* cnt as it was computed */
885 
886  poly w=gnc_uu_Mult_ww(t,Op[t],jG,bG,r);
887  c[cnt]=n_Copy(p_GetCoeff(w,r),r);
888  D = pNext(w); /* getting coef and rest D */
889  p_LmDelete(&w,r);
890  w=NULL;
891 
892  Op[t]= 0;
893  Pp=p_One(r);
894  p_SetExpV(Pp,Op,r);
895  p_Setm(Pp,r);
896 
897  if (t<nlast)
898  {
899  kk=lF[cnt+1];
900  On[kk]=F[kk];
901 
902  Pn=p_One(r);
903  p_SetExpV(Pn,On,r);
904  p_Setm(Pn,r);
905 
906  if (t!=first) /* typical expr */
907  {
908  w=gnc_p_Mult_mm(D,Pn,r);
909  Rout=gnc_mm_Mult_p(Pp,w,r);
910  w=NULL;
911  }
912  else /* last step */
913  {
914  On[t]=0;
915  p_SetExpV(Pn,On,r);
916  p_Setm(Pn,r);
917  Rout=gnc_p_Mult_mm(D,Pn,r);
918  }
919 #ifdef PDEBUG
920  p_Test(Pp,r);
921 #endif
922  p_Delete(&Pn,r);
923  }
924  else /* first step */
925  {
926  Rout=gnc_mm_Mult_p(Pp,D,r);
927  }
928 #ifdef PDEBUG
929  p_Test(Pp,r);
930 #endif
931  p_Delete(&Pp,r);
932  num=n_Mult(c[cnt+1],c[cnt],r);
933  n_Delete(&c[cnt],r);
934  c[cnt]=num;
935  Rout=p_Mult_nn(Rout,c[cnt+1],r); /* Rest is ready */
936  out=p_Add_q(out,Rout,r);
937  Pp=NULL;
938  cnt--;
939  }
940  /* only to feel safe:*/
941  Pn=Pp=NULL;
942  freeT(On,rN);
943  freeT(Op,rN);
944 
945 /* leadterm and Prv-part with coef 1 */
946 /* U[0]=exp; */
947 /* U[jG]=U[jG]+bG; */
948 /* make leadterm */
949 /* ??????????? we have done it already :-0 */
950 
951  Rout=p_One(r);
952  p_SetExpV(Rout,U,r);
953  p_Setm(Rout,r); /* use again this name */
954  p_SetCoeff(Rout,c[cnt+1],r); /* last computed coef */
955 
956  out=p_Add_q(out,Rout,r);
957 
958  Rout=NULL;
959 
960  freeT(U, rN);
961  freeN(c, i);
962  freeT(lF, rN);
963 
964  if (cnf!=0)
965  {
966  Rout=p_One(r);
967  p_SetExpV(Rout,Prv,r);
968  p_Setm(Rout,r);
969  freeT(Prv, rN);
970  out=gnc_mm_Mult_p(Rout,out,r); /* getting the final result */
971  p_Delete(&Rout,r);
972  }
973 
974  return (out);
975 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
CanonicalForm num(const CanonicalForm &f)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1456
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
#define freeN(A, k)
Definition: old.gring.cc:95
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:448
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
void On(int sw)
switches
int i
Definition: cfEzgcd.cc:123
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
poly gnc_uu_Mult_ww(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:1085
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define freeT(A, v)
Definition: old.gring.cc:94
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:443
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly gnc_p_Mult_mm ( poly  p,
const poly  m,
const ring  r 
)

Definition at line 443 of file old.gring.cc.

444 {
445  return( gnc_p_Mult_mm_Common(p, m, 1, r) );
446 }
return P p
Definition: myNF.cc:203
poly gnc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r)
Definition: old.gring.cc:347
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
poly gnc_p_Mult_mm_Common ( poly  p,
const poly  m,
int  side,
const ring  r 
)

Definition at line 347 of file old.gring.cc.

350 {
351  if ((p==NULL) || (m==NULL)) return NULL;
352  /* if (pNext(p)==NULL) return(nc_mm_Mult_nn(p,pCopy(m),r)); */
353  /* excluded - the cycle will do it anyway - OK. */
354  if (p_IsConstant(m,r)) return(p_Mult_nn(p,p_GetCoeff(m,r),r));
355 
356 #ifdef PDEBUG
357  p_Test(p,r);
358  p_Test(m,r);
359 #endif
360  poly v=NULL;
361  int rN=r->N;
362  int *P=(int *)omAlloc0((rN+1)*sizeof(int));
363  int *M=(int *)omAlloc0((rN+1)*sizeof(int));
364  /* coefficients: */
365  number cP,cM,cOut;
366  p_GetExpV(m, M, r);
367  cM=p_GetCoeff(m,r);
368  /* components:*/
369  const int expM=p_GetComp(m,r);
370  int expP=0;
371  int expOut=0;
372  /* bucket constraints: */
373  int UseBuckets=1;
374  if (pLength(p)< MIN_LENGTH_BUCKET || TEST_OPT_NOT_BUCKETS) UseBuckets=0;
375 
376  CPolynomialSummator sum(r, UseBuckets == 0);
377 
378  while (p!=NULL)
379  {
380 #ifdef PDEBUG
381  p_Test(p,r);
382 #endif
383  expP=p_GetComp(p,r);
384  if (expP==0)
385  {
386  expOut=expM;
387  }
388  else
389  {
390  if (expM==0)
391  {
392  expOut=expP;
393 #ifdef PDEBUG
394  if (side)
395  {
396  Print("gnc_p_Mult_mm: Multiplication in the left module from the right");
397  }
398 #endif
399  }
400  else
401  {
402  /* REPORT_ERROR */
403 #ifdef PDEBUG
404  const char* s;
405  if (side==1) s="gnc_p_Mult_mm";
406  else s="gnc_mm_Mult_p";
407  Print("%s: exponent mismatch %d and %d\n",s,expP,expM);
408 #endif
409  expOut=0;
410  }
411  }
412  p_GetExpV(p,P,r);
413  cP=p_GetCoeff(p,r);
414  cOut=n_Mult(cP,cM,r);
415  if (side==1)
416  {
417  v = gnc_mm_Mult_nn(P, M, r);
418  }
419  else
420  {
421  v = gnc_mm_Mult_nn(M, P, r);
422  }
423  v = p_Mult_nn(v,cOut,r);
424  n_Delete(&cOut,r);
425  p_SetCompP(v,expOut,r);
426 
427  sum += v;
428 
429  p_LmDelete(&p,r);
430  }
431  freeT(P,rN);
432  freeT(M,rN);
433 
434  return(sum);
435 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:22
poly gnc_mm_Mult_nn(int *F, int *G, const ring r)
Definition: old.gring.cc:460
static int pLength(poly a)
Definition: p_polys.h:189
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
#define M
Definition: sirandom.c:24
const ring r
Definition: syzextra.cc:208
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:243
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1781
int m
Definition: cfEzgcd.cc:119
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
kBucketDestroy & P
Definition: myNF.cc:191
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(...
Definition: summator.h:29
#define freeT(A, v)
Definition: old.gring.cc:94
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static void gnc_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)
inlinestatic

Definition at line 3187 of file old.gring.cc.

3188 {
3189  // "commutative"
3190  p_Procs->p_Mult_mm = rGR->p_Procs->p_Mult_mm = gnc_p_Mult_mm;
3191  p_Procs->pp_Mult_mm = rGR->p_Procs->pp_Mult_mm = gnc_pp_Mult_mm;
3192  p_Procs->p_Minus_mm_Mult_qq = rGR->p_Procs->p_Minus_mm_Mult_qq = nc_p_Minus_mm_Mult_qq;
3193 
3194  // non-commutaitve multiplication by monomial from the left
3195  rGR->GetNC()->p_Procs.mm_Mult_p = gnc_mm_Mult_p;
3196  rGR->GetNC()->p_Procs.mm_Mult_pp = gnc_mm_Mult_pp;
3197 
3198 #if 0
3199  // Previous Plural's implementation...
3200  rGR->GetNC()->p_Procs.SPoly = gnc_CreateSpolyOld;
3201  rGR->GetNC()->p_Procs.ReduceSPoly = gnc_ReduceSpolyOld;
3202 
3203  rGR->GetNC()->p_Procs.BucketPolyRed = gnc_kBucketPolyRedOld;
3204  rGR->GetNC()->p_Procs.BucketPolyRed_Z= gnc_kBucketPolyRed_ZOld;
3205 #else
3206  // A bit cleaned up and somewhat rewritten functions...
3207  rGR->GetNC()->p_Procs.SPoly = gnc_CreateSpolyNew;
3208  rGR->GetNC()->p_Procs.ReduceSPoly = gnc_ReduceSpolyNew;
3209 
3210  rGR->GetNC()->p_Procs.BucketPolyRed = gnc_kBucketPolyRedNew;
3211  rGR->GetNC()->p_Procs.BucketPolyRed_Z= gnc_kBucketPolyRed_ZNew;
3212 #endif
3213 
3214  // warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object?
3215  if (rHasLocalOrMixedOrdering(rGR))
3216  rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_mora);
3217  else
3218  rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_bba);
3219 
3220 /////////// rGR->GetNC()->p_Procs.GB = gnc_gr_bba; // bba even for local case!
3221 // old /// r->GetNC()->GB() = gnc_gr_bba;
3222 // rGR->GetNC()->p_Procs.GlobalGB = gnc_gr_bba;
3223 // rGR->GetNC()->p_Procs.LocalGB = gnc_gr_mora;
3224 // const ring save = currRing; if( save != r ) rChangeCurrRing(r);
3225 // ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
3226 // if( save != r ) rChangeCurrRing(save); return (res);
3227 
3228 
3229 #if 0
3230  // Old Stuff
3231  p_Procs->p_Mult_mm = gnc_p_Mult_mm;
3232  _p_procs->p_Mult_mm = gnc_p_Mult_mm;
3233 
3234  p_Procs->pp_Mult_mm = gnc_pp_Mult_mm;
3235  _p_procs->pp_Mult_mm = gnc_pp_Mult_mm;
3236 
3237  p_Procs->p_Minus_mm_Mult_qq = NULL; // gnc_p_Minus_mm_Mult_qq_ign;
3238  _p_procs->p_Minus_mm_Mult_qq= NULL; // gnc_p_Minus_mm_Mult_qq_ign;
3239 
3240  r->GetNC()->mmMultP() = gnc_mm_Mult_p;
3241  r->GetNC()->mmMultPP() = gnc_mm_Mult_pp;
3242 
3243  r->GetNC()->SPoly() = gnc_CreateSpoly;
3244  r->GetNC()->ReduceSPoly() = gnc_ReduceSpoly;
3245 
3246 #endif
3247 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
poly gnc_CreateSpolyOld(const poly p1, const poly p2, const ring r)
Definition: old.gring.cc:1517
poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &shorter, const poly, const ring r)
for p_Minus_mm_Mult_qq in pInline2.h
Definition: old.gring.cc:196
ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1052
poly gnc_pp_Mult_mm(const poly p, const poly m, const ring r, poly &last)
poly gnc_ReduceSpolyNew(const poly p1, poly p2, const ring r)
Definition: old.gring.cc:1444
void gnc_kBucketPolyRed_ZNew(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:2113
const ring r
Definition: syzextra.cc:208
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:448
poly gnc_CreateSpolyNew(const poly p1, const poly p2, const ring r)
Definition: old.gring.cc:1605
poly gnc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: old.gring.cc:453
void gnc_kBucketPolyRedOld(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:1967
void gnc_kBucketPolyRedNew(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:2000
#define NULL
Definition: omList.c:10
void * cast_A_to_vptr(A a)
Definition: auxiliary.h:442
poly gnc_ReduceSpolyOld(const poly p1, poly p2, const ring r)
Definition: old.gring.cc:1388
static p_Procs_s * _p_procs
Definition: p_Procs_Set.h:114
ideal gnc_gr_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1314
void gnc_kBucketPolyRed_ZOld(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:2080
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:443
poly gnc_pp_Mult_mm ( const poly  p,
const poly  m,
const ring  r,
poly last 
)
poly gnc_pp_Mult_mm ( const poly  p,
const poly  m,
const ring  r 
)

Definition at line 438 of file old.gring.cc.

439 {
440  return( gnc_p_Mult_mm_Common(p_Copy(p,r), m, 1, r) );
441 }
return P p
Definition: myNF.cc:203
poly gnc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r)
Definition: old.gring.cc:347
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
poly gnc_ReduceSpolyNew ( const poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1444 of file old.gring.cc.

1445 {
1446  assume(p_LmDivisibleBy(p1, p2, r));
1447 
1448  const long lCompP1 = p_GetComp(p1,r);
1449  const long lCompP2 = p_GetComp(p2,r);
1450 
1451  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1452  {
1453 #ifdef PDEBUG
1454  Werror("gnc_ReduceSpolyNew: different non-zero components!");
1455 #endif
1456  return(NULL);
1457  }
1458 
1459  poly m = p_One(r);
1460  p_ExpVectorDiff(m, p2, p1, r);
1461  //p_Setm(m,r);
1462 #ifdef PDEBUG
1463  p_Test(m,r);
1464 #endif
1465 
1466  /* pSetComp(m,r)=0? */
1467  poly N = nc_mm_Mult_p(m, p_Head(p1,r), r);
1468 
1469  number C = p_GetCoeff(N, r);
1470  number cF = p_GetCoeff(p2, r);
1471 
1472  /* GCD stuff */
1473  number cG = n_SubringGcd(C, cF, r->cf);
1474 
1475  if (!n_IsOne(cG, r))
1476  {
1477  cF = n_Div(cF, cG, r); n_Normalize(cF, r);
1478  C = n_Div(C, cG, r); n_Normalize(C, r);
1479  }
1480  else
1481  {
1482  cF = n_Copy(cF, r);
1483  C = n_Copy(C, r);
1484  }
1485  n_Delete(&cG,r);
1486 
1487  p2 = p_Mult_nn(p2, C, r); // p2 !!!
1488  p_Test(p2,r);
1489  n_Delete(&C,r);
1490  n_Delete(&cG,r);
1491 
1492  poly out = nc_mm_Mult_pp(m, pNext(p1), r);
1493  p_Delete(&m,r);
1494 
1495  N = p_Add_q(N, out, r);
1496  p_Test(N,r);
1497 
1498  if (!n_IsMOne(cF,r)) // ???
1499  {
1500  cF = n_InpNeg(cF,r);
1501  N = p_Mult_nn(N, cF, r);
1502  p_Test(N,r);
1503  }
1504  n_Delete(&cF,r);
1505 
1506  out = p_Add_q(p2,N,r); // delete N, p2
1507  p_Test(out,r);
1508  if ( out!=NULL ) p_Content(out,r);
1509  return(out);
1510 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:72
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:577
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:819
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2182
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:613
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:685
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
void Werror(const char *fmt,...)
Definition: reporter.cc:199
poly gnc_ReduceSpolyOld ( const poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1388 of file old.gring.cc.

1389 {
1390  assume(p_LmDivisibleBy(p1, p2, r));
1391 
1392 #ifdef PDEBUG
1393  if (p_GetComp(p1,r)!=p_GetComp(p2,r)
1394  && (p_GetComp(p1,r)!=0)
1395  && (p_GetComp(p2,r)!=0))
1396  {
1397  dReportError("nc_ReduceSpolyOld: different components");
1398  return(NULL);
1399  }
1400 #endif
1401  poly m = p_One(r);
1402  p_ExpVectorDiff(m,p2,p1,r);
1403  //p_Setm(m,r);
1404 #ifdef PDEBUG
1405  p_Test(m,r);
1406 #endif
1407  /* pSetComp(m,r)=0? */
1408  poly N = nc_mm_Mult_p(m, p_Head(p1,r), r);
1409  number C = p_GetCoeff(N, r);
1410  number cF = p_GetCoeff(p2, r);
1411  /* GCD stuff */
1412  number cG = n_SubringGcd(C, cF, r->cf);
1413  if ( !n_IsOne(cG,r) )
1414  {
1415  cF = n_Div(cF, cG, r); n_Normalize(cF, r);
1416  C = n_Div(C, cG, r); n_Normalize(C, r);
1417  }
1418  else
1419  {
1420  cF = n_Copy(cF, r);
1421  C = n_Copy(C, r);
1422  }
1423  n_Delete(&cG,r);
1424  p2 = p_Mult_nn(p2, C, r);
1425  poly out = nc_mm_Mult_pp(m, pNext(p1), r);
1426  N = p_Add_q(N, out, r);
1427  p_Test(p2,r);
1428  p_Test(N,r);
1429  if (!n_IsMOne(cF,r))
1430  {
1431  cF = n_InpNeg(cF,r);
1432  N = p_Mult_nn(N, cF, r);
1433  p_Test(N,r);
1434  }
1435  out = p_Add_q(p2,N,r);
1436  p_Test(out,r);
1437  if ( out!=NULL ) p_Content(out,r);
1438  p_Delete(&m,r);
1439  n_Delete(&cF,r);
1440  n_Delete(&C,r);
1441  return(out);
1442 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:72
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:577
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:819
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2182
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:613
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:685
int dReportError(const char *fmt,...)
Definition: dError.cc:45
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly gnc_uu_Mult_ww ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)

Definition at line 1085 of file old.gring.cc.

1088 {
1089  /* Check zero exceptions, (q-)commutativity and is there something to do? */
1090  assume(a!=0);
1091  assume(b!=0);
1092  poly out=p_One(r);
1093  if (i<=j)
1094  {
1095  p_SetExp(out,i,a,r);
1096  p_AddExp(out,j,b,r);
1097  p_Setm(out,r);
1098  return(out);
1099  }/* zero exeptions and usual case */
1100  /* if ((a==0)||(b==0)||(i<=j)) return(out); */
1101 
1102  if (MATELEM(r->GetNC()->COM,j,i)!=NULL)
1103  /* commutative or quasicommutative case */
1104  {
1105  p_SetExp(out,i,a,r);
1106  p_AddExp(out,j,b,r);
1107  p_Setm(out,r);
1108  if (n_IsOne(p_GetCoeff(MATELEM(r->GetNC()->COM,j,i),r),r)) /* commutative case */
1109  {
1110  return(out);
1111  }
1112  else
1113  {
1114  number tmp_number=p_GetCoeff(MATELEM(r->GetNC()->COM,j,i),r); /* quasicommutative case */
1115  n_Power(tmp_number,a*b,&tmp_number, r); // BUG! ;-(
1116  p_SetCoeff(out,tmp_number,r);
1117  return(out);
1118  }
1119  }/* end_of commutative or quasicommutative case */
1120  p_Delete(&out,r);
1121 
1122 
1123  if(ncExtensions(NOCACHEMASK) && !ncExtensions(NOFORMULAMASK)) // don't use cache whenever possible!
1124  { // without cache!?
1125  CFormulaPowerMultiplier* FormulaMultiplier = GetFormulaPowerMultiplier(r);
1127 
1128  if( FormulaMultiplier != NULL )
1129  PairType = FormulaMultiplier->GetPair(j, i);
1130 
1131  if( PairType != _ncSA_notImplemented )
1132  // // return FormulaMultiplier->Multiply(j, i, b, a);
1133  return CFormulaPowerMultiplier::Multiply( PairType, j, i, b, a, r);
1134  }
1135 
1136 
1137  /* we are here if i>j and variables do not commute or quasicommute */
1138  /* in fact, now a>=1 and b>=1; and j<i */
1139  /* now check whether the polynomial is already computed */
1140  int rN=r->N;
1141  int vik = UPMATELEM(j,i,rN);
1142  int cMTsize=r->GetNC()->MTsize[vik];
1143  int newcMTsize=0;
1144  newcMTsize=si_max(a,b);
1145 
1146  if (newcMTsize<=cMTsize)
1147  {
1148  out = nc_p_CopyGet(MATELEM(r->GetNC()->MT[vik],a,b),r);
1149  if (out !=NULL) return (out);
1150  }
1151  int k,m;
1152  if (newcMTsize > cMTsize)
1153  {
1154  int inM=(((newcMTsize+6)/7)*7);
1155  assume (inM>=newcMTsize);
1156  newcMTsize = inM;
1157  // matrix tmp = (matrix)omAlloc0(inM*inM*sizeof(poly));
1158  matrix tmp = mpNew(newcMTsize,newcMTsize);
1159 
1160  for (k=1;k<=cMTsize;k++)
1161  {
1162  for (m=1;m<=cMTsize;m++)
1163  {
1164  out = MATELEM(r->GetNC()->MT[UPMATELEM(j,i,rN)],k,m);
1165  if ( out != NULL )
1166  {
1167  MATELEM(tmp,k,m) = out;/*MATELEM(r->GetNC()->MT[UPMATELEM(j,i,rN)],k,m)*/
1168  // omCheckAddr(tmp->m);
1169  MATELEM(r->GetNC()->MT[UPMATELEM(j,i,rN)],k,m)=NULL;
1170  // omCheckAddr(r->GetNC()->MT[UPMATELEM(j,i,rN)]->m);
1171  out=NULL;
1172  }
1173  }
1174  }
1175  id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(j,i,rN)]),r);
1176  r->GetNC()->MT[UPMATELEM(j,i,rN)] = tmp;
1177  tmp=NULL;
1178  r->GetNC()->MTsize[UPMATELEM(j,i,rN)] = newcMTsize;
1179  }
1180  /* The update of multiplication matrix is finished */
1181 
1182 
1183  return gnc_uu_Mult_ww_formula(i, a, j, b, r);
1184 
1185  out = gnc_uu_Mult_ww_vert(i, a, j, b, r);
1186  // out = nc_uu_Mult_ww_horvert(i, a, j, b, r);
1187  return(out);
1188 }
const poly a
Definition: syzextra.cc:212
static CFormulaPowerMultiplier * GetFormulaPowerMultiplier(const ring r)
Definition: ncSAFormula.h:95
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
Enum_ncSAType GetPair(int i, int j) const
Definition: ncSAFormula.h:46
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
static poly gnc_uu_Mult_ww_formula(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:1052
int k
Definition: cfEzgcd.cc:93
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
static poly Multiply(Enum_ncSAType type, const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:706
const ring r
Definition: syzextra.cc:208
poly gnc_uu_Mult_ww_vert(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:977
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
poly nc_p_CopyGet(poly a, const ring r)
Definition: old.gring.cc:2578
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
const int NOCACHEMASK
Definition: nc.h:371
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:629
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:602
#define p_GetCoeff(p, r)
Definition: monomials.h:57
const int NOFORMULAMASK
Definition: nc.h:370
const poly b
Definition: syzextra.cc:213
bool ncExtensions(int iMask)
Definition: old.gring.cc:87
Enum_ncSAType
Definition: ncSAFormula.h:17
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
static poly gnc_uu_Mult_ww_formula ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)
inlinestatic

Definition at line 1052 of file old.gring.cc.

1053 {
1055  return gnc_uu_Mult_ww_vert(i, a, j, b, r);
1056 
1057  CFormulaPowerMultiplier* FormulaMultiplier = GetFormulaPowerMultiplier(r);
1059 
1060  if( FormulaMultiplier != NULL )
1061  PairType = FormulaMultiplier->GetPair(j, i);
1062 
1063 
1064  if( PairType == _ncSA_notImplemented )
1065  return gnc_uu_Mult_ww_vert(i, a, j, b, r);
1066 
1067 
1068  // return FormulaMultiplier->Multiply(j, i, b, a);
1069  poly t = CFormulaPowerMultiplier::Multiply( PairType, j, i, b, a, r);
1070 
1071  int rN=r->N;
1072  matrix cMT = r->GetNC()->MT[UPMATELEM(j,i,rN)]; /* cMT=current MT */
1073 
1074 
1075  MATELEM(cMT, a, b) = nc_p_CopyPut(t,r);
1076 
1077  // t=MATELEM(cMT,a,b);
1078 // t= nc_p_CopyGet(MATELEM(cMT,a,b),r);
1079  // return(p_Copy(t,r));
1080  /* since the last computed element was cMT[a,b] */
1081  return(t);
1082 }
const poly a
Definition: syzextra.cc:212
static CFormulaPowerMultiplier * GetFormulaPowerMultiplier(const ring r)
Definition: ncSAFormula.h:95
Enum_ncSAType GetPair(int i, int j) const
Definition: ncSAFormula.h:46
static poly Multiply(Enum_ncSAType type, const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:706
const ring r
Definition: syzextra.cc:208
poly gnc_uu_Mult_ww_vert(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:977
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
const int NOFORMULAMASK
Definition: nc.h:370
poly nc_p_CopyPut(poly a, const ring r)
Definition: old.gring.cc:2599
const poly b
Definition: syzextra.cc:213
bool ncExtensions(int iMask)
Definition: old.gring.cc:87
Enum_ncSAType
Definition: ncSAFormula.h:17
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
poly gnc_uu_Mult_ww_horvert ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)

Definition at line 1190 of file old.gring.cc.

1192 {
1193  int k,m;
1194  int rN=r->N;
1195  matrix cMT=r->GetNC()->MT[UPMATELEM(j,i,rN)]; /* cMT=current MT */
1196 
1197  poly x=p_One(r);p_SetExp(x,j,1,r);p_Setm(x,r);/* var(j); */
1198  poly y=p_One(r);p_SetExp(y,i,1,r);p_Setm(y,r); /*var(i); for convenience */
1199 #ifdef PDEBUG
1200  p_Test(x,r);
1201  p_Test(y,r);
1202 #endif
1203 
1204  poly t=NULL;
1205 
1206  int toXY;
1207  int toYX;
1208 
1209  if (a==1) /* y*x^b, b>=2 */
1210  {
1211  toXY=b-1;
1212  while ( (MATELEM(cMT,1,toXY)==NULL) && (toXY>=2)) toXY--;
1213  for (m=toXY+1;m<=b;m++)
1214  {
1215  t=MATELEM(cMT,1,m);
1216  if (t==NULL) /* remove after debug */
1217  {
1218  t = p_Copy(MATELEM(cMT,1,m-1),r);
1219  t = gnc_p_Mult_mm(t,x,r);
1220  MATELEM(cMT,1,m) = t;
1221  /* omCheckAddr(cMT->m); */
1222  }
1223  else
1224  {
1225  /* Error, should never get there */
1226  WarnS("Error: a=1; MATELEM!=0");
1227  }
1228  t=NULL;
1229  }
1230  return(p_Copy(MATELEM(cMT,1,b),r));
1231  }
1232 
1233  if (b==1) /* y^a*x, a>=2 */
1234  {
1235  toYX=a-1;
1236  while ( (MATELEM(cMT,toYX,1)==NULL) && (toYX>=2)) toYX--;
1237  for (m=toYX+1;m<=a;m++)
1238  {
1239  t=MATELEM(cMT,m,1);
1240  if (t==NULL) /* remove after debug */
1241  {
1242  t = p_Copy(MATELEM(cMT,m-1,1),r);
1243  t = gnc_mm_Mult_p(y,t,r);
1244  MATELEM(cMT,m,1) = t;
1245  /* omCheckAddr(cMT->m); */
1246  }
1247  else
1248  {
1249  /* Error, should never get there */
1250  WarnS("Error: b=1, MATELEM!=0");
1251  }
1252  t=NULL;
1253  }
1254  return(p_Copy(MATELEM(cMT,a,1),r));
1255  }
1256 
1257 /* ------------ Main Cycles ----------------------------*/
1258  /* a>1, b>1 */
1259 
1260  int dXY=0; int dYX=0;
1261  /* dXY = distance for computing x-mult, then y-mult */
1262  /* dYX = distance for computing y-mult, then x-mult */
1263  int toX=a-1; int toY=b-1; /* toX = to axe X, toY = to axe Y */
1264  toXY=b-1; toYX=a-1;
1265  /* if toX==0, toXY = dist. to computed y * x^toXY */
1266  /* if toY==0, toYX = dist. to computed y^toYX * x */
1267  while ( (MATELEM(cMT,toX,b)==NULL) && (toX>=1)) toX--;
1268  if (toX==0) /* the whole column is not computed yet */
1269  {
1270  while ( (MATELEM(cMT,1,toXY)==NULL) && (toXY>=1)) toXY--;
1271  /* toXY >=1 */
1272  dXY=b-1-toXY;
1273  }
1274  dXY=dXY+a-toX; /* the distance to nearest computed y^toX x^b */
1275 
1276  while ( (MATELEM(cMT,a,toY)==NULL) && (toY>=1)) toY--;
1277  if (toY==0) /* the whole row is not computed yet */
1278  {
1279  while ( (MATELEM(cMT,toYX,1)==NULL) && (toYX>=1)) toYX--;
1280  /* toYX >=1 */
1281  dYX=a-1-toYX;
1282  }
1283  dYX=dYX+b-toY; /* the distance to nearest computed y^a x^toY */
1284 
1285  if (dYX>=dXY)
1286  {
1287  /* first x, then y */
1288  if (toX==0) /* start with the row*/
1289  {
1290  for (m=toXY+1;m<=b;m++)
1291  {
1292  t=MATELEM(cMT,1,m);
1293  if (t==NULL) /* remove after debug */
1294  {
1295  t = p_Copy(MATELEM(cMT,1,m-1),r);
1296  t = gnc_p_Mult_mm(t,x,r);
1297  MATELEM(cMT,1,m) = t;
1298  /* omCheckAddr(cMT->m); */
1299  }
1300  else
1301  {
1302  /* Error, should never get there */
1303  WarnS("dYX>=dXY,toXY; MATELEM==0");
1304  }
1305  t=NULL;
1306  }
1307  toX=1; /* y*x^b is computed */
1308  }
1309  /* Now toX>=1 */
1310  for (k=toX+1;k<=a;k++)
1311  {
1312  t=MATELEM(cMT,k,b);
1313  if (t==NULL) /* remove after debug */
1314  {
1315  t = p_Copy(MATELEM(cMT,k-1,b),r);
1316  t = gnc_mm_Mult_p(y,t,r);
1317  MATELEM(cMT,k,b) = t;
1318  /* omCheckAddr(cMT->m); */
1319  }
1320  else
1321  {
1322  /* Error, should never get there */
1323  WarnS("dYX>=dXY,toX; MATELEM==0");
1324  }
1325  t=NULL;
1326  }
1327  } /* endif (dYX>=dXY) */
1328 
1329 
1330  if (dYX<dXY)
1331  {
1332  /* first y, then x */
1333  if (toY==0) /* start with the column*/
1334  {
1335  for (m=toYX+1;m<=a;m++)
1336  {
1337  t=MATELEM(cMT,m,1);
1338  if (t==NULL) /* remove after debug */
1339  {
1340  t = p_Copy(MATELEM(cMT,m-1,1),r);
1341  t = gnc_mm_Mult_p(y,t,r);
1342  MATELEM(cMT,m,1) = t;
1343  /* omCheckAddr(cMT->m); */
1344  }
1345  else
1346  {
1347  /* Error, should never get there */
1348  WarnS("dYX<dXY,toYX; MATELEM==0");
1349  }
1350  t=NULL;
1351  }
1352  toY=1; /* y^a*x is computed */
1353  }
1354  /* Now toY>=1 */
1355  for (k=toY+1;k<=b;k++)
1356  {
1357  t=MATELEM(cMT,a,k);
1358  if (t==NULL) /* remove after debug */
1359  {
1360  t = p_Copy(MATELEM(cMT,a,k-1),r);
1361  t = gnc_p_Mult_mm(t,x,r);
1362  MATELEM(cMT,a,k) = t;
1363  /* omCheckAddr(cMT->m); */
1364  }
1365  else
1366  {
1367  /* Error, should never get there */
1368  WarnS("dYX<dXY,toY; MATELEM==0");
1369  }
1370  t=NULL;
1371  }
1372  } /* endif (dYX<dXY) */
1373 
1374  p_Delete(&x,r);
1375  p_Delete(&y,r);
1376  t=p_Copy(MATELEM(cMT,a,b),r);
1377  return(t); /* since the last computed element was cMT[a,b] */
1378 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
const poly a
Definition: syzextra.cc:212
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:448
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
const poly b
Definition: syzextra.cc:213
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:443
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
poly gnc_uu_Mult_ww_vert ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)

Definition at line 977 of file old.gring.cc.

978 {
979  int k,m;
980  int rN=r->N;
981  const int cMTindex = UPMATELEM(j,i,rN);
982  matrix cMT=r->GetNC()->MT[cMTindex]; /* cMT=current MT */
983 
984  poly x=p_One(r);p_SetExp(x,j,1,r);p_Setm(x,r);
985 /* var(j); */
986  poly y=p_One(r);p_SetExp(y,i,1,r);p_Setm(y,r);
987 /*var(i); for convenience */
988 #ifdef PDEBUG
989  p_Test(x,r);
990  p_Test(y,r);
991 #endif
992  poly t=NULL;
993 /* ------------ Main Cycles ----------------------------*/
994 
995  for (k=2;k<=a;k++)
996  {
997  t = MATELEM(cMT,k,1);
998 
999  if (t==NULL) /* not computed yet */
1000  {
1001  t = nc_p_CopyGet(MATELEM(cMT,k-1,1),r);
1002  // t=p_Copy(MATELEM(cMT,k-1,1),r);
1003  t = gnc_mm_Mult_p(y,t,r);
1004  cMT=r->GetNC()->MT[cMTindex]; // since multiplication can change the MT table...
1005  assume( t != NULL );
1006 #ifdef PDEBUG
1007  p_Test(t,r);
1008 #endif
1009  MATELEM(cMT,k,1) = nc_p_CopyPut(t,r);
1010  // omCheckAddr(cMT->m);
1011  p_Delete(&t,r);
1012  }
1013  t=NULL;
1014  }
1015 
1016  for (m=2;m<=b;m++)
1017  {
1018  t = MATELEM(cMT,a,m);
1019  // t=MATELEM(cMT,a,m);
1020  if (t==NULL) //not computed yet
1021  {
1022  t = nc_p_CopyGet(MATELEM(cMT,a,m-1),r);
1023  assume( t != NULL );
1024  // t=p_Copy(MATELEM(cMT,a,m-1),r);
1025  t = gnc_p_Mult_mm(t,x,r);
1026  cMT=r->GetNC()->MT[cMTindex]; // since multiplication can change the MT table...
1027 #ifdef PDEBUG
1028  p_Test(t,r);
1029 #endif
1030  MATELEM(cMT,a,m) = nc_p_CopyPut(t,r);
1031  // MATELEM(cMT,a,m) = t;
1032  // omCheckAddr(cMT->m);
1033  p_Delete(&t,r);
1034  }
1035  t=NULL;
1036  }
1037  p_Delete(&x,r);
1038  p_Delete(&y,r);
1039  t=MATELEM(cMT,a,b);
1040  assume( t != NULL );
1041 
1042  t= nc_p_CopyGet(t,r);
1043 #ifdef PDEBUG
1044  p_Test(t,r);
1045 #endif
1046  // return(p_Copy(t,r));
1047  /* since the last computed element was cMT[a,b] */
1048  return(t);
1049 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
const poly a
Definition: syzextra.cc:212
int k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:448
poly nc_p_CopyGet(poly a, const ring r)
Definition: old.gring.cc:2578
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
poly nc_p_CopyPut(poly a, const ring r)
Definition: old.gring.cc:2599
const poly b
Definition: syzextra.cc:213
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:443
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idOppose ( ring  Rop,
ideal  I,
const ring  dst 
)

opposes a module I from Rop to currRing(dst)

Definition at line 3453 of file old.gring.cc.

3454 {
3455  /* the simplest case:*/
3456  if ( Rop == dst ) return id_Copy(I, dst);
3457 
3458  /* check Rop == rOpposite(currRing) */
3459  if (!rIsLikeOpposite(dst, Rop))
3460  {
3461  WarnS("an opposite ring should be used");
3462  return NULL;
3463  }
3464  int i;
3465  ideal idOp = idInit(I->ncols, I->rank);
3466  for (i=0; i< (I->ncols)*(I->nrows); i++)
3467  {
3468  idOp->m[i] = pOppose(Rop,I->m[i], dst);
3469  }
3470  id_Test(idOp, dst);
3471  return idOp;
3472 }
ideal id_Copy(ideal h1, const ring r)
#define id_Test(A, lR)
Definition: simpleideals.h:67
poly pOppose(ring Rop, poly p, const ring dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3414
const ideal
Definition: gb_hack.h:42
#define WarnS
Definition: emacs.cc:81
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so ...
Definition: old.gring.cc:3387
int i
Definition: cfEzgcd.cc:123
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
BOOLEAN nc_CallPlural ( matrix  CCC,
matrix  DDD,
poly  CCN,
poly  DDN,
ring  r,
bool  bSetupQuotient,
bool  bCopyInput,
bool  bBeQuiet,
ring  curr,
bool  dummy_ring 
)

returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation!

Definition at line 2734 of file old.gring.cc.

2739 {
2740  assume( r != NULL );
2741  assume( curr != NULL );
2742 
2743  if( !bSetupQuotient)
2744  assume( (r->qideal == NULL) ); // The basering must NOT be a qring!??
2745 
2746  assume( rSamePolyRep(r, curr) || bCopyInput ); // wrong assumption?
2747 
2748 
2749  if( r->N == 1 ) // clearly commutative!!!
2750  {
2751  assume(
2752  ( (CCC != NULL) && (MATCOLS(CCC) == 1) && (MATROWS(CCC) == 1) && (MATELEM(CCC,1,1) == NULL) ) ||
2753  ( (CCN == NULL) )
2754  );
2755 
2756  assume(
2757  ( (DDD != NULL) && (MATCOLS(DDD) == 1) && (MATROWS(DDD) == 1) && (MATELEM(DDD,1,1) == NULL) ) ||
2758  ( (DDN == NULL) )
2759  );
2760  if(!dummy_ring)
2761  {
2762  WarnS("commutative ring with 1 variable");
2763  return FALSE;
2764  }
2765  }
2766 
2767  // there must be:
2768  assume( (CCC != NULL) != (CCN != NULL) ); // exactly one data about coeffs (C).
2769  assume( !((DDD != NULL) && (DDN != NULL)) ); // at most one data about tails (D).
2770 
2771 // ring save = currRing;
2772 // if( save != curr )
2773 // rChangeCurrRing(curr);
2774 
2775 
2776 #if OUTPUT
2777  if( CCC != NULL )
2778  {
2779  PrintS("nc_CallPlural(), Input data, CCC: \n");
2780  iiWriteMatrix(CCC, "C", 2, curr, 4);
2781  }
2782  if( DDD != NULL )
2783  {
2784  PrintS("nc_CallPlural(), Input data, DDD: \n");
2785  iiWriteMatrix(DDD, "D", 2, curr, 4);
2786  }
2787 #endif
2788 
2789 
2790 #ifndef SING_NDEBUG
2791  id_Test((ideal)CCC, curr);
2792  id_Test((ideal)DDD, curr);
2793  p_Test(CCN, curr);
2794  p_Test(DDN, curr);
2795 #endif
2796 
2797  if( (!bBeQuiet) && (r->GetNC() != NULL) )
2798  WarnS("going to redefine the algebra structure");
2799 
2800 // if( currRing != r )
2801 // rChangeCurrRing(r);
2802 
2803  matrix CC = NULL;
2804  poly CN = NULL;
2805  matrix C; bool bCnew = false;
2806 
2807  matrix DD = NULL;
2808  poly DN = NULL;
2809  matrix D; bool bDnew = false;
2810 
2811  number nN, pN, qN;
2812 
2813  bool IsSkewConstant = false, tmpIsSkewConstant;
2814  int i, j;
2815 
2816  nc_type nctype = nc_undef;
2817 
2818  //////////////////////////////////////////////////////////////////
2819  // check the correctness of arguments, without any real chagnes!!!
2820 
2821 
2822 
2823  // check C
2824  if ((CCC != NULL) && ( (MATCOLS(CCC)==1) || MATROWS(CCC)==1 ) )
2825  {
2826  CN = MATELEM(CCC,1,1);
2827  }
2828  else
2829  {
2830  if ((CCC != NULL) && ( (MATCOLS(CCC)!=r->N) || (MATROWS(CCC)!=r->N) ))
2831  {
2832  Werror("Square %d x %d matrix expected", r->N, r->N);
2833 
2834 // if( currRing != save )
2835 // rChangeCurrRing(save);
2836  return TRUE;
2837  }
2838  }
2839  if (( CCC != NULL) && (CC == NULL)) CC = CCC; // mp_Copy(CCC, ?); // bug!?
2840  if (( CCN != NULL) && (CN == NULL)) CN = CCN;
2841 
2842  // check D
2843  if ((DDD != NULL) && ( (MATCOLS(DDD)==1) || MATROWS(DDD)==1 ) )
2844  {
2845  DN = MATELEM(DDD,1,1);
2846  }
2847  else
2848  {
2849  if ((DDD != NULL) && ( (MATCOLS(DDD)!=r->N) || (MATROWS(DDD)!=r->N) ))
2850  {
2851  Werror("Square %d x %d matrix expected",r->N,r->N);
2852 
2853 // if( currRing != save )
2854 // rChangeCurrRing(save);
2855  return TRUE;
2856  }
2857  }
2858 
2859  if (( DDD != NULL) && (DD == NULL)) DD = DDD; // mp_Copy(DDD, ?); // ???
2860  if (( DDN != NULL) && (DN == NULL)) DN = DDN;
2861 
2862  // further checks and some analysis:
2863  // all data in 'curr'!
2864  if (CN != NULL) /* create matrix C = CN * Id */
2865  {
2866  if (!p_IsConstant(CN,curr))
2867  {
2868  Werror("Incorrect input : non-constants are not allowed as coefficients (first argument)");
2869  return TRUE;
2870  }
2871  assume(p_IsConstant(CN,curr));
2872 
2873  nN = p_GetCoeff(CN, curr);
2874  if (n_IsZero(nN, curr))
2875  {
2876  Werror("Incorrect input : zero coefficients are not allowed");
2877 
2878 // if( currRing != save )
2879 // rChangeCurrRing(save);
2880  return TRUE;
2881  }
2882 
2883  if (n_IsOne(nN, curr))
2884  nctype = nc_lie;
2885  else
2886  nctype = nc_general;
2887 
2888  IsSkewConstant = true;
2889 
2890  C = mpNew(r->N,r->N); // ring independent!
2891  bCnew = true;
2892 
2893  for(i=1; i<r->N; i++)
2894  for(j=i+1; j<=r->N; j++)
2895  MATELEM(C,i,j) = prCopyR_NoSort(CN, curr, r); // nc_p_CopyPut(CN, r); // copy CN from curr into r
2896 
2897 #ifndef SING_NDEBUG
2898  id_Test((ideal)C, r);
2899 #endif
2900 
2901  } else
2902  if ( (CN == NULL) && (CC != NULL) ) /* copy matrix C */
2903  {
2904  /* analyze C */
2905 
2906  pN = NULL; /* check the consistency later */
2907 
2908  if( r->N > 1 )
2909  if ( MATELEM(CC,1,2) != NULL )
2910  pN = p_GetCoeff(MATELEM(CC,1,2), curr);
2911 
2912  tmpIsSkewConstant = true;
2913 
2914  for(i=1; i<r->N; i++)
2915  for(j=i+1; j<=r->N; j++)
2916  {
2917  if (MATELEM(CC,i,j) == NULL)
2918  qN = NULL;
2919  else
2920  {
2921  if (!p_IsConstant(MATELEM(CC,i,j),curr))
2922  {
2923  Werror("Incorrect input : non-constants are not allowed as coefficients (first argument at [%d, %d])", i, j);
2924  return TRUE;
2925  }
2926  assume(p_IsConstant(MATELEM(CC,i,j),curr));
2927  qN = p_GetCoeff(MATELEM(CC,i,j),curr);
2928  }
2929 
2930 
2931  if ( qN == NULL ) /* check the consistency: Cij!=0 */
2932  // find also illegal pN
2933  {
2934  Werror("Incorrect input : matrix of coefficients contains zeros in the upper triangle");
2935 
2936 // if( currRing != save )
2937 // rChangeCurrRing(save);
2938  return TRUE;
2939  }
2940 
2941  if (!n_Equal(pN, qN, curr->cf)) tmpIsSkewConstant = false;
2942  }
2943 
2944  if( bCopyInput )
2945  {
2946  C = mp_Copy(CC, curr, r); // Copy C into r!!!???
2947 #ifndef SING_NDEBUG
2948  id_Test((ideal)C, r);
2949 #endif
2950  bCnew = true;
2951  }
2952  else
2953  C = CC;
2954 
2955  IsSkewConstant = tmpIsSkewConstant;
2956 
2957  if ( tmpIsSkewConstant && n_IsOne(pN, curr) )
2958  nctype = nc_lie;
2959  else
2960  nctype = nc_general;
2961  }
2962 
2963  /* initialition of the matrix D */
2964  if ( DD == NULL ) /* we treat DN only (it could also be NULL) */
2965  {
2966  D = mpNew(r->N,r->N); bDnew = true;
2967 
2968  if (DN == NULL)
2969  {
2970  if ( (nctype == nc_lie) || (nctype == nc_undef) )
2971  nctype = nc_comm; /* it was nc_skew earlier */
2972  else /* nc_general, nc_skew */
2973  nctype = nc_skew;
2974  }
2975  else /* DN != NULL */
2976  for(i=1; i<r->N; i++)
2977  for(j=i+1; j<=r->N; j++)
2978  MATELEM(D,i,j) = prCopyR_NoSort(DN, curr, r); // project DN into r->GetNC()->basering!
2979 #ifndef SING_NDEBUG
2980  id_Test((ideal)D, r);
2981 #endif
2982  }
2983  else /* DD != NULL */
2984  {
2985  bool b = true; // DD == null ?
2986 
2987  for(int i = 1; (i < r->N) && b; i++)
2988  for(int j = i+1; (j <= r->N) && b; j++)
2989  if (MATELEM(DD, i, j) != NULL)
2990  {
2991  b = false;
2992  break;
2993  }
2994 
2995  if (b) // D == NULL!!!
2996  {
2997  if ( (nctype == nc_lie) || (nctype == nc_undef) )
2998  nctype = nc_comm; /* it was nc_skew earlier */
2999  else /* nc_general, nc_skew */
3000  nctype = nc_skew;
3001  }
3002 
3003  if( bCopyInput )
3004  {
3005  D = mp_Copy(DD, curr, r); // Copy DD into r!!!
3006 #ifndef SING_NDEBUG
3007  id_Test((ideal)D, r);
3008 #endif
3009  bDnew = true;
3010  }
3011  else
3012  D = DD;
3013  }
3014 
3015  assume( C != NULL );
3016  assume( D != NULL );
3017 
3018 #if OUTPUT
3019  PrintS("nc_CallPlural(), Computed data, C: \n");
3020  iiWriteMatrix(C, "C", 2, r, 4);
3021 
3022  PrintS("nc_CallPlural(), Computed data, D: \n");
3023  iiWriteMatrix(D, "D", 2, r, 4);
3024 
3025  Print("\nTemporary: type = %d, IsSkewConstant = %d\n", nctype, IsSkewConstant);
3026 #endif
3027 
3028 
3029  // check the ordering condition for D (both matrix and poly cases):
3030  if ( gnc_CheckOrdCondition(D, r) )
3031  {
3032  if( bCnew ) mp_Delete( &C, r );
3033  if( bDnew ) mp_Delete( &D, r );
3034 
3035  Werror("Matrix of polynomials violates the ordering condition");
3036 
3037 // if( currRing != save )
3038 // rChangeCurrRing(save);
3039  return TRUE;
3040  }
3041 
3042  // okay now we are ready for this!!!
3043 
3044  // create new non-commutative structure
3045  nc_struct *nc_new = (nc_struct *)omAlloc0(sizeof(nc_struct));
3046 
3047  ncRingType(nc_new, nctype);
3048 
3049  nc_new->C = C; // if C and D were given by matrices at the beginning they are in r
3050  nc_new->D = D; // otherwise they should be in r->GetNC()->basering(polynomial * Id_{N})
3051 
3052  nc_new->IsSkewConstant = (IsSkewConstant?1:0);
3053 
3054  // Setup new NC structure!!!
3055  if (r->GetNC() != NULL)
3056  {
3057 #ifndef SING_NDEBUG
3058  WarnS("Changing the NC-structure of an existing NC-ring!!!");
3059 #endif
3060  nc_rKill(r);
3061  }
3062 
3063  r->GetNC() = nc_new;
3064 
3065  r->ext_ref=NULL;
3066 
3067 // if( currRing != save )
3068 // rChangeCurrRing(save);
3069 
3070  return gnc_InitMultiplication(r, bSetupQuotient);
3071 }
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:77
#define Print
Definition: emacs.cc:83
void nc_rKill(ring r)
complete destructor
Definition: old.gring.cc:2527
#define FALSE
Definition: auxiliary.h:140
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define id_Test(A, lR)
Definition: simpleideals.h:67
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
Definition: nc.h:83
nc_type
Definition: nc.h:20
Definition: nc.h:25
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:738
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1781
Definition: nc.h:27
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1642
BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient=false)
Definition: old.gring.cc:3087
int i
Definition: cfEzgcd.cc:123
Definition: nc.h:24
void PrintS(const char *s)
Definition: reporter.cc:294
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:784
#define p_Test(p, r)
Definition: p_polys.h:160
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
BOOLEAN gnc_CheckOrdCondition(matrix D, ring r)
Definition: old.gring.cc:2679
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
Definition: nc.h:23
matrix D
Definition: nc.h:92
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:57
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
matrix C
Definition: nc.h:91
#define MATROWS(i)
Definition: matpol.h:27
int IsSkewConstant
Definition: nc.h:101
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
Definition: nc.h:26
#define MATELEM(mat, i, j)
Definition: matpol.h:29
BOOLEAN nc_CheckSubalgebra ( poly  PolyVar,
ring  r 
)

Definition at line 2620 of file old.gring.cc.

2621 {
2622 // ring save = currRing;
2623 // int WeChangeRing = 0;
2624 // if (currRing != r)
2625 // rChangeCurrRing(r);
2626 // WeChangeRing = 1;
2627 // }
2628  int rN=r->N;
2629  int *ExpVar=(int*)omAlloc0((rN+1)*sizeof(int));
2630  int *ExpTmp=(int*)omAlloc0((rN+1)*sizeof(int));
2631  p_GetExpV(PolyVar, ExpVar, r);
2632  int i; int j; int k;
2633  poly test=NULL;
2634  int OK=1;
2635  for (i=1; i<rN; i++)
2636  {
2637  if (ExpVar[i]==0) /* i.e. not in PolyVar */
2638  {
2639  for (j=i+1; j<=rN; j++)
2640  {
2641  if (ExpVar[j]==0)
2642  {
2643  test = MATELEM(r->GetNC()->D,i,j);
2644  while (test!=NULL)
2645  {
2646  p_GetExpV(test, ExpTmp, r);
2647  OK=1;
2648  for (k=1;k<=rN;k++)
2649  {
2650  if (ExpTmp[k]!=0)
2651  {
2652  if (ExpVar[k]!=0) OK=0;
2653  }
2654  }
2655  if (!OK)
2656  {
2657 // if ( WeChangeRing )
2658 // rChangeCurrRing(save);
2659  return(TRUE);
2660  }
2661  pIter(test);
2662  }
2663  }
2664  }
2665  }
2666  }
2667  freeT(ExpVar,rN);
2668  freeT(ExpTmp,rN);
2669 // if ( WeChangeRing )
2670 // rChangeCurrRing(save);
2671  return(FALSE);
2672 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define FALSE
Definition: auxiliary.h:140
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
#define TRUE
Definition: auxiliary.h:144
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
CanonicalForm test
Definition: cfModGcd.cc:4037
#define NULL
Definition: omList.c:10
#define freeT(A, v)
Definition: old.gring.cc:94
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void nc_CleanUp ( nc_struct p)
inline

Definition at line 2513 of file old.gring.cc.

2514 {
2515  assume(p != NULL);
2516  omFreeSize((ADDRESS)p,sizeof(nc_struct));
2517 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
Definition: nc.h:83
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
void nc_CleanUp ( ring  r)
inline

Definition at line 2519 of file old.gring.cc.

2520 {
2521  /* small CleanUp of r->GetNC() */
2522  assume(r != NULL);
2523  nc_CleanUp(r->GetNC());
2524  r->GetNC() = NULL;
2525 }
void nc_CleanUp(nc_struct *p)
Definition: old.gring.cc:2513
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
poly nc_CreateShortSpoly ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1926 of file old.gring.cc.

1927 {
1928 #ifdef PDEBUG
1929  p_Test(p1, r);
1930  p_Test(p2, r);
1931 #endif
1932 
1933  const long lCompP1 = p_GetComp(p1,r);
1934  const long lCompP2 = p_GetComp(p2,r);
1935 
1936  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1937  {
1938 #ifdef PDEBUG
1939  Werror("nc_CreateShortSpoly: wrong module components!"); // !!!!
1940 #endif
1941  return(NULL);
1942  }
1943 
1944  poly m;
1945 
1946 #ifdef HAVE_RATGRING
1947  if ( rIsRatGRing(r))
1948  {
1949  /* rational version */
1950  m = p_LcmRat(p1, p2, si_max(lCompP1, lCompP2), r);
1951  } else
1952 #endif
1953  {
1954  m = p_Lcm(p1, p2, si_max(lCompP1, lCompP2), r);
1955  }
1956 
1957 // n_Delete(&p_GetCoeff(m, r), r);
1958 // pSetCoeff0(m, NULL);
1959 
1960 #ifdef PDEBUG
1961 // p_Test(m,r);
1962 #endif
1963 
1964  return(m);
1965 }
poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r)
Definition: old.gring.cc:147
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208
poly p_LcmRat(const poly a, const poly b, const long lCompM, const ring r)
Definition: p_polys.cc:1588
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
void Werror(const char *fmt,...)
Definition: reporter.cc:199
poly nc_mm_Bracket_nn ( poly  m1,
poly  m2,
const ring  r 
)

returns [m1,m2] for two monoms, destroys nothing without coeffs

Definition at line 2336 of file old.gring.cc.

2337 {
2338  if (p_LmIsConstant(m1, r) || p_LmIsConstant(m1, r)) return(NULL);
2339  if (p_LmCmp(m1,m2, r)==0) return(NULL);
2340  int rN=r->N;
2341  int *M1=(int *)omAlloc0((rN+1)*sizeof(int));
2342  int *M2=(int *)omAlloc0((rN+1)*sizeof(int));
2343  int *aPREFIX=(int *)omAlloc0((rN+1)*sizeof(int));
2344  int *aSUFFIX=(int *)omAlloc0((rN+1)*sizeof(int));
2345  p_GetExpV(m1,M1, r);
2346  p_GetExpV(m2,M2, r);
2347  poly res=NULL;
2348  poly ares=NULL;
2349  poly bres=NULL;
2350  poly prefix=NULL;
2351  poly suffix=NULL;
2352  int nMin,nMax;
2353  number nTmp=NULL;
2354  int i,j,k;
2355  for (i=1;i<=rN;i++)
2356  {
2357  if (M2[i]!=0)
2358  {
2359  ares=NULL;
2360  for (j=1;j<=rN;j++)
2361  {
2362  if (M1[j]!=0)
2363  {
2364  bres=NULL;
2365  /* compute [ x_j^M1[j],x_i^M2[i] ] */
2366  if (i<j) {nMax=j; nMin=i;} else {nMax=i; nMin=j;}
2367  if ( (i==j) || ((MATELEM(r->GetNC()->COM,nMin,nMax)!=NULL) && n_IsOne(p_GetCoeff(MATELEM(r->GetNC()->C,nMin,nMax), r), r) )) /* not (the same exp. or commuting exps)*/
2368  { bres=NULL; }
2369  else
2370  {
2371  if (i<j) { bres=gnc_uu_Mult_ww(j,M1[j],i,M2[i], r); }
2372  else bres=gnc_uu_Mult_ww(i,M2[i],j,M1[j], r);
2373  if (n_IsOne(p_GetCoeff(bres, r), r))
2374  {
2375  bres=p_LmDeleteAndNext(bres, r);
2376  }
2377  else
2378  {
2379  nTmp=n_Sub(p_GetCoeff(bres, r),n_Init(1, r), r);
2380  p_SetCoeff(bres,nTmp, r); /* only lc ! */
2381  }
2382 #ifdef PDEBUG
2383  p_Test(bres, r);
2384 #endif
2385  if (i>j) bres=p_Neg(bres, r);
2386  }
2387  if (bres!=NULL)
2388  {
2389  /* now mult (prefix, bres, suffix) */
2390  memcpy(aSUFFIX, M1,(rN+1)*sizeof(int));
2391  memcpy(aPREFIX, M1,(rN+1)*sizeof(int));
2392  for (k=1;k<=j;k++) aSUFFIX[k]=0;
2393  for (k=j;k<=rN;k++) aPREFIX[k]=0;
2394  aSUFFIX[0]=0;
2395  aPREFIX[0]=0;
2396  prefix=p_One(r);
2397  suffix=p_One(r);
2398  p_SetExpV(prefix,aPREFIX, r);
2399  p_Setm(prefix, r);
2400  p_SetExpV(suffix,aSUFFIX, r);
2401  p_Setm(suffix, r);
2402  if (!p_LmIsConstant(prefix, r)) bres = gnc_mm_Mult_p(prefix, bres, r);
2403  if (!p_LmIsConstant(suffix, r)) bres = gnc_p_Mult_mm(bres, suffix, r);
2404  ares=p_Add_q(ares, bres, r);
2405  /* What to give free? */
2406  /* Do we have to free aPREFIX/aSUFFIX? it seems so */
2407  p_Delete(&prefix, r);
2408  p_Delete(&suffix, r);
2409  }
2410  }
2411  }
2412  if (ares!=NULL)
2413  {
2414  /* now mult (prefix, bres, suffix) */
2415  memcpy(aSUFFIX, M2,(rN+1)*sizeof(int));
2416  memcpy(aPREFIX, M2,(rN+1)*sizeof(int));
2417  for (k=1;k<=i;k++) aSUFFIX[k]=0;
2418  for (k=i;k<=rN;k++) aPREFIX[k]=0;
2419  aSUFFIX[0]=0;
2420  aPREFIX[0]=0;
2421  prefix=p_One(r);
2422  suffix=p_One(r);
2423  p_SetExpV(prefix,aPREFIX, r);
2424  p_Setm(prefix, r);
2425  p_SetExpV(suffix,aSUFFIX, r);
2426  p_Setm(suffix, r);
2427  bres=ares;
2428  if (!p_LmIsConstant(prefix, r)) bres = gnc_mm_Mult_p(prefix, bres, r);
2429  if (!p_LmIsConstant(suffix, r)) bres = gnc_p_Mult_mm(bres, suffix, r);
2430  res=p_Add_q(res, bres, r);
2431  p_Delete(&prefix, r);
2432  p_Delete(&suffix, r);
2433  }
2434  }
2435  }
2436  freeT(M1, rN);
2437  freeT(M2, rN);
2438  freeT(aPREFIX, rN);
2439  freeT(aSUFFIX, rN);
2440 #ifdef PDEBUG
2441  p_Test(res, r);
2442 #endif
2443  return(res);
2444 }
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition: coeffs.h:666
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
int k
Definition: cfEzgcd.cc:93
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1456
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:954
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:448
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
poly gnc_uu_Mult_ww(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:1085
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
#define freeT(A, v)
Definition: old.gring.cc:94
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:443
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define MATELEM(mat, i, j)
Definition: matpol.h:29
poly nc_p_Bracket_qq ( poly  p,
const poly  q,
const ring  r 
)

returns [p,q], destroys p

Definition at line 2295 of file old.gring.cc.

2296 {
2297  assume(p != NULL && q!= NULL);
2298 
2299  if (!rIsPluralRing(r)) return(NULL);
2300  if (p_ComparePolys(p,q, r)) return(NULL);
2301  /* Components !? */
2302  poly Q=NULL;
2303  number coef=NULL;
2304  poly pres=NULL;
2305  int UseBuckets=1;
2306  if (((pLength(p)< MIN_LENGTH_BUCKET/2) && (pLength(q)< MIN_LENGTH_BUCKET/2))
2308  UseBuckets=0;
2309 
2310 
2311  CPolynomialSummator sum(r, UseBuckets == 0);
2312 
2313  while (p!=NULL)
2314  {
2315  Q=q;
2316  while(Q!=NULL)
2317  {
2318  pres=nc_mm_Bracket_nn(p,Q, r); /* since no coeffs are taken into account there */
2319  if (pres!=NULL)
2320  {
2321  coef = n_Mult(p_GetCoeff(p, r),p_GetCoeff(Q, r), r);
2322  pres = p_Mult_nn(pres,coef,r);
2323 
2324  sum += pres;
2325  n_Delete(&coef, r);
2326  }
2327  pIter(Q);
2328  }
2329  p=p_LmDeleteAndNext(p, r);
2330  }
2331  return(sum);
2332 }
poly nc_mm_Bracket_nn(poly m1, poly m2, const ring r)
returns [m1,m2] for two monoms, destroys nothing without coeffs
Definition: old.gring.cc:2336
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
BOOLEAN p_ComparePolys(poly p1, poly p2, const ring r)
returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL
Definition: p_polys.cc:4352
return P p
Definition: myNF.cc:203
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:22
#define Q
Definition: sirandom.c:25
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
static int pLength(poly a)
Definition: p_polys.h:189
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define pIter(p)
Definition: monomials.h:44
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(...
Definition: summator.h:29
poly nc_p_CopyGet ( poly  a,
const ring  r 
)

Definition at line 2578 of file old.gring.cc.

2579 {
2580 #ifndef PDEBUG
2581  p_Test(a, r);
2582 #endif
2583 
2584 // if (r != currRing)
2585 // {
2586 //#ifdef PDEBUF
2587 // Werror("nc_p_CopyGet call not in currRing");
2588 //#endif
2589 // return(NULL);
2590 // }
2591  return(p_Copy(a,r));
2592 }
const poly a
Definition: syzextra.cc:212
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
const ring r
Definition: syzextra.cc:208
#define p_Test(p, r)
Definition: p_polys.h:160
poly nc_p_CopyPut ( poly  a,
const ring  r 
)

Definition at line 2599 of file old.gring.cc.

2600 {
2601 #ifndef PDEBUG
2602  p_Test(a, r);
2603 #endif
2604 
2605 // if (r != currRing)
2606 // {
2607 //#ifdef PDEBUF
2608 // Werror("nc_p_CopyGet call not in currRing");
2609 //#endif
2610 // return(NULL);
2611 // }
2612 
2613  return(p_Copy(a,r));
2614 }
const poly a
Definition: syzextra.cc:212
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
const ring r
Definition: syzextra.cc:208
#define p_Test(p, r)
Definition: p_polys.h:160
poly nc_p_Minus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int shorter,
const poly  ,
const ring  r 
)

for p_Minus_mm_Mult_qq in pInline2.h

Definition at line 196 of file old.gring.cc.

198 {
199  poly mc = p_Neg( p_Copy(m, r), r );
200  poly mmc = nc_mm_Mult_pp( mc, q, r );
201  p_Delete(&mc, r);
202 
203  int org_p=pLength(p);
204  int org_q=pLength(q);
205 
206  p = p_Add_q(p, mmc, r);
207 
208  shorter = pLength(p)-org_p-org_q; // ring independent!
209 
210  return(p);
211 }
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
poly nc_p_Plus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int lp,
const int  ,
const ring  r 
)

Definition at line 214 of file old.gring.cc.

216 {
217  p = p_Add_q(p, nc_mm_Mult_pp( m, q, r ), r);
218 
219  lp = pLength(p);
220 
221  return(p);
222 }
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
void nc_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)

Definition at line 3251 of file old.gring.cc.

3252 {
3253  assume(rIsPluralRing(rGR));
3254  assume(p_Procs!=NULL);
3255 
3256  gnc_p_ProcsSet(rGR, p_Procs);
3257 
3258  if(rIsSCA(rGR) && ncExtensions(SCAMASK) )
3259  {
3260  sca_p_ProcsSet(rGR, p_Procs);
3261  }
3262 
3263  if( ncExtensions(NOPLURALMASK) )
3265 
3266  if(!rIsSCA(rGR) && !ncExtensions(NOFORMULAMASK))
3268 
3269 }
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
#define assume(x)
Definition: mod2.h:405
void sca_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: sca.cc:1239
#define NULL
Definition: omList.c:10
const int SCAMASK
Definition: nc.h:355
static bool rIsSCA(const ring r)
Definition: nc.h:206
BOOLEAN ncInitSpecialPairMultiplication(ring r)
Definition: ncSAMult.cc:267
const int NOPLURALMASK
Definition: nc.h:369
bool ncInitSpecialPowersMultiplication(ring r)
Definition: ncSAFormula.cc:51
static void gnc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3187
const int NOFORMULAMASK
Definition: nc.h:370
bool ncExtensions(int iMask)
Definition: old.gring.cc:87
void nc_PolyPolyRed ( poly b,
poly  p,
number *  c,
const ring  r 
)

Definition at line 2282 of file old.gring.cc.

2283 {
2284 #if 0
2285  nc_PolyPolyRedOld(b, p, c, r);
2286 #else
2287  nc_PolyPolyRedNew(b, p, c, r);
2288 #endif
2289 }
return P p
Definition: myNF.cc:203
void nc_PolyPolyRedNew(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2182
const ring r
Definition: syzextra.cc:208
void nc_PolyPolyRedOld(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2148
const poly b
Definition: syzextra.cc:213
void nc_PolyPolyRedNew ( poly b,
poly  p,
number *  c,
const ring  r 
)
inline

Definition at line 2182 of file old.gring.cc.

2184 {
2185 #ifdef PDEBUG
2186  p_Test(b, r);
2187  p_Test(p, r);
2188 #endif
2189 
2190 #if MYTEST
2191  PrintS("nc_PolyPolyRedNew(");
2192  p_Write0(b, r);
2193  PrintS(", ");
2194  p_Write0(p, r);
2195  PrintS(", *c): ");
2196 #endif
2197 
2198  // b will not by multiplied by any constant in this impl.
2199  // ==> *c=1
2200  if (c!=NULL) *c=n_Init(1, r);
2201 
2202  poly pp = NULL;
2203 
2204  // there is a problem when p is a square(=>0!)
2205 
2206  while((b != NULL) && (pp == NULL))
2207  {
2208 
2209 // poly pLmB = p_Head(b, r);
2210  poly m = p_One(r);
2211  p_ExpVectorDiff(m, b, p, r);
2212 // pDelete(&pLmB);
2213  //pSetm(m);
2214 
2215 #ifdef PDEBUG
2216  p_Test(m, r);
2217  p_Test(b, r);
2218 #endif
2219 
2220  pp = nc_mm_Mult_pp(m, p, r);
2221 
2222 #if MYTEST
2223  PrintS("\n{b': ");
2224  p_Write0(b, r);
2225  PrintS(", m: ");
2226  p_Write0(m, r);
2227  PrintS(", pp: ");
2228  p_Write0(pp, r);
2229  PrintS(" }\n");
2230 #endif
2231 
2232  p_Delete(&m, r); // one m for all tries!
2233 
2234 // assume( pp != NULL );
2235 
2236  if( pp == NULL )
2237  {
2238  b = p_LmDeleteAndNext(b, r);
2239 
2240  if( !p_DivisibleBy(p, b, r) )
2241  return;
2242 
2243  }
2244  }
2245 
2246 #if MYTEST
2247  PrintS("{b': ");
2248  p_Write0(b, r);
2249  PrintS(", pp: ");
2250  p_Write0(pp, r);
2251  PrintS(" }\n");
2252 #endif
2253 
2254 
2255  if(b == NULL) return;
2256 
2257 
2258  assume(pp != NULL);
2259 
2260  const number n = p_GetCoeff(pp, r); // no new copy
2261 
2262  number nn;
2263 
2264  if (!n_IsMOne(n, r)) // TODO: as above.
2265  {
2266  nn=n_InpNeg(n_Invers(n, r), r);
2267  number t = n_Mult(nn, p_GetCoeff(b, r), r);
2268  n_Delete(&nn, r);
2269  pp=p_Mult_nn(pp, t, r);
2270  n_Delete(&t, r);
2271  }
2272  else
2273  {
2274  pp=p_Mult_nn(pp, pGetCoeff(b), r);
2275  }
2276 
2277 
2278  b=p_Add_q(b,pp,r);
2279 
2280 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
return P p
Definition: myNF.cc:203
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly pp
Definition: myNF.cc:296
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1682
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible ...
Definition: coeffs.h:563
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
const poly b
Definition: syzextra.cc:213
void nc_PolyPolyRedOld ( poly b,
poly  p,
number *  c,
const ring  r 
)
inline

Definition at line 2148 of file old.gring.cc.

2150 {
2151  // b will not by multiplied by any constant in this impl.
2152  // ==> *c=1
2153  if (c!=NULL) *c=n_Init(1, r);
2154  poly m=p_One(r);
2155  p_ExpVectorDiff(m,p_Head(b, r),p, r);
2156  //pSetm(m);
2157 #ifdef PDEBUG
2158  p_Test(m, r);
2159 #endif
2160  poly pp=nc_mm_Mult_pp(m,p,r);
2161  assume(pp!=NULL);
2162 
2163  p_Delete(&m, r);
2164  number n=p_GetCoeff(pp, r);
2165  number nn;
2166  if (!n_IsMOne(n, r))
2167  {
2168  nn=n_InpNeg(n_Invers(n, r), r);
2169  n =n_Mult(nn,p_GetCoeff(b, r), r);
2170  n_Delete(&nn, r);
2171  pp=p_Mult_nn(pp,n,r);
2172  n_Delete(&n, r);
2173  }
2174  else
2175  {
2176  pp=p_Mult_nn(pp,p_GetCoeff(b, r),r);
2177  }
2178  b=p_Add_q(b,pp,r);
2179 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
poly pp
Definition: myNF.cc:296
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:819
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible ...
Definition: coeffs.h:563
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:556
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
const poly b
Definition: syzextra.cc:213
matrix nc_PrintMat ( int  a,
int  b,
ring  r,
int  metric 
)

returns matrix with the info on noncomm multiplication

Definition at line 2446 of file old.gring.cc.

2447 {
2448 
2449  if ( (a==b) || !rIsPluralRing(r) ) return(NULL);
2450  int i;
2451  int j;
2452  if (a>b) {j=b; i=a;}
2453  else {j=a; i=b;}
2454  /* i<j */
2455  int rN=r->N;
2456  int size=r->GetNC()->MTsize[UPMATELEM(i,j,rN)];
2457  matrix M = r->GetNC()->MT[UPMATELEM(i,j,rN)];
2458  /* return(M); */
2459 /*
2460  int sizeofres;
2461  if (metric==0)
2462  {
2463  sizeofres=sizeof(int);
2464  }
2465  if (metric==1)
2466  {
2467  sizeofres=sizeof(number);
2468  }
2469 */
2470  matrix res=mpNew(size,size);
2471  int s;
2472  int t;
2473  int length;
2474  long totdeg;
2475  poly p;
2476  for(s=1;s<=size;s++)
2477  {
2478  for(t=1;t<=size;t++)
2479  {
2480  p=MATELEM(M,s,t);
2481  if (p==NULL)
2482  {
2483  MATELEM(res,s,t)=0;
2484  }
2485  else
2486  {
2487  length = pLength(p);
2488  if (metric==0) /* length */
2489  {
2490  MATELEM(res,s,t)= p_ISet(length,r);
2491  }
2492  else if (metric==1) /* sum of deg divided by the length */
2493  {
2494  totdeg=0;
2495  while (p!=NULL)
2496  {
2497  totdeg=totdeg+p_Deg(p,r);
2498  pIter(p);
2499  }
2500  number ntd = n_Init(totdeg, r);
2501  number nln = n_Init(length, r);
2502  number nres= n_Div(ntd,nln, r);
2503  n_Delete(&ntd, r);
2504  n_Delete(&nln, r);
2505  MATELEM(res,s,t)=p_NSet(nres,r);
2506  }
2507  }
2508  }
2509  }
2510  return(res);
2511 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
return P p
Definition: myNF.cc:203
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
static int pLength(poly a)
Definition: p_polys.h:189
#define pIter(p)
Definition: monomials.h:44
poly res
Definition: myNF.cc:322
#define M
Definition: sirandom.c:24
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:613
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
const poly b
Definition: syzextra.cc:213
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1302
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
poly nc_pSubst ( poly  p,
int  n,
poly  e,
const ring  r 
)

substitute the n-th variable by e in p destroy p e is not a constant

Definition at line 3275 of file old.gring.cc.

3276 {
3277  int rN = r->N;
3278  int *PRE = (int *)omAlloc0((rN+1)*sizeof(int));
3279  int *SUF = (int *)omAlloc0((rN+1)*sizeof(int));
3280  int i,pow;
3281  number C;
3282  poly suf,pre;
3283  poly res = NULL;
3284  poly out = NULL;
3285  while ( p!= NULL )
3286  {
3287  C = p_GetCoeff(p, r);
3288  p_GetExpV(p, PRE, r); /* faster splitting? */
3289  pow = PRE[n]; PRE[n]=0;
3290  res = NULL;
3291  if (pow!=0)
3292  {
3293  for (i=n+1; i<=rN; i++)
3294  {
3295  SUF[i] = PRE[i];
3296  PRE[i] = 0;
3297  }
3298  res = p_Power(p_Copy(e, r),pow, r);
3299  /* multiply with prefix */
3300  pre = p_One(r);
3301  p_SetExpV(pre,PRE, r);
3302  p_Setm(pre, r);
3303  res = nc_mm_Mult_p(pre,res, r);
3304  /* multiply with suffix */
3305  suf = p_One(r);
3306  p_SetExpV(suf,SUF, r);
3307  p_Setm(suf, r);
3308  res = p_Mult_mm(res,suf, r);
3309  res = p_Mult_nn(res,C, r);
3310  p_SetComp(res,PRE[0], r);
3311  }
3312  else /* pow==0 */
3313  {
3314  res = p_Head(p, r);
3315  }
3316  p = p_LmDeleteAndNext(p, r);
3317  out = p_Add_q(out,res, r);
3318  }
3319  freeT(PRE,rN);
3320  freeT(SUF,rN);
3321  return(out);
3322 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:973
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1456
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
poly res
Definition: myNF.cc:322
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:819
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:902
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define p_GetCoeff(p, r)
Definition: monomials.h:57
#define freeT(A, v)
Definition: old.gring.cc:94
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:418
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2100
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void nc_rCleanUp ( ring  r)
bool nc_rCopy ( ring  res,
const ring  r,
bool  bSetupQuotient 
)

Definition at line 3075 of file old.gring.cc.

3076 {
3077  if (nc_CallPlural(r->GetNC()->C, r->GetNC()->D, NULL, NULL, res, bSetupQuotient, true, true, r))
3078  {
3079  WarnS("Error occured while coping/setuping the NC structure!"); // No reaction!???
3080  return true; // error
3081  }
3082 
3083  return false;
3084 }
#define WarnS
Definition: emacs.cc:81
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
BOOLEAN nc_CallPlural(matrix CCC, matrix DDD, poly CCN, poly DDN, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
Definition: old.gring.cc:2734
#define NULL
Definition: omList.c:10
ring nc_rCreateNCcomm ( ring  r)

Definition at line 3326 of file old.gring.cc.

3327 {
3328  if (rIsPluralRing(r)) return r;
3329 
3330  ring rr = rCopy(r);
3331 
3332  matrix C = mpNew(rr->N,rr->N); // ring-independent!?!
3333  matrix D = mpNew(rr->N,rr->N);
3334 
3335  for(int i=1; i<rr->N; i++)
3336  for(int j=i+1; j<=rr->N; j++)
3337  MATELEM(C,i,j) = p_One(rr);
3338 
3339  if (nc_CallPlural(C, D, NULL, NULL, rr, false, true, false, rr, TRUE)) // TODO: what about quotient ideal?
3340  WarnS("Error initializing multiplication!"); // No reaction!???
3341 
3342  return rr;
3343 }
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
int i
Definition: cfEzgcd.cc:123
BOOLEAN nc_CallPlural(matrix CCC, matrix DDD, poly CCN, poly DDN, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
Definition: old.gring.cc:2734
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
ring rCopy(ring r)
Definition: ring.cc:1579
#define NULL
Definition: omList.c:10
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void nc_rKill ( ring  r)

complete destructor

Definition at line 2527 of file old.gring.cc.

2529 {
2530  if( r->GetNC()->GetGlobalMultiplier() != NULL )
2531  {
2532  delete r->GetNC()->GetGlobalMultiplier();
2533  r->GetNC()->GetGlobalMultiplier() = NULL;
2534  }
2535 
2536  if( r->GetNC()->GetFormulaPowerMultiplier() != NULL )
2537  {
2538  delete r->GetNC()->GetFormulaPowerMultiplier();
2539  r->GetNC()->GetFormulaPowerMultiplier() = NULL;
2540  }
2541 
2542 
2543  int i,j;
2544  int rN=r->N;
2545  if ( rN > 1 )
2546  {
2547  for(i=1;i<rN;i++)
2548  {
2549  for(j=i+1;j<=rN;j++)
2550  {
2551  id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(i,j,rN)]),r);
2552  }
2553  }
2554  omFreeSize((ADDRESS)r->GetNC()->MT,rN*(rN-1)/2*sizeof(matrix));
2555  omFreeSize((ADDRESS)r->GetNC()->MTsize,rN*(rN-1)/2*sizeof(int));
2556  id_Delete((ideal *)&(r->GetNC()->COM),r);
2557  }
2558  id_Delete((ideal *)&(r->GetNC()->C),r);
2559  id_Delete((ideal *)&(r->GetNC()->D),r);
2560 
2561  if( rIsSCA(r) && (r->GetNC()->SCAQuotient() != NULL) )
2562  {
2563  id_Delete(&r->GetNC()->SCAQuotient(), r); // Custom SCA destructor!!!
2564  }
2565 
2566 
2567  nc_CleanUp(r);
2568 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
void * ADDRESS
Definition: auxiliary.h:161
void nc_CleanUp(nc_struct *p)
Definition: old.gring.cc:2513
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
bool nc_SetupQuotient ( ring  rGR,
const ring  rG,
bool  bCopy 
)

Definition at line 3475 of file old.gring.cc.

3476 {
3477  if( rGR->qideal == NULL )
3478  return false; // no quotient = no work! done!? What about factors of SCA?
3479 
3480  bool ret = true;
3481  // currently only super-commutative extension deals with factors.
3482 
3483  if( ncExtensions(SCAMASK) )
3484  {
3485  bool sca_ret = sca_SetupQuotient(rGR, rG, bCopy);
3486 
3487  if(sca_ret) // yes it was dealt with!
3488  ret = false;
3489  }
3490 
3491  if( bCopy )
3492  {
3493  assume(rIsPluralRing(rGR) == rIsPluralRing(rG));
3494  assume((rGR->qideal==NULL) == (rG->qideal==NULL));
3495  assume(rIsSCA(rGR) == rIsSCA(rG));
3496  assume(ncRingType(rGR) == ncRingType(rG));
3497  }
3498 
3499  return ret;
3500 }
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
bool sca_SetupQuotient(ring rGR, ring rG, bool bCopy)
Definition: sca.cc:923
const int SCAMASK
Definition: nc.h:355
static bool rIsSCA(const ring r)
Definition: nc.h:206
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
bool ncExtensions(int iMask)
Definition: old.gring.cc:87
bool ncExtensions ( int  iMask)

Definition at line 87 of file old.gring.cc.

88 {
89  return ((getNCExtensions() & iMask) == iMask);
90 }
int & getNCExtensions()
Definition: old.gring.cc:75
poly p_CopyEmbed ( poly  p,
ring  srcRing,
int  shift,
int  ,
ring  dstRing 
)

Definition at line 3350 of file old.gring.cc.

3351 {
3352  if (dstRing == srcRing)
3353  {
3354  return(p_Copy(p,dstRing));
3355  }
3356  nMapFunc nMap=n_SetMap(srcRing->cf, dstRing->cf);
3357  poly q;
3358  // if ( nMap == nCopy)
3359  // {
3360  // q = prCopyR(p,srcRing);
3361  // }
3362  // else
3363  {
3364  int *perm = (int *)omAlloc0((rVar(srcRing)+1)*sizeof(int));
3365  int *par_perm = (int *)omAlloc0((rPar(srcRing)+1)*sizeof(int));
3366  // int *par_perm = (int *)omAlloc0((rPar(srcRing)+1)*sizeof(int));
3367  int i;
3368  // if (srcRing->P > 0)
3369  // {
3370  // for (i=0; i<srcRing->P; i++)
3371  // par_perm[i]=-i;
3372  // }
3373  if ((shift<0) || (shift > rVar(srcRing))) // ???
3374  {
3375  Werror("bad shifts in p_CopyEmbed");
3376  return(0);
3377  }
3378  for (i=1; i<= srcRing->N; i++)
3379  {
3380  perm[i] = shift+i;
3381  }
3382  q = p_PermPoly(p,perm,srcRing, dstRing, nMap,par_perm, rPar(srcRing));
3383  }
3384  return(q);
3385 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
return P p
Definition: myNF.cc:203
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:538
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
polyrec * poly
Definition: hilb.h:10
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3892
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly p_Lcm ( const poly  a,
const poly  b,
const long  lCompM,
const ring  r 
)

Definition at line 147 of file old.gring.cc.

148 {
149  poly m = // p_One( r);
150  p_Init(r);
151 
152  const int pVariables = r->N;
153 
154  for (int i = pVariables; i!=0; i--)
155  {
156  const int lExpA = p_GetExp (a, i, r);
157  const int lExpB = p_GetExp (b, i, r);
158 
159  p_SetExp (m, i, si_max(lExpA, lExpB), r);
160  }
161 
162  p_SetComp (m, lCompM, r);
163 
164  p_Setm(m,r);
165 
166 #ifdef PDEBUG
167 // p_Test(m,r);
168 #endif
169 
170  n_New(&(p_GetCoeff(m, r)), r);
171 
172  return(m);
173 }
#define n_New(n, r)
Definition: coeffs.h:440
const poly a
Definition: syzextra.cc:212
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
const poly b
Definition: syzextra.cc:213
poly p_Lcm ( const poly  a,
const poly  b,
const ring  r 
)

Definition at line 175 of file old.gring.cc.

176 {
177 #ifdef PDEBUG
178  p_Test(a, r);
179  p_Test(b, r);
180 #endif
181 
182  const long lCompP1 = p_GetComp(a, r);
183  const long lCompP2 = p_GetComp(b, r);
184 
185  const poly m = p_Lcm(a, b, si_max(lCompP1, lCompP2), r);
186 
187 #ifdef PDEBUG
188 // p_Test(m,r);
189 #endif
190  return(m);
191 }
const poly a
Definition: syzextra.cc:212
poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r)
Definition: old.gring.cc:147
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define p_Test(p, r)
Definition: p_polys.h:160
const poly b
Definition: syzextra.cc:213
poly pOppose ( ring  Rop,
poly  p,
const ring  dst 
)

opposes a vector p from Rop to currRing (dst!)

Definition at line 3414 of file old.gring.cc.

3415 {
3416  /* the simplest case:*/
3417  if ( Rop == dst ) return(p_Copy(p, dst));
3418  /* check Rop == rOpposite(currRing) */
3419 
3420 
3421  if ( !rIsLikeOpposite(dst, Rop) )
3422  {
3423  WarnS("an opposite ring should be used");
3424  return NULL;
3425  }
3426 
3427  nMapFunc nMap = n_SetMap(Rop->cf, dst->cf); // reverse?
3428 
3429  /* nMapFunc nMap = nSetMap(Rop);*/
3430  /* since we know that basefields coinside! */
3431 
3432  // coinside???
3433 
3434  int *perm=(int *)omAlloc0((Rop->N+1)*sizeof(int));
3435  if (!p_IsConstantPoly(p, Rop))
3436  {
3437  /* we know perm exactly */
3438  int i;
3439  for(i=1; i<=Rop->N; i++)
3440  {
3441  perm[i] = Rop->N+1-i;
3442  }
3443  }
3444  poly res = p_PermPoly(p, perm, Rop, dst, nMap);
3445  omFreeSize((ADDRESS)perm,(Rop->N+1)*sizeof(int));
3446 
3447  p_Test(res, dst);
3448 
3449  return res;
3450 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
#define WarnS
Definition: emacs.cc:81
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so ...
Definition: old.gring.cc:3387
poly res
Definition: myNF.cc:322
polyrec * poly
Definition: hilb.h:10
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
#define p_Test(p, r)
Definition: p_polys.h:160
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3892
#define NULL
Definition: omList.c:10
static BOOLEAN p_IsConstantPoly(const poly p, const ring r)
Definition: p_polys.h:1795
#define omAlloc0(size)
Definition: omAllocDecl.h:211
BOOLEAN rIsLikeOpposite ( ring  rBase,
ring  rCandidate 
)

checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so

Definition at line 3387 of file old.gring.cc.

3388 {
3389  /* the same basefield */
3390  int diagnose = TRUE;
3391  nMapFunc nMap = n_SetMap(rCandidate->cf, rBase->cf); // reverse?
3392 
3393 ////// if (nMap != nCopy) diagnose = FALSE;
3394  if (nMap == NULL) diagnose = FALSE;
3395 
3396 
3397  /* same number of variables */
3398  if (rBase->N != rCandidate->N) diagnose = FALSE;
3399  /* nc and comm ring */
3400  if ( rIsPluralRing(rBase) != rIsPluralRing(rCandidate) ) diagnose = FALSE;
3401  /* both are qrings */
3402  /* NO CHECK, since it is used in building opposite qring */
3403  /* if ( ((rBase->qideal != NULL) && (rCandidate->qideal == NULL)) */
3404  /* || ((rBase->qideal == NULL) && (rCandidate->qideal != NULL)) ) */
3405  /* diagnose = FALSE; */
3406  /* TODO: varnames are e->E etc */
3407  return diagnose;
3408 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
#define NULL
Definition: omList.c:10
int setNCExtensions ( int  iMask)

Definition at line 80 of file old.gring.cc.

81 {
82  const int iOld = getNCExtensions();
83  getNCExtensions() = iMask;
84  return (iOld);
85 }
int & getNCExtensions()
Definition: old.gring.cc:75

Variable Documentation

int iNCExtensions = SCAMASK | NOFORMULAMASK

Definition at line 73 of file old.gring.cc.